TL;DR
LLM agents often drown in the verbose, noisy text returned by tools like web search, leading to high costs and "attention dilution." Coca-Cola (Context Compression via Continuous Latent Tokens) solves this by compressing tool observations into a few high-dimensional vectors that are injected directly into the agent's embedding space. By training the model to preserve the agent's next-action distribution rather than reconstructing the original text, Coca-Cola slashes token usage by up to 89% and speeds up runtime by over 50% while actually improving task accuracy.
What Problem Does This Paper Address?
When an LLM agent uses a tool—like a search engine—it typically appends the entire raw output to its context window. In multi-step tasks, this leads to two major issues:
- Computational Overhead: Context grows exponentially. By the fourth step of a reasoning chain, tool observations can account for over 96% of the total tokens, as shown in Figure 1.
- Performance Degradation: Much of this text is "noise" (e.g., irrelevant race details when you only need a driver's name). This distracts the model, a phenomenon often called "attention dilution," which impairs reasoning quality.
Existing solutions like token pruning or text summarization are limited because they stay within the realm of discrete text. The authors argue that tools don't actually need to "speak" to agents in human-readable text; they just need to convey enough information for the agent to take the correct next action.
Methods
The authors propose a continuous latent context compression model called Coca-Cola. Instead of outputting a shorter string of words, it outputs a small set of continuous vectors (latent tokens).
The Architecture
- Context-Aware Encoder ($C_\theta$): A small language model that jointly processes the task instruction, the current reasoning trajectory, and the raw tool observation.
- Latent Adapter ($A_\phi$): A lightweight module that maps the encoder's hidden states into the specific input embedding space of the target agent.
- Latent Bottleneck: The raw observation (which might be thousands of tokens) is squeezed into a fixed number of latent tokens (e.g., 128).
Action-Preserving Training
The "secret sauce" is how the model is trained. Instead of training the compressor to reconstruct the original text (which would include all the noise), they use Action-Preserving Training. They align the next-action distribution of a "student" agent (receiving compressed latent tokens) with a "teacher" agent (receiving the full, raw text). By minimizing the KL divergence between these two distributions, the compressor learns to retain only the information critical for decision-making.
Datasets
The researchers evaluated Coca-Cola using web-search agents across four popular open-domain Question Answering (QA) benchmarks:
- Natural Questions (NQ) and TriviaQA: Focus on factual retrieval.
- 2WikiMultiHopQA and HotpotQA: Require complex, multi-step reasoning across multiple documents.
They tested these on two distinct model families: Qwen3.5 (35B and 4B) and GLM-4 (Flash and Z1-9B).
Key Insights and Ideas
- Latent Capacity: Theoretically, continuous vectors have a much higher "codebook capacity" than discrete text tokens. A single latent token can encode information jointly across multiple dimensions, making it far more efficient than a single word.
- Action-Sufficiency > Reconstruction: Traditional compression tries to save every detail. Coca-Cola realizes that if the agent's next action is "Search for birth year," the compressor doesn't need to remember the course length of the race the subject won—it only needs to remember the subject's name.
- Noise Filtering as a Feature: By aggressively compressing the input, the model effectively filters out distractions. This is why Coca-Cola often outperforms the "Vanilla" model that sees the full text; the agent can focus purely on the "signal."
Key Results
Coca-Cola demonstrated massive efficiency gains without sacrificing—and often improving—intelligence:
- Token Reduction: Total token consumption dropped by 70.01%–89.24%.
- Speedup: End-to-end runtime was reduced by 24.45%–55.97%.
- Accuracy Boost: Despite the heavy compression, task performance (Exact Match and F1) consistently improved. For example, on HotpotQA with the Qwen models, the F1 score more than doubled, jumping from 16.41% to 33.75%.
Figure 4 highlights a case study where the Vanilla model gets distracted by irrelevant "Mid-Century Modern" details, while Coca-Cola identifies the specific "Scandinavian design" evidence needed to answer correctly.
Limitations and Future Work
- Tool Specificity: The current study focuses heavily on web-search agents. While the architecture is general, it remains to be seen how well it adapts to tools with very different output structures, like SQL databases or code interpreters.
- Training Requirements: Coca-Cola requires a dedicated training phase to align the compressor with a specific target LLM. A "plug-and-play" version that works across any model without fine-tuning would be a significant next step.
- Fixed Token Budget: The model currently uses a fixed number of latent tokens. Future iterations might benefit from dynamic compression ratios based on the complexity of the tool output.
Summary updated