The Value of Being Wrong: Self-Mined Visual In-Context Learning from Errors

NeurIPS 2026 Spotlight
Shu Zhao, Tan Yu
NVIDIA
A hard negative from the mined pool shows the VLM which region to use: the distractor that caused its past mistake is marked, and the model answers from the target region.

A VLM's own past mistakes can steer attention away from visual distractors and onto the target region. SMILE retrieves a hard negative with the same error pattern from the mined pool, making the distractor evidence explicit and steering the VLM toward the correct visual region.

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 5× lower latency.

Method

SMILE pipeline. Offline: the VLM answers each labeled example several times, and examples whose majority vote is wrong enter the hard-negative corpus. Online: image similarity retrieves positive demonstrations, and the query's zero-shot prediction retrieves hard negatives with similar mistaken predictions.

SMILE mines failures offline and reuses them online as counterfactual demonstrations. Left: the target VLM is run on the labeled corpus; examples whose voted prediction disagrees with the ground truth are stored with both the gold answer and the mistaken answer. Right: for a new query, image similarity retrieves positive demonstrations, while the query's zero-shot prediction is matched in text-embedding space to stored mistaken predictions; the resulting hard negatives are appended to the context before final inference.

Results

Main comparison with both primary metric and F1 reported per dataset. The best and second best scores per model and metric are highlighted.

ModelMethodCUBFlowersOK-VQAVizWizAverage
AccF1AccF1EMF1EMF1ScoreF1
Gemma3-4BNone10.568.1946.7646.5019.1226.7039.8557.2629.0734.66
Random9.988.1037.0139.5124.8130.7451.8467.0830.9136.36
RICES65.4067.6286.7087.4326.6532.7256.0870.4058.7164.54
MUIER65.2167.4286.3987.2826.8732.8256.5970.7558.7764.57
MMICES13.9510.9838.0938.2026.2432.4152.7268.2132.7537.45
CIRCLES71.9772.3993.3293.4931.2736.8957.6171.3563.5468.53
SMILE (ours)72.2272.7596.8996.8835.0139.9469.6976.2068.4571.44
Gemma3-12BNone30.3425.0267.5164.3325.4733.8956.8271.2645.0448.62
Random29.2725.8271.2871.5633.5939.5670.1380.5451.0754.37
RICES76.3776.2596.4496.2936.8642.6173.9883.4370.9174.65
MUIER76.5176.3996.4296.2836.5842.3073.7283.0470.8174.50
MMICES36.3731.6171.3669.1335.1240.8571.5081.5653.5955.79
CIRCLES77.0376.9097.7797.7537.7543.2374.3082.3571.7175.06
SMILE (ours)76.9876.8998.8598.8643.6748.2978.5884.4074.5277.11
Qwen2.5-VL-3BNone7.095.9722.5724.0442.2946.1275.8378.5836.9538.68
Random15.8115.6341.7644.5741.5445.3074.4877.4043.4045.73
RICES72.2673.8893.0692.8442.5746.2670.8073.3769.6771.59
MUIER72.2573.8793.0692.8341.6645.8271.6174.7469.6471.81
MMICES17.2615.3833.8435.4739.3242.9573.2376.2140.9142.50
CIRCLES74.8976.3494.7094.7743.2447.2772.9375.3371.4473.43
SMILE (ours)76.7577.7594.7995.2543.7547.5378.2682.7273.3975.81
Qwen2.5-VL-7BNone14.8311.7943.4742.1433.3138.3368.7073.3040.0841.39
Random26.2724.4247.1549.7441.6646.2076.1178.3447.8049.67
RICES82.1581.9198.8398.8543.6648.3273.7976.1374.6176.30
MUIER82.1481.9098.9398.9544.2948.7674.6777.0875.0176.67
MMICES34.5729.7249.1547.6243.4047.6670.6972.7749.4549.44
CIRCLES82.1782.1398.9999.0443.5448.5377.6382.3675.5878.02
SMILE (ours)82.5582.3099.3399.3747.8051.6183.4287.4978.2880.19

Efficiency

Per-query inference latency of CIRCLES and SMILE for four VLMs on H100 and H200 GPUs.

Per-query inference latency across four VLMs. SMILE is 3.6–6.0× faster than CIRCLES on H100 (top) and 4.2–6.0× faster on H200 (bottom).

Visualization

Attention maps over the query image without and with the hard-negative block, for a bird-species question and a tree question; with hard negatives the attention moves to the discriminating region and the prediction becomes correct.

Hard negatives concentrate attention on the discriminating region and flip the prediction. Attention from the final prompt token to query-image patches, with vs. without the prediction-conditioned hard-negative block.

Code and Data

BibTeX

@misc{zhao2026smile,
  title={The Value of Being Wrong: Self-Mined Visual In-Context Learning from Errors},
  author={Shu Zhao and Tan Yu},
  year={2026},
  eprint={2610.16977},
  archivePrefix={arXiv},
  primaryClass={cs.CV},
  url={https://arxiv.org/abs/2610.16977},
}