“glass top left of table” RefCOCO




Uncovering How VLMs Locate and Extract Visual Information
A silent overview of the problem, the method and the main results. Come see the poster in Sydney on Wed, Dec 9 (10:00 AM – 1:00 PM AEDT, Hall 1-4, #S3403).
Vision-language models (VLMs) can locate an image region referred to by a text prompt and route the corresponding visual evidence to the output, yet the internal mechanism behind this behavior is not understood. Inspired by retrieval heads in large language models, we ask whether VLMs contain an analogous mechanism for visual retrieval. We answer affirmatively by introducing Visual Retrieval Heads (VRHs), a small subset of attention heads (about 1.7–2.6%) that are causally responsible for grounding text descriptions to image regions.
To find them, we recast existing head-scoring methods under a unified design space over query tokens, key aggregation, and cross-sample aggregation. We then show that scoring attention from output prediction tokens with a sum over the ground-truth referent region most reliably identifies causal heads. Across four VLMs and five referring-expression benchmarks, masking only the top 20 VRHs reduces grounding accuracy by up to 80 percentage points, while masking the same number of random heads has little effect.
Beyond replicating the causal–sparse–universal triad established for text retrieval heads, VRHs exhibit several properties not previously reported: they generalize across visual reference tasks, remaining causal on attribute, spatial, counting, and visual-math benchmarks despite being discovered through bounding-box prediction; they are functionally specific, preserving output format while corrupting localization; and they are architecturally shared, transferring causally across VLMs that share an LLM backbone but differ in vision encoder, projector, and instruction tuning.
In LLMs, a handful of retrieval heads route the right input token to the output during long-context recall. They are causal, sparse, and universal. Do VLMs have an analogue for finding the right image region?
Ablating them breaks retrieval and leaves the output fluent, so the model needs them for the task.
A few percent of all heads carry the behavior. Perturbing the other heads has little effect.
They appear across model families and scales, which points to a shared internal mechanism.
OCR Heads and VERA study text rendered inside images. Localization Heads work on general images, but they select heads by the shape of their attention and do not test whether the heads are causally necessary. VRHs are the first heads shown to be causally responsible for visual retrieval from general images.
| Specialized heads | Visual retrieval source | Causally validated? |
|---|---|---|
| Retrieval Heads (Wu et al.) | Text (long context) | yes |
| QRHead | Text (long context) | yes |
| OCR Heads | Rendered text in images | yes |
| VERA | Visual documents | yes |
| Localization Heads | General images | no |
| Visual Retrieval Heads Ours | General images | yes |
Table 1. VRHs are the first attention heads shown to be causally responsible for visual retrieval from general images.
We use referring-expression visual grounding as a probing task: given an image and an expression, the model must output a bounding box. The ground-truth box marks which visual tokens the model should read from.
Prior methods all score a head by how strongly it attends from a set of query tokens to the key tokens in the evidence region. For grounding, we let the key tokens be the visual tokens overlapping the ground-truth box. Written in one form:
Existing methods are different choices along these three axes. We build all 23 combinations, mask each variant's top heads, and keep the variant whose masking lowers grounding accuracy the most. Pick a setting below to see which method it corresponds to.
Table 2 and the design space. The two aggregation axes change the result little. The query-token set matters most: scoring from output tokens, the tokens the model generates for its answer, gives the strongest causal signal.
Figure 2. Causal validation of head-scoring variants (RefCOCO, four VLMs). We mask each variant's top-20 heads and report grounding accuracy (lower means the masked heads matter more). Our default (Qout, Φsum, Ωavg) gives the largest drop. The Qs, Φ and Ω bars each flip one axis, and Δ is the gap to Ours. Flipping the query-token set changes the result most.
To test a head's causal contribution, we zero the attention output of head (l, h) before it is added to the residual stream. Every other head, MLP and layer norm is left unchanged. Text retrieval heads were tested with the same intervention, so the results are comparable. All experiments run on a single 48 GB GPU.
Across four VLMs and five grounding benchmarks, masking a few VRHs lowers grounding accuracy far more than masking random heads or heads found by prior methods.
Figure 3. Comparison with existing specialized heads (RefCOCO). As k grows, masking the top-k VRHs lowers grounding accuracy much faster than masking the top-k heads of Retrieval Heads, OCR Heads, VERA or Localization Heads, or k random heads.
Figure 4. Universality of VRHs. Grounding accuracy after masking the top-k VRHs in four VLMs on RefCOCO/+/g (average), RefSpatialBench and Toloka. Masking a few VRHs (red) causes large drops in every model and benchmark. Masking the same number of random heads (gray) barely changes accuracy.
Figure 6. Eleven VLMs (RefCOCO, k=20). No masking vs. 20 random heads masked vs. the top-20 VRHs masked. Besides the four main VLMs, the figure covers Magma-8B, LLaVA-NeXT-Llama3-8B, PaliGemma2-10B, DeepSeek-VL2-Small, InternVL2.5-8B, GLM-4.6V-Flash and Phi-4-Reasoning-Vision (Llama-3, Gemma 2, DeepSeekMoE, InternLM2.5, GLM and Phi backbones). Masking the VRHs drops accuracy to 5.0–32.1% in every model.
Fewer than 15% of heads score above 10−3, and 0–4% score above 5×10−3, depending on the model. Masking these few heads is enough to break grounding. Retrieval heads in LLMs are sparse in the same way.
Figure 5. Sparsity of VRH scores (RefCOCO). Distribution of head scores across the four VLMs; only a small fraction of heads score above 10⁻³.
An interactive version of Figure 1. Switch between all heads, the top-20 VRHs alone and all heads except the VRHs. The map shows where the model looks, and the box shows whether it stays on target.
Attention · all heads
click to step
Attention overlays are qualitative examples from the paper (Qwen2.5-VL-7B). Accuracies are dataset-level numbers from the appendix (RefCOCO, Toloka). Masking the top-20 VRHs (2.6% of heads) breaks grounding, and masking the same number of random heads barely changes it.
Each object has its own color. Move the cursor over one to highlight it. We then force the top-20 Visual Retrieval Heads to attend only to that segment, and the precomputed output shows how the predicted box (red) changes.
Each object segment is an automatic mask; steering forces the top-20 VRHs’ attention uniformly onto the pointed segment (decode-only, matching how VRHs were detected). Boxes are precomputed object-locate outputs from Qwen3-VL-8B. The showcase omits incomplete or unusable segment outputs; steering can redirect a prediction, but is not guaranteed to match every selected segment.
Every cell is one attention head, arranged by layer (rows) and head index (columns). The top-20 VRHs are highlighted. They sit in the middle layers. Hover to inspect a head.
For Qwen2.5-VL-7B, 20 of 784 heads (2.6%) form the VRH set, all in layers 14–19.
Top-20 (layer, head) indices are taken verbatim from the paper's appendix.
The 12 highest-ranked VRHs on the map above can be clicked one by one. Knock out any combination and see how the predicted box (red) moves relative to the ground truth (green). The buttons apply the full top-20 intervention or a 20-random-head control. Each box is a precomputed Qwen2.5-VL-7B output for that exact set of masked heads. Invalid outputs and control failures are shown as they are.
VRHs are causal, sparse and universal like text retrieval heads. They also have the four properties below.
The heads are detected from bounding-box grounding only. Masking them also lowers accuracy on attribute, spatial, counting, vision-centric and visual-math benchmarks.
With VRHs masked, the output keeps its format: the box still parses and the sentence still reads well. What breaks is where the model looks. Text retrieval heads show the same failure in LLMs.
Heads found in one VLM also break grounding when masked at the same indices in another VLM with the same LLM backbone, even though the vision encoder, projector and instruction tuning differ.
The result does not depend on which output tokens are scored. Heads detected from only 5–10 annotated grounding examples break grounding as much as heads detected from 200.
Masking the top-20 VRHs detected on RefCOCO lowers accuracy on seven VQA benchmarks in all four VLMs. Masking 20 random heads changes accuracy by at most 4.6 points.
| Model | Condition | VAW | Spatial457 | SpatialRGPT | CV-Bench | MMStar | CountBenchQA | MathVista |
|---|
Table 3. Cross-task generalization. Red = drop under VRH masking (k=20). Random masking (k=20) stays near the baseline.
Figure 8. Qwen2.5-VL-7B on RefCOCO, k=20. (a) With VRHs masked, most predictions are still valid boxes but mislocated. The control, random heads plus selected first-layer (L0) heads, breaks the output format instead (parse failures). (b) Heads detected from one random output token or from all output tokens both lower accuracy to about 7% when masked (random heads: 86.0%). (c) Heads detected from 5 to 200 samples all lower accuracy to 7–8% when masked.
Text retrieval heads show the same fluent-but-unfaithful failure in LLMs. Here the model keeps answering in the expected format after it stops looking at the referent.




















Attention maps on visual grounding. Left to right: input, all heads, the top-20 VRHs only, and the model with the VRHs masked. Attention concentrates on the referent with all heads, and the top-20 VRHs alone show the same pattern. With the VRHs masked, attention spreads out and the predicted box (red) misses the ground truth (green).




All heads: blue · correct VRHs masked: gray · wrong




All heads: yellow · correct VRHs masked: purple · wrong




All heads: yellow · correct VRHs masked: green · wrong




All heads: tan · correct VRHs masked: brown · wrong
Attention maps on visual question answering. Each panel shows the input (green = ground-truth region), the top-20 VRH attention, all-heads attention, and attention after masking the VRHs. With VRHs intact the answer is correct. With VRHs masked, attention leaves the evidence and the answer is still fluent but no longer matches the image.
Figure 7. Same-backbone VLM pairs (RefCOCO). Pairs: Qwen2.5-VL-7B / InternVL3-8B (Qwen2.5-7B), Qwen3-VL-8B / InternVL3.5-8B (Qwen3-8B), Magma-8B / LLaVA-NeXT-8B (Llama-3-8B). Top: the layer-head score maps of each pair look alike (top-20 overlap 14–18 of 20, Spearman ρ 0.89–0.91). Bottom: masking one model's top-k VRHs at the same indices in its partner also breaks grounding. For the Llama-3 pair, Magma-8B drops from 68.8% to 0.0% and LLaVA-NeXT-8B from 85.8% to 5.8%.
The heads detected on RefCOCO can be reused as they are. The first two results below are new and not in the paper. They use no training and no head re-detection.
Left: visual KV-cache compression (Qwen2.5-VL-7B, RefCOCOg). We keep SparseMM's rule for splitting the visual KV budget across heads and only replace its head scores with VRH scores. Right: multi-image QA (Qwen3-VL-8B, Visual Haystacks, 10 images). All images and the question go through one prefill, each image is scored by the attention of the top-20 VRHs on its visual tokens, and the same VLM answers from the highest-scoring image.
Grounding accuracy at a 2% visual KV budget with VRH scores vs. SparseMM's head scores. The full cache gives 85.7%.
How often the referenced image is ranked first, with VRH attention vs. the MIRAGE retriever (CLIP: 54.2%). Answer accuracy rises from 72.6% with MIRAGE's selection to 82.4%.
Following Ma et al.'s recipe for text retrieval heads, we use a VRH-masked model as the negative policy for direct preference optimization (DPO). The rejected responses then carry the failure we want to remove: answers produced without the VRHs.
The gains are small but consistent: +0.78 points on average across three grounding benchmarks, and larger than with a random-head-masked negative policy.
Figure A3. DPO with VRH-based negatives. Perturbing causally relevant heads gives a more informative preference signal than random-head dropping.
A sparse set of attention heads carries visual evidence from the region named in the text to the output. Masking only these heads breaks grounding.
Masking them also lowers accuracy on attribute, spatial, counting and visual-math questions. Heads found in one VLM transfer to VLMs with the same LLM backbone.
5–10 annotated examples are enough to find them. The same heads can guide KV-cache compression, image selection and DPO training.
Limitations and next steps. Attention shows where evidence comes from, not what is read out. The paper studies single-image inputs. Next steps are activation patching and causal mediation analysis, and video and interleaved image-text inputs. The KV-cache and multi-image results above are a first look at applications.
@inproceedings{park2026retrievalheads,
title = {Retrieval Heads Meet Vision: Uncovering How VLMs
Locate and Extract Visual Information},
author = {Park, Chanho and Choi, Daehyeon and Lee, Jihyun
and Sung, Minhyuk},
booktitle = {Advances in Neural Information Processing Systems},
year = {2026}
}