The Value of Being Wrong: Self-Mined Visual In-Context Learning from Errors
Organizations: NVIDIA
Abstract
Visual in-context learning (ICL) enables vision-language models (VLMs) to adapt at test time via demonstration examples, but its effectiveness depends critically on the examples selected. Recent counterfactual selection methods improve ICL by constructing demonstrations that expose how individual attribute changes affect the answer. However, they require multi-stage pipelines involving attribute extraction, caption engineering, and composed image matching. We propose a simpler alternative grounded in a key observation: a model's own prediction errors are natural counterfactual demonstrations that directly encode its failure modes. Our method, SMILE (Self-Mined Visual In-Context Learning from Errors), builds a model-specific pool of hard negatives offline by recording the target VLM's own mistakes. At test time, the prediction serves as a direction signal that surfaces, in the semantic embedding space, the past mistakes most likely to recur for the current query. This prediction-conditioned identification provides a unified mechanism for both closed-set classification and open-ended visual question answering without task-specific design. Across four benchmarks and four VLMs, SMILE delivers an average task-score gain of +3.09 points over the SOTA baseline at 5x lower latency. Project page: https://tree-shu-zhao.github.io/SMILE/
Figures & tables
| Model | Method | CUB | Flowers | OK-VQA | VizWiz | Average | |||||
| Acc | F1 | Acc | F1 | EM | F1 | EM | F1 | Score | F1 | ||
| Gemma3-4B | None | 10.56 | 8.19 | 46.76 | 46.50 | 19.12 | 26.70 | 39.85 | 57.26 | 29.07 | 34.66 |
| Random | 9.98 | 8.10 | 37.01 | 39.51 | 24.81 | 30.74 | 51.84 | 67.08 | 30.91 | 36.36 | |
| RICES | 65.40 | 67.62 | 86.70 | 87.43 | 26.65 | 32.72 | 56.08 | 70.40 | 58.71 | 64.54 | |
| MUIER | 65.21 | 67.42 | 86.39 | 87.28 | 26.87 | 32.82 | 56.59 | 70.75 | 58.77 | 64.57 | |
| MMICES | 13.95 | 10.98 | 38.09 | 38.20 | 26.24 | 32.41 | 52.72 | 68.21 | 32.75 | 37.45 | |
| Full | Uncovered | Fair | |
| Full corpus | 82.15 | 76.27 | 89.77 |
| Hard only | 80.34 | 80.00 | 83.27 |
| Clean only | 46.12 | 11.66 | 92.42 |
| HN-pool source | CUB | OK-VQA | ||||||||
| Q2.5-3B | Q2.5-7B | Q3-8B | G-4B | G-12B | Q2.5-3B | Q2.5-7B | Q3-8B | G-4B | G-12B | |
| Qwen2.5-VL-3B | +0.00 | +0.77 | -0.23 | +1.69 | -1.20 | +0.00 | +0.24 | -1.47 | -1.98 | -0.71 |
| Qwen2.5-VL-7B | +0.27 | +0.00 | -0.12 | -0.05 | -0.65 | -0.38 | +0.00 | -1.19 | -1.89 | -0.79 |
| Qwen3-VL-8B | +0.26 | +0.38 | +0.00 | +0.67 | -0.58 | -0.12 | +0.29 | +0.00 | -0.50 | +0.52 |
| Gemma-3-4B | +0.30 | +1.18 | -0.09 | +0.00 | -0.02 | -0.43 | -0.36 | -1.20 | +0.00 | -0.67 |
| Gemma-3-12B | +0.53 | +0.01 | +0.32 | +0.31 | +0.00 | -0.30 | +0.04 | -0.71 | -1.55 | +0.00 |
| Pos. | Rand. HN | Pred. HN | CUB | OK-VQA |
| ✗ | ✗ | ✗ | 14.83 | 33.31 |
| ✓ | ✗ | ✗ | 81.18 | 43.16 |
| ✓ | ✓ | ✗ | 81.23 | 42.86 |
| ✓ | ✗ | ✓ | 82.55 | 47.80 |
| CUB | OK-VQA | Avg. | |
| EM | 82.34 | 40.46 | 61.40 |
| F1 | 82.39 | 46.65 | 64.52 |
| Semantic | 82.55 | 47.80 | 65.18 |
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset | # samples | Gemma-3-12B | Gemma-3-4B | Qwen2.5-VL-7B | Qwen2.5-VL-3B |
| CUB-200 | |||||
| Flowers-102 | |||||
| OK-VQA | 3.5 | 2.5 | |||
| VizWiz |
| Encoder | EM | F1 |
| CLIP ViT-B/32 | 70.85 | 70.50 |
| CLIP ViT-B/16 | 74.63 | 74.53 |
| CLIP ViT-L/14 | 79.79 | 79.72 |
| CLIP ViT-H/14 | 83.88 | 83.54 |
| CLIP ViT-G/14 | 82.55 | 82.30 |
| SigLIP 2 base/16-224 | 76.68 | 76.36 |
| Model | CUB | Flowers | OK-VQA | VizWiz | ||||
| Acc | F1 | Acc | F1 | EM | F1 | EM | F1 | |
| Qwen3-VL-4B | 84.08 | 89.42 | 99.45 | 99.46 | 44.15 | 49.03 | 81.94 | 87.95 |
| Qwen3-VL-8B | 83.87 | 89.41 | 99.61 | 99.62 | 47.50 | 51.70 | 82.39 | 87.51 |
| queries | natural | hard-only | clean-only | clean hard | |
| 2 | 2,161 | 90.19 | 83.80 | 86.49 | |
| 4 | 1,584 | 89.77 | 83.27 | 92.42 | |
| 8 | 1, 844 | 89.22 | 79.74 | 94.55 | |
| 12 | 1, 385 | 87.79 | 78.44 | 96.10 |
In-Context Learning
In-context learning studies how models adapt to new tasks from examples or instructions supplied at inference time, without changing their weights.
See all 386 papers