Manuscript Offprint
arXiv:2611.06500Tools Need Not Speak in Text: Latent Context Compression for Agents
Abstract
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.
Date: November 5, 2026
First author: 23371522@buaa.edu.cn
Corresponding author: jia_li@mail.tsinghua.edu.cn
1 Introduction
Large language model (LLM) agents increasingly use external tools to acquire information and solve multi-step tasks Yang et al. (2024); Hong et al. (2025); Wang et al. (2023), with web search as a representative example Schick et al. (2023); Li et al. (2025a); He et al. (2024); Li et al. (2026). Under the widely adopted ReAct Yao et al. (2022) paradigm, an agent first reasons over the task and its current context to select a tool call, then adds the returned observation to its context to take the next action. For example, after querying a search engine, a web-search agent appends the returned search results to its context and uses them to decide whether to perform another search or provide a final answer Li et al. (2025a).
However, appending raw tool observations leads to rapid context growth over successive reasoning steps, introducing two drawbacks. First, increased computational overhead. As shown in Figure 1 (left), tool observations account for a large and growing share of the context, reaching 96.7% at Step 4 and leading to substantially higher token usage and computational cost Xiao et al. (2026); Jiang et al. (2023). Second, degraded task performance. In Figure 1 (right), identifying the name Sébastien Buemi suffices to guide the next search for his birth year, while extensive race details are irrelevant to this decision. Such redundant content consumes context and can distract the model from key evidence, impairing reasoning quality Liu et al. (2024); Levy et al. (2024); Shi et al. (2023).
A natural solution is to compress the agent's context. Existing methods mainly use token pruning or text summarization. Token pruning uses a model to identify and remove less informative tokens Li et al. (2023); Jiang et al. (2023); Pan et al. (2024); Jiang et al. (2024). Text summarization uses an auxiliary LLM to condense tool outputs or interaction histories into shorter summaries Wang et al. (2026); Xu et al. (2023). However, such text-level compression has a fundamental flaw: because

Figure 1 Tool observation redundancy in LLM agents. Left: Tool returns increasingly dominate the agent context, accounting for 96.7% of total tokens by Step 4, while individual observations exhibit substantial length. Right: A representative web-search example illustrating that only a few fragments of a lengthy tool output are relevant to the agent's next decision.
the compressed result remains a discrete token sequence that must stay semantically coherent, its achievable compression ratio is inherently limited.
A closer look at tool–agent interactions raises a fundamental question: must tool outputs be expressed in textual tokens? Since these outputs primarily support an agent's subsequent reasoning and actions, tool–agent interaction need not rely on explicit textual tokens. This observation motivates us to reconsider how tool information is represented. Compared with discrete text tokens, continuous latent tokens (i.e., high-dimensional vectors in the embedding space) offer a more flexible alternative. These latent tokens can encode rich information compactly under a limited token budget, while their differentiability enables direct optimization for downstream objectives. Recent studies Yu et al. (2026); Chen et al. (2026b) have explored latent tokens in reasoning Hao et al. (2024); Cheng & Van Durme (2024); Xu et al. (2025); Deng et al. (2023); Anonymous (2026), agents' communication Ye et al. (2026); Zou et al. (2025); Du et al. (2026); Jin et al. (2026), and memory Zhang et al. (2025a; 2026); Wang et al. (2024); Zhang et al. (2025b). Together, these studies suggest that models can directly process and exchange information through latent tokens, opening up new possibilities for information transfer between tools and agents.
Motivated by this analysis, we propose Coca-Cola (Context Compression via Continuous Latent Tokens), a latent context compression model for LLM agents. Conditioned on the task instruction and the agent's current-step reasoning trajectory, Coca-Cola compresses long, noisy tool observations into a few latent tokens that retain information critical to subsequent decisions. These latent tokens are mapped into the agent's input embedding space, enabling it to use the compressed information for further reasoning and actions.
Although latent tokens enable efficient information compression, applying them to compress tool observations for agents introduces two key challenges. The first is to make compressed representations effectively usable by the agent. The second is to preserve decision-critical information under a limited representation budget. To address the first challenge, we design a context-aware encoder with a latent adapter that maps compressed representations into the target agent's input embedding space. This allows the agent to directly use these latent tokens for subsequent reasoning and actions. For the second challenge, we propose an action-preserving training method. Specifically, we align the agent's next-action distributions under full and compressed tool observations. This trains the compression model to minimize its impact on the agent's next-action behavior, thereby preserving action-critical information.
We evaluate Coca-Cola across two model configurations and four web-search QA benchmarks. Compared to uncompressed agents, Coca-Cola reduces total token consumption by 70.01%-89.24% and end-to-end runtime by 24.45%-55.97%, demonstrating substantial efficiency gains. Despite aggressive compression, Coca-Cola consistently outperforms the uncompressed agent in both EM and F1, and achieves the best EM and F1 among all methods in six of the eight model–dataset settings.
Our contributions are threefold:
-
To our knowledge, we are the first to recognize that tools need not convey information through explicit tokens and to compress tool outputs into latent tokens.
-
We propose Coca-Cola, a latent context compression model trained to preserve action-critical information.
-
Experiments on web-search agents demonstrate that Coca-Cola substantially improves efficiency while consistently improving task performance.
2.1 LLM-Based Agents
LLM-based agents typically follow the ReAct paradigm Yao et al. (2022), alternating between reasoning and tool use to accomplish multi-step tasks. Formally, given a task instruction , an agent parameterized by generates a reasoning step and issues a tool call at step , receiving a tool observation . Let denote the trajectory prefix before receiving , comprising previous reasoning steps, tool calls, and observations. The agent appends to its context and continues reasoning to select the next tool call or produce a final answer:
As tool interactions proceed, the agent accumulates previous reasoning steps, tool calls, and their observations in its context. Without compression or truncation, the context length after the -th tool call can be approximated as
where denotes the token count and is the total context length, excluding fixed prompt and formatting overhead. Since tool calls often return lengthy search results and document snippets, tool observations accumulate over successive interactions and can eventually dominate the agent's context, incurring substantial context overhead.
2.2 Textual Compression for Tool-Augmented Agents
To reduce the context overhead of tool interactions, existing methods primarily rely on token pruning and text summarization Wang et al. (2026); Xiao et al. (2026); Chen et al. (2026a); Shi et al. (2025). Formally, given the tool observation at step , text-based compression methods transform it into a shorter sequence of discrete tokens using a compression function :
where denotes the vocabulary, is the compressed sequence length. The agent then replaces the original observation with its compressed counterpart to select the next action:
Token-pruning methods selectively remove less informative tokens. LLMLingua estimates token informativeness using language models (Jiang et al., 2023), while LLMLingua-2 formulates compression as a token classification task (Pan et al., 2024). LongLLMLingua further improves the density of task-relevant information in long-context prompts (Jiang et al., 2024).
Text summarization instead employs auxiliary language models to condense tool outputs or interaction histories into shorter natural-language summaries. RECOMP generates query-relevant summaries of retrieved documents (Xu et al., 2023), while Search-o1 extracts useful information from search results through its Reason-in-Documents module (Li et al., 2025a; Jin et al., 2025). For long-horizon agents, ACON jointly compresses tool observations and interaction histories, refining compression instructions based on agent failures (Kang et al., 2025).
Despite their different strategies, these methods retain information in the form of discrete text tokens. In contrast, Coca-Cola compresses tool observations into continuous latent representations, moving beyond text-based compression.
2.3 Latent Tokens for Agents
In recent years, continuous latent tokens have been explored for reasoning, communication, and memory in large language agents. For latent reasoning, Coconut (Hao et al., 2024), CCoT (Cheng & Van Durme, 2024), and SoftCoT (Xu et al., 2025) explore reasoning in continuous latent spaces, reducing reliance on explicit natural-language reasoning processes. For agent communication, KVComm (Ye et al., 2026) and LatentMAS (Zou et al., 2025) investigate information exchange between agents through hidden states or KV caches. For memory, MemGen (Zhang et al., 2025a) and NextMem (Zhang et al., 2026) explore storing and utilizing historical information through continuous latent tokens. These studies demonstrate that latent tokens can support both internal information processing and inter-model communication, offering new possibilities beyond traditional text-based interactions.
Another line of research employs latent tokens to compress long textual contexts Rau et al. (2024); Cheng et al. (2024); Li et al. (2025b); Chevalier et al. (2023); Mu et al. (2023); Ge et al. (2023). Gist Tokens (Mu et al., 2023) learns special compression tokens to encode long prompts into compact representations; AutoCompressor (Chevalier et al., 2023) compresses long texts into continuous summary vectors; and 500xCompressor (Li et al., 2025b) explores context compression at extremely high compression ratios. Among these approaches, ICAE (Ge et al., 2023), which is closely related to our work, employs an autoencoder-based architecture to compress long texts into a small number of continuous vectors and trains a language model to utilize these latent tokens for downstream tasks.
However, existing latent context compression methods primarily focus on preserving or reconstructing the original textual information. In contrast, Coca-Cola directly optimizes for the agent's subsequent decisions, preserving decision-critical information while discarding redundant content.
3 Method
3.1 Overview
As shown in Figure 2, we propose Coca-Cola, a continuous latent context compression model for LLM agents. Unlike traditional text-based compression methods, Coca-Cola compresses lengthy tool observations into a small number of latent tokens to reduce the context overhead of tool interactions. We first theoretically analyze the information capacity of latent tokens, providing theoretical motivation for compressing tool observations into continuous vectors (Section 3.2).
Specifically, after each tool call, Coca-Cola takes the task instruction, the agent's current-step reasoning trajectory, and the tool observation as input. A lightweight encoder processes these inputs, while a latent adapter maps the resulting latent tokens into the target agent's input embedding space (Section 3.3). To preserve decision-critical information under a limited representation budget, we further introduce Action-Preserving Training, which trains the compressor by aligning the agent's next-action distributions under full and compressed observations (Section 3.4). During inference, the trained compressor replaces raw tool observations with latent tokens after each tool call, allowing the agent to perform multi-step interactions with a more compact context (Section 3.5).
3.2 Theoretical Analysis
We analyze the potential advantage of latent tokens through their finite-precision codebook capacity. Here, capacity is defined as the logarithm of the number of distinguishable codewords, with the context shared by the encoder and the agent held fixed.

