Counting serves as a simple but powerful test of a Large Vision-Language Model's (LVLM's) reasoning; it forces the model to identify each individual object and then add them all up. In this study, we investigate how LVLMs implement counting using controlled synthetic and real-world benchmarks, combined with mechanistic analyses. Our results show that LVLMs display a human-like counting behavior, with precise performance on small numerosities and noisy estimation for larger quantities. We introduce two novel interpretability methods, Visual Activation Patching and HeadLens, and use them to uncover a structured "counting circuit" that is largely shared across a variety of visual reasoning tasks. Building on these insights, we propose a lightweight intervention strategy that exploits simple and abundantly available synthetic images to fine-tune arbitrary pretrained LVLMs exclusively on counting. Despite the narrow scope of this fine-tuning, the intervention not only enhances counting accuracy on in-distribution synthetic data, but also yields an average improvement of +8.36% on out-of-distribution counting benchmarks and an average gain of +1.54% on complex, general visual reasoning tasks for Qwen2.5-VL. These findings highlight the central, influential role of counting in visual reasoning and suggest a potential pathway for improving overall visual reasoning capabilities through targeted enhancement of counting mechanisms.
Figures & tables
Figure 1: Overview of Main Contributions
Model
Dataset
Acc ↑
MAE ↓
RMSE ↓
OBO ↑
Qwen2.5-VL-7B
SynDot
76.12
0.25
0.52
96.21
SynPoly
53.74
0.94
1.75
82.27
SynReal
73.48
0.79
2.13
91.01
Qwen3-VL-8B
SynDot
73.22
0.32
0.66
95.21
SynPoly
70.34
0.52
1.49
94.02
SynReal
88.79
0.15
0.47
98.88
Table 1: Performance comparison on synthetic benchmarks.
Figure 2: Counting Uncertainty Curve by Yes/No Answer of Qwen2.5 VL 7B.
Figure 3: T-SNE visualization of model hidden states based on black dots data.
Figure 4: Left: Layer-wise Overwrite Rate of Different Input Tokens Patching Strategy; Right: Layer-wise Logit Lens Tracking Curve for Counting Number.
Figure 5: Visualization of two functional groups of counting heads . Left to right: Head importance (positive-only), attention ratio on image tokens, and top-10 HeadLens CTER across heads. We present the typical attention distribution and top-10 HeadLens results for Cross-modal Routing Heads (green boxes) and Counting Aggregation Heads (blue boxes), using L19H23(left) and L26H26(right). Both have "three" (三) in Chinese as the top-1 HeadLens token.
Figure 6: Visual Grounding Heads in Early Layers. Left: Head-wise heatmap based on Visual Grounding Score; Right: Layer-wise Visual Grounding Score.
Backbone
Method
SynReal
PixMo-Count
Acc
MAE ↓
RMSE ↓
OBO ↑
Acc
MAE ↓
RMSE ↓
OBO ↑
Qwen2.5-VL-7B
Baseline
73.48
0.79
2.13
91.01
58.79
0.84
1.79
84.00
Ours
84.83
0.74
1.47
97.75
64.15
0.62
1.46
87.10
Qwen3-VL-8B
Baseline
88.79
0.15
0.47
98.88
58.75
0.73
1.35
88.20
Ours
91.21
0.11
0.34
99.41
66.98
0.60
1.25
91.65
LLaVA-1.5-7B
Baseline
54.27
3.59
5.05
66.34
31.88
1.81
3.09
59.77
Table 2: Evaluation on Out-of-distribution Counting Benchmarks.
Backbone
Method
MMMU
RealWorldQA
MathVista
Δ (avg.)
Qwen2.5-VL-7B
Baseline
54.89
61.96
57.30
–
Ours
56.33
64.14
58.30
+1.54
Qwen3-VL-8B
Baseline
58.33
70.05
66.30
–
Ours
60.74
71.83
67.90
+1.93
LLaVA-1.5-7B
Baseline
44.44
56.21
23.90
–
Ours
44.56
56.48
26.30
+0.93
Table 3: Evaluation on General Capability Benchmarks.
SFT
Lfocus
βh
Synreal
PixMo-Count
MMMU
RealWorldQA
MathVista
Baseline
73.48
58.79
54.89
61.96
57.30
✓
79.78
61.67
56.00
63.14
58.10
✓
✓
82.34
63.32
56.11
64.05
58.20
✓
✓
✓
84.83
64.15
56.33
64.14
58.30
Table 4: Component ablation on Qwen2.5-VL-7B across specialized and general benchmarks.
Figure 7: Jaccard Similarity for the top-20 most important heads of different tasks.
Appendix figures & tables19 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 8: Data Samples of the three synthetic benchmarks.
Figure 9: Head Importance Heatmap for Qwen2.5-VL on SynDot
Rank
ID
Import.
Img_Attn
Obj_in_Img
GT@10
Top-1 Acc
1
L26H26
0.801
0.034
0.032
0.83
0.55
2
L26H24
0.792
0.301
0.005
0.83
0.53
3
L26H25
0.716
0.314
0.023
0.92
0.77
4
L18H10
0.521
0.937
0.129
0.13
0.03
5
L16H1
0.393
0.903
0.260
0.10
0.00
6
L22H13
0.289
0.538
0.094
0.68
0.48
Appendix
Table 5: Top-20 attention heads ranked by importance and categorized by HeadLens projection. Importance : importance score from head ablation; Img_Attn : fraction of attention on image tokens; Obj_in_Img : fraction of image attention on object-relevant regions; GT@10 : ground-truth count in top-10 HeadLens projections; Top-1 Acc : top-1 HeadLens projection accuracy. Rows in green denote Counting Aggregation Heads and rows in blue denote Cross-Modal Routing Heads .
Figure 10: Layer-wise VAP on SynDot for LLaVA-1.5-7B, InternVL3.5-8B and Qwen3-VL-8B.
Figure 11: LLaVA1.5-7B: Head-wise HeatMap on Head Importance, Attention Ratio on Image Tokens and Text Tokens (from left to right).
Figure 12: Qwen3-VL-8B: Head-wise HeatMap on Head Importance, Attention Ratio on Image Tokens and Text Tokens (from left to right).
Figure 13: Layer-wise Probing Performance Curves for Binding and Counting.
Figure 14: Comparison of HeadLens and AttentionLens on SynPoly. Top : Head-wise top-1 accuracy on model final output (not ground truth counting). HeadLens (left) produces a sparse signal where only a few heads in Layer 26 stand out, which is aligned with our head importance heatmap in fig. 9 . While AttentionLens (right) spreads high accuracy across the majority of heads, especially in layers 14–27. Bottom : KL divergence distribution across all 784 heads. AttentionLens concentrates nearly all heads into a narrow low-KL band ( KL<3 ), collapsing the dynamic range needed to distinguish critical from non-critical heads. HeadLens preserves a broad distribution that naturally separates the counting circuit from irrelevant heads.
HeadLens
AttentionLens
Ratio
# Lenses trained
28
784
28×
Parameters per lens
∼ 12.8M
∼ 0.46M
0.04×
Total parameters
∼ 360M
∼ 362M
∼1×
Training steps
14,000
235,200
17×
Wall time (SynPoly)
37.9 s
2,385.1 s
63×
Wall time (SynDot)
41.9 s
2,414.5 s
58×
Appendix
Table 6: Computational cost comparison between HeadLens and AttentionLens.
Figure 15: Layer-wise emergence of numeric representations for both models. Both show zero numeric signal in the first 70% of layers. Qwen’s emergence is more concentrated (layers 25–27) and achieves far higher correct-in-top-10 rates (up to 11% ) versus LLaVA’s peak of 1.6% .
Model
Method
SynDot
SynPoly
Acc
MAE ↓
RMSE ↓
OBO ↑
Acc
MAE ↓
RMSE ↓
OBO ↑
Qwen2.5-VL-7B
Baseline
76.12
0.25
0.52
96.21
53.74
0.94
1.75
82.27
Ours
89.20
0.11
0.33
100.00
79.10
0.21
0.47
99.60
Qwen3-VL-8B
Baseline
73.22
0.32
0.66
95.21
70.34
0.52
1.49
94.02
Ours
95.40
0.05
0.21
100.00
93.40
0.07
0.26
100.00
LLaVA-1.5-7B
Baseline
24.07
4.46
6.58
39.22
33.30
1.65
2.34
56.71
Appendix
Table 7: In-distribution counting benchmarks with full metrics.
Model
Method
Acc ↑
MAE ↓
RMSE ↓
OBO ↑
Qwen2.5-VL-7B
Baseline
80.44
0.66
4.34
89.61
Ours
82.08
0.58
4.28
91.24
Qwen3-VL-8B
Baseline
87.98
0.23
0.86
95.52
Ours
90.22
0.20
0.85
95.93
LLaVA-1.5-7B
Baseline
42.16
1.38
2.08
59.67
Ours
47.86
1.15
1.78
67.01
Appendix
Table 8: CountBenchQA results.
Model
Method
Range
Acc ↑
MAE ↓
RMSE ↓
OBO ↑
Qwen3-VL-8B
Baseline
11-20
35.00
0.90
1.25
80.02
21-30
10.42
2.49
3.02
32.37
Ours
11-20
48.16
0.59
0.86
93.45
21-30
18.27
1.61
2.05
52.81
Appendix
Table 9: Performance comparison over larger counting ranges for Qwen3-VL-8B. Ours are finetuned on the number range 1-10 only.
Figure 16: Layer-wise ablation of the attention regularizer for three LVLMs.
Method
α
MMMU
RealWorldQA
MathVista
Average
SFT + Lfocus
1.0
56.11
64.05
58.20
59.45
+ HTT
1.1
56.14
63.94
58.10
59.39
+ HTT
1.2
56.33
64.12
58.20
59.55
+ HTT
1.3
56.43
64.05
57.90
59.46
+ HTT + HIR
1.2
56.33
64.14
58.30
59.59
Appendix
Table 10: Ablation study of head temperature tuning (HTT) coefficient α and head importance reweighting (HIR) on Qwen2.5-VL-7B. The baseline method is SFT+ Lfocus with α=1.0 .
Figure 17: Data sample of SynColorShape.
Training Task
Δ MMMU
Δ MathVista
Δ RealWorldQA
Δ (avg.)
Color-Shape SFT
− 0.1
− 0.7
− 0.2
− 0.3
Color-Shape SFT + AttnReg
− 0.2
− 0.8
+0.2
− 0.3
Counting (Ours)
+1.44
+1.00
+2.18
+1.54
Appendix
Table 11: Change in general reasoning benchmarks ( Δ from each method’s own baseline) for Qwen2.5-VL-7B. Color-shape recognition training shows no positive transfer, while counting training yields consistent gains.
Figure 18: SynPoly case studies at GT=5. Prompt: How many colorful polygons are in the image? Answer with only an integer. Observation: Base predicts 4 and Ours predicts 5. Base attention is more spread with weak peaks, while ours shows sharper peaks aligned with the dots already at Layer 2 and remains aligned in the all-layer average. Conclusion: Our method strengthens early visual grounding for counting, making the attention more instance-aligned even when both models output the correct number.
Figure 19: SynDot case studies at GT=6. Prompt: How many black dots are in the image? Answer with only an integer. Observation: Base predicts 6 and Ours also predicts 6. However, base attention is more spread with weak peaks, while ours shows sharper peaks aligned with the dots already at Layer 2 and remains aligned in the all-layer average. Conclusion: Our method strengthens early visual grounding for counting, making the attention more instance-aligned even when both models output the correct number.