Parallel Context Compaction
What You'll Learn
- Why long agent histories create a context-management problem before a model reaches its advertised window limit.
- How the paper partitions a conversation, dispatches prefix-aware workers, and merges block summaries in order.
- What the HotpotQA and LoCoMo experiments actually show about accuracy, latency, throughput, and token volume.
- Which production checks matter before adopting parallel compaction in a coding agent, support workflow, or tool-using system.
Parallel Context Compaction Is a Serving Design, Not a Bigger Context Window
Parallel Context Compaction addresses a practical problem in long-horizon agents. A coding agent, research assistant, or workflow runner accumulates user messages, tool outputs, intermediate decisions, and model responses in one conversation. That history grows with every turn. Eventually, the system either exceeds the model’s hard context limit or becomes slow and noisy long before reaching it.
Compaction replaces part of the old history with a shorter representation. The goal is not to preserve every token. The goal is to keep the facts, decisions, constraints, and tool state that the next step still needs. That is a lossy operation by definition. A shorter summary can be easier for a model to use, but it can also remove a file path, a failed experiment, a user preference, or an unresolved assumption that later becomes important.
The paper by Musa Cim, Burak Topcu, Chita Das, and Mahmut Taylan Kandemir, submitted to arXiv on May 22, 2026, studies this problem as a serving-system question. It compares the usual single blocking compaction call with a block-based parallel design. The paper is not a claim that context windows are obsolete, and it is not a promise that any agent will become 10x faster.
This distinction matters because context length, context quality, and serving latency are different variables. The site’s Planning in the LLM Era analysis makes the same system-level point from the planning side: a capable agent still needs a controlled working state. A model may accept 128k or 1M tokens while still losing signal inside a long history. A summary may be shorter while omitting a critical detail. A parallel design may reduce the time spent in compaction while increasing generated summary tokens. A useful implementation measures all of these separately.
Why Sequential Compaction Creates Summary Lag
The conventional design waits until the conversation crosses a threshold, sends the entire history to a summarization model, waits for one output, and then resumes the agent. The agent is blocked during that call. If the history is large, the summarizer must process a large prompt and generate a summary before the user or tool loop continues.
The arXiv paper reports two reasons this baseline is difficult to control. First, the output length does not grow in proportion to the input length. In its motivating sweep, input grows from 2,048 to 98,304 tokens, approximately 48x, while average output grows by only about 3x. The displayed output-to-input ratio falls from 47.9% at 2,048 input tokens to 3.1% at 98,304 input tokens.
Second, the content and length of a generated summary vary across repeated runs. The paper measures output-length coefficient of variation and semantic similarity across repeated compactions. Longer inputs generally make the retained content less predictable. That matters more than a simple token count because two summaries with similar lengths can preserve different facts.
The paper also measures the share of end-to-end time consumed by synchronous compaction. It reports that compaction can consume up to 62% of HotpotQA execution under a low threshold, with displayed examples of 62.4% for Llama-3.1-8B and 51.3% for gpt-oss-20B at a 16k threshold. These are experimental measurements, not a benchmark for every production stack.
| Sequential-compaction issue | What happens | Why it matters | What to measure |
|---|---|---|---|
| Blocking call | The agent waits while one summarization request runs | User-visible latency and tool-loop stalls | Compaction share of end-to-end wall time |
| Unstable output length | Summary volume shifts across repeated calls | Memory budgeting becomes less predictable | Output tokens and coefficient of variation |
| Lossy selection | The model decides what to retain and what to omit | Downstream answers may lose key evidence | Task success and fact-retention tests |
| Prompt dependence | Length instructions do not guarantee a target volume | Prompt wording is a weak capacity control | Output volume across prompt variants |
How the Parallel Design Partitions a Conversation
The paper’s design begins by taking a snapshot of the current conversation when the compaction threshold is crossed. It records the snapshot length and partitions the history into contiguous blocks. The block size is a configuration knob. A smaller block creates more workers. A larger block creates fewer workers and more work per request.
Each worker receives a prompt containing the conversation prefix through its target block. The target block is marked and placed at the end of the visible prompt. The workers are then dispatched concurrently to the serving engine. When they finish, their summaries are concatenated in block order to form the compacted history.
This is not simple independent chunk summarization. If every worker sees only one isolated chunk, it loses the earlier context that may explain a reference or dependency. It is also not a full repeated prompt with a marker at a different position for every worker, because that can prevent prefix reuse. The paper’s prefix-aware target-at-end layout is intended to preserve causal context while allowing a shared prefix to be cached.
The output is still a set of generated summaries. Parallelism does not make summarization lossless, and it does not make the model’s marker interpretation perfect. That boundary is relevant to the Agent JIT Compilation discussion, where serving overhead can accumulate across every tool and model step. The paper notes that the evaluated models were not fine-tuned specifically to attend to the XML target markers. That is a real boundary for systems that depend on exact block ownership.
What the Paper Actually Evaluated
The evaluation uses four model backbones: Llama-3.1-8B, gpt-oss-20B, Llama-3.3-70B, and gpt-oss-120B. The set spans 8B to 120B parameters, dense and mixture-of-experts architectures, and reasoning and non-reasoning models. That variety is useful, but it does not cover every serving engine, model family, quantization choice, or workload pattern.
The benchmarks are HotpotQA and LoCoMo. HotpotQA supplies multi-hop questions based on Wikipedia documents. LoCoMo supplies long multi-session conversations with multiple questions. The paper uses Qwen3-30B as an independent language-model judge, run deterministically and blind to the backbone model, rather than using the same model to evaluate its own output.
The multi-turn system-level experiment fixes the compaction threshold at 96k tokens and sweeps block sizes of 16k, 8k, 4k, and 2k tokens. Smaller blocks mean more concurrent workers and generally more generated summary tokens. That creates the core tradeoff in the paper: more summarized material can help downstream task accuracy, but it can also increase compute, queue pressure, and total output.
| Evaluation dimension | Paper setup | What it tests | What it does not establish |
|---|---|---|---|
| Backbones | Four models from 8B to 120B | Behaviour across model sizes and architectures | Performance for every commercial or open model |
| Benchmarks | HotpotQA and LoCoMo | Multi-hop evidence retention and long dialogue | Every coding, browsing, or enterprise workflow |
| Judge | Qwen3-30B, independent and blind | Downstream answer quality | Human evaluation of all tool-state failures |
| Threshold and sweep | 96k threshold, 16k to 2k blocks | Worker count and summary-volume tradeoffs | Optimal settings for a different context budget |
Accuracy Improves With More Summary Output, But Never Becomes Perfect
The paper’s Figure 4 compares downstream answer accuracy for sequential compaction and parallel block sizes. As the block size decreases, more workers run and total compaction output generally increases. The paper reports that accuracy improves over the sequential baseline across the sweep because more information survives into the summary.
That finding is easy to misread. The paper explicitly says accuracy does not reach 100% even at the smallest block size. Downstream performance is also bounded by the reasoning capability of the backbone model. Parallel compaction can preserve more context without guaranteeing that the model will use that context correctly.
The correct production question is not “Did the summary become shorter?” It is “Did the next task succeed with the facts and state that the task required?” For a coding agent, that may mean retaining the current branch, test failure, file path, and unresolved implementation task. For a support agent, it may mean preserving the customer’s entitlement, prior troubleshooting, and escalation boundary. A generic QA score will not expose every failure class.
The paper’s results also show why active context size should not be treated as a quality metric by itself. A 90% reduction may be useful if redundant conversation is removed. It may be harmful if the removed 10% contained the only exact command or constraint that the next tool call needs.
Throughput Results Are Mixed, Not a Universal Speedup
The old article described a 4-15x throughput improvement as though it were a general result. The paper does not support that framing. Table 7 and Table 8 show a mixed full sweep. Some block sizes improve end-to-end throughput, some are close to baseline, and some regress.
In the HotpotQA table, examples include 1.41x end-to-end throughput for gpt-oss-20B at a 4k block, 1.76x for gpt-oss-120B at 4k, 1.21x for Llama-3.1-8B at 2k, and 1.08x for Llama-3.3-70B at 4k. The same table includes lower results such as 0.86x for gpt-oss-20B at 16k and 0.80x for gpt-oss-120B at 16k.
LoCoMo shows the same dependence on model and block size. The paper reports 1.73x for gpt-oss-120B at 8k, 1.21x for Llama-3.1-8B at 2k, and 1.31x for Llama-3.3-70B at 2k. It also reports lower results such as 0.96x for gpt-oss-20B at 2k and 0.89x for Llama-3.1-8B at 16k.
Table 9 narrows the comparison to selected runs with comparable compaction decode volumes. Those four comparisons report throughput changes of 2.13x, 1.70x, 1.49x, and 1.37x. This is the most defensible headline range from the paper, but it remains a selected matched-volume comparison rather than a promise for arbitrary production agents.
| Reported comparison | Configuration | Measured result | Interpretation |
|---|---|---|---|
| Matched decode volume | Llama-3.3-70B on HotpotQA, 4k block | 2.13x throughput | Selected comparison, not a universal gain |
| Matched decode volume | Llama-3.3-70B on HotpotQA, 8k block | 1.70x throughput | Different block size changes the result |
| Matched decode volume | gpt-oss-20B on LoCoMo, 8k block | 1.49x throughput | Benchmark and model dependent |
| Matched decode volume | Llama-3.1-8B on HotpotQA, 4k block | 1.37x throughput | Selected matched-volume result |
| Full sweep | Several models and block sizes | Gains and regressions | End-to-end measurement is mandatory |
Prefix Caching Saves Prefill, Not Every Millisecond
The paper’s serving design depends on shared prefixes. vLLM’s official Automatic Prefix Caching documentation explains that a new query can reuse the KV cache of an existing query when the prefix matches, allowing the engine to skip computation for the shared part.
That benefit applies primarily to prefilling. The vLLM documentation explicitly says prefix caching does not reduce the time spent generating new tokens during decoding. If the answer is long, or if requests do not share the same prefix, the cache may not produce the expected end-to-end improvement.
This is why the target-at-end layout matters. Each worker sees a prefix that extends through its target block. Earlier prefix work can be reused, while the worker’s unique target content still requires processing. At larger block sizes, that uncached work can dominate. The paper identifies prefill cost as a reason that 16k blocks can perform worse than smaller blocks.
For a real deployment, cache hit rate must be logged rather than inferred from the prompt template. Small changes in system instructions, tool descriptions, message ordering, serialization, or marker placement can change the token prefix and destroy reuse. A diagram that looks parallel at the application layer can still be mostly repeated prefill at the GPU layer.
Production Failure Modes Are More Important Than the Diagram
A prototype can assume that every worker finishes, every summary is valid, and every marker is interpreted correctly. A production agent cannot. The coordinator needs deadlines, retry rules, partial-result handling, and a policy for abandoning compaction when the user or tool loop is waiting.
The first failure mode is state loss. Tool outputs may contain exact JSON keys, shell commands, file paths, identifiers, or error messages that a prose summary changes or omits. The safe design stores critical state outside the summary and treats compaction as a derived view of that state.
The second is ordering. Per-block summaries must be merged in the original causal order. A worker returning late must not move its block after a later block. The coordinator should attach sequence numbers and verify that all expected blocks are present before replacing the active history.
The third is cost. More workers can generate more summary tokens. A design that cuts compaction latency but doubles output tokens may increase cost and queue contention. It may also make the downstream context larger than the sequential baseline.
The fourth is recovery. If one worker fails, the system needs a policy. Teams working on enterprise agent security should also treat a partial compaction as a state-integrity event, not just a latency event. It can retry the block, fall back to sequential compaction, keep the previous history, or ask for a fresh snapshot. Silently merging an incomplete summary is the worst option because the agent may continue with missing context while believing the compaction succeeded.
API Compaction and Research Compaction Solve Different Problems
Server-side compaction is now exposed by major model platforms, but those features are not identical to the arXiv design. Anthropic’s platform documentation describes compaction as a beta feature that triggers at a configured input-token threshold, creates a compaction block, and continues with the compacted context. Its documentation shows a default trigger of 150,000 input tokens and a minimum supported trigger of 50,000 tokens.
OpenAI’s official documentation describes server-side compaction in the Responses API through a compact threshold. It also documents a standalone compaction endpoint for stateless workflows. The returned compaction item carries forward state in an encrypted, opaque representation that is not intended to be human-interpretable.
The distinction is practical. The paper’s block summaries are human-readable text produced by workers that the operator can inspect and merge. That is different from the dynamic workflow patterns used by hosted agent systems, where the provider may control more of the state representation. A hosted API may return an opaque state object with product-specific retention and chaining behavior. Both approaches reduce the context sent to later turns, but their debugging, portability, and audit properties differ.
Teams should not mix these claims. Anthropic or OpenAI documentation can establish that a product supports compaction. It cannot establish that the arXiv parallel design produces the same latency, accuracy, or token economics on that product. Conversely, the paper’s vLLM experiments do not describe the exact behavior of a hosted server-side compaction API.
| Approach | State representation | Control surface | Primary tradeoff |
|---|---|---|---|
| Paper’s parallel compaction | Human-readable per-block summaries | Block size, worker count, prompts, merge order | Coordinator complexity and generated-token cost |
| Anthropic server-side compaction | Compaction block in the API conversation | Trigger and custom instructions | Beta availability and provider-specific behavior |
| OpenAI server-side compaction | Encrypted opaque compaction item | Compact threshold and response chaining | Less human-readable state |
| External memory and retrieval | Structured records or retrieved documents | Schema, indexing, retrieval, retention | Retrieval misses and synchronization work |
How a Senior Developer Should Implement a Trial
Start with an evaluation harness, not a production traffic switch. Record the same conversation traces and replay them against sequential compaction and parallel compaction. Use realistic tool outputs, long error messages, code diffs, and user corrections. A synthetic chat with repetitive prose will hide the state-loss problem.
Measure at least six dimensions. Record end-to-end wall time, compaction wall time, prefill time, decode time, total generated tokens, and cache hit rate. Then measure downstream task success, factual retention, tool-call correctness, and recovery after a worker timeout. A speedup without task success is not a serving improvement.
Test block sizes as a sweep rather than choosing 2k or 4k from the paper and assuming it transfers. The paper’s results change with model, benchmark, and block size. The right setting for a coding agent with large tool outputs may not be the right setting for a customer-support dialogue with short turns.
Keep durable state outside the summary. Store task identifiers, file manifests, user permissions, tool schemas, selected configuration, and unresolved failures in structured records. Let the summary explain the state, but do not make the summary the only copy of the state.
Finally, define a rollback rule. If accuracy drops, cache hit rate falls, worker failures rise, or cost exceeds the sequential baseline, the coordinator should be able to disable parallel compaction without losing the original conversation. The ability to turn off an optimization is part of the design, not an afterthought.
What Parallel Context Compaction Means in Practice
The paper establishes a useful direction: a long history does not have to be summarized by one synchronous call over the entire snapshot. Prefix-aware blocks can create concurrent work, expose a block-count control over summary volume, and improve compaction throughput in selected comparisons.
It also establishes the limits. The method is lossy. Accuracy does not reach 100%. End-to-end results vary by model and block size. Prefill can erase the benefit of parallelism. The current design still waits for all workers, uses fixed block size and one prompt, and has not been fine-tuned for marker awareness.
The strongest implementation lesson is therefore not “parallel is faster.” It is “parallelism changes the cost and quality tradeoff.” It gives the coordinator more knobs, but each knob adds a failure mode. The only credible deployment decision comes from replaying real traces and measuring task success, latency, cache reuse, token cost, and recovery behaviour together.
For developers building long-running agents, compaction is one layer of context engineering. It also belongs beside the site’s AI forecasting discussion, because long-horizon reliability depends on how evidence is retained and evaluated, not only on how fast tokens are served. The surrounding system still needs explicit memory, retrieval, tool-state protection, observability, and a clear policy for what may be forgotten. A smaller context is useful only when the next action still has the information it needs.
Conclusion: Measure the Whole Agent, Not Just the Summarizer
Parallel Context Compaction is a research-backed serving pattern for distributing context summarization across prefix-aware workers. The arXiv paper evaluates it on four model backbones and two long-horizon benchmarks. Its selected matched-decode comparisons report 1.37x to 2.13x throughput improvements, while the full sweep contains both gains and regressions.
The paper does not prove a universal 4-15x speedup, perfect reasoning preservation, or a turnkey production architecture. Its strongest contributions are more specific: predictable control over summary volume through block count, a prefix-aware layout that can reuse shared prefill work, and measurements that expose the latency and instability of sequential compaction.
Use those contributions as an evaluation plan. Protect critical state outside summaries, replay real traces, measure the end-to-end path, and keep a sequential fallback. Compaction is successful only when the next agent action remains correct at an acceptable cost.
Frequently Asked Questions
SK Jabedul Haque
Building India's most trusted finance education platform — simplifying news, schemes and market trends so anyone can understand and invest confidently.
Read full bioNever miss an update
Get our clearest explainers on schemes, markets and money — read what matters, without the noise.
Explore more articles