TowerBridge: Bridging the Dual-Encoder Modality Gap via Weight-Space Programming
Organizations: Department of Computer Science, Virginia Tech
Abstract
CLIP-style dual encoders map images and text through two separate towers into a shared embedding space, where the two modalities occupy distinct regions separated by a modality gap. Retrieval fails when wrong matches, or hard negatives, outrank the correct one, and the gap is the usual suspect. Yet removing it post hoc degrades retrieval on every CLIP checkpoint we test. We introduce a paired statistic that identifies directions where the two towers agree more on hard negatives than on matched pairs. Mildly attenuating these directions improves retrieval while largely preserving the gap. We arrive at this correction through weight-space programming: guided by the statistic, an LLM agent inspects both towers and writes closed-form weight edits without backpropagation. Free to edit any component, the agent improves COCO test retrieval on all 13 CLIP checkpoints and edits an output projection in 12 of the 13. We distill and refine its recurring correction into TowerBridge, a closed-form recipe motivated by a first-order analysis of the hard-negative margin. Computed in seconds from 25,000 labelled pairs, it requires no model-specific tuning and leaves the architecture and inference cost unchanged. TowerBridge improves COCO test retrieval by 16.8 RSUM and Flickr30k test retrieval by 6.6 on average across all 21 evaluated CLIP checkpoints, including 8 unseen by the agent, while limiting any drop in ImageNet zero-shot accuracy to 0.5 points. It also reduces hubness on all 21 checkpoints and improves retrieval on 4 of 5 dual encoders from other families.
Figures & tables
| COCO val | COCO | Flickr30k | SC add | |||||
| Checkpoint | 1R | 2R | Test | Val | Test | IN | 1R | 2R |
| L/14 MetaCLIP-fullCC | ||||||||
| H/14 LAION-2B | ||||||||
| B/32 LAION-2B | ||||||||
| B/32 DataComp-XL | ||||||||
| H/14 DFN-5B | ||||||||
| Variant | COCO val | Flickr30k val | IN | SC add | Guard |
|---|---|---|---|---|---|
| TowerBridge edit (default) | |||||
| One round | |||||
| Three rounds | |||||
| Subspace | |||||
| Subspace | |||||
| Image tower only |
| Method | Data | Flickr30k val | COCO val |
|---|---|---|---|
| TowerBridge edit | Pairs | ||
| Text-only variant | Pairs | ||
| KISSME-K [ 31 ] | Pairs | ||
| CSLS [ 9 ] | COCO | ||
| NNN [ 7 ] | COCO | ||
| QB-Norm [ 5 ] | COCO |
| Image text | Text image | |||||||
|---|---|---|---|---|---|---|---|---|
| Checkpoint | Method | R@1 | R@5 | R@10 | R@1 | R@5 | R@10 | RSUM |
| B/16 OpenAI | Zero-shot | |||||||
| TowerBridge | ||||||||
| L/14 DFN-2B | Zero-shot | |||||||
| TowerBridge | ||||||||
| B/32 LAION-2B (e16; fresh) | Zero-shot | |||||||
| COCO | Flickr30k | |||||
| Method | val | val | test | IN | Guard | Add |
| All 21 CLIP checkpoints | ||||||
| TowerBridge | 21/21 | |||||
| Fixed hinge | 21/21 | |||||
| Fixed InfoNCE | 21/21 | |||||
| The 15 checkpoints excluded from schedule selection | ||||||
| Metric change kept | COCO val | Flickr30k val | IN |
|---|---|---|---|
| All 21 CLIP checkpoints | |||
| Everywhere (hinge map) | |||
| Inside | |||
| Outside | |||
| Inside a random subspace | – | ||
| TowerBridge, for reference | |||
| RSICD | ROCOv2 | |||
| Edit | RSUM | Guard | RSUM | Guard |
| Before fallback | ||||
| TowerBridge, COCO-built | 21/21 | 21/21 | ||
| Hinge map, COCO-built | 21/21 | 21/21 | ||
| TowerBridge, in-domain | 21/21 | 20/21 | ||
| Hinge map, 50 steps | 2/21 | 8/21 | ||
| Test set | Zero-shot | TowerBridge | Hinge map | Diff. |
|---|---|---|---|---|
| CIFAR-100 | ||||
| EuroSAT | ||||
| GTSRB | ||||
| Caltech-101 | ||||
| DTD | ||||
| Oxford Pets |
| Arm | COCO val | Flickr30k val | SC add | IN | |
| 21 main-cohort CLIPs | |||||
| TowerBridge | [ , ] | ||||
| Constrained (CON 2 ) | [ , ] | ||||
| Four prospective checkpoints | |||||
| TowerBridge | [ , ] | ||||
| Constrained (CON 2 ) | [ , ] | ||||
| Model | Flickr30k val | Flickr30k test | IN | |
|---|---|---|---|---|
| EVA02-B/16 | [ , ] | |||
| MobileCLIP-B | [ , ] | |||
| CoCa ViT-B/32 | [ , ] | |||
| SigLIP B/16 | [ , ] | |||
| SigLIP2 B/16 † | ( ) | ( ) | ( ) | |
| COCO val | Flickr30k val | Flickr30k test | ImageNet | |||||
|---|---|---|---|---|---|---|---|---|
| Model | RSUM gain | RSUM gain | RSUM gain | Zero-shot (%) | Change | |||
| MetaCLIP 2 H/14 | [ , ] | [ , ] | [ , ] | |||||
| EVA02-E/14+ | [ , ] | [ , ] | [ , ] | |||||
| SigLIP2 So400m/14 | [ , ] | [ , ] | [ , ] | |||||
| PE Core L/14 | [ , ] | [ , ] | [ , ] | |||||
| Built from | COCO | Flickr30k | Web | IN | Guard |
|---|---|---|---|---|---|
| Before fallback | |||||
| Web, 5,000 pairs | 15/21 | ||||
| Web, 10,000 pairs | – | 18/21 | |||
| COCO, 25,000 pairs | 21/21 | ||||
| Deployed | |||||
| Web, 5,000 pairs | |||||
| Metric | Zero-shot | TowerBridge | Change | Improve | |
| Image text | |||||
| mAP@R | [ , ] | ||||
| R-Precision | [ , ] | ||||
| Recall@1 | [ , ] | ||||
| Text image | |||||
| mAP@R | [ , ] | ||||
| COCO val | Flickr30k val | IN | ||||
|---|---|---|---|---|---|---|
| Checkpoint | Orig. | New | Orig. | New | Orig. | New |
| B/16 OpenAI | ||||||
| L/14 DFN-2B | ||||||
| B/32 LAION-2B | ||||||
| 21 CLIPs, mean | ||||||
| Checkpoint | Built from | COCO val | Flickr30k val |
|---|---|---|---|
| B/16 OpenAI | COCO | ||
| Flickr30k | |||
| Mix | |||
| B/16 DataComp-XL | COCO | ||
| Flickr30k | |||
| Mix |
| Edit | Image skew | Caption skew | RSUM |
|---|---|---|---|
| Zero-shot | – | ||
| 10% shrink of the plane | |||
| Removal of the plane | |||
| 10% shrink of , one round | |||
| TowerBridge |
| Size | COCO val | Flickr30k val | IN | Guard |
|---|---|---|---|---|
| (TowerBridge) |
| Edit | COCO val | Flickr30k val | IN | Improve |
|---|---|---|---|---|
| One round | ||||
| TowerBridge | ||||
| Mean span | ||||
| Two rounds | ||||
| TowerBridge | ||||
| Mean span | ||||
| Edit | COCO val | Flickr30k val | Improve |
|---|---|---|---|
| Centering, cosine score | |||
| Per modality | |||
| Per modality, eval.-set means | |||
| Common mean | |||
| Mean shift, gap closed | |||
| Centering, inner-product score | |||
| Gap | Change after the edit (%) | |||
| Checkpoint | Zero-shot | Gap | Spread T I | Spread I T |
| B/16 DataComp-L | ||||
| B/16 DataComp-XL | ||||
| B/16 DFN-2B | ||||
| B/16 LAION-2B | ||||
| B/16 LAION-400M | ||||
| 21 CLIPs, COCO val | 21 CLIPs, Flickr30k val | 5 other families, COCO val | ||||
| Measure | Median | Better | Median | Better | Median | Better |
| Hubness ( ) | ||||||
| -occurrence skewness, images | ||||||
| -occurrence skewness, captions | ||||||
| Hub occurrence, images | ||||||
| Robin Hood index, images | ||||||
| Setting | COCO val | Flickr30k val | IN | Guard |
|---|---|---|---|---|
| TowerBridge, | 21/21 | |||
| TowerBridge, | 21/21 | |||
| TowerBridge, | 21/21 | |||
| TowerBridge, | 15/21 | |||
| TowerBridge, | 4/21 | |||
| TowerBridge, | 0/21 |
| Method | COCO val | Flickr30k val | IN | Add | All |
|---|---|---|---|---|---|
| B/16 OpenAI | |||||
| TowerBridge | |||||
| KISSME-K | |||||
| Fixed map | |||||
| Tuned map | |||||
| LoRA | |||||
| Method | Tuning | COCO val | Flickr30k val | IN | ||
|---|---|---|---|---|---|---|
| TowerBridge (closed form) | None | [ , ] | [ , ] | |||
| Learned map, both towers | Gradient | [ , ] | [ , ] | |||
| Learned map, text side only | Gradient | [ , ] | [ , ] | |||
| LoRA | Gradient | [ , ] | [ , ] | |||
| Full fine-tuning | Gradient | |||||
| Re-ranker | COCO bank | Flickr30k bank | ||
|---|---|---|---|---|
| CSLS | [ , ] | [ , ] | ||
| QB-Norm (DIS) | [ , ] | [ , ] | ||
| NNN | [ , ] | [ , ] | ||
| DN | [ , ] | [ , ] | ||
| Stage | Data or checkpoints | Role |
|---|---|---|
| Original agent sessions | 35k COCO training images for construction; another 5k for selection; COCO val and ImageNet 5k proxy for feedback | Choose and accept edits within each of 13 sessions; no Flickr30k or retrieval-test feedback |
| Recipe development | Six-checkpoint pilot; 18 checkpoints previously examined in one-round analyses | Choose the two-round schedule and strengths; the 18-model evaluation is on previously studied models |
| Frozen construction | 5k COCO training images, five captions each, with the same rule on every checkpoint | Compute each checkpoint’s map without a retrieval validation split |
| Deployment guard | Full ImageNet val, 50k labelled images and 80 prompts per class | Select two rounds, otherwise one round, otherwise zero-shot; the same set measures ImageNet retention |
| Final retrieval reporting | Sealed COCO test and Flickr30k test; correction maps fixed before evaluation | Measure retrieval gains; scores do not choose the deployed edit |
| Prospective transfer | Three checkpoints with revisions pinned before download | Evaluate the rule after development; these form a subset of the eight checkpoints without sessions |
| Correction | COCO val | Flickr30k val | Guard |
|---|---|---|---|
| One round, | |||
| Larger step, | |||
| Round two, fixed negatives | |||
| Round two, re-mined (TowerBridge) |
| Stage | B/16 | L/14 |
|---|---|---|
| Interpreter start and imports | ||
| Model loading | ||
| Construction data: read, decode, resize, tokenize | ||
| Construction: encode, both rounds, fold | ||
| Guard data: 50k images, 80k prompts | ||
| Guard encoding |
| Z | COCO test 5k | Flickr30k | |||||
|---|---|---|---|---|---|---|---|
| Checkpoint | COCO | A Z | R Z | A R | A Z | IN | Audit |
| B/32 OpenAI | Caveat | ||||||
| B/16 DataComp-L | Valid | ||||||
| B/16 OpenAI | ∘ | Valid | |||||
| L/14 OpenAI | Valid | ||||||
| B/16 LAION-400M | Valid | ||||||
| Checkpoint | Arm / contrast | Flickr30k val | COCO val | Flickr30k test | |||
|---|---|---|---|---|---|---|---|
| B/16 OpenAI | FULL | ||||||
| NOW | |||||||
| NOD | |||||||
| FULL NOW | [ , ] | [ , ] | [ , ] | ||||
| FULL NOD | [ , ] | [ , ] | [ , ] | ||||
| L/14 DFN-2B | FULL | ||||||
| Checkpoint | DEEP Z | DEEP+TB TB | In TB’s subspace | ||
|---|---|---|---|---|---|
| B/16 OpenAI ∘ | [ , ] | [ , ] | |||
| B/32 OpenAI | [ , ] | [ , ] | |||
| L/14 OpenAI | [ , ] | [ , ] | |||
| B/16 LAION-2B | [ , ] | [ , ] | |||
| L/14 DFN-2B | [ , ] | [ , ] | |||
| B/32 LAION-2B | [ , ] | [ , ] | |||
| Image text | Text image | ||||||
| Checkpoint | Z | R@1 | R@5 | R@10 | R@1 | R@5 | R@10 |
| B/16 DataComp-L | |||||||
| B/16 DataComp-XL | |||||||
| B/16 DFN-2B | |||||||
| B/16 LAION-2B | |||||||
| B/16 LAION-400M | |||||||
| Quantity | Data set | Checkpoints | Estimate, 95% CI | |
| TowerBridge edit | ||||
| RSUM change, mean | COCO val | 21 CLIPs | [ , ] | |
| Accuracy change | SugarCrepe overall | 21 CLIPs | [ , ] | |
| Accuracy change | SugarCrepe add | 21 CLIPs | [ , ] | |
| The TowerBridge edit on the three fresh checkpoints | ||||
| RSUM change | Flickr30k val | B/32 LAION-2B (e16) | [ , ] | |
| Group or cohort | Checkpoints | Used in | |
|---|---|---|---|
| S: with agent sessions | 13 | B/32 OpenAI; B/16 OpenAI, LAION-400M, LAION-2B, DataComp-L, DataComp-XL, DFN-2B, MetaCLIP-400M, MetaCLIP-fullCC b ; L/14 OpenAI, LAION-2B, DataComp-XL, DFN-2B | Table S26 , Fig. 3 , Secs. D.1 , D.6 , D.9 and E |
| U: without sessions | 5 | L/14 MetaCLIP-fullCC b , H/14 LAION-2B, B/32 LAION-2B, B/32 DataComp-XL, H/14 DFN-5B | Table 1 |
| F: fresh | 3 | B/32 LAION-2B (e16), L/14 CommonPool-XL (LAION filter) a , H/14 MetaCLIP-2.5B b | Table 1 ; chosen before download |
| A: additional | 4 | B/32 MetaCLIP-fullCC b , L/14 CommonPool-XL a , g/14 LAION-2B a , ConvNeXt-Base-W LAION-2B | Only in the cohorts of 24, 25 and 30 |
| B: additional | 2 | B/16 CommonPool-L (CLIP filter), bigG/14 LAION-2B | Only in the cohort of 24 |
| C: constrained variant | 4 | B/32 MetaCLIP-400M, L/14 LAION-400M, L/14 CommonPool-XL (CLIP filter) a , g/14 LAION-2B a | Table S6 |
| Checkpoint | Astra’s patch zero-shot | TowerBridge zero-shot | TowerBridge Astra’s patch | |||
| B/32 OpenAI | [ , ] | [ , ] | [ , ] | |||
| B/16 OpenAI | [ , ] | [ , ] | [ , ] | |||
| L/14 OpenAI | [ , ] | [ , ] | [ , ] | |||
| B/16 LAION-400M | [ , ] | [ , ] | [ , ] | |||
| B/16 LAION-2B | [ , ] | [ , ] | [ , ] | |||
| B/16 DataComp-L | [ , ] | [ , ] | [ , ] | |||
Cross-Modal Retrieval
Cross-modal retrieval matches queries and items across different data types, such as text, images, video, audio, and sensor signals.
See all 205 papers