Papers
arxiv:2611.06500

Tools Need Not Speak in Text: Latent Context Compression for Agents

Published on Nov 4
· Submitted by
Yt Liu
on Nov 6
Authors:
,
,
,

Abstract

A continuous latent context compression model for LLM agents compresses tool observations into latent tokens and uses action-preserving training to reduce token consumption and runtime while improving task performance.

Large language model (LLM) agents typically append raw tool outputs to their context. Over multi-step interactions, long and noisy observations incur substantial context overhead and dilute the agent's attention to task-relevant information. Existing token pruning and summarization methods remain constrained by discrete text representations, limiting the achievable compression ratios. In this work, we challenge the prevailing assumption that agents must consume tool observations as explicit text tokens. To this end, we propose Coca-Cola, a continuous latent context compression model for LLM agents. Coca-Cola compresses tool observations into latent tokens and embeds them into the input embedding space of the agent. We further introduce Action-Preserving Training, which aligns the agent's next-action distributions under full and compressed observations. This trains the compression model to learn action-sufficient latent tokens that retain decision-critical information. Experiments with web-search agents on four QA benchmarks and two model families show that Coca-Cola reduces the agent's token consumption by 70.01%-89.24% and end-to-end runtime by 24.45%-55.97%, while consistently improving task performance. These results suggest that Coca-Cola offers a promising approach for context compression in agents. Our code is available at https://github.com/THU-Agent/Coca-cola.

Community

Paper author Paper submitter

We introduce Coca-Cola (Context Compression via Continuous Latent Tokens), a method that lets LLM agents consume tool observations as compact latent representations instead of lengthy text.

Rather than reconstructing the original tool output, Coca-Cola learns to preserve the information that matters for the agent’s next decision. Our Action-Preserving Training aligns next-action distributions under full and compressed observations, while keeping the target agent frozen.

Across four web-search QA benchmarks—Natural Questions, TriviaQA, 2WikiMultiHopQA, and HotpotQA—and two model families (Qwen and GLM), Coca-Cola achieves:

  • 70.01%–89.24% lower total agent token consumption
  • 24.45%–55.97% shorter end-to-end runtime
  • Higher answer EM and F1 than the uncompressed agent in every evaluated setting

The key idea: tool observations need to support the agent’s decisions; they do not have to remain readable text.

We welcome feedback and discussion, especially on extending latent tool observations to other agent workflows!

Okay, 70-89% fewer tokens while the answers get better is the part that stopped me. I like that the compressor is trained to keep what the next action needs instead of rebuilding the text. Does it carry over to other tools, like code output or API responses, beyond web search?

This is an automated message from the Librarian Bot. I found the following papers similar to this paper.

The following papers were recommended by the Semantic Scholar API

Please give a thumbs up to this comment if you found it helpful!

If you want recommendations for any Paper on Hugging Face checkout this Space

You can directly ask Librarian Bot for paper recommendations by tagging it in a comment: @librarian-bot recommend

The failure mode I'd hunt first is verbatim recall: if the only correct next action is echoing a token straight out of the tool output — request IDs for a retry, the exact field name from a 422, a file path from a stack trace — does the latent keep it byte-exact or just its gist? My guess is gist, and that's fine for 90% of steps and fatal for the 10% where the whole task is transcription. Second thing that bites in prod: a latent observation is welded to the checkpoint that produced it, so my logs stop being grep-able and I can't replay yesterday's trajectory after a model upgrade. I'd want the raw observation parked on a side channel with "show me the tool output" as a first-class tool call, so the agent can rehydrate the exact bytes when it needs them and humans can still read the transcript at 2am. Curious whether compressed and raw can coexist in the same context without the agent drifting toward whichever is easier to attend to.

·

On verbatim recall: Coca-Cola’s training objective (Eq. 11) is purely action-distribution alignment — KL divergence + cross-entropy on the next action, with zero reconstruction loss. It’s explicitly designed to discard anything that doesn’t shift the next-token distribution. That works for their QA benchmarks where the answer is a named entity repeated across passages, but for your example (request IDs, exact field names from a 422, stack trace paths) the exact token sequence is the action. The theoretical codebook capacity argument (Eq. 5 vs 6) doesn’t help either — capacity is a ceiling on what the encoder could represent, not what the loss function teaches it to retain. Coordinates encoding verbatim strings that don’t move action probabilities get zero gradient.

On observability / replay: Not addressed at all. The latent tokens are floats in a specific agent’s embedding space, produced by a specific encoder + adapter checkpoint. Swap any component (model upgrade, adapter retrain) and the latent is meaningless. Your logs become ungreppable tensor dumps. The side-channel idea (raw observation persisted, latent in the hot path, show_me_the_tool_output as a first-class rehydration call) is the right design — and architecturally easy since the raw observation already exists at compression time as encoder input.

On dual-channel drift: If both latent and a rehydration tool coexist in context, the agent has no internal signal for “my latent lost byte-level fidelity on this specific observation” — that metacognitive capability isn’t part of the training. Most likely it either never rehydrates (gist feels sufficient) or always does (defeating compression). A cleaner fix would be having the compressor itself emit a lossy/lossless flag — e.g., trained to predict when per-example KL exceeded a threshold — to gate rehydration automatically rather than relying on the agent to introspect.

TL;DR: Solid work for high-redundancy observations with narrow action spaces (web search QA). The 70-89% compression with improved F1 is real. But for production agentic loops where verbatim fidelity, greppable logs, and version-independent replay matter, you’d want latent as cache + raw as source of truth + a learned gate for selective rehydration.

Sign up or log in to comment

Get this paper in your agent:

hf papers read 2611.06500
Don't have the latest CLI?
curl -LsSf https://hf.co/cli/install.sh | bash

Models citing this paper 0

No model linking this paper

Cite arxiv.org/abs/2611.06500 in a model README.md to link it from this page.

Datasets citing this paper 0

No dataset linking this paper

Cite arxiv.org/abs/2611.06500 in a dataset README.md to link it from this page.

Spaces citing this paper 0

No Space linking this paper

Cite arxiv.org/abs/2611.06500 in a Space README.md to link it from this page.

Collections including this paper 1