arXiv:2610.16977cs.CVOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.16977

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

Shu Zhao, Tan Yu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

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×5\times lower latency. Project page: https://tree-shu-zhao.github.io/SMILE/.

1 Introduction

In-context learning (ICL) has become the dominant paradigm for adapting vision-language models (VLMs) to new tasks at test time without parameter updates [1–5], unlike fine-tuning [6, 7], reinforcement learning [8], or training task-specific models [9–12]. However, the quality of the demonstration set matters as much as the model itself: poorly selected examples can reinforce spurious correlations [13], while carefully curated ones can expose the fine-grained distinctions that determine the correct answer [14–16]. This sensitivity has spurred active research into demonstration-selection strategies, from nearest-neighbor image matching [17] to multimodal heuristics [18–23].

Recently, CIRCLES [24] shows that counterfactual demonstration selection, assembling demonstrations that isolate how individual attribute changes affect the answer, helps VLMs reason about fine-grained visual distinctions. However, constructing each counterfactual requires the VLM to extract task-relevant attributes, generate faithful counterfactual captions, and execute composed image matching against the labeled corpus, a multi-stage pipeline with three potential points of failure.

This paper proposes a simpler path. Our key observation is that a model's own prediction errors already function as natural counterfactuals. As illustrated in Figure 1, a hard negative retrieved from the model's past errors can expose the same visual failure mode as the query, helping the VLM reject a plausible but wrong answer that positive demonstrations or attribute-based retrieval may not disambiguate. When a VLM predicts "brick" for a building image whose ground-truth answer is "concrete," that example demonstrates that the visual evidence the model considers sufficient for one answer actually corresponds to a different one: precisely what a counterfactual demonstration should

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

Figure

Figure 1: A VLM’s own past mistakes can steer attention away from visual distractors and onto the target region. Direct answering and positive-only retrieval focus on visually similar but misleading evidence, while attribute-based counterfactual retrieval fails to isolate the relevant material distinction. SMILE instead 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.

convey. Crucially, these errors are not arbitrary: we show empirically (Section 3) that classification mistakes recur as exact confusion pairs, while VQA mistakes remain semantically close to the correct answer even when exact strings differ. This structure turns the model’s own zero-shot prediction into a useful cue for selecting past errors that resemble its current likely mistake.

Building on this insight, we propose SMILE (Self-Mined Visual In-Context Learning from Errors). An offline mining pass collects incorrectly predicted labeled examples as a reusable hard-negative pool. At test time, positive demonstrations are identified by image-embedding similarity, then the model's zero-shot prediction guides identification of hard negatives whose stored mistaken predictions are semantically aligned in text-embedding space. Across four benchmarks and four VLMs, SMILE delivers an average task-score gain of +3.09 points over the SOTA baseline at 5×5\times lower latency.

Our contributions are:

• We reformulate counterfactual demonstration selection for visual ICL as model-specific hard-negative mining, a simple yet effective training-free framework.

• We provide empirical analysis showing that model errors are a reusable selection signal: exact confusions recur in closed-set classification, semantic error directions persist in open-ended VQA, and a pool decomposition explains why mined hard examples remain useful rather than noisy.

• We introduce prediction-conditioned selection via text-embedding similarity, a unified mechanism for both closed-set classification and open-ended VQA, and demonstrate consistent improvements across four benchmarks and four VLMs from two model families.

References (57)