Hierarchical Question-Image Co-Attention for Visual Question Answering
Paper · 2016 · Jiasen Lu, Jianwei Yang, Dhruv Batra et al.
Summary
To answer a question about a picture, a system has to work out what the question asks and which parts of the picture can supply an answer. A question about the color of a bird, for example, calls for finding the bird and recognizing that its color is the property at issue. Earlier approaches could use a question to direct attention towards particular parts of an image. This paper makes the exchange go both ways. The wording guides the selection of visual features, and the visual features guide the selection of useful parts of the question. The authors call this exchange co-attention, an approach to visual question answering.
The method reads the question at the level of individual words, short windows of neighboring words, and positions interpreted in the context of the question sequence. At each level it produces a weighted summary of the picture and a weighted summary of the text. The authors test two ways to obtain those summaries. Parallel co-attention uses a shared grid of associations between text positions and image locations to compute both sets of weights. Alternating co-attention first summarizes the question, then uses that summary to examine the image, and finally lets the resulting image summary guide another reading of the question. A classifier combines the summaries across levels and chooses from a fixed set of answers.
In the paper’s headline comparisons, overall accuracy rises from 60.3% to 60.5% on VQA and from 61.6% to 63.3% on COCO-QA. With ResNet image features, the paper reports 62.1% for open-ended VQA and 65.4% classification accuracy on the COCO-QA test set. Controlled experiments on VQA validation data help locate the contribution of the language side. The full system scores 1.1% above the version with visual attention alone, using the authors’ reported difference. Replacing learned attention with uniform weights has its largest reported effect at the question level, where the authors give a drop of 1.7% in accuracy. The displayed examples show how several levels can highlight different parts of a picture or different words. The accuracy comparisons measure the value of those choices for answer prediction, while the examples show what the resulting weights look like on selected cases.
Deep dive: Hierarchical Question-Image Co-Attention for Visual Question Answering
Hierarchical co-attention uses an image to focus a question and a question to focus an image, improving answer prediction on VQA and COCO-QA. · about 36 minutes to read
The problem and its context
Selecting the evidence for a question
A picture can support many questions whose answers depend on different information. Identifying an object calls for evidence about what is present. Describing an object’s color calls for evidence about a property of a particular object. Counting calls for finding the relevant instances. In visual question answering, the system receives an image and a question together, and the answer depends on how it connects them. A representation of the image alone has no reason to favor one kind of evidence before it has access to the question.
A straightforward approach described in the paper gives the answer predictor a single feature vector for the entire image. The vector comes from a deep convolutional network, so its entries can reflect visual information gathered from across the picture. The question can still affect the prediction when the text and image representations meet. But the same image vector reaches the predictor regardless of the wording or subject of the question. Any distinctions among image locations must survive the process that formed that vector.
Spatial attention changes the interface between the image encoder and the answer predictor. It starts with features that still correspond to locations and assigns each location a weight. The result is a summary that can depend on the current question. A question about a bird can give the bird’s location more influence in the summary. A question about the surroundings can change which features receive the most weight. The shift is from representing the image in the same way for each question to choosing what to emphasize for this particular image–question pair.
The authors ask what happens when the question receives the same kind of selective treatment. Their motivating example is a horse-counting question that can be phrased with an instruction to look at the image or with wording about what the viewer can see. Both forms ask for the number of horses. The counting expression and the name of the animal carry much of what the system needs, while the remaining words can vary. The authors use this example to motivate a mechanism that can give unequal weight to different positions. The example establishes the design problem. Robustness to changes in wording would require a separate empirical test.
Selection on the question side also has a purpose beyond tolerating different wording. The question can contain several meaningful fragments that serve different roles. In a color question, one fragment identifies the requested property and another identifies the object to inspect. Compressing the entire question before interacting with the image gives the image encoder a single signal to work with. Keeping position-specific representations makes it possible for the appearance of an object to affect which text features are emphasized. This is the connection the paper explores between the two inputs in vision and language.
What visual attention already did
The authors describe several ways earlier work selected image evidence. Some approaches produced candidate object regions and scored their relevance to the question and a possible answer. A spatial map supplied an alternative way to organize those choices. Work on grounded questions also used visual attention for pointing, where the relevant part of a scene mattered to the task itself. The paper discusses this direction through Visual7W.
Other systems looked at the image repeatedly. In stacked attention, a later stage can build on the evidence collected by an earlier stage. Repeated passes offer a way to refine an initial spatial selection before predicting an answer. The question still guides attention on the visual side in the account given by the paper. An earlier example is Stacked Attention Networks for Image Question Answering.
The closest comparison in the paper’s discussion uses different amounts of text in successive visual passes. The first pass aligns individual words with image patches. The next uses the full question to construct a spatial map. This matters for interpreting the new contribution. Earlier systems already had ways to connect fine-grained text features to visual locations. The additional operation here is an explicit distribution over question positions whose weights depend on the image. The hierarchy also computes its attention maps separately at each language level. An earlier level can supply features to the next stage of the language encoder, but its image attention map does not determine the next level’s map.
The paper also mentions a compositional approach in which a parser selects the neural modules used to answer a question. That approach lets the question control the structure of the computation. Co-attention gives the question a different role. It lets the language guide a weighted selection of visual features and lets those features alter a weighted selection of text. The same operation can be applied to features that describe words, local phrases, or words in the context of the question sequence.
What language attention contributed
Attention over text was already familiar in the language tasks discussed by the authors. In translation, it provided a way to recover different parts of the source sentence as needed. A single compressed representation of a long input can be a bottleneck when different output words depend on different source positions. A learned alignment gives the translation system access to a changing mixture of source features. The paper points to Neural Machine Translation by Jointly Learning to Align and Translate.
Text comprehension provides a related case. What a system needs to retrieve from a passage depends on what it has been asked about the passage. Attention makes it possible to emphasize individual positions in the reading material rather than relying completely on a fixed-width summary. The paper cites Teaching Machines to Read and Comprehend.
The paper also discusses language tasks where the relationship between two inputs is itself the subject of the prediction. Word-by-word attention can help a system judge entailment by giving it a way to compare particulars of one sentence with particulars of another. Work on sentence pairs explored joint attention over convolutional hierarchies and two-way attention for placing paired features in a common representation space. These examples show why attention over language could be relevant to pictures. If a text deserves different emphasis depending on the input it is paired with, an image can provide the conditioning information just as another piece of text can. The language-side precedents include Reasoning about Entailment with Neural Attention and ABCNN.
The method, step by step
From the inputs to an answer
The system keeps a grid of image features and a sequence of question features. A location in the grid stands for visual information from part of the image. A position in the sequence starts as a representation of one word and acquires more context as it passes through the language encoder. Keeping the grid and the sequence gives attention a set of locations to choose among on each side. The attention operations eventually reduce each set to a single vector, but the choice of how to do so is conditioned on the inputs.
A word representation can pick up the identity of an object mentioned in the question. A representation built from a local window can capture a cue spread across neighboring words, such as the expression that introduces a count. A recurrent representation can carry context beyond that window. The image grid can interact with any of these representations. There is one visual feature extractor, and the same grid is available to the co-attention operation at each language level. The visual summary can change because the language features used to compute the weights change.
The answer classifier receives the resulting summaries in order from the word level to the question level. It can use information that persists across the levels as well as details that become prominent at just one of them. The order of answer encoding is separate from the way the attention maps are produced. The maps at the different levels are computed without feeding the summary from one co-attention level into the next. The final classifier is where those independently formed summaries meet.
How an image and a question become an answer
The steps in order.
Words, local phrases, and question context
The input identifies each word with a one-hot vector. In this representation one entry marks the vocabulary item, and the other entries are zero. An embedding matrix maps the vocabulary indicator into a dense vector whose entries can be learned during answer training. The outcome is an ordered sequence of word embeddings.
In the paper’s notation, Q is the question feature matrix appropriate to the operation at hand. Its columns are positions in the question. The superscripts w, p, and s distinguish the word, phrase, and question levels. The subscript t picks out a position in the sequence, and T is the number of words. V is the image feature matrix, whose n-th column is the visual feature vₙ at spatial location n. The total number of locations is N. A hat on an image or question feature typically indicates a summary produced by attention. The phrase convolution uses a hat for its intermediate response, which exists before co-attention.
At the word level, each position contains only its learned embedding. To construct the phrase level, the authors move convolutional filters along the ordered embeddings. A filter of one width sees an individual word. Filters of the other widths see a pair or a triple. The same learned weights for a given width apply as the window moves along the question. This makes each filter sensitive to a pattern in a local sequence wherever the pattern occurs.
q̂ᵖₛ,ₜ = tanh(Wᶜₛ qʷₜ:ₜ₊ₛ₋₁), s ∈ {1, 2, 3}
Here q̂ᵖₛ,ₜ is the candidate phrase feature at position t for filter width s. The superscripts p and w mark phrase and word features. The filter weights are Wᶜₛ, with c identifying convolution. The expression qʷₜ:ₜ₊ₛ₋₁ denotes the sequence of word embeddings in the width-s window indexed from t, ending at t plus s minus one. Multiplication applies the filter to the window, and tanh is the elementwise hyperbolic tangent. The membership symbol ∈ indicates that the available widths are the values in braces. In this formula the subscript s is a window size. Elsewhere a superscript s labels the question level.
The bigram and trigram convolutions use zero padding so their outputs have the same sequence length as the word embeddings. Without a length-preserving convention, a wider window would generally have fewer valid positions at the boundaries. Padding lets the convolution produce a response for every position at every width. That makes the responses comparable at matching positions.
qᵖₜ = max(q̂ᵖ₁,ₜ, q̂ᵖ₂,ₜ, q̂ᵖ₃,ₜ), t ∈ {1, 2, …, T}
The result qᵖₜ is the phrase vector attached to position t. The hatted vectors are the candidate responses for the listed widths. The max operation takes the largest response for each feature dimension at that position. The braces and ellipsis cover the positions starting at the first word and continuing through T, the question length. The resulting sequence keeps the order and length of the input.
This pooling runs across widths, while a different pooling operation later runs across positions. The distinction matters. At the phrase stage, the system retains an entry at every question position. Within an entry, one feature can come from the unigram filter and another from a wider filter. The result is therefore a representation of local context with an adjustable effective width in each feature dimension. It does not require the question to be divided into explicit phrases with declared boundaries. It can nevertheless give a phrase-length pattern a strong response where several neighboring words help identify the kind of question being asked.
The phrase sequence then goes through an LSTM, or long short-term memory network. An LSTM is a recurrent encoder. At each step it incorporates the current phrase feature into a state carried along the sequence. The hidden vector at step t is the question-level feature qˢₜ. This level still has an entry for each position. Attention can choose among contextualized positions instead of being confined to a single vector from the end of the sequence. Its inputs differ from the phrase vectors because their information can reach beyond the local convolution windows.
This arrangement creates two separate forms of dependence. The features themselves form a hierarchy. The phrase features depend on the embeddings, and the question-level features depend on the phrase sequence. The attention computations at those levels are separate. Information from a word can reach a contextual feature through the language encoder whether or not that word received a large weight in word-level co-attention. Conversely, a word-level summary can contribute directly to the answer classifier even when the contextual pass emphasizes some other portion of the question.
Parallel co-attention
Parallel co-attention begins by comparing every position in the current question representation with every location in the image grid. A question about a bird can, for example, have features related to the object and features related to what should be said about the object. The comparison gives each text position its own set of associations with image locations. It also gives each image location its own set of associations with text positions. The two attention calculations consult the same resulting grid.
C = tanh(Qᵀ Wᵦ V)
The image matrix V has d rows and N columns, and the question matrix Q has d rows and T columns. The symbol d is the feature width used by the attention calculation. The superscript ᵀ on Q denotes matrix transposition. Wᵦ is the learned affinity weight matrix, with d rows and d columns. The output C has T rows and N columns. Each entry comes from a learned bilinear comparison of a question column and an image column, followed by elementwise tanh.
The learned matrix in the middle lets the relationship depend on combinations of features from the two inputs. In the product, an entry can respond strongly when particular visual and textual features occur together. The result is an affinity, a learned association score. It does not have to identify a literal word–region match. A text feature about an attribute, for instance, can affect the score of a region that might supply evidence for that attribute.
The paper considers a simpler use of the affinity matrix. Each modality could take the strongest available association over positions in the other modality. For an image location, this amounts to looking down the corresponding affinity column and keeping its highest entry.
aᵛ[n] = maxᵢ(Cᵢ,ₙ)
The quantity aᵛ[n] is the proposed image attention score at location n, with v marking the visual side. Cᵢ,ₙ is the affinity between question position i and image location n. The subscript i on max means that the comparison ranges over question positions.
aᑫ[t] = maxⱼ(Cₜ,ⱼ)
The quantity aᑫ[t] is the proposed question attention score at position t, with q marking the question side. Cₜ,ⱼ is the affinity between position t and image location j. The subscript j on max means that the comparison ranges over image locations.
The reported parallel mechanism instead uses the affinities to transfer features between the two collections of positions. On the visual side, all text positions can contribute to the representation used to score an image location. The affinities determine how the contributions are combined. The score also has access to a projection of the original visual feature at that location.
Hᵛ = tanh(Wᵥ V + (Wᵩ Q) C)
Hᵛ is the hidden feature matrix for scoring image locations. The subscript ᵥ marks the image projection Wᵥ, and ᵩ marks the question projection Wᵩ. Both learned matrices have k rows and d columns, where k is the width of the hidden scoring features. Wᵥ V gives a projected feature at each image location. Wᵩ Q gives a projected feature at each question position. Right multiplication by C combines those projected text features into a contribution for each image location. The plus sign adds the visual and text-derived contributions, and tanh acts elementwise on the result.
Hᑫ = tanh(Wᵩ Q + (Wᵥ V) Cᵀ)
Hᑫ is the hidden feature matrix for scoring question positions. Wᵩ Q gives the direct contribution from the projected question features, and Wᵥ V gives the projected image features. Cᵀ is the transpose of the affinity matrix. It lets the projected image columns contribute to each question position. The addition combines the two terms at that position and tanh transforms the sum elementwise.
This is where reciprocity enters the calculation. On the visual side, C tells the operation how to combine language features for a specific location. On the language side, its transpose tells the operation how to combine visual features for a specific question position. Each side also has a path for its own features. The affinities used in these products can have either sign and need not sum to a fixed amount. The probability distributions used for the final summaries come from separate scoring and normalization steps.
aᵛ = softmax(wₕᵥᵀ Hᵛ)
The vector aᵛ contains an attention probability for each of the N image locations. The learned vector wₕᵥ has k entries, and its transpose scores each column of Hᵛ, the visual hidden feature matrix. Softmax turns the resulting location scores into non-negative weights that sum to one over the image grid.
aᑫ = softmax(wₕᵩᵀ Hᑫ)
The vector aᑫ contains an attention probability for each of the T question positions. The learned vector wₕᵩ also has k entries. Its transpose scores the columns of Hᑫ, the question hidden feature matrix. Here softmax normalizes across the sequence of question positions.
v̂ = ∑ₙ₌₁ᴺ aᵛₙ vₙ
The attended image summary is v̂. The summation ∑ ranges over image locations n, starting at the first and ending at N. Each weight aᵛₙ is the entry of the visual attention distribution at location n. It multiplies the original visual feature vₙ. The result is a weighted sum of the feature columns in V.
q̂ = ∑ₜ₌₁ᵀ aᑫₜ qₜ
The attended question summary is q̂. The sum ranges over positions t from the first through T. The question weight aᑫₜ multiplies the feature qₜ from the current level’s question matrix. At the phrase level, for example, the vectors being collected are phrase features even though the available positions still correspond to positions in the word sequence.
The visual and question distributions are calculated from the same affinity grid, and neither distribution has to be finished before the other can be formed. This is what makes the procedure parallel. A learned strength at one image–text pair is available to both scoring branches. It can end up with different effects on the two distributions because the branches score different hidden features and normalize over different sets of locations.
Alternating co-attention
Alternating co-attention uses a summary as the signal passed from one side to the other. It reads the question first and uses that preliminary summary to guide visual attention. The resulting image summary then guides a fresh weighting of the question. The final question weights can therefore differ from the ones used to initiate the process. Each level starts its own sequence of these operations.
The attention operation takes a collection of candidate features and a vector of guidance. The collection might consist of image locations, or it might consist of question positions. Guidance supplies a common context for scoring every member of that collection. The softmax and weighted sum have the same roles in both uses.
H = tanh(Wₓ X + (Wɡ g) 𝟙ᵀ)
X is the matrix of feature columns to be attended. Its columns are xᵢ, where i indexes whichever set of positions is currently in use. The vector g is the guidance. Wₓ and Wɡ are learned projections for the candidate features and the guidance, respectively. In the paper’s notation they have k rows and d columns. The vector 𝟙 has one entry for every candidate column, with all entries equal to one. Its transpose 𝟙ᵀ replicates the projected guidance across columns. The sum combines that guidance with each projected feature, and the elementwise tanh produces the hidden matrix H.
aˣ = softmax(wₕₓᵀ H)
The vector aˣ is the distribution over columns of X. The learned scoring vector wₕₓ has k entries. Its transpose turns each column of H into a scalar score, and softmax normalizes those scores across the available columns.
x̂ = ∑ᵢ aˣᵢ xᵢ
The attended output is x̂. The sum runs over the column index i. The probability aˣᵢ weights the corresponding feature xᵢ from X. The operator returns a summary in the original feature space of the collection.
x̂ = 𝒜(X; g)
The symbol 𝒜 names the complete operation whose output is x̂. Its first argument X supplies the features to be weighted and its second argument g supplies the guidance. The semicolon in the notation distinguishes their roles. The method uses the operation first with question features and zero guidance, then with image features and the resulting question summary, and last with question features and the resulting image summary.
ŝ = 𝒜(Q; 𝟎)
Here ŝ is the preliminary attended question feature. Q contains the features at the current language level, and 𝟎 is the zero guidance vector. The operation 𝒜 can still assign different scores to different question positions because the projected question features vary across columns.
v̂ = 𝒜(V; ŝ)
The vector v̂ is the attended image feature. V contains the spatial feature columns, and ŝ supplies the guidance to 𝒜. A location can receive a different score when the preliminary question summary changes.
q̂ = 𝒜(Q; v̂)
The vector q̂ is the final attended question feature. The operation 𝒜 scores the columns of Q again, now with v̂ as the guidance. The resulting pair supplied to the classifier consists of v̂ and q̂. The preliminary text feature ŝ has already served its role by conditioning the visual step.
A shared guidance vector can affect the relative scores because the scoring operation applies a nonlinearity after adding the guidance to each projected feature. A location whose features are already strongly active and a location with a different feature pattern can respond differently to the same change in guidance. The order of operations also explains a risk the authors identify. If the opening question summary emphasizes the wrong part of the sentence, visual attention can be directed towards evidence that reinforces the initial mistake when the system returns to the question.
The contrast with the parallel mechanism is about the information passed between inputs. The parallel mechanism explicitly computes a score for every pair of positions and uses that grid to aggregate features. The alternating mechanism passes an attended summary vector at each stage. Both mechanisms produce image and question distributions. In either case, they are used across all levels of the language representation.
How the classifier combines the levels
The classifier predicts from a vocabulary of answer strings. Its input is the pair of attention summaries from each level. At a given level, it first adds the visual and text vectors. It then combines that sum with the representation accumulated at the preceding level, if there is one. The authors implement this as a multilayer perceptron, a sequence of learned feature transformations. Their equations leave the bias terms implicit.
hʷ = tanh(Wʷ(q̂ʷ + v̂ʷ))
The vector hʷ is the first hidden representation for answer prediction. The two hatted vectors are the attended word-level question feature q̂ʷ and the attended image feature v̂ʷ obtained at the same level. They are added coordinate by coordinate. The learned matrix Wʷ transforms the sum and tanh acts on its entries.
hᵖ = tanh(Wᵖ[(q̂ᵖ + v̂ᵖ), hʷ])
The vector hᵖ is the next hidden representation. The phrase-level summaries q̂ᵖ and v̂ᵖ are added. The brackets and comma mean concatenation, which places the entries of the sum and of hʷ together in one longer vector. Wᵖ learns how to mix those entries, and tanh gives the transformed feature.
hˢ = tanh(Wˢ[(q̂ˢ + v̂ˢ), hᵖ])
The vector hˢ is the hidden representation after the question level. The summaries q̂ˢ and v̂ˢ come from question-level co-attention. Their sum is concatenated with hᵖ, which already carries information from the previous stages. Wˢ transforms the joined vector before the elementwise tanh.
p = softmax(Wₕ hˢ)
The vector p gives a probability for each candidate answer. The learned output matrix Wₕ turns hˢ into one score per candidate. Softmax normalizes across those candidates. This softmax has a different domain from the attention softmax operations, which normalize across locations in the image or positions in the question.
The hierarchy consequently has a role at both ends of the method. It creates increasingly contextual representations of the question before the attention computations and gives their outputs a particular route into the answer decision afterwards. Word-level evidence must pass through the phrase and question integration stages. Question-level evidence enters at the last integration stage. The ablations matter in part because a difference between levels could reflect either the quality of their representations or where they enter the classifier.
Feature extraction and training
The authors rescale images to 448 × 448 before extracting the activations from the final pooling layer of the visual network. These activations supply the spatial feature grid used in the co-attention equations. Their experiments use feature extractors based on VGGNet or ResNet.
The implementation uses Torch and the Rmsprop optimizer. The base learning rate is 4e-4, momentum is 0.99, and weight decay is 1e-8. The batch size is 300. The training schedule allows up to 256 epochs, with early stopping when validation accuracy has failed to improve over the previous 5 epochs. The authors use a hidden width of 512 for the question-level integration layer on COCO-QA and 1024 on VQA, which they describe as the larger dataset. The remaining hidden layers and word embeddings use vectors of size 512, and the reported dropout probability is 0.5 on each layer.
Learning the word embeddings with the system means the answer task can shape what they represent. The phrase filters, co-attention scores, and answer classifier likewise serve the answer prediction objective. The procedure produces attention distributions as intermediate quantities. The paper discusses them by visualizing where they put their weight and by testing what happens when learned weights are removed. The authors release the implementation under the name HieCoAttenVQA.
Experiments and results
What the benchmarks measure
Both benchmarks use images from Microsoft COCO. They differ in how questions and answers are obtained, which matters for interpreting both the classification task and the effect of the language hierarchy. One collects human questions and several responses for each of them. The other derives questions automatically from captions and uses single-word answers.
The VQA dataset contains 248,349 training questions, 121,512 validation questions, and 244,302 test questions. The paper gives 6,141,630 as the total count of question–answer pairs. Each question has 10 free responses. These are grouped by answer type into yes/no, number, and other. The paper uses the established VQA evaluation protocol and obtains its test-dev and test-standard scores from the evaluation server. For the reported test runs the authors train on the training and validation data together.
The VQA answer classifier uses the 1000 most frequent responses as its candidate classes. These account for 86.54% of answers in the combined training and validation data. The coverage figure describes the choice of output vocabulary. It is distinct from the system’s measured accuracy on the test cases. The benchmark provides an open-ended setting and a multiple-choice setting. Open-ended here describes the benchmark condition presented to the system. The method itself still produces an answer from its learned vocabulary. In multiple-choice evaluation the question comes with possible answers, which changes the prediction setting and the relevant comparisons.
The COCO-QA dataset has 78,736 training questions drawn from 8,000 images and 38,948 test questions drawn from 4,000 images. The categories are organized around what the question asks for. Object questions make up 70% of the dataset, number questions 7%, color questions 17%, and location questions 6%. The paper describes the automatic conversion from COCO captions as the source of the questions and reports that all answers are single words. The dataset was introduced in Exploring Models and Data for Image Question Answering.
For COCO-QA the authors report classification accuracy and Wu-Palmer similarity, abbreviated WUPS. Accuracy evaluates whether the answer matches the target class. WUPS evaluates similarity between the predicted and recorded answer, so it addresses a different aspect of a wrong answer. A prediction can fail the exact classification test while still being closer in meaning to the recorded word than some other wrong answer. The main numerical comparison the authors describe for COCO-QA is in classification accuracy.
VQA comparisons
The baseline from the original VQA work is the deeper LSTM Q + norm I system. It represents the question with a recurrent encoder and uses a normalized image representation. The baseline gives the authors a comparison with a system that passes a whole-image feature to the answer predictor. Their open-ended test comparisons also include SMem, SAN, FDA, and DMN+. For multiple choice, they compare with FDA and a region-selection system. The answer conditions are reported separately because results from one are meaningful against other systems using the same condition.
For open-ended VQA, the results discussion compares DMN+ at 60.4% with alternating co-attention using ResNet at 62.1%. In the multiple-choice comparison it gives 64.2% for FDA and 66.1% for alternating co-attention using ResNet. These are the overall test comparisons as stated in the paper’s results discussion. The paper separately gives a headline VQA comparison of 60.3% to 60.5% in its abstract, before describing the improvement with ResNet. The abstract gives those headline figures without naming a test split. The 60.4% comparison comes from the open-ended results discussion, where the comparison system is explicitly identified as DMN+.
Overall open-ended accuracy in the reported VQA test comparison
Alternating co-attention with ResNet scores above the reported DMN+ result.
The numbers
| System or setting | accuracy % |
|---|---|
| DMN+ | 60.4 |
| Alternating co-attention with ResNet (this paper) | 62.1 |
Overall multiple-choice accuracy in the reported VQA test comparison
Alternating co-attention with ResNet scores above the reported FDA result.
The numbers
| System or setting | accuracy % |
|---|---|
| FDA | 64.2 |
| Alternating co-attention with ResNet (this paper) | 66.1 |
Performance also varies by answer type. For open-ended questions the authors report improvements of 3.4% for other answers and 1.4% for number answers. For multiple choice the reported improvements are 4.0% for other answers and 1.1% for number answers. These numbers are category-specific improvements in the paper’s VQA test discussion. The other category is broad, while number is defined by the form of answer. Neither category establishes which evidence individual predictions used.
The choice of visual features matters to the comparisons. According to the authors, switching to ResNet matches or improves on VGG across the cases they report. A score that changes both the attention architecture and the feature extractor reflects the combined system. The paper therefore discusses comparisons that share an extractor family. On test-dev, the authors report a 1.8% advantage for alternating co-attention with ResNet over FDA, which also uses ResNet. They also report that their VGG-based approach exceeds DMN+ by 0.2% on test-dev. SMem uses GoogLeNet in the comparisons, and several of the other systems use VGG. The comparisons with shared extractor families help answer the narrower question of whether an advantage appears with comparable sources of visual features. The retrained ablations address architectural changes more directly.
COCO-QA comparisons
On COCO-QA the comparison systems are 2-VIS+BLSTM, IMG-CNN, and SAN. The benchmark’s automatically formed questions and single-word target answers make it a distinct test from VQA despite the shared source of the images. Exact answer accuracy has a particularly direct interpretation when the output is one word and the dataset supplies a target class. The test also has an uneven category mix, so strong overall classification accuracy can come with different behavior in categories that contribute fewer questions.
The paper’s abstract compares the earlier COCO-QA accuracy of 61.6% with 63.3% for co-attention and then gives 65.4% with ResNet. The results discussion identifies the 61.6% test result as SAN(2,CNN). Its sentence giving the 65.4% score assigns it to the alternating ResNet configuration. The adjacent discussion says that parallel co-attention performs better in the COCO-QA setup. Those statements leave the scope of the comparison between parallel and alternating unclear. The chart uses the reported classifier accuracies and labels the ResNet result at the level on which the abstract and the results discussion agree.
Classification accuracy on the COCO-QA test set
Co-attention improves on the reported SAN result, with the highest accuracy reported for the ResNet configuration.
The numbers
| System or setting | accuracy % |
|---|---|
| SAN(2,CNN) | 61.6 |
| Hierarchical co-attention | 63.3 |
| Hierarchical co-attention with ResNet (this paper) | 65.4 |
The authors give reasons why each attention strategy might have an advantage in some settings. Parallel co-attention reduces each image–text pair to a scalar affinity through a learned dot product. They describe this compression as a difficulty in training the parallel approach. Alternating co-attention gives an intermediate summary a direct role in the next scoring operation. The authors point out that errors can accumulate along that sequence. These are explanations of the two designs’ potential difficulties. The benchmark results are measurements of complete configurations and do not separately quantify either source of difficulty.
What the ablations show
Visual attention, question attention, and their combination
The ablations use the VQA validation set. The authors retrain altered systems and compare them with the full approach and with the deeper recurrent question baseline. Retraining matters because the remaining parts get an opportunity to adapt to the removal. A loss in accuracy after retraining shows what is lost even with that adaptation. Turning off a component only at evaluation time would instead expose a trained system to inputs or internal features it had never been optimized to use.
The image-attention-only version drops learned attention on the question. It still uses the question to choose image evidence, so the question has a role in both visual selection and answer prediction. The validation comparison places this version above the baseline that uses a whole-image feature. That finding supports the use of spatial weighting in the authors’ setup and agrees with the earlier visual attention results they discuss. Because the attentive version comes from the paper’s own architecture, it also serves as a closer comparison for testing the added contribution of weighting question positions.
The authors report a 1.1% validation accuracy difference between the full system and the image-attention-only version. This comparison specifically concerns adding learned question attention to an approach that can already select image locations. It speaks to the motivating question of whether visual attention alone captures the benefit of selection. The result indicates an additional benefit from letting the system assign weights to language positions under the tested setup.
The question-attention-only variant removes spatial image attention. It still has visual information and therefore differs from a system asked to answer using the question alone. The authors report that it improves on the LSTM Q+I baseline by 0.5% on VQA validation. They also report a drop of 1.1% relative to image attention alone. The comparisons give question weighting a contribution of its own while showing that the visual selection creates the stronger of the two single-attention configurations in this experiment. The gains from individual variants describe their performance as separately trained systems. Their effects can depend on what other mechanisms are available alongside them.
The phrase encoder and the placement of attention
One ablation replaces the convolution and pooling stage with an additional word embedding layer. This keeps a further transformation above the word representations while removing the particular operation that combines neighboring words with filters of different widths. It therefore asks whether that local sequence processing matters over and above having a deeper/layered representation. The substitution changes the inputs available to the phrase-level co-attention and to the recurrent encoder. Its effect would combine what is lost at the middle level with any effects on the contextual features formed from it. The authors describe the substitution, while their written analysis gives numerical drops for the separate uniform-attention experiments.
Those experiments target a different intervention. The authors retain the hierarchy and set the attention at one level to a uniform distribution, leaving the other levels learned. At the affected level, a uniform distribution gives all positions the same weight. Summaries still reach the classifier, but the mechanism no longer selects which positions receive more influence at that stage. Thus removing phrase-level attention, for example, still leaves local phrase features available and lets the recurrent encoder use them. This is separate from replacing the convolution that creates those features.
On the VQA validation set, the authors give an accuracy drop of 1.7% when question-level attention becomes uniform, 0.3% when phrase-level attention becomes uniform, and 0.2% when word-level attention becomes uniform. The ordering shows which single replacement costs the most in the full hierarchy. Word and phrase attention still make measurable contributions under the reported comparisons. The question-level operation has the largest effect with the other levels present.
The authors suggest that the question level’s larger effect may come from its proximity to prediction. The last integration layer can draw directly on the question-level summaries. Word-level summaries reach the output only after additional integration, and phrase-level summaries also enter earlier. There is another difference inherent in the setup. The later representations already include recurrent context, while the earlier ones represent a word or a local window. The ablation measures the importance of learned attention at its assigned position under both of these conditions. It leaves the relative roles of representation and classifier placement open.
The alternating procedure is also tested with a further round. The authors report an improvement of 0.3% in the VQA validation ablation. An additional round gives one side access to a more recently attended representation of the other. It can refine an earlier selection if useful information survived that selection. This result measures the extra round tried by the authors. It does not describe what would happen as the number of passes continued to increase.
What the heat maps illustrate
The qualitative comparisons put the attention maps from the levels next to the same question and picture. Colors indicate relative weight. On the image side, the word-level maps frequently emphasize objects in the displayed examples, such as heads or a bird. Higher weights at these locations show that their features have more influence on the pooled visual vector at that level. On the question side, highlighted positions show which text features receive greater weight.
At the phrase level, the maps can move toward the background in some examples and become more focused on the objects in others. The authors suspect that the type of question helps determine the pattern. Such a shift makes sense for the design because the phrase-level filters can detect cues about what kind of answer is needed. A spatial change across levels, however, shows a change in weighting. Establishing that it occurred specifically because of the question type would require comparisons that hold other influences fixed.
The text maps often emphasize expressions asking for a color or the number of snowboarders. An example involving a bird puts weight on text about its color and on the bird’s region in the image. These cases illustrate how the two distributions can make a compatible selection on their respective sides. The maps also illustrate the purpose of producing separate summaries at the levels. The system can preserve evidence about an object at one level while gathering information about a property or surrounding region at another.
The paper includes displays for both successful and unsuccessful predictions on the two benchmarks. The failure cases place the predicted answer and the recorded answer next to the maps. Reading them alongside the successful cases gives the visualizations a concrete role in interpretability. They reveal the weights used in collecting image and question features and help a reader inspect the path from inputs to pooled features. A prediction still depends on the contents of those features and on how the answer classifier combines them.
Limitations
Limits the authors identify
The authors identify difficulties specific to each co-attention strategy. In the parallel approach, an affinity entry compresses an image vector and a question vector into a scalar. The paper describes the dot-product step as making the approach harder to train. The later projections retain access to the original features, so this compression concerns the explicit cross-input comparison, not the entire representation. The reported experiments compare the completed systems and do not isolate the compression as a measured source of training difficulty.
For alternating attention, each attended summary guides the next operation. This creates the possibility of error accumulation. The authors also raise error propagation in their discussion of earlier stacked visual attention systems. Independence across hierarchy levels addresses one version of that problem. A poor word-level spatial selection does not become the required starting map for phrase-level or question-level attention. Within a level, however, alternating co-attention still depends on the quality of its preceding summary. An error can travel around that shorter sequence.
The authors describe their heat maps as illustrative. They use them to show that learned weights can correspond to recognizable parts of images and questions and suggest that the question type may account for differences among some examples. They also present use on other vision and language tasks as a possibility. Their reported training and evaluation concern visual question answering. The conclusion therefore supports a proposal for transfer, with empirical results confined to the tested tasks.
Limits apparent from the evaluation
The VQA output vocabulary places a firm boundary on open-ended prediction. If an answer has no class in the chosen vocabulary, the classifier cannot emit it. The 86.54% coverage figure on training and validation responses is useful for seeing how much of the observed response distribution the 1000 common answers represent. It is not itself a test accuracy estimate or a direct ceiling under the evaluation protocol, which uses several human responses per question. The system also produces a class probability rather than a written explanation or a chain of intermediate answers.
Both benchmarks use COCO images. They vary in the source of the questions and the form of the answers, which makes their comparison informative, but the experiments leave performance with unrelated image collections, different answer vocabularies, and substantially different question distributions unmeasured. On COCO-QA, the prevalence of object questions gives them considerable influence over aggregate accuracy. Category-level results can help explain a benchmark score, while the overall numbers alone cannot establish that the attention mechanism is equally helpful for all kinds of questions.
The motivation about horse-question phrasing remains a hypothesis. The reported tests do not pair meaning-preserving rewrites of the same question and measure whether the answer stays fixed. An attention map that deemphasizes some words on one example provides a reason to investigate that behavior. It does not show that the same evidence will be selected after a change in wording, nor does overall accuracy show whether sensitivity to paraphrase improved.
Attention visualizations and accuracy ablations also answer different questions about reliance on evidence. The validation experiments change components and measure the resulting accuracy of retrained systems. The displays show which positions get large coefficients for particular examples. A highlighted region may contain features for several objects or properties, and the classifier also receives visual and language summaries from elsewhere in the hierarchy. The paper gives an aggregate test of the usefulness of attention and illustrative local evidence about its behavior. It does not report an intervention that changes the highlighted part of a picture while holding the question fixed to test whether a particular answer changes.
The architecture gives a natural way to exchange information between image and language, but visual feature quality, training, and answer selection all affect the reported comparisons. Sharing an extractor family with a baseline helps narrow the explanation for the performance gap. The ablations narrow it further by changing components of the authors’ architecture on a common validation split. The paper does not give uncertainty estimates for the differences discussed in the ablation analysis, so its small reported drops are best read as the observed ordering in these runs. The authors’ interpretation about closeness to the classifier remains a plausible explanation of that ordering.
What came after
Making image evidence part of the test
Making the V in VQA Matter brings the role of the image to the foreground of benchmark design. Hierarchical co-attention changes the routes by which image features can influence an answer, including the route through attention to the question itself. A benchmark centered on image understanding poses a related but distinct question. It asks whether the evaluation gives credit for using distinctions in the image that matter to the answer. This connects the design of an architecture to the design of a test that can reveal whether the visual input is doing useful work. The later work addresses that evaluation problem in Making the V in VQA Matter.
Don’t Just Assume; Look and Answer frames a related problem in terms of priors. A question can make one answer seem likely before the system examines the particular picture. This follows directly as an evaluation concern for a classifier trained over frequent answer classes. A system can have the means to exchange information between the picture and the words and still be rewarded for relying on regularities in the questions. The later work places the question of overcoming those priors at the center of visual question answering. Its focus identifies what an overall score alone leaves unresolved about the original study’s use of image evidence. Don’t Just Assume; Look and Answer.
RUBi takes up the same broad issue through unimodal bias. The term points to the possibility that one input can carry enough predictive information to dominate a task nominally defined over more than one. This is a different aspect of the interaction co-attention was built to support. Reciprocal attention provides a place for each input to affect the treatment of the other. Work on unimodal bias asks how to reduce the incentive to solve the problem from one of the inputs in the first place. RUBi.
Changing how the inputs interact
FiLM treats visual reasoning as a problem of conditioning one part of the system on another input. In co-attention, that conditioning is visible in the weights over positions. A question-derived signal helps decide which spatial features are collected, and a visual signal helps decide which language features are collected. FiLM organizes its approach around a general conditioning layer. The comparison helps distinguish choosing among existing spatial features from changing how visual features are processed under the influence of a question. Both address the need for question-dependent visual computation through different architectural operations. FiLM.
LXMERT pursues the interaction through a cross-modality encoder based on Transformers. Co-attention in the original paper produces summaries for an answer classifier at designated levels of a word-to-question hierarchy. The cross-modality encoder places learning representations across the inputs at the center of the design. The continuity lies in letting information from vision and language meet while their representations are being formed. This extends the architectural question from which positions should supply the final summaries to how a joint encoder should represent the two inputs. LXMERT.
GCAN carries the name co-attention into a task outside visual question answering. It combines graph awareness with co-attention for explainable fake news detection on social media. The shift in task makes the more general architectural idea apparent. Different sources of structured evidence can influence which parts of one another receive emphasis. The question–image system studied here uses a text sequence and a spatial grid. GCAN’s framing makes graph structure part of the corresponding design problem and uses explainability in a different prediction setting. GCAN.
Testing reasoning and examining explanations
CLEVR addresses compositional language and visual reasoning through a diagnostic dataset. Hierarchical co-attention represents language at several scales, but its classifier receives pooled evidence rather than an explicit record of the operations needed to solve a question. A diagnostic benchmark centered on composition directs attention to the structure of the task. It makes the combination of linguistic demands and visual relationships an object of evaluation in its own right. This gives a concrete direction to questions raised by the original paper’s broad answer categories, where an aggregate score can cover many different kinds of reasoning. CLEVR.
Inferring and Executing Programs for Visual Reasoning puts programs at the center of visual reasoning. Its framing makes the distinction between weighting evidence and organizing a computation explicit. In hierarchical co-attention, the language representation helps choose features and the classifier learns how to combine their summaries. Program inference and execution organize the task around operations to be carried out. That line of work addresses how to express the connection between a complex question and the steps of its solution, a connection that remains implicit in the co-attention classifier. Inferring and Executing Programs for Visual Reasoning.
Grad-CAM approaches visual explanation through gradient-based localization. The original paper can display spatial attention because its pooling operation uses a learned location distribution. Gradient-based localization addresses the explanatory question by starting from the prediction and tracing its relation to visual activations. The two approaches give readers different objects to inspect. A spatial attention map records how features were weighted at a particular stage of the forward computation. A gradient-based explanation addresses how visual activations relate to a selected output. Their connection helps clarify what readers can ask of the original heat maps and what other forms of evidence can complement them. Grad-CAM.
Cite
Cite as Jiasen Lu, Jianwei Yang, Dhruv Batra and Devi Parikh. 2016. Hierarchical Question-Image Co-Attention for Visual Question Answering. arXiv (Cornell University).
@misc{lu2016hierarchical,
title = {{Hierarchical Question-Image Co-Attention for Visual Question Answering}},
author = {Jiasen Lu, Jianwei Yang, Dhruv Batra and Devi Parikh},
year = {2016},
doi = {10.48550/arxiv.1606.00061},
eprint = {1606.00061},
archivePrefix = {arXiv},
url = {https://doi.org/10.48550/arxiv.1606.00061}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/lu-2016-hierarchical-question-image-co-attention/
References
- Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Deep compositional question answering with neural module networks. In CVPR, 2016. OpenAlex ↗ · Scholar ↗
- Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C Lawrence Zitnick, and Devi Parikh. Vqa: Visual question answering. In ICCV, 2015. our card
- Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015. our card
- R. Collobert, K. Kavukcuoglu, and C. Farabet. Torch7: A matlab-like environment for machine learning. In BigLearn, NIPS Workshop, 2011. OpenAlex ↗ · Scholar ↗
- Abhishek Das, Harsh Agrawal, C Lawrence Zitnick, Devi Parikh, and Dhruv Batra. Human attention in visual question answering: Do humans and deep networks look at the same regions? arXiv preprint arXiv:1606.03556, 2016. OpenAlex ↗ · Scholar ↗
- Akira Fukui, Dong Huk Park, Daylen Yang, Anna Rohrbach, Trevor Darrell, and Marcus Rohrbach. Multimodal compact bilinear pooling for visual question answering and visual grounding. arXiv preprint arXiv:1606.01847, 2016. our card
- Haoyuan Gao, Junhua Mao, Jie Zhou, Zhiheng Huang, Lei Wang, and Wei Xu. Are you talking to a machine? dataset and methods for multilingual image question answering. In NIPS, 2015. OpenAlex ↗ · Scholar ↗
- Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. our card
- Karl Moritz Hermann, Tomas Kocisky, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. In NIPS, 2015. our card
- Baotian Hu, Zhengdong Lu, Hang Li, and Qingcai Chen. Convolutional neural network architectures for matching natural language sentences. In NIPS, 2014. OpenAlex ↗ · Scholar ↗
- Ilija Ilievski, Shuicheng Yan, and Jiashi Feng. A focused dynamic attention model for visual question answering. arXiv:1604.01485, 2016. OpenAlex ↗ · Scholar ↗
- Jin-Hwa Kim, Sang-Woo Lee, Dong-Hyun Kwak, Min-Oh Heo, Jeonghee Kim, Jung-Woo Ha, and Byoung-Tak Zhang. Multimodal residual learning for visual qa. arXiv preprint arXiv:1606.01455, 2016. OpenAlex ↗ · Scholar ↗
- Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A Shamma, et al. Visual genome: Connecting language and vision using crowdsourced dense image annotations. arXiv preprint arXiv:1602.07332, 2016. our card
- Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ECCV, 2014. our card
- Lin Ma, Zhengdong Lu, and Hang Li. Learning to answer questions from image using convolutional neural network. In AAAI, 2016. OpenAlex ↗ · Scholar ↗
- Mateusz Malinowski, Marcus Rohrbach, and Mario Fritz. Ask your neurons: A neural-based approach to answering questions about images. In ICCV, 2015. OpenAlex ↗ · Scholar ↗
- Mengye Ren, Ryan Kiros, and Richard Zemel. Exploring models and data for image question answering. In NIPS, 2015. our card
- Tim Rocktäschel, Edward Grefenstette, Karl Moritz Hermann, Tomáš Kočiskỳ, and Phil Blunsom. Reasoning about entailment with neural attention. In ICLR, 2016. our card
- Cicero dos Santos, Ming Tan, Bing Xiang, and Bowen Zhou. Attentive pooling networks. arXiv preprint arXiv:1602.03609, 2016. OpenAlex ↗ · Scholar ↗
- Kevin J Shih, Saurabh Singh, and Derek Hoiem. Where to look: Focus regions for visual question answering. In CVPR, 2016. OpenAlex ↗ · Scholar ↗
- Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. CoRR, abs/1409.1556, 2014. our card
- Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In CVPR, 2015. OpenAlex ↗ · Scholar ↗
- Caiming Xiong, Stephen Merity, and Richard Socher. Dynamic memory networks for visual and textual question answering. In ICML, 2016. OpenAlex ↗ · Scholar ↗
- Huijuan Xu and Kate Saenko. Ask, attend and answer: Exploring question-guided spatial attention for visual question answering. arXiv preprint arXiv:1511.05234, 2015. OpenAlex ↗ · Scholar ↗
- Zichao Yang, Xiaodong He, Jianfeng Gao, Li Deng, and Alex Smola. Stacked attention networks for image question answering. In CVPR, 2016. our card
- Wenpeng Yin, Hinrich Schütze, Bing Xiang, and Bowen Zhou. Abcnn: Attention-based convolutional neural network for modeling sentence pairs. In ACL, 2016. our card
- Peng Zhang, Yash Goyal, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Yin and yang: Balancing and answering binary visual questions. arXiv preprint arXiv:1511.05099, 2015. OpenAlex ↗ · Scholar ↗
- Yuke Zhu, Oliver Groth, Michael Bernstein, and Li Fei-Fei. Visual7w: Grounded question answering in images. In CVPR, 2016. our card
- C Lawrence Zitnick, Aishwarya Agrawal, Stanislaw Antol, Margaret Mitchell, Dhruv Batra, and Devi Parikh. Measuring machine intelligence through visual question answering. AI Magazine, 37(1), 2016. OpenAlex ↗ · Scholar ↗