# RETAIN: Online Visual Query Localisation with Bounded Object-Level Memory

> RETAIN condenses streaming video into object slots and answers visual queries from each object's latest stored sighting. On Ego4D VQ2D validation, its spatio-temporal AP at 0.25 IoU is 0.44 with 2,048 slots, 5% relatively above EAGLE, while storage remains fixed.

- arXiv: https://arxiv.org/abs/2612.00920
- Authors: Sparsh Rastogi, Toan Nguyen, Chinmaya Panigrahy, Jatin Bedi, Flora D. Salim
- Published: 2026-12-02
- Topic: Vision
- Visual carousel: https://instaxiv.com/p/2612.00920
- Explanation by InstaXiv, a secondary educational summary. Cite the original paper for exact results. InstaXiv is not affiliated with or endorsed by arXiv or Cornell University.

## Can a fixed memory beat methods that search the whole video?

**0.44** stAP25 on VQ2D; EAGLE scored 0.42

## A query asks for the latest past sighting

**Offline VQL:** VQL takes an object crop and query time, then asks where that object appeared most recently beforehand. Offline methods retain video or per-frame features and search again.

**RETAIN:** RETAIN processes frames before the query is known, merging sightings into bounded object slots. Later queries read those slots alone.

The design hinge is what to preserve when frames cannot be revisited.

## How each sighting enters memory

1. **Sample and encode**: At 2 frames per second, a region encoder turns each written frame into object-level tokens.
2. **Merge repeats**: A token updates its nearest slot only when similarity clears a threshold, refreshing appearance and last-seen time.
3. **Make room**: A token below threshold starts a slot; at capacity, the least recently updated slot is evicted.
4. **Complete the track**: A tracker fills in each completed observation from a 20-second rolling buffer; a few crops persist after those frames expire.

## Three parts of RETAIN

![Figure 2](https://cdn.instaxiv.com/figures/2612.00920/figure2.webp)

Read left to right: the online write condenses observations into object slots; bounded memory sits in the middle, and query-time read retrieves and refines a response track. (Figure 2)

## What happens when the query arrives

1. **Retrieve by appearance**: The query crop uses the slot encoder; cosine similarity ranks candidates, and temporal suppression drops nearby duplicate observations.
2. **Re-rank by time**: It reranks the ten candidates using recency, update frequency, position and relationships, passing the top three onward.
3. **Verify and refine**: Stored crops help distinguish lookalikes; a chooser selects one candidate, then a refinement head adjusts its boxes into the latest pre-query track.

## The primary score rises, but box recovery trails

| Method | tAP25 | stAP25 | Success (%) | Recovery (%) |
| --- | --- | --- | --- | --- |
| EAGLE*† | 0.47 | 0.42 | 61.3 | 52.1 |
| **RETAIN K=2048 (+5% rel. stAP25)** | **0.61** | **0.44** | **62.5** | **49.8** |

_Ego4D VQ2D validation, 4,507 queries; AP@.25, success at stIoU .05, recovery at box IoU .5. Results table; *prior report, †extra data._

## Object slots beat frame memories at equal storage

| Method | stAP25 | Success (%) |
| --- | --- | --- |
| Frames, most recent | 0.290 | 41.6 |
| Frames, evenly spaced | 0.131 | 26.8 |
| **RETAIN object slots (+0.151 stAP25)** | **0.441** | **62.5** |

_Matched storage, same read components; 4,507 Ego4D VQ2D validation queries. Source: object-level versus frame-level memory ablation._

## The memory often has the object; retrieval still errs

**Retained:** In a 100-clip validation sample, the queried object occupied a memory slot at query time for 88.8% of queries.

**Selection failures:** Across 4,507 queries, 15.7% are wrong-candidate selections; 5.6% have no matching object among the ten slots read.

Wrong-candidate selection is the largest named failure class here.

## Storage is fixed; query time includes active tracking

| Method | 1h storage (GB) | Median query (s) | Mean query (s) |
| --- | --- | --- | --- |
| VQLoC | 7.5 | 50.8 | 55.5 |
| PRVQL | 7.5 | 41.3 | 47.0 |
| RELOCATE | 382 | 97.5 | 200 |
| **RETAIN K=2048 (10× faster avg)** | **0.37*** | **0.19** | **≈4.5†** |

_VQ2D validation efficiency table, rerun baselines; *includes the 20-s buffer, storage fixed; †mean includes candidate tracking on 29% of queries._

## Fixed memory does not yet mean real-time use

- **Tracking throughput**: With SAM 3, tracking every observation costs about 930 compute-seconds per second of video; limiting propagation to 2-fps writes still costs about 170.
- **Very small objects**: For objects at most 0.39% of frame area, success is 36.8%, below RELOCATE's 43.9%; sparse prompt coverage may explain the gap.
- **Validation-only evidence**: Only 2D VQL is evaluated, on Ego4D's validation split; test labels were not public and the server no longer accepted submissions.

Best used when: Consider it where bounded storage matters and the tracking-throughput bottleneck can be handled separately.

## Key takeaways

- Object-level merging lets a fixed budget cover distinct objects better than recent or evenly spaced frame storage.
- For visual-query memory, preserve each object's latest sighting and a few crops to verify ambiguous candidates at query time.
- The open engineering problem is tracking those observations fast enough for genuinely real-time, on-device video.

## Links

- arXiv: https://arxiv.org/abs/2612.00920
- PDF: https://arxiv.org/pdf/2612.00920
- Code: https://github.com/SparshRastogi/RETAIN
- Project page: https://sparshrastogi.github.io/RETAIN

## Citation

```bibtex
@article{rastogi2026retain,
  title   = {RETAIN: Online Visual Query Localisation with Bounded Object-Level Memory},
  author  = {Rastogi, Sparsh and Nguyen, Toan and Panigrahy, Chinmaya and Bedi, Jatin and Salim, Flora D.},
  journal = {arXiv preprint arXiv:2612.00920},
  year    = {2026},
  url     = {https://arxiv.org/abs/2612.00920}
}
```
