Vision-language retrieval with CLIP-style dual encoders achieves strong cross-modal performance, yet practical accuracy often hinges on localized semantic distinctions where top-ranked near misses differ from the true match by a single critical detail. Hard-sample mining can select confusable candidates but cannot construct corrected counterparts; synthetic augmentation can generate novel samples but, without conditioning on actual model failures, targets irrelevant dimensions of hardness. We observe that a top-ranked false positive is a counterfactual scaffold---sharing most of the query's semantics while differing in a localized failure-causing residual. Minimally correcting this residual yields a hard positive of the ground truth in the same modality; the corrected and unedited versions form a hard negative pair that straddles the decision boundary, producing complementary pull--push supervision. We introduce RePair, guided by three principles---Validity, Minimality, and Locality---which mines false positives bidirectionally, applies LLM-guided counterfactual editing, and trains with a local hard-pair contrastive objective. On Flickr30K and COCO30K, RePair outperforms controlled augmentation baselines with only 107K synthetic samples---26%--75% fewer than comparable methods---confirming failure-conditioned repair is more data-efficient than error-agnostic augmentation.
Figures & tables
Figure 1: The RePair operator. Top: For a text query q , the retrieval system returns a near-miss false positive pfp that shares the query’s scaffold (green: “a girl in a red shirt”) but differs on the failure-causing residual (red: wrong swing type). RePair minimally edits only the residual to produce pedit , which carries the same semantics as the ground truth pgt . Bottom: Before repair, pfp falls in the FP zone between the ideal boundary and the model’s learned boundary. The repair signal pulls pedit toward pgt and pushes pfp away, shifting the model boundary to eliminate the FP zone.
Figure 2: RePair pipeline overview. Validity (Mining & Validation) : A retriever mines top- Kmine false positives ( pIfp / pTfp ) in both T2I and I2T directions; a pre-edit verifier filters annotation noise and benign mismatches, ensuring only genuine failures serve as editing seeds. Minimality (Counterfactual Editing) : An instruction generator produces a minimal edit instruction τedit conditioned on (q,pfp) ; a modality-specific editor applies τedit to pfp , and post-edit selection picks the candidate closest to pfp , yielding a hard positive pedit (edited) and a hard negative pfp (original). The resulting pairs are organized into local contrastive grids for training ( Locality ; see Figure 3 ).
Figure 3: The 3×3 local confusion grid. Diagonal entries are positive pairs; off-diagonal entries serve as hard negatives.
Method
Samples (k)
Aug. Type
Flickr30K
COCO30K
I+
I−
T+
T−
I2T
T2I
I2T
T2I
R@1
R@5
R@1
R@5
R@1
R@5
R@1
R@5
Vanilla
–
87.87
98.22
74.60
92.87
60.54
83.86
44.15
71.97
NegCLIP
205
✓
88.07
98.13
74.38
92.78
61.06
84.00
44.37
72.29
SugarCrepe
145
✓
88.95
98.62
74.64
92.98
61.92
85.02
45.09
72.94
LaCLIP
145
✓
86.69
97.83
74.46
92.60
60.96
84.30
44.99
72.70
Table 1: Retrieval performance on Image-to-Text (I2T) and Text-to-Image (T2I) on Flickr30K and COCO30K. The best and second-best results are marked in bold and underlined , respectively. Augmentation modality and polarity are marked by I+ / I− (image hard positive/negative) and T+ / T− (text hard positive/negative).
Category
Ablation setting
R@1I2T
R@1T2I
RePair
-
62.64
46.11
Failure Cond. ( Val. )
w/o Failure
60.54_{\text{{\color[rgb]{0.72,0,0}-2.10}}}
43.69_{\text{{\color[rgb]{0.72,0,0}-2.42}}}
Repair Op. ( Min. + Loc. )
w/o Repair (FP-as-HN)
60.83_{\text{{\color[rgb]{0.72,0,0}-1.81}}}
44.20_{\text{{\color[rgb]{0.72,0,0}-1.91}}}
Seed Valid. ( Val. )
w/o QC
61.98_{\text{{\color[rgb]{0.72,0,0}-0.66}}}
44.87_{\text{{\color[rgb]{0.72,0,0}-1.24}}}
Min.-Change ( Min. )
w/o PQC
62.12_{\text{{\color[rgb]{0.72,0,0}-0.52}}}
45.33_{\text{{\color[rgb]{0.72,0,0}-0.78}}}
Local Training ( Loc. )
Full Matrix
61.42_{\text{{\color[rgb]{0.72,0,0}-1.22}}}
44.36_{\text{{\color[rgb]{0.72,0,0}-1.75}}}
Table 2: Ablation and sensitivity analysis on COCO30K. Top: core design ablations (one design choice toggled at a time), each defined where it is discussed in Section 4.3 . Bottom: external component sensitivity. Subscripts show Δ R@1 vs. the full method.
Figure 4: Case study of RePair’s synthesis on T2I (left) and I2T (right). In T2I, the query q ( “playing chess alone” ) retrieves a near-miss image Ifp depicting multiple players; RePair edits only the failure-causing residual to produce Iedit , which matches the query and serves as a hard positive alongside Igt , while the unedited Ifp becomes the paired hard negative. Symmetrically in I2T, a false-positive caption Tfp sharing the query’s scaffold ( “people watch” ) but with a mismatched residual ( “skateboard” ) is corrected to a faithful description Tedit . Igt and Tgt denote the ground truth.
Method
Accuracy
P@1
VG-Attr
VG-Rel
COCO-Ord
Flk-Ord
Vanilla
62.6
51.6
25.4
31.1
NegCLIP
62.0
49.3
26.7
31.5
SugarCrepe
62.1
51.3
26.6
32.1
LaCLIP
62.8
49.7
27.1
32.0
SimCLR
62.5
53.7
27.0
32.8
Table 3: Compositional evaluation on ARO Yuksekgonul et al. (2023) . All values in %; best and second-best in bold and underlined .
Appendix figures & tables21 assets
Supplementary material from the paper’s appendix.
Appendix
Dataset
# Train
# Val
# Test
Caps/Img
Resolution
Flickr30K
29,000
1,014
1,000
5
2242
COCO30K
29,000
5,000
5,000
5
2242
Appendix
Table 4: Summary of dataset statistics and preprocessing details.
Hyperparameter
Value / Search Range
Optimization
Optimizer
AdamW
Learning Rate
{1e-5, 5e-6, 2e-6, 1e-6}
Weight Decay
0.1
LR Scheduler
Cosine Annealing
Warmup Ratio
0.1
Appendix
Table 5: Hyperparameter Settings and Grid Search Ranges.
Symbol
Meaning
D={(Ii,Ti)}i=1N
Paired image–text dataset
I,T
An image / a text (generic)
zI(I),zT(T)
ℓ2 -normalized embeddings
s(I,T)=zI(I)⊤zT(T)
Cosine similarity
ℓ(I,T)=αs(I,T)
Training/retrieval logit
α (or τ=1/α )
Logit scale (or temperature)
Appendix
Table 6: Notation used in failure-driven counterfactual synthesis and 3×3 grid training.
Method
Samples (k)
Aug. Type
I2T
T2I
I+
I−
T+
T−
R@1
R@5
R@10
MRR
R@1
R@5
R@10
MRR
Vanilla
–
87.87
98.22
99.30
0.9247
74.60
92.87
96.21
0.8262
NegCLIP
205
✓
88.07
98.13
99.51
0.9235
74.38
92.78
96.19
0.8264
SugarCrepe
145
✓
88.95
98.62
99.51
0.9273
74.64
92.98
96.25
0.8284
LaCLIP
145
✓
86.69
97.83
99.21
0.9157
74.46
92.60
96.13
0.8257
SimCLR
145
✓
88.26
98.32
99.41
0.9245
74.30
92.78
96.11
0.8258
Appendix
Table 7: Full retrieval performance on Image-to-Text (I2T) and Text-to-Image (T2I) on Flickr30K . The best and second-best results are marked in bold and underlined , respectively. Augmentation modality and polarity are marked by I+ / I− (image hard positive/negative) and T+ / T− (text hard positive/negative). Combined baseline abbreviations: La = LaCLIP, SC = SugarCrepe, CF = COCO-CF, AL = ALiA.
Method
Samples (k)
Aug. Type
I2T
T2I
I+
I−
T+
T−
R@1
R@5
R@10
MRR
R@1
R@5
R@10
MRR
Vanilla
–
60.54
83.86
90.94
0.7070
44.15
71.97
81.74
0.5679
NegCLIP
205
✓
61.06
84.00
91.24
0.7134
44.37
72.29
81.95
0.5710
SugarCrepe
145
✓
61.92
85.02
91.14
0.7167
45.09
72.94
82.69
0.5778
LaCLIP
145
✓
60.96
84.30
91.00
0.7267
44.99
72.70
82.32
0.5778
SimCLR
145
✓
61.34
84.14
90.86
0.7190
45.13
72.77
82.24
0.5775
Appendix
Table 8: Full retrieval performance on Image-to-Text (I2T) and Text-to-Image (T2I) on COCO30K . The best and second-best results are marked in bold and underlined , respectively. Augmentation modality and polarity are marked by I+ / I− (image hard positive/negative) and T+ / T− (text hard positive/negative). Combined baseline abbreviations: La = LaCLIP, SC = SugarCrepe, CF = COCO-CF, AL = ALiA.
Figure 5: A representative 3×3 grid from Flickr30K centered on an outdoor sports scenario. The anchor pair (Ia,Ta) depicts “a boy and a girl play cricket,” but the model retrieves a hard-negative text Thn describing “two kids play soccer.” RePair synthesizes a corrected counterpart T+(Ihn) (“Two boys play cricket”) and retrieves the matched image I+(Thn) , creating a grid that forces the model to distinguish between fine-grained activities (cricket vs. soccer) and subjects (boy/girl vs. two boys).
Figure 6: A 3×3 grid from COCO30K capturing a kitchen scene. The anchor (Ia,Ta) features a “grey counter top” with “red stools,” while the hard negative Thn describes a “modern kitchen” with “red cabinets” and “stainless appliances.” The synthesized positive T+(Ihn) corrects the attributes to match the hard-negative image Ihn (“wooden counter top,” “black chairs”), ensuring that the model learns to disentangle compositional attributes like color and material within the shared kitchen domain.
Figure 7: Distribution of synthesized and mined samples for COCO30K. The four panels show: (Top-Left) Number of hard-positive captions generated per image anchor; (Top-Right) Number of hard-positive images generated per caption anchor; (Bottom-Left) Distribution of hard-negative images linked to each image anchor; (Bottom-Right) Distribution of hard-negative captions linked to each caption anchor. Note the long-tail distribution in hard negatives (log scale) versus the controlled sparsity of hard positives.
Figure 8: Distribution of synthesized and mined samples for Flickr30K. The layout follows Figure 7 . While the overall patterns are similar to COCO30K, the tail of the hard-negative distribution is shorter (max ∼ 250 vs. ∼ 400).
Figure 9: Effect of synthetic sample budget on Recall@1 for Flickr30K. (a) Image-to-Text and (b) Text-to-Image retrieval across 20k–100k synthesized samples. RePair consistently outperforms all baselines at every budget level, while error-agnostic methods saturate or regress as sample count grows.
Quality Control
Instruction Generation
Editing
Total
Dataset
Dir
In
Out
Tot
In
Out
Tot
In
Out
Tot
In
Out
Tot
Flickr30K
I2T
707.3
80.3
787.6
981.4
61.7
1,043.1
597.9
45.9
643.8
2,286.6
187.9
2,474.5
T2I
1,064.6
101.0
1,165.6
279.0
25.8
304.8
-
-
-
1,343.6
126.8
1,470.4
Combined
1,771.9
181.3
1,953.2
1,260.3
87.5
1,347.8
597.9
45.9
643.8
3,630.2
314.7
3,944.9
COCO30K
I2T
701.9
69.5
771.4
706.7
31.1
737.8
382.2
25.2
407.4
1,790.8
125.8
1,916.6
T2I
1,063.3
95.3
1,158.6
214.9
20.6
235.5
-
-
-
1,278.2
115.9
1,394.1
Appendix
Table 9: Token usage (K tokens) by dataset, direction, and stage. “Total” sums over Stage 1–3; “Combined” sums I2T and T2I.
Method
QC?
Samples (K)
LLM (K)
Image (K)
LLM ratio
Image ratio
NegCLIP
No
205
0
0
0 ×
0 ×
LaCLIP
No
145
145
0
0.41 ×
0 ×
TripletCLIP
No
145
145
145
0.41 ×
0.81 ×
SugarCrepe
Yes
145
435–1,305
0
1.23–3.68 ×
0 ×
ALiA
Yes
145
145
435
0.41 ×
2.42 ×
COCO-CF
Yes
145
435
435
1.23 ×
2.42 ×
Appendix
Table 10: Unified generation overhead comparison. “LLM (K)” and “Image (K)” denote total LLM API calls and image-generation invocations in thousands. Baselines with native QC are aligned at 3-candidates-to-1-selected to match RePair’s M=3 protocol. Ratios are relative to RePair (Full).
Variant
Samples
LLM/sample
Image/sample
Total LLM / Image
RePair-I2T
47K
5
0
235K / 0
RePair-T2I
60K
2
3
120K / 180K
Full
107K
—
—
355K / 180K
Appendix
Table 11: RePair per-sample call breakdown.
Dataset
Direction
Criterion 1 (%)
Criterion 2 (%)
Flickr30K
T2I
32.39
67.61
Flickr30K
I2T
57.61
42.39
COCO30K
T2I
25.85
74.15
COCO30K
I2T
27.93
72.07
Appendix
Table 12: Distribution of QC-filtered samples by criterion. Each row sums to 100% of total filtered samples for that setting.
Metric
Value
Precision
90.2%
Recall
83.9%
Accuracy
82.0%
Cohen’s κ
0.58
Appendix
Table 13: Agreement between QC decisions and human annotators ( N=400 , COCO30K).
Criterion
Overall
I2T
T2I
Original FP genuinely wrong
99.5
99.0
100.0
Edited sample matches query
95.8
96.5
95.0
Scaffold preserved
97.0
99.3
94.8
Edit is minimal
93.3
96.8
89.8
Valid hard contrast
92.5
95.5
89.5
Appendix
Table 14: Verification of retained post-edit pairs by human annotators (%; N=800 , 200 per dataset × direction split).
COCO30K
Flickr30K
I2T (text edit)
98.5
92.5
T2I (image edit)
92.0
87.0
Appendix
Table 15: Valid hard-contrast rate (%) by dataset and direction.
Error Type
I2T (%)
T2I (%)
Object Error
44.0
48.3
Hallucination
36.9
0.5
Action Error
34.1
26.6
Attribute Error
33.7
10.7
Count Error
18.8
12.4
Relation Error
12.1
15.8
Appendix
Table 16: Error type distribution on COCO30K (multi-label; percentages sum to > 100%). Column maxima and the I2T Hallucination rate are shown in bold .
Error Type
Mean
Std
Median
Attribute Error
0.912
0.063
0.932
Relation Error
0.882
0.086
0.904
Action Error
0.875
0.093
0.901
Count Error
0.873
0.100
0.899
Object Error
0.860
0.104
0.891
Appendix
Table 17: Editing quality by error type (COCO30K T2I, cosine similarity between original FP and edited counterpart). Hallucination is omitted due to insufficient T2I samples ( n=3 ).
Failure Mode
COCO30K
Flickr30K
Total
I2T
T2I
I2T
T2I
Semantic mismatch
2
8
12
12
34
Scaffold drift
0
8
0
13
21
Artifact
0
0
0
1
1
Ambiguous FP
1
0
3
0
4
Total
3
16
15
26
60
Appendix
Table 18: Editing failure modes among the 60 shortfall records from the post-edit verification ( N=800 ).
Iteration
NI2T
NT2I
R@1I2T
R@1T2I
Iter0
47.0k
60.0k
62.64
46.11
Iter1
58.1k+11.1k
81.7k+21.7k
63.02_{\text{{\color[rgb]{0,0.88,0}+0.38}}}
46.32_{\text{{\color[rgb]{0,0.88,0}+0.21}}}
Iter2
62.3k+4.2k
92.3k+10.6k
63.11_{\text{{\color[rgb]{0,0.88,0}+0.09}}}
46.40_{\text{{\color[rgb]{0,0.88,0}+0.08}}}
Appendix
Table 19: Multi-round synthesis: Recall@1 evolution on I2T and T2I retrieval.
When a text description is extended with an additional detail, image-text similarity should drop if that detail is wrong. We show that CLIP-style dual encoders often violate this intuition: appending a plausible but incorrect object or relation to an otherwise correct description can increase the similarity score. We call such cases half-truths. On COCO, CLIP prefers the correct shorter description only 40.6% of the time, and performance drops to 32.9% when the added detail is a relation. We trace this vulnerability to weak supervision on caption parts: contrastive training aligns full sentences but does not explicitly enforce that individual entities and relations are grounded. We propose CS-CLIP (Component-Supervised CLIP), which decomposes captions into entity and relation units, constructs a minimally edited foil for each unit, and fine-tunes the model to score the correct unit above its foil while preserving standard dual-encoder inference. CS-CLIP raises half-truth accuracy to 69.3% and improves average performance on established compositional benchmarks by 5.7 points, suggesting that reducing half-truth errors aligns with broader gains in compositional understanding. Code is publicly available at: https://github.com/kargibora/CS-CLIP
Bora Kargi, Arnas Uselis, Seong Joon Oh
University of Tübingen, Tübingen AI Center · Konrad Zuse School of Excellence in Learning and Intelligent Systems (ELIZA)
Synthetic hard negatives generated in the representation space have proven effective for unimodal self-supervised learning, but transferring this idea to vision-language pretraining is not straightforward. We analyze six representation-space synthesis strategies and identify two failure modes in their transfer to vision-language pretraining: cross-modal constructions that produce overly easy negatives or pull them toward the query, and intra-modal constructions that incorporate the matched positive. We also observe logit-scale saturation when training with synthetic hard negatives and a learnable temperature, and find that fixing the temperature improves downstream performance. Using this geometric analysis we propose SNAP, which generates intra-modal hard negatives that never involve the positive from either modality, avoiding both failure modes entirely. SNAP is model-agnostic, requires no external generative models, and adds less than 10% training time overhead. Evaluated on top of CLIP and FLIP across multiple architectures and datasets, SNAP delivers consistent improvements on zero-shot retrieval, zero-shot classification, and linear probe evaluation.
Nikos Giakoumoglou, Paschalis Giakoumoglou, Andreas Floros +2
Imperial College London, London, UK · Centre for Research and Technology Hellas, Thessaloniki, Greece
Language models increasingly answer questions by consulting retrieved documents rather than memory alone, a design now common in search assistants and enterprise knowledge tools. Grounding a model in retrieved text reduces unsupported statements but does not eliminate them, and a reader cannot tell a grounded sentence from an invented one. Most research on this problem stops at detection, yet flagging a faulty answer changes nothing for the person reading it, and little is known about which action should follow. Using RAGTruth, a benchmark whose unsupported passages are annotated by hand, we split each flagged answer into individual factual claims, check each against the retrieved source, and compare leaving the answer untouched with three repair strategies of increasing richness: deleting an unsupported claim, replacing it with source text, and rewriting it. Three language models from different families judge the 916 repaired answers. Every strategy reduces the proportion of answers judged to contain unsupported content, and all three judges agree on the ordering. Deletion achieves the largest reduction while retaining least of the original answer, at 64.3% of the text, whereas rewriting retains 80.1% and reduces least. Repair is not confined to faulty answers: 83.5% of answers annotated clean are edited too. The strategies occupy different points on a grounding preservation trade-off rather than forming a quality ranking, and choosing between them needs evidence about answer usefulness that automatic metrics cannot supply.
Sai Krishna Reddy Mulakkayala, Niki van Stein, Aske Plaat