TL;DR
Compress & Cache (C&C) is a novel framework that uses the Large Language Model (LLM) within a vision-language model to compress massive amounts of visual data into just a few "summary tokens." By decoupling compression from generation and using a unique "double-forward pass" training strategy, C&C achieves 2x better compression than previous methods while simultaneously setting new state-of-the-art records for both image generation and retrieval.
The "Token Bloat" Problem
Large Vision Language Models (LVLMs) like LLaVA are incredibly capable, but they suffer from a significant "token bloat" problem. A single image can easily translate into 576 or more visual tokens, which quickly dwarfs the text of a user's question. This makes inference slow and memory-intensive, especially in Retrieval-Augmented Generation (RAG) settings where a model might need to "look" at dozens of images to find an answer.
Previous solutions tried to prune or condense these tokens "on-the-fly" during inference. However, doing this every time you ask a question is computationally expensive. Furthermore, most existing compression methods are "one-trick ponies"—they might help the model describe an image (generative tasks), but they make the model terrible at finding that image in a database (discriminative tasks).
As illustrated above, C&C shifts the heavy lifting of compression to an upfront, offline "indexing" stage, decoupling it from the query-dependent generation phase. This allows the model to cache summaries for highly efficient retrieval and generation later.
Methods: The Double-Forward Pass
The authors propose C&C to create a representation that is simultaneously suitable for generative and discriminative tasks, nearly lossless, and storage-efficient.
- The Double-Forward Pass: This is the core training innovation.
- Pass 1 (Compression): The LLM takes the raw image tokens and a "summarization" prompt. It acts as a bottleneck, squeezing the visual information into a tiny set of summary tokens.
- Pass 2 (Generation): The model then uses only those summary tokens (discarding the original image tokens) alongside the language instruction to generate an answer.
- Dual-Loss Training: To ensure the summary tokens are universally useful, the model is trained with two objectives:
- Autoregressive Loss ($\mathcal{L}_{AR}$): Applied after the second pass, this ensures the summary tokens contain enough detail to generate accurate text.
- Contrastive Loss ($\mathcal{L}_{disc}$): Applied after the first pass, this aligns the summary tokens with text descriptions, making them excellent for image-text retrieval.
- Stage-Specific Adapters: The researchers used Low-Rank Adaptation (LoRA) but with a twist: they used different adapter weights for the compression stage versus the generation stage. This allows the model to switch "mindsets" between being a data compressor and a conversationalist.
Datasets and Evaluation
The model was trained and evaluated on a massive breadth of benchmarks:
- Training: LLaVA-665k and CC3M for the base model; LLaVA-OneVision’s 3.2M sample collection for the high-resolution variant.
- Generative Evaluation: GQA, MMB, MME, POPE, SQA, TextVQA, VisWiz, and VQAv2.
- Retrieval/Discriminative Evaluation: Flickr30K, MS-COCO, and NoCaps.
- Compositionality: SugarCrepe (testing if the model understands complex relationships like "the cat is on the mat" vs "the mat is on the cat").
- Visual RAG: A suite of document-heavy tasks like ArxivQA and ChartQA.
Key Insights
- The LLM is a Great Summarizer of Itself: We already know LLMs are great at summarizing text. This paper proves they are equally adept at summarizing their own internal visual representations into a "latent shorthand" that they can understand later.
- Retrieval Helps Generation: One of the most surprising findings was that adding a contrastive loss (intended for retrieval) actually improved the model’s ability to generate text. Forcing the model to learn distinct, discriminative features makes its internal "summary" more robust.
- Disentanglement is Key: By separating the compression into an offline stage, the model can afford to be more "thoughtful" during the initial indexing, leading to much higher quality summaries than on-the-fly methods.
Key Results
- Superior Squeezing: C&C achieved a 2x higher compression rate (using only 16 tokens) compared to prior state-of-the-art methods without losing any performance on standard benchmarks.
- Retrieval Powerhouse: On image-text retrieval tasks, C&C outperformed models like EVA-CLIP, which are significantly larger and trained on billions more samples.
- Efficiency in RAG: In Visual RAG scenarios, C&C outperformed the specialized VisRAG retriever while being 3.8x smaller and using 24x fewer tokens than uncompressed baselines.
- Near-Lossless: Even when compressed down to just 32 tokens (from 576), the model's performance on benchmarks like MME remained nearly identical to the uncompressed LLaVA-1.5.
Limitations and Future Work
While C&C is highly efficient for stored data, it requires an upfront computational cost to create the index. If you are processing a "one-and-done" image that will never be queried again, the overhead of the first forward pass might not be worth it.
The authors also note that while stage-specific adapters help, they add complexity to the model architecture. Future work could explore ways to achieve this "dual-mindset" without switching weights, or scaling the approach to handle even higher-resolution images and video sequences where token bloat is even more severe.
Summary updated