Figure 2 Overview of Coca-Cola. Left: The latent tool bottleneck encodes raw tool observations into compact continuous latent representations, conditioned on the task instruction and current reasoning state. Middle: Action-preserving distillation aligns the next-action distributions of a full-observation teacher and a latent-conditioned student, updating only the compressor while keeping the agent backbone frozen. Right: During inference, raw tool observations are replaced by latent representations after each tool call, enabling efficient multi-step agent interactions.
For a model with vocabulary size , each text token is selected from symbols. A sequence of tokens therefore admits at most distinct sequences, giving a maximum codebook capacity of
A latent token can instead encode information jointly across multiple numerical coordinates within a single input position. Assume each -dimensional latent token has effective coordinates, each admitting distinguishable values at finite precision, and that all coordinate combinations across representations are realizable. Under these assumptions, representations have a codebook capacity of
Thus, when , continuous latent representations can provide a larger codebook capacity under the same input-position budget, i.e., . This potential comes from joint encoding across multiple coordinates, whereas each text position remains restricted to a symbol from a fixed vocabulary. This analysis motivates continuous compression of tool observations from a capacity perspective; the information usable in practice still depends on the compressor's encoding ability and the agent's ability to use the representations.
3.3 Model Architecture
Building on the above theoretical analysis, we propose Coca-Cola, a continuous latent context compression model for LLM agents. Coca-Cola encodes tool observations into a small number of latent tokens and maps them into the target agent's input embedding space. To make these latent tokens directly usable by the agent, we design a compression model consisting of a context-aware encoder and a latent adapter, as illustrated in Figure 2 (left).
Context-Aware Encoder. Our analysis of tool-use trajectories shows that a tool observation is not only relevant to the observation itself, but also depends on the task instruction and the agent's current reasoning state. To this end, we employ a small language model as the context-aware encoder, which jointly encodes the task instruction, current-step reasoning trajectory, and tool observation. Specifically, given the task instruction , current-step reasoning trajectory prefix , and tool observation , the model produces context-conditioned hidden states:
Latent Adapter. Since the context-aware encoder and the target agent operate in different representation spaces, the encoded hidden states cannot be directly consumed by the agent. To bridge this gap, we introduce a latent adapter that transforms the hidden states into a fixed number of latent tokens and maps them into the target agent's input embedding space:
where is the number of latent tokens and is the target agent's input embedding dimension. The resulting latent tokens are then directly inserted into the agent's input embedding sequence, delimited by special boundary markers:
Here, denotes the target agent's input embedding function. This design provides a continuous interface between tool observations and the target agent.
3.4 Action-Preserving Training
Although latent tokens can encode tool observations compactly, preserving decision-critical information under a limited representation budget remains challenging. To address this challenge, we design a training method that aligns the agent's next-action distributions under full and compressed observations, encouraging the compression model to retain information critical to next-action selection.
Specifically, given the task instruction , trajectory prefix , and tool observation , we feed the full observation and its compressed latent tokens separately into the same frozen target agent. The resulting next-action distributions are defined as
Our goal is to align these distributions, minimizing the impact of compression on the agent's subsequent decisions.
To this end, we jointly optimize an action-distribution alignment loss and an action-level supervision loss:
where denotes the next-action token recorded in the collected trajectory, and and control the respective loss weights. The KL divergence aligns the action distributions under full and compressed observations, while the cross-entropy loss further supervises the predictions using recorded actions. Together, these objectives encourage the compression model to prioritize information relevant to subsequent decisions.
Since latent tokens are continuous and differentiable, gradients can propagate through the frozen target agent to optimize the compression model:
During training, we keep the target agent frozen and update only the LoRA parameters of the context-aware encoder and the parameters of the latent adapter. By directly aligning the agent's action distributions under full and compressed observations, Coca-Cola learns action-sufficient latent tokens without reconstructing the original tool observations.
3.5 Inference
At inference, Coca-Cola replaces each raw tool observation with latent tokens. Given the task instruction , current-step trajectory prefix , and tool observation , the trained compression model produces
The agent then conditions on , rather than the raw observation, to generate its next action:
For multi-step tool use, Coca-Cola repeats this process after every tool call. By replacing tool outputs with a small number of latent tokens, Coca-Cola reduces context growth while retaining information needed for subsequent decisions.
Table 1 Efficiency comparison across four web-search QA datasets using Qwen3.5-35B-A3B and Qwen3.5-4B. Best results are in bold. Blue annotations under Coca-Cola indicate reductions (%) relative to Vanilla in token usage and runtime.
| NQ | TriviaQA | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Vanilla | LongLLM Lingua | LLM Summary | ICAE | Coca-Cola | Vanilla | LongLLM Lingua | LLM Summary | ICAE | Coca-Cola | |
| 14362.12 | 8607.04 | 6099.83 | 5926.23 | 1766.53↓ 87.7% | 10022.93 | 5445.57 | 3791.53 | 3038.35 | 1413.12↓ 85.9% | |
| 992.69 | 1232.61 | 1080.51 | 665.57 | 417.69↓ 57.9% | 779.34 | 1048.02 | 679.36 | 535.42 | 349.36↓ 55.2% | |
| Comp_rate ↑ | - | 35.92% | 53.24% | 57.07% | 85.78% | - | 39.89% | 58.61% | 66.92% | 83.68% |
| Time (s) ↓ | 96.19 | 109.48 | 121.02 | 87.06 | 64.64↓ 32.8% | 73.30 | 86.91 | 91.67 | 64.89 | 55.38↓ 24.4% |
| 2Wiki | HotpotQA | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Vanilla | LongLLM Lingua | LLM Summary | ICAE | Coca-Cola | Vanilla | LongLLM Lingua | LLM Summary | ICAE | Coca-Cola | |
| 37427.21 | 21110.06 | 10011.31 | 12268.64 | 10744.51↓ 71.3% | 42723.75 | 21241.95 | 8088.21 | 15763.53 | 9429.04↓ 77.9% | |
| 1510.37 | 1488.63 | 1163.11 | 1080.53 | 932.57↓ 38.3% | 1560.28 | 1596.04 | 1253.70 | 1035.63 | 831.43↓ 46.7% | |
| Comp_rate ↑ | - | 41.96% | 71.30% | 65.72% | 70.01% | - | 48.43% | 78.90% | 62.06% | 76.83% |
| Time (s) ↓ | 164.99 | 137.22 | 175.97 | 142.18 | 119.91↓ 27.3% | 161.39 | 145.83 | 160.24 | 139.04 | 120.88↓ 25.1% |
Table 2 Efficiency comparison across four web-search QA datasets using GLM-4.7-Flash and GLM-Z1-9B. Best results are in bold. Blue annotations under Coca-Cola indicate reductions (%) relative to Vanilla in token usage and runtime.
| NQ | TriviaQA | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Vanilla | LongLLM Lingua | LLM Summary | ICAE | Coca-Cola | Vanilla | LongLLM Lingua | LLM Summary | ICAE | Coca-Cola | |
| 17388.56 | 5779.61 | 3903.19 | 5068.65 | 4265.42↓ 75.5% | 11176.91 | 4689.20 | 2842.51 | 3510.28 | 2595.00↓ 76.8% | |
| 887.74 | 797.81 | 734.77 | 805.93 | 536.37↓ 39.6% | 738.96 | 688.27 | 634.84 | 617.94 | 413.28↓ 44.1% | |
| Comp_rate ↑ | - | 64.01% | 74.62% | 67.86% | 73.73% | - | 54.87% | 70.82% | 65.36% | 74.75% |
| Time (s) ↓ | 89.29 | 91.06 | 106.47 | 83.63 | 42.17↓ 52.8% | 91.36 | 89.93 | 128.36 | 72.33 | 41.97↓ 54.1% |
| 2Wiki | HotpotQA | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Vanilla | LongLLM Lingua | LLM Summary | ICAE | Coca-Cola | Vanilla | LongLLM Lingua | LLM Summary | ICAE | Coca-Cola | |
| 31693.47 | 11934.39 | 5113.19 | 7677.77 | 3003.38↓ 90.5% | 28781.88 | 6059.07 | 4690.11 | 4029.96 | 4041.03↓ 86.0% | |
| 976.35 | 672.11 | 895.04 | 777.21 | 511.07↓ 47.7% | 834.04 | 826.07 | 747.77 | 707.66 | 609.95↓ 26.9% | |
| Comp_rate ↑ | - | 61.41% | 81.61% | 74.12% | 89.24% | - | 76.75% | 81.64% | 84.00% | 84.30% |
| Time (s) ↓ | 106.37 | 109.93 | 153.25 | 89.21 | 46.83↓ 56.0% | 84.55 | 102.54 | 101.61 | 99.58 | 49.37↓ 41.6% |
4 Experimental Setup
4.1 Research Questions
We systematically evaluate Coca-Cola to address the following four research questions:
Table 3 Web search performance comparison. Best results within each model setting are in bold. Arrows in the Coca-Cola rows indicate relative changes (%) over the Vanilla Model for each metric.
| Method | Single-hop QA | Multi-hop QA | ||||||
|---|---|---|---|---|---|---|---|---|
| NQ | TriviaQA | 2Wiki | HotpotQA | |||||
| EM | F1 | EM | F1 | EM | F1 | EM | F1 | |
| Qwen3.5-35B-A3B & Qwen3.5-4B | ||||||||
| Vanilla Model | 23.67 | 33.17 | 56.10 | 62.87 | 17.30 | 26.94 | 11.00 | 16.41 |
| LongLLMLingua | 19.00 | 25.81 | 44.30 | 48.69 | 21.30 | 34.25 | 11.90 | 19.75 |
| LLMSummary | 24.65 | 32.35 | 54.70 | 61.38 | 21.06 | 31.77 | 23.10 | 29.60 |
| ICAE | 24.38 | 35.20 | 61.80 | 69.27 | 13.72 | 16.91 | 23.71 | 31.21 |
| Coca-Cola | 24.78&up 4.69% | 37.33&up 12.54% | 59.20&up 5.53% | 67.07&up 6.68% | 24.00&up 38.73% | 32.34&up 20.04% | 25.70&up 133.64% | 33.75&up 105.67% |
| GLM-4.7-Flash & GLM-Z1-9B | ||||||||
| Vanilla Model | 21.50 | 26.08 | 41.50 | 44.57 | 26.50 | 31.29 | 20.50 | 25.89 |
| LongLLMLingua | 17.00 | 21.16 | 39.50 | 42.41 | 20.50 | 24.91 | 19.50 | 23.00 |
| LLMSummary | 16.00 | 21.05 | 46.00 | 49.29 | 22.50 | 25.61 | 13.50 | 17.60 |
| ICAE | 17.00 | 20.82 | 38.00 | 40.94 | 18.50 | 20.75 | 16.50 | 20.13 |
| Coca-Cola | 23.50&up 9.30% | 31.45&up 20.59% | 51.50&up 24.10% | 59.41&up 33.30% | 28.00&up 5.66% | 36.20&up 15.69% | 23.50&up 14.63% | 30.76&up 18.81% |
RQ1 (Efficiency): How much computational overhead can Coca-Cola reduce in terms of token consumption and execution time?
We measure token consumption, compression rates, and end-to-end runtime across different model configurations and benchmarks.
RQ2 (Task Performance): Can Coca-Cola preserve or improve agent task performance while reducing context overhead?
We compare EM and F1 scores against uncompressed agents and existing compression methods to assess the impact of compression on task performance.
RQ3 (Ablation Study): What factors affect the performance of Coca-Cola?
We investigate how the number of latent tokens and different contextual inputs affect compression effectiveness and task performance.
RQ4 (Case Study): How does Coca-Cola support agent decision-making through latent tokens?
We present a representative case study to illustrate how latent tokens preserve decision-critical information and guide subsequent actions.
4.2 Agent Setting and Model Configurations
We evaluate Coca-Cola in a web-search agent setting, as web search is one of the most common tool-use scenarios for LLM agents Li et al. (2025a); Jin et al. (2025), and its returned results are typically lengthy and highly redundant (Figure 1), making it a natural testbed for observation compression. Notably, Coca-Cola involves no search-specific design: the compressor conditions only on the task instruction, the current reasoning trajectory, and the raw tool observation, and can thus be applied to other tools without architectural modification.
To evaluate Coca-Cola across different model configurations, we use two model pairs: Qwen3.5-35B-A3B with Qwen3.5-4B Qwen Team (2026), and GLM-4.7-Flash with GLM-Z1-9B GLM Team et al. (2025); Team GLM et al. (2024).
4.3 Baselines
We compare Coca-Cola against four representative approaches:
Vanilla Model. An uncompressed agent that directly appends raw tool observations to its context.
LongLLMLingua. A token-pruning method that compresses context by selectively removing less informative tokens Jiang et al. (2024).
LLMSummary. A text summarization approach that uses an auxiliary language model to summarize tool observations into shorter natural-language text Li et al. (2025a).
ICAE. ICAE Ge et al. (2023) learns continuous latent tokens through text reconstruction. Since ICAE was not originally designed for agent tool observations, we adapt its training objective to our setting. Specifically, we use the same compression architecture as Coca-Cola but replace the action-preserving training objective with a text-reconstruction objective, training the model to recover the original tool observations from compressed latent tokens.
4.4 Benchmarks
We evaluate on four open-domain question answering benchmarks: Natural Questions (NQ) Kwiatkowski et al. (2019), TriviaQA Joshi et al. (2017), 2WikiMultiHopQA (2Wiki) Ho et al. (2020), and HotpotQA Yang et al. (2018).
NQ and TriviaQA primarily assess the agent's ability to retrieve and utilize factual evidence, while 2Wiki and HotpotQA require multi-hop reasoning across multiple pieces of evidence. Together, these benchmarks evaluate whether latent compression preserves critical information under varying reasoning complexity.
4.5 Evaluation Metrics
We evaluate each method in terms of task performance and system efficiency.
Task Performance. We report Exact Match (EM) and token-level F1 scores on the final answers to measure answer correctness.
System Efficiency. We measure the average input tokens , output tokens , compression ratio Comp_rate, and end-to-end execution time Time.
The compression ratio is defined as
where the superscripts latent and raw denote the compressed and uncompressed settings, respectively.
5 Experimental Results
5.1 RQ1: How much computational overhead can Coca-Cola reduce?
In this RQ, we evaluate the efficiency gains of Coca-Cola in terms of token consumption and end-to-end execution time across different model configurations and QA benchmarks. The results are presented in Tables 1 and 2.
Coca-Cola substantially reduces tool-context overhead. Compared with the Vanilla Model, which directly incorporates full tool observations into the agent's context, Coca-Cola consistently reduces both input and output token consumption across all evaluated datasets. For instance, on NQ with the Qwen models, the average number of input tokens decreases from 14,362.12 to 1,766.53, representing an 87.70% reduction. Similarly, on 2Wiki with the GLM models, input token consumption drops from 31,693.47 to 3,003.38, corresponding to a 90.52% reduction. These results demonstrate that replacing noisy tool observations with compact latent tokens effectively mitigates context growth while reducing subsequent generation overhead.
Coca-Cola achieves high compression rates across all settings. Coca-Cola reduces total token consumption by 70.01%–89.24% and achieves the highest compression rate in five of the eight model-dataset settings. Compared with ICAE, which shares the same architecture but uses a reconstruction objective, Coca-Cola achieves a higher compression rate in all eight settings; for example, on 2Wiki with the GLM models, it reaches 89.24% versus 74.12% for ICAE. LLMSummary

