TL;DR
While learned KV cache compression methods like "Cartridges" excel at summarizing long documents for LLMs, they suffer from a hidden flaw: off-context derailment. When a model is loaded with a compressed document cache, its ability to answer unrelated general knowledge questions or follow basic instructions often collapses. This paper introduces Cartridges++, which uses training-time data mixing and inference-time relevance routing to maintain high document fidelity without sacrificing the model's general intelligence.
What Problem Does This Paper Address?
Large Language Models (LLMs) are increasingly used to process massive documents, but storing the "Key-Value (KV) cache"—the model's internal memory of the text—is incredibly expensive, growing linearly with document length. To solve this, researchers developed Compressed KV (CKV) representations. A leading method, Cartridges, uses distillation to "bake" a long document into a tiny, fixed-size set of virtual KV tokens.
However, the authors discovered a major deployment hurdle. Standard evaluations only test "on-context" performance (e.g., "Based on this 100k-page medical record, what is the patient's history?"). They ignore "off-context" queries (e.g., "What is Saturn made of?"). It turns out that when a Cartridge is active, the LLM often becomes "derailed," hallucinating that the answer is in the document or simply losing its ability to follow instructions. As shown in Figure 1, a model might spuriously cite a patient record when asked about planetary science.
Methods
The authors propose two complementary strategies to create Cartridges++:
- Data Mixing ($C^D_{++}$): During the "self-study" phase where the Cartridge is trained to represent a document, the authors mix in a small fraction (e.g., 5%) of general-purpose instruction data. This forces the compressed representation to remain "neutral" and not interfere with the model's base capabilities.
- Relevance Routing ($C^R_{++}$): This is an inference-time fix. A lightweight classifier (like a k-nearest-neighbor or a simple linear layer) looks at the incoming query and decides if it actually needs the document. If the query is off-context, the router simply bypasses the Cartridge, letting the LLM act as if no document were loaded.
Datasets
The study employs a rigorous two-sided evaluation:
- Long-Context (On-Context): QASPER-16 (NLP papers), LongHealth-10 (medical records), MTOB (language translation), and QuALITY-20 (narratives).
- Capability Preservation (Off-Context): TinyMMLU and MMLU-Pro (general knowledge), and IFEval (instruction following).
- Training Data: The authors used the Dolci-Instruct-SFT mixture as a proxy for general-purpose queries during both the data-mixing training and the router calibration.
Key Insights and Ideas
- The Relevance Asymmetry: There is a fundamental trade-off. Heuristic "eviction" methods (which just drop less important tokens) preserve general capabilities well but struggle with document fidelity. Learned methods like Cartridges have the opposite problem: they are great at the document but terrible at everything else.
- Interference is not Hallucination: Even if a model gives the "correct" answer to an off-context question, it might still be "interfered" with. The authors used an LLM-as-a-judge to flag cases where the model spuriously attributed its knowledge to the irrelevant document.
- Pareto Improvement: Cartridges++ effectively shifts the Pareto frontier. By using routing or mixing, you can achieve the high compression and accuracy of learned methods while staying close to the "No Context" baseline for unrelated tasks.
Key Results
- Derailment is Real: Standard Cartridges can increase "context interference" (spurious document mentions) by over 20% compared to a full-context model (see Figure 3).
- Routing is Highly Effective: The $C^R_{++}$ router achieves over 90% accuracy in distinguishing between document-related and unrelated queries. This allows it to recover nearly all the model's original general knowledge performance.
- Data Mixing Sweet Spot: As shown in Figure 4, even a tiny amount of data mixing (1-5% $\gamma$ fraction) drastically reduces interference and improves off-context accuracy without significantly hurting the model's ability to reason over the long document.
Limitations and Future Work
The authors acknowledge a few trade-offs:
- Inference Overhead: The routing method requires a "re-prefill" step. If the router decides to use the Cartridge, the query must be processed again with the compressed cache loaded, adding a small latency penalty.
- Mixing Limits: While data mixing is "free" at inference time, very high mixing fractions eventually begin to degrade the specialized document performance.
- Future Directions: The authors suggest exploring adaptive relevance estimation and combining both mixing and routing to create even more robust long-context memories.
Summary updated