Figure 3 Effect of the number of latent tokens on NQ (GLM-4.7-Flash & GLM-Z1-9B). F1 improves steadily as the latent budget increases.
attains slightly higher compression rates in the remaining three settings, but with lower EM and F1 than Coca-Cola in all three; for instance, on NQ with the GLM models, its EM is only 16.00%, compared with 23.50% for Coca-Cola (Table 3).
Coca-Cola translates token savings into tangible improvements in inference efficiency. Across all four datasets and both model configurations, Coca-Cola consistently achieves the lowest average execution time. With the Qwen models, runtime decreases by 24.45%-32.80%; for example, on NQ it drops from 96.19 to 64.64 seconds, a 32.80% reduction. The gains are even larger with the GLM models, where runtime decreases by 41.61%-55.97%; for example, on 2Wiki it drops from 106.37 to 46.83 seconds, a 55.97% reduction. These findings demonstrate that the benefits of Coca-Cola extend beyond token-level compression, translating into practical improvements in inference latency and computational cost.
5.2 RQ2: Can Coca-Cola improve agent task performance while reducing tool-token overhead?
In this RQ, we evaluate whether Coca-Cola can preserve or improve agent performance while reducing tool-context overhead, using Exact Match (EM) and F1. The results are presented in Table 3.
High compression rates do not compromise task performance, but can even lead to improvements. Compared with the Vanilla Model, Coca-Cola consistently achieves higher EM and F1 across all evaluated settings. On TriviaQA with Qwen, Coca-Cola improves F1 from 62.87% to 67.07% while achieving an 83.68% compression rate. Similarly, on 2Wiki with GLM, F1 increases from 31.29% to 36.20% at an 89.24% compression rate. These results suggest that filtering redundant and irrelevant tool information may alleviate attention dilution caused by lengthy contexts, allowing agents to focus more effectively on task-relevant evidence.
Coca-Cola outperforms existing compression methods in most settings. Coca-Cola achieves the highest score in 13 of the 16 dataset-metric pairs, and the highest EM and F1 simultaneously in six of the eight model-dataset combinations, including all four with the GLM models. For example, on TriviaQA with GLM, Coca-Cola achieves an F1 of 59.41%, surpassing the strongest baseline, LLMSummary (49.29%). Similarly, on HotpotQA with Qwen, Coca-Cola achieves an F1 of 33.75%, compared with 31.21% for the strongest baseline, ICAE. The only exceptions occur with the Qwen models, where ICAE achieves higher EM and F1 on TriviaQA and LongLLMLingua achieves a higher F1 on 2Wiki; however, these baselines compress tool observations considerably less than Coca-Cola (66.92% vs. 83.68% and 41.96% vs. 70.01%, respectively). Unlike text-based or generic latent compression, Coca-Cola prioritizes decision-relevant information, even under high compression rates.
5.3 RQ3: What factors affect the performance of Coca-Cola?
The number of latent tokens. On NQ with the GLM models, we vary the number of latent tokens and train a separate compressor for each setting (Figure 3). F1 increases
Table 4 Context-component ablation on NQ (GLM-4.7-Flash & GLM-Z1-9B, m = 128).
| Method | EM (%) | Compression rate (%) |
|---|---|---|
| NQ | ||
| Full | 23.50 | 73.73 |
| w/o Reasoning State | 21.45 | 80.43 |
| w/o Task Goal | 20.02 | 78.38 |
| Observation-only | 18.34 | 79.94 |
steadily from 26.34% to 31.45% as m grows, while the compression rate stays between 78.83% and 82.56% for and drops to 73.73% at . We adopt as the default, as it offers the best trade-off between efficiency and task performance across datasets in our preliminary experiments.
Different contextual inputs. To assess the contribution of the conditioning signals, we train four variants with : Full (), w/o Reasoning State (), w/o Task Goal (), and Observation-only (), where the task goal text is also removed from when excluded (Table 4). Both signals contribute: removing the reasoning state, the task goal, and both reduces EM by 2.05, 3.48, and 5.16 points, respectively. This confirms that decision-critical information cannot be fully determined from the observation alone. Removing the reasoning state causes a smaller drop, likely because on single-hop NQ the agent's current sub-goal largely coincides with the original question. Although the ablated variants achieve higher compression rates (78.38%–80.43%), they do so at the cost of EM. Notably, even the Observation-only variant outperforms all compression baselines on NQ with the GLM models in both EM (18.34% vs. at most 17.00%) and compression rate (79.94% vs. at most 74.62%), including ICAE, which shares the same architecture but uses a reconstruction objective. This highlights the benefit of action-preserving training.
5.4 RQ4: How does Coca-Cola support agent decision-making through latent tokens?
Figure 4 presents a representative case from HotpotQA. The search results contain both information linking Jens Risom to Mid-Century Modern design and key evidence that he introduced Scandinavian design to America. The Vanilla Model fails to distinguish between these two pieces of information and produces an incorrect answer even after an additional search. In contrast, Coca-Cola identifies the evidence directly relevant to the question and arrives at the correct answer with fewer searches and lower context overhead.
6 Conclusion
In this paper, we introduce Coca-Cola, a continuous latent context compression model for compacting noisy tool observations in LLM agents. Unlike conventional token pruning and summarization methods, Coca-Cola encodes tool outputs into a small number of task-conditioned latent tokens that are directly injected into the agent. Through our action-preserving training, we learn a compression model that preserves decision-critical information rather than reconstructing the original observations. Experiments on web-search tasks demonstrate that Coca-Cola substantially reduces context overhead while consistently improving task performance.
More fundamentally, we challenge a prevailing assumption in LLM agents: interaction between tools and agents need not rely on explicit text tokens. Instead, tools only need to convey information sufficient for subsequent decisions through compact, latent tokens. This perspective opens a promising direction for building more efficient and scalable long-horizon agents.
References
Anonymous. Learning when to think aloud in latent reasoning. In Submitted to ACL Rolling Review - October 2026, 2026. URL https://openreview.net/forum?id=cidlIx7Vr2. under review.
HotpotQA #377
Case Study
Question
Jens Risom introduced what type of design, characterized by minimalism and functionality?
Same initial query. Search returns: 5 URLs each, 3 shared.
Vanilla
Initial reasoning
The user is asking about Jens Risom and what type of design he introduced, characterized by minimalism and functionality. I need to search for information about Jens Risom and his design style.
Let me start by searching for Jens Risom and his design contributions.
</think><begin_search_query>|Jens Risom design style minimalism functionality</end_search_query>
Search evidence
Rank 1 · ABT Modern
"..." played a pivotal role in shaping Mid-Century Modern furniture design."
Rank 3 · Chairish
"He was one of the first designers to introduce Scandinavian design to America."
Reasoning after search
</think>Based on the search results, I can see that Jens Risom was a Danish-born American designer who played a pivotal role in shaping Mid-Century Modern furniture design. The search results consistently mention that he:
-
Introduced the Scandinavian aesthetic to the American market
-
His designs emphasized clean lines, organic forms, and functionality
-
He is associated with Mid-Century Modern style
-
His work is characterized by minimalism and functionality
The search results clearly indicate that Jens Risom introduced Mid-Century Modern design, which is characterized by minimalism and functionality. This style was heavily influenced by Scandinavian design principles that he brought to America.
Let me verify this information with one more search to be certain.
<begin_search_query>|Jens Risom Mid-Century Modern design minimalism</end_search_query>
Latent
Initial reasoning
The user is asking about Jens Risom and what type of design he introduced, characterized by minimalism and functionality.
Let me search for information about Jens Risom and his design style.
</think><begin_search_query>|Jens Risom design style minimalism functionality</end_search_query>
Search evidence
Rank 1 · Chairish
"He was one of the first designers to introduce Scandinavian design to America."
Rank 2 · ABT Modern
"..." played a pivotal role in shaping Mid-Century Modern furniture design."
Reasoning after search
</think>Based on the search results, I can now answer the question about Jens Risom and his design style.
From the search results, I can see that:
-
Jens Risom was a Danish-American furniture designer who introduced Scandinavian design to the United States.
-
His design style is characterized by:
-
Minimalism
-
Functionality
-
Clean lines
-
Natural materials (especially wood)
-
Simplicity
-
He is particularly known for his Scandinavian modern furniture designs, which he brought to America in the 1940s.
-
His work emphasized the combination of form and function, which are key principles of Scandinavian design.
The answer to the question is Scandinavian design (or Scandinavian modern design).
boxed{Scandinavian design}
Vanilla · Final reasoning
Final model output
</think>Based on the search results, I now have comprehensive information about Jens Risom and his design contributions.
The search results consistently confirm that:
-
Jens Risom (1916-2016) was a Danish-American furniture designer
-
He is widely recognized as one of the pioneers of Mid-Century Modern design in the United States
-
He was one of the first designers to introduce Scandinavian design to the American market
-
His designs are characterized by clean lines, organic forms, and functionality
-
His work exemplifies minimalism and functionality
The Wikipedia article specifically states: "An exemplar of Mid-Century modern design, Risom was one of the first designers to introduce Scandinavian design in the United States."
The answer to the question is clear: Jens Risom introduced Mid-Century Modern design, which is characterized by minimalism and functionality.
boxed{Mid-Century Modern}
Outcomes
Vanilla
Mid-Century Modern
Incorrect
Latent
Scandinavian design
Correct
Reference answer
Scandinavian design
Figure 4 Case study on HotpotQA #377 comparing the Vanilla Model and Coca-Cola.
Haorui Chen, Yuancheng Zhu, Yitong Zhang, and Jia Li. Coast: Action-preserving observation compression for coding agents. arXiv preprint arXiv:2607.02911, 2026a.
Siyi Chen, Xiaoyan Zhang, Meng Wu, Jonathan Tremblay, Valts Blukis, Stan Birchfield, Rene Vidal, Alvaro Velasquez, Sijia Liu, and Qing Qu. See what i see, know what i think: Dense latent communication across heterogeneous agents. arXiv preprint arXiv:2606.13594, 2026b.
Jeffrey Cheng and Benjamin Van Durme. Compressed chain of thought: Efficient reasoning through dense representations. arXiv preprint arXiv:2412.13171, 2024.
Xin Cheng, Xun Wang, Xingxing Zhang, Tao Ge, Si-Qing Chen, Furu Wei, Huishuai Zhang, and Dongyan Zhao. xrag: Extreme context compression for retrieval-augmented generation with one token. Advances in Neural Information Processing Systems, 37:109487–109516, 2024.
Alexis Chevalier, Alexander Wettig, Anirudh Ajith, and Danqi Chen. Adapting language models to compress contexts. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pp. 3829–3846, 2023.
Yuntian Deng, Kiran Prasad, Roland Fernandez, Paul Smolensky, Vishrav Chaudhary, and Stuart Shieber. Implicit chain of thought reasoning via knowledge distillation. arXiv preprint arXiv:2311.01460, 2023.
Zhuoyun Du, Runze Wang, Huiyu Bai, Zouying Cao, Xiaoyong Zhu, Yu Cheng, Bo Zheng, Wei Chen, and Haochao Ying. Enabling agents to communicate entirely in latent space. In Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 27106–27129, 2026.
Tao Ge, Jing Hu, Lei Wang, Xun Wang, Si-Qing Chen, and Furu Wei. In-context autoencoder for context compression in a large language model. arXiv preprint arXiv:2307.06945, 2023.
GLM Team et al. GLM-4.5: Agentic, reasoning, and coding (ARC) foundation models, 2025. URL https://arxiv.org/abs/2508.06471.
Shibo Hao, Sainbayar Sukhbaatar, DiJia Su, Xian Li, Zhiting Hu, Jason Weston, and Yuandong Tian. Training large language models to reason in a continuous latent space. arXiv preprint arXiv:2412.06769, 2024.
Hongliang He, Wenlin Yao, Kaixin Ma, Wenhao Yu, Yong Dai, Hongming Zhang, Zhenzhong Lan, and Dong Yu. Webvoyager: Building an end-to-end web agent with large multimodal models. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 6864–6890, 2024.
Xanh Ho, Anh-Khoa Duong Nguyen, Saku Sugawara, and Akiko Aizawa. Constructing a multi-hop qa dataset for comprehensive evaluation of reasoning steps. In Proceedings of the 28th International Conference on Computational Linguistics, pp. 6609–6625, 2020.
Sirui Hong, Yizhang Lin, Bang Liu, Bangbang Liu, Binhao Wu, Ceyao Zhang, Danyang Li, Jiaqi Chen, Jiayi Zhang, Jinlin Wang, et al. Data interpreter: An llm agent for data science. In Findings of the association for computational linguistics: ACL 2025, pp. 19796–19821, 2025.
Huiqiang Jiang, Qianhui Wu, Chin-Yew Lin, Yuqing Yang, and Lili Qiu. Lmlingua: Compressing prompts for accelerated inference of large language models. In Proceedings of the 2023 conference on empirical methods in natural language processing, pp. 13358–13376, 2023.
Huiqiang Jiang, Qianhui Wu, Xufang Luo, Dongsheng Li, Chin-Yew Lin, Yuqing Yang, and Lili Qiu. Longllmlingua: Accelerating and enhancing llms in long context scenarios via prompt compression. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1658–1677, 2024.
Bowen Jin, Hansi Zeng, Zhenrui Yue, Jinsung Yoon, Sercan Arik, Dong Wang, Hamed Zamani, and Jiawei Han. Search-r1: Training llms to reason and leverage search engines with reinforcement learning. arXiv preprint arXiv:2503.09516, 2025.
Haibo Jin, Peng Kuang, Ye Yu, Xiaopeng Yuan, and Haohan Wang. Agent primitives: Reusable latent building blocks for multi-agent systems. arXiv preprint arXiv:2602.03695, 2026.
Mandar Joshi, Eunsol Choi, Daniel S Weld, and Luke Zettlemoyer. Triviaqa: A large scale distantly supervised challenge dataset for reading comprehension. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1601–1611, 2017.
Minki Kang, Wei-Ning Chen, Dongge Han, Huseyin A Inan, Lukas Wutschitz, Yanzhi Chen, Robert Sim, and Saravan Rajmohan. Acon: Optimizing context compression for long-horizon llm agents. arXiv preprint arXiv:2510.00615, 2025.
Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, et al. Natural questions: a benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:453–466, 2019.
Mosh Levy, Alon Jacoby, and Yoav Goldberg. Same task, more tokens: the impact of input length on the reasoning performance of large language models. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 15339–15353, 2024.
Xiaoxi Li, Guanting Dong, Jiajie Jin, Yuyao Zhang, Yujia Zhou, Yutao Zhu, Peitian Zhang, and Zhicheng Dou. Search-o1: Agentic search-enhanced large reasoning models. In Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing, pp. 5420–5438, 2025a.
Xiaoxi Li, Jiajie Jin, Guanting Dong, Hongjin Qian, Yongkang Wu, Ji-Rong Wen, Yutao Zhu, and Zhicheng Dou. Webthinker: Empowering large reasoning models with deep research capability. Advances in Neural Information Processing Systems, 38:120091–120131, 2026.
Yucheng Li, Bo Dong, Frank Guerin, and Chenghua Lin. Compressing context to enhance inference efficiency of large language models. In Proceedings of the 2023 conference on empirical methods in natural language processing, pp. 6342–6353, 2023.
Zongqian Li, Yixuan Su, and Nigel Collier. 500xcompressor: Generalized prompt compression for large language models. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 25081–25091, 2025b.
Nelson F Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, and Percy Liang. Lost in the middle: How language models use long contexts. Transactions of the association for computational linguistics, 12:157–173, 2024.
Jesse Mu, Xiang Li, and Noah Goodman. Learning to compress prompts with gist tokens. Advances in Neural Information Processing Systems, 36:19327–19352, 2023.
Zhuoshi Pan, Qianhui Wu, Huiqiang Jiang, Menglin Xia, Xufang Luo, Jue Zhang, Qingwei Lin, Victor Rühle, Yuqing Yang, Chin-Yew Lin, et al. Lmlingua-2: Data distillation for efficient and faithful task-agnostic prompt compression. In Findings of the Association for Computational Linguistics: ACL 2024, pp. 963–981, 2024.
Qwen Team. Qwen3.5: Towards native multimodal agents, February 2026. URL https://qwen.ai/blog?id=qwen3.5.
David Rau, Shuai Wang, Hervé Déjean, and Stéphane Clinchant. Context embeddings for efficient answer generation in rag. arXiv preprint arXiv:2407.09252, 2024.
Timo Schick, Jane Dwivedi-Yu, Roberto Dessi, Roberta Raileanu, Maria Lomeli, Eric Hambro, Luke Zettlemoyer, Nicola Cancedda, and Thomas Scialom. Toolformer: Language models can teach themselves to use tools. In Advances in Neural Information Processing Systems, 2023.
Freda Shi, Xinyun Chen, Kanishka Misra, Nathan Scales, David Dohan, Ed H Chi, Nathanael Schärli, and Denny Zhou. Large language models can be easily distracted by irrelevant context. In International conference on machine learning, pp. 31210–31227. PMLR, 2023.
Yuling Shi, Yichun Qian, Hongyu Zhang, Beijun Shen, and Xiaodong Gu. Longcodezip: Compress long context for code language models. arXiv preprint arXiv:2510.00446, 2025.
Team GLM et al. ChatGLM: A family of large language models from GLM-130B to GLM-4 All Tools, 2024. URL https://arxiv.org/abs/2406.12793.
Guanzhi Wang, Yuqi Xie, Yunfan Jiang, Ajay Mandlekar, Chaowei Xiao, Yuke Zhu, Linxi Fan, and Anima Anandkumar. Voyager: An open-ended embodied agent with large language models. arXiv preprint arXiv:2305.16291, 2023.
Yu Wang, Yifan Gao, Xiusi Chen, Haoming Jiang, Shiyang Li, Jingfeng Yang, Qingyu Yin, Zheng Li, Xian Li, Bing Yin, et al. Memoryllm: Towards self-updatable large language models. arXiv preprint arXiv:2402.04624, 2024.
Yuhang Wang, Yuling Shi, Mo Yang, Rongrui Zhang, Shilin He, Heng Lian, Yuting Chen, Siyu Ye, Kai Cai, and Xiaodong Gu. Swe-pruner: Self-adaptive context pruning for coding agents. arXiv preprint arXiv:2601.16746, 2026.
Yuan-An Xiao, Pengfei Gao, Chao Peng, and Yingfei Xiong. Reducing cost of llm agents with trajectory reduction. Proceedings of the ACM on Software Engineering, 3, 2026.
Fangyuan Xu, Weijia Shi, and Eunsol Choi. Recomp: Improving retrieval-augmented lms with compression and selective augmentation. arXiv preprint arXiv:2310.04408, 2023.
Yige Xu, Xu Guo, Zhiwei Zeng, and Chunyan Miao. Softcot: Soft chain-of-thought for efficient reasoning with llms. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 23336–23351, 2025.
John Yang, Carlos Jimenez, Alexander Wettig, Kilian Lieret, Shunyu Yao, Karthik Narasimhan, and Ofir Press. Swe-agent: Agent-computer interfaces enable automated software engineering. Advances in Neural Information Processing Systems, 37:50528–50652, 2024.
Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William Cohen, Ruslan Salakhutdinov, and Christopher D Manning. Hotpotqa: A dataset for diverse, explainable multi-hop question answering. In Proceedings of the 2018 conference on empirical methods in natural language processing, pp. 2369–2380, 2018.
Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao. React: Synergizing reasoning and acting in language models. arXiv preprint arXiv:2210.03629, 2022.
Hancheng Ye, Zhengqi Gao, Mingyuan Ma, Qinsi Wang, Yuzhe Fu, Ming-Yu Chung, Yueqian Lin, Zhijian Liu, Jianyi Zhang, Danyang Zhuo, et al. Kvcomm: Online cross-context kv-cache communication for efficient llm-based multi-agent systems. Advances in Neural Information Processing Systems, 38:17882–17928, 2026.
Xinlei Yu, Zhangquan Chen, Yongbo He, Tianyu Fu, Guanting Dong, Cheng Yang, Chengming Xu, Yue Ma, Xiaobin Hu, Zhe Cao, et al. The latent space: Foundation, evolution, mechanism, ability, and outlook. arXiv preprint arXiv:2604.02029, 2026.
Guibin Zhang, Muxin Fu, and Shuicheng Yan. Memgen: Weaving generative latent memory for self-evolving agents. arXiv preprint arXiv:2509.24704, 2025a.
Guibin Zhang, Fanci Meng, Guancheng Wan, Zherui Li, Kun Wang, Zhenfei Yin, Lei Bai, and Shuicheng Yan. Latentevolve: Self-evolving test-time scaling in latent space. arXiv preprint arXiv:2509.24771, 2025b.
Zeyu Zhang, Rui Li, Xiaoyan Zhao, Yang Zhang, Wenjie Wang, Xu Chen, and Tat-Seng Chua. Nextmem: Towards latent factual memory for llm-based agents. arXiv preprint arXiv:2603.15634, 2026.
Jiaru Zou, Ruizhong Qiu, Gaotang Li, Xiyuan Yang, Katherine Tieu, Pan Lu, Ke Shen, Hanghang Tong, Yejin Choi, Jingrui He, et al. Latent collaboration in multi-agent systems. arXiv preprint arXiv:2511.20639, 2025.
Appendix
A Implementation Details
A.1 Training Configuration
We construct the compression dataset from 4,188 distinct tasks, containing 4,363 tool observation-action pairs. We reserve 10% of the pairs for validation, yielding 3,927 training pairs and 436 validation pairs.
The target agent remains frozen throughout training. We update only the LoRA parameters of the context-aware model and the parameters of the latent adapter. The LoRA rank, scaling factor, and dropout rate are set to 16, 32, and 0.05, respectively.
We use paged 8-bit AdamW as the optimizer, with initial learning rates of for both the LoRA parameters and the latent adapter. The learning rate decays linearly to . The weight decay is set to 0. The loss weights and are set to 0.3 and 1.0, respectively. The KL loss weight is warmed up over the first 20% of training steps.
A.2 Inference Configuration
During inference, each tool observation is compressed into 128 continuous latent tokens and directly injected into the target agent's input embedding sequence.
For web search, we retrieve up to 5 results per tool call and allow a maximum of 5 tool calls per task.
A.3 Hardware and Software
All experiments are conducted on 4 NVIDIA A100-SXM4 GPUs, each with 80 GB of memory.
Training. For Coca-Cola, the frozen target agent is distributed across 3 GPUs, while the context-aware encoder and the latent adapter are placed on the remaining GPU.
Inference. All inference results, including the runtimes reported in Tables 1 and 2, are obtained with the target agent running on a single GPU in all settings. Where an additional GPU is used, it hosts only the compression model.
B Web Search Agent Prompt
Figure 5 presents the prompt used to guide the agent in web-search-based question answering. The prompt specifies the search tool interface, the maximum number of search attempts, and the required final-answer format. It also provides an example of multi-step search to illustrate how the agent can iteratively retrieve information and reason over search results.
Web Search Reasoning Prompt
You are a reasoning assistant with the ability to perform web searches to help you answer the user's question accurately.
Search protocol
You have special tools:
- To perform a search: write
<|begin_search_query|> your query here <|end_search_query|>.
Then, the system will search and analyze relevant web pages, then provide you with helpful information in the format
<|begin_search_result|> ...search results... <|end_search_result|>.
You can repeat the search process multiple times if necessary. The maximum number of search attempts is limited to {MAX_SEARCH_LIMIT}.
Once you have all the information you need, continue your reasoning.
Remember:
-
Use <|begin_search_query|> to request a web search and end with <|end_search_query|>.
-
When done searching, continue your reasoning.
Example:
Question: "Alice David is the voice of Lara Croft in a video game developed by which company?"
Assistant thinking steps:
-
I need to find out who voices Lara Croft in the video game.
-
Then, I need to determine which company developed that video game.
Assistant:
<|begin_search_query|> Alice David Lara Croft voice <|end_search_query|>
(System returns processed information from relevant web pages)
Assistant thinks: The search results indicate that Alice David is the voice of Lara Croft in a specific video game. Now, I need to find out which company developed that game.
Assistant:
<|begin_search_query|> video game developed by Alice David Lara Croft <|end_search_query|>
Assistant continues reasoning with the new information...
Question & answer format
Please answer the following question. You should think step by step and solve it.
Provide your final answer in the format \boxed{YOUR_ANSWER}.
Question: {question}