In one line: Revives encoder-decoder soft-token compression by arguing its weakness was training scale rather than architecture: a 0.6B encoder (causal, window 1,024, mean pooling, MLP adapter, chosen in a from-scratch search of single runs with loss gaps of 0.002 to 0.022) plus a 4B decoder, trained end to end on 350B tokens at 4x/8x/16x, reaches its first token 4.7 to 8.8x sooner than FastKVzip at the same ratio (a baseline itself slower than not compressing; against no compression the gain is 1.45x at 4K and 4.5x at 64K) and cuts peak memory at long context, while staying within about 2.6 RULER points of uncompressed at 4x; the slower KV methods remain more accurate on RULER at 4x and 8x. The standard KV layout lets the decoder run in standard engines (the released vLLM path runs encoder and decoder as separate processes), and an EXPAND agent recovers 17 to 20 points on RULER needle tasks at 16x (a codebase is illustrated, not evaluated).
How far to trust it: Believe the systems result: shrinking the sequence before the decoder sees it cuts time and memory, by a lot at long context, and the released checkpoints let anyone check. Treat the quality claims more carefully: at 4x and 8x the slower KV methods are still more accurate on RULER, the 8.8x headline is measured against a baseline that is itself six times slower than not compressing at all, the 16x points in Figures 1 and 5 sit 1.5 to 2.8 points above the paper's own Table 6, and several architecture choices rest on single-run loss gaps of 0.003 to 0.02 that the downstream tables do not always confirm. The evidence, judged.
The idea in one sentence: shrink a long prompt before the decoder reads it: a small encoder turns every N tokens into one latent token, so the 4B decoder prefills and caches T/N positions instead of T, while KV cache compression evicts entries only after paying for the full prefill; trained end to end on 350B tokens, it is the only method in the paper faster than not compressing, at a cost of about 2.6 RULER points at 4x.
KV compression pays for the whole prefill first; the LCLM never does
Times and peak memory: the paper's Figure 4, read from its vector paths (one H200, one sample, mean of 30 runs); peak memory includes both models' weights, 9.24 GB. Cache sizes are computed from the released config. Any length and ratio: the Simulate a long prompt tab.
You need: how a KV cache grows with context and what eviction does (Long context), and why a paged engine cannot always reclaim what eviction frees (Batching, KV cache and scheduling). New terms: latent token (one continuous embedding standing for a block of N tokens); compression ratio N (tokens per latent: 4, 8 or 16); encoder window W (how many tokens the encoder reads in one pass, 1,024 here); adapter (the MLP that maps encoder width to decoder width); TTFT (time to first token); EXPAND (the agent's tool that swaps a compressed chunk back for its text); systems-realisable (a cache saving an engine can actually free).
Long-context inference is bottlenecked by memory, because the KV cache grows with context length (§1; the sizing in general is on Long context). For the decoder used throughout this paper, Qwen3-4B-Instruct-2507 (36 layers, 8 key-value heads of 128 dimensions), every token of context costs of keys and values in bf16, so a 256K-token prompt needs of cache before the model writes a word (derived from the released decoder config: 2 × 36 × 8 × 128 × 2 bytes).
The established fix is KV cache compression: prefill normally, then evict entries by some heuristic (eviction policies compared on Long context; this paper's baselines are SnapKV, Expected Attention, KVzip and Attention Matching, §2, Appendix B). It has four practical problems the paper is blunt about:
The paper adds a distinction worth keeping: algorithmic or theoretical cache reduction (entries masked or subsampled from a full cache, non-uniform per head) is not systems-realisable cache reduction, which needs kernels that "have not been released or even implemented" (§6.1).
The alternative is soft-token compression: an encoder turns raw tokens into a much shorter sequence of continuous embeddings, which the decoder reads in place of the context. In principle this is better shaped: compression is parallelisable, it works in standard inference engines, and it can extend the decoder past its native context length. In practice the existing methods (gist tokens, ICAE, AutoCompressor, xRAG, REFRAG and others) either degraded the base model noticeably or only worked after task-specific finetuning, so they lost to KV cache compression on the accuracy-efficiency frontier; none was tested on information-dense long-context suites such as RULER (§1, §2).
The question: is that loss intrinsic to the encoder-decoder shape, or did nobody train one properly? Can a general, task-agnostic compressor keep a strong model's abilities?
Not compressing. Every KV method first does the full prefill and then adds scoring work on top, so its time to first token (TTFT) can only be at or above the uncompressed model's. These are the paper's own measurements on one H200 at one sample, read from the vector paths of Figure 4 (method in the Tables tab); move the context length:
KV methods' times do not depend on the target ratio (one bar each). A method is missing where the paper's runs stopped: every KV method and the uncompressed decoder stop at 256K. The LCLM is the only method faster than not compressing, because it shortens the sequence before the decoder's prefill.
An LCLM is three trained parts in a row (§3, Figure 3 left):
The encoder window W is a separate knob from the ratio N. With W = N, as in prior work (REFRAG, the work of Liao et al.), each forward pass sees only the block it compresses. With W = T the encoder reads the whole input at once. The paper settles on W = 1,024 at N = 16: each latent summarises 16 tokens that were read in the context of up to 1,024. The three pooling operators of the search (Appendix D.1):
The adapter is a LLaVA-style two-layer MLP applied to each latent on its own; an attention-based alternative was also searched.
The adapter is the LLaVA-style projector: RMSNorm, then a two-layer MLP with GELU, applied to each latent on its own, sm = W2 GELU(W1 RMSNorm(zm) + b1) + b2 (Eq. 7 to 8). In the released 16x checkpoint it maps 1,024 dimensions to 2,560 through a hidden width of 2,560: parameters (shapes from the adapter weights' header). The attention-based alternative adds one self-attention layer over the latents before the MLP (Eq. 9 to 11).
Drawn with 64 input tokens so every token is visible. The paper's default is N = 16 and W = 1,024, which is 64 blocks per window: much wider, relative to the block, than the "64 (all)" setting here. Which tokens can influence a latent follows from the mask and the window; how much they do is learned.
The goal is to keep a strong model's abilities, not to win one task, so the data is broad (§4). Three kinds are mixed (§4.1, Figure 2):
<|memory_start|> and <|memory_end|>) and normal tokens, and the next-token loss is taken only on the uncompressed tokens. Prior work compressed the first half and trained on the second; interleaving teaches the model to condition on latents at many positions, not only at the start.Why mix them is the instructive part (App. C.1). Reconstruction alone gives a model that reconstructs with negligible loss and "cannot perform any other tasks, even when the LLM decoder is kept frozen": a general form of prefix tuning. Next-token prediction alone gives latents that support generation but lose exact strings. Neither failure is shown with numbers; both are "early experiments".
Pre-training mixture: Common Crawl text, code, science and reasoning, long-context and instruction-style data, mostly NVIDIA's Nemotron sets plus about 500K long documents from OLMo-3's longmino (App. C.1). SFT: outdated completions relabelled with Qwen3-30B-A3B-Instruct-2507 and Qwen3-235B-A22B-Instruct-2507 (Apache-2.0 checkpoints), plus three synthetic long-context corpora: repository summarisation, document summarisation and repository-level code generation (App. C.3). Reconstruction: code, text, long documents, maths and LaTeX, with a bank of 100 prompt templates per source to stop the model overfitting one phrasing (App. C.2).
Raw documents get a fixed alternation that starts with a wrapped (compressed) segment and ends with an unwrapped one. Documents over 16,384 tokens keep 8,192 trainable tokens; shorter ones keep half. Segment pairs: 1 under 2,048 tokens, 1 to 2 up to 4,096, 2 to 4 up to 8,192, 4 to 6 up to 16,384, 4 to 8 above. The first wrapped segment holds 30% to 40% of the wrapped tokens and the last unwrapped segment 40% to 50% of the trainable ones.
Conversations are wrapped per message: with probability one half the whole message is enclosed; otherwise 1 to 3 wrapped regions are placed inside it (1 region for 32 to 200 tokens, 1 to 2 for 200 to 600, 1 to 3 above; messages under 32 tokens are always fully wrapped), covering 80% to 100% of the message with a 5% unwrapped gap where feasible, falling back to full wrapping below 70% coverage (App. C.4). Training packs several examples per sequence with a block-diagonal mask so they cannot see each other (App. E.4).
Staged training (§4.2, Table 1): Stage 0 trains the adapter only; Stage 1 unfreezes the encoder; Stage 2 unfreezes the decoder at a small learning rate (1e-5 against 6e-5); Stage 3 is SFT with the decoder at 3e-5. Training everything end to end from the start "underperforms": the decoder is not used to the encoder's output, both sides take large gradients, and the model degrades. It is the same align-then-finetune shape as vision-language model training (LLaVA, Cambrian). Variants that freeze the decoder or use LoRA, which is what most prior work does, "substantially underperform" (early experiments, no numbers).
The models (§5): a Qwen3-Embedding-0.6B encoder and a Qwen3-4B-Instruct-2507 decoder, trained at 4x, 8x and 16x. Training ran on 32 nodes of 4 AMD MI300A GPUs each.
This is the part anyone building a compressor would otherwise have to guess. The authors pretrain many variants from scratch, in a cleanroom: Qwen3-0.6B's architecture on both sides, all weights randomly initialised with one seed, everything trained end to end, 38B tokens per variant at N = 16 (§5). Starting from scratch matters because the pre-trained Qwen3-Embedding encoder already uses a causal mask and EOS pooling, which would bias the comparison. Four findings:
Also at scale (App. E.1): an encoder initialised from the embedding model (Qwen3-Embedding, itself trained from the LLM) beats one initialised from the LLM, with the gap narrowing over training.
0.022: the best design ends at 1.169 and the worst two at 1.191. These are the printed call-outs of Figure 3 (a 100-step running average at step 10,000; one run each), drawn on a scale that starts at the best value:
Read the gaps against the curves' own wiggle: in the figure the running average still moves by about 0.01 to 0.02 within a few hundred steps, and there is one seed per variant. The window step from 256 to 1,024 is 0.003; mean against concat is 0.002. Two things the figure shows that the text does not say: at W = 16, token pooling (1.182) is as good as mean pooling (1.183), so "mean beats token pooling" holds only with a wide window; and bidirectional attention and EOS pooling at W = 1,024 tie for worst.
Do the choices hold at scale? The authors check each one in the full pipeline (pre-trained 0.6B encoder and 4B decoder) on loss (Figures 8 to 10) and downstream (App. G.4). Side by side:
| Claim | From scratch (Fig. 3, 9) | At scale, loss | At scale, benchmarks | Holds? |
|---|
Loss values are the figures' printed call-outs (Figure 3's plot is a raster image; the others are vector text in the e-print, checked by recompute.py). Benchmarks are Tables 20, 26, 30 and 31; the seven columns are RULER 4K, 8K and 16K, LongBench English and Chinese, LongHealth and GSM8K. The Tables tab has every row.
Evaluation is mostly long-context: RULER (synthetic stress tests, 4K to 16K; the benchmark itself is on Long-context and multimodal benchmarks), LongBench (16 English and 5 Chinese subtasks) and LongHealth (clinical multiple choice over five concatenated patient records, about 64K tokens, no chain of thought). Instructions stay as normal tokens; only the long context is compressed (§6, Table 5). GSM8K is the odd one out: the whole prompt is compressed. Baselines are SnapKV (plain, query-aware and self-study), Expected Attention, KVzip, FastKVzip and Attention Matching (fast and slow), all on the same Qwen3-4B decoder (§6.1).
A new frontier on time to first token against accuracy. In Figures 1 and 5 KV methods appear as vertical lines: they prefill the whole context whatever the target ratio, and eviction is cheap next to prefill, so their time barely moves; a higher LCLM ratio removes decoder work directly (§6.2). The printed speed-ups, recomputed from the decoded points, all compare LCLM 4x with FastKVzip 4x:
| Panel | Printed | Recomputed | Accuracy, LCLM against FastKVzip | LCLM 4x against no compression |
|---|
Defaults reproduce every printed speed-up, independently (TTFT ratio of two decoded points, method in the Tables tab). The last column is the comparison the figure leaves out: the uncompressed decoder's own TTFT at the same length, from Figure 4.
Memory scales differently. From 4K to 1M tokens (Figure 4), the 16x model's peak memory stays flat at about 26 GB from 128K to 512K, because the encoder's batched activations (128 windows of 1,024 tokens, 131,072 tokens per pass) dominate until the decoder's prefill over the latents overtakes them; the 8x model is flat from 128K to 256K. Every KV baseline runs out of memory at 512K and 1M on the 141 GB H200, except that Attention Matching fails at 512K from numerical instability in its linear solver. At 256K the uncompressed decoder needs GB against GB for LCLM 4x and GB for 16x. At 4K everything costs about the same, GB, which is just the two models' weights in bf16 (computed from the configs: GB).
Every KV method is slower than doing nothing; the LCLM's memory goes flat. The paper's Figure 4, rebuilt from its vector paths, beside this text. In time, every KV method sits above the uncompressed line (they add scoring to a full prefill); switch to memory for the 16x model's flat stretch, and to the computed KV cache for what the decoder alone would hold.
Single sample, mean of 30 runs, one H200. The uncompressed decoder's line stops at 256K, which is also its maximum position (262,144 in the config).
Quality against the uncompressed decoder (Table 6, beside this text). At 4x the model is close to uncompressed and even above it on LongBench English (46.04 against 45.21). At 16x RULER 4K falls to 75.06 while GSM8K holds at 81.05, which is the notable one: 16x discards 93.75% of the positions of a short, dense maths problem where nearly every token matters (App. G.1). Most KV baselines collapse on GSM8K at 16x (none above 31.39), and SnapKV scores 0.08 at every ratio, which is one problem of 1,319; at 4x, though, KVzip reaches 89.08 against the LCLM's 91.05. LongBench Chinese drops furthest: 40.92 at 4x against 46.63 uncompressed, where KVzip keeps 47.45.
Scaling cuts against "more understanding effort helps". Scaling the decoder from 4B to 8B lowered the end-of-stage-2 loss from 0.6884 to 0.6591; scaling the encoder from 0.6B to 4B only to 0.6860 (Figure 11). Downstream the picture is mixed (Table 4): the 4B encoder wins LongBench, LongHealth and GSM8K, the 0.6B encoder wins every RULER length, and the 8B decoder wins nothing but LongBench (37.80 against 37.33). Lower ratios give lower loss: 0.6643 at 4x, 0.6789 at 8x, 0.6884 at 16x.
The authors' reading: a bigger encoder buys better semantic aggregation and worse exact retrieval; the 8B decoder is a hybrid-thinking model that the 4B-tuned data may not suit, and the 4B instruct model already beats it uncompressed on several tasks (App. E.3).
Agents usually find information by lexical or semantic search, which fails when the right keyword is not obvious before reading: a bug reported in the "dashboard login flow" may live in an indirectly called entitlement module that never mentions "dashboard" or "login" (§7). An LCLM makes it cheap to put everything in context at once. The harness: cut the input into 512-token chunks, compress each, give each an integer id, and give the model one tool, EXPAND(i), which returns chunk i's original text; at each turn the model can expand or answer.
The test is RULER's needle-in-a-haystack tasks at 16x (Table 33): the agent lifts the 8-task average from at 4K, from at 8K and from at 16K, with the biggest gains on the hardest needles (ns3 and nm3, about +40 points each). For scale, the uncompressed decoder averages on the same eight tasks at 4K (Table 7). The codebase in Figure 6 is the motivating illustration; no code task is evaluated.
The hardest needles (ns3 and nm3, where the value to recall is a UUID in RULER's task config) are where compression loses most and where expanding recovers most: the latents still say where to look when the exact string is gone, which is why skim-then-expand works.
EXPAND brings back exactly one block. The bar chart's axis starts at 60, which makes the gap look larger than the +17 to +20 points it is. Figure 6 of Li, McLeish, Chen et al. (arXiv 2606.09659), CC BY 4.0.What holds up.
The weaknesses, concretely.
Unsaid in the paper: Table 4's LongBench column is the en16 and cn5 average weighted by subtask count, (16 × 39.08 + 5 × 31.74) / 21 = 37.33, unlike Table 6's en16 column.
Verdict. Believe the systems claim and the shape of the trade-off: an encoder that shrinks the context before the decoder buys large savings in time and memory at long context, keeps quality close to uncompressed at 4x, and works in standard engines. Discount the size of the win over KV compression (it is measured against baselines slower than doing nothing), keep in mind that the slower KV methods are still more accurate at 4x and 8x, and treat the architecture-search rankings beyond "W = N is bad" and "causal beats bidirectional" as provisional.
<|memory_start|> and <|memory_end|>.transformers.AutoModel nor vllm.LLM loads them alone. The vLLM path runs the encoder and decoder in separate processes that hand off a .pt file of embeddings, because vLLM takes all GPU memory at start-up and running both in one process runs out of memory (model card). So "works in vLLM" means the decoder half today.The paper's central systems claim, run on its own numbers: the same prompt through an LCLM, through KV cache compression and through the uncompressed decoder. KV methods compress after the decoder's full prefill; an LCLM shortens the sequence before it (§6.2). Move the context length from 4K to 1M and the ratio between 4x and 16x; the steps below follow the pipeline chosen above the figure, and the counters under it give the decoder's work, the cache and the measured time and memory.
LCLM, step by step
KV cache sizes are computed from the released configurations (bf16, 147,456 bytes per decoder position). Times and peak memory are the paper's measurements, read from the vector paths of Figure 4: one sample, mean of 30 runs after 20 warm-ups on one H200 (141 GB), Hugging Face Transformers implementations, encoder batch 128 windows (§6). The KV pipeline's scoring step is drawn generically; its time is FastKVzip's, the fastest KVzip variant, with the range across all KV methods beside it. The same comparison at one length and ratio (64K, 4x), in 3D, is the figure at the top of The paper.
The paper's Figure 4 (time and memory from 4K to 1M tokens, every method) is rebuilt inline in Results.
A trained toy LCLM (encoder, mean pooling, MLP adapter, decoder, as §3 and Appendix D define them) was built to test the architecture-search claims in the browser. In eight designs on CPU (from scratch as in §5, then with a pre-trained toy decoder as in §4.2), the 2-layer toy never learned key-value retrieval well enough to make its ablations meaningful, even when the decoder read the raw context; its logs are kept in src/model/pilot/. Rather than ship a model at chance, this page tests the paper's claims against its own tables and figures (the Tables tab).
Every number here is transcribed from the arXiv HTML at its printed precision (mk_tables.py) or decoded from the vector paths of the figures in the arXiv e-print (decode_figs.py); every derived number is recomputed in recompute.py, which runs checks against printed values, all passing.
The e-print ships Figures 1, 4 and 5 as vector PDFs. Each marker is a path with its own fill colour (matched to the legend swatches) and shape (circle 4x, square 8x, triangle 16x, down-triangle ratio-agnostic); its centre is converted to data units with the panel's own tick marks (log axes for time). Check: every decoded accuracy of a 4x or 8x LCLM point, and of almost every baseline, lands within 0.02 of Table 6, and the printed speed-ups (8.8x, 6.4x, 4.7x, 5.2x, 5.2x) come out at . No curve was read by eye.
Click a column to sort. Bold is the best compressed method in the column at this ratio. Sample sizes from score granularity: GSM8K 1,319 problems (standard error about 1 point near 80%), LongHealth 400 questions (about 2.2 points), RULER 500 per task over 13 tasks. Concat rows are printed at one decimal in the paper. Table 6.
One sample, mean of 30 runs, one H200. Empty cells: the method did not run at that length. The paper also plots SnapKV (self-study) here; its values are within 2% of SnapKV's. Figure 4.
Rows: the 16x LCLM alone, with the expand-or-answer loop, and the gain; the last row at 4K is the uncompressed decoder from Table 7 on the same tasks. Every printed gain and average recomputes exactly. Table 33.
Pre- and post-compression token counts; "trainable" is the tokens that carry loss. The rows of Table 2 sum to before compression, against the printed total of 283.78B (rounding). Licences as printed: "Nvidia" is the Nemotron licence.
Every link opens in a new tab. Reading time of the resources below: 5h 15m.
arXiv preprint, 2026, the paper itself; the HTML version has the anchors this page links to. abstract page, PDF.
(1h 30m)
training (four-stage pipeline from one YAML), Hugging Face and two-stage vLLM inference, and the EXPAND agent; the repository shows no licence (checked 3 October 2026), while the three checkpoints at huggingface.co/latent-context are Apache-2.0.
(20 min for the entry path)
Lin et al., Meta, 2025: the RAG-specific version of the same idea, with precomputable chunk embeddings and an RL policy choosing what to expand; useful as the narrower, more deployable sibling (the paper cites it for W = N token pooling).
(45 min)
Li et al., NAACL 2025: the map of the field this paper is arguing with, covering the gist, ICAE, AutoCompressor, 500xCompressor and xRAG lineage.
(1h)
Kim et al., 2025: the strongest KV baseline at 4x and 8x here; scores each cache entry by the attention it gets while the model reconstructs its own context.
(40 min)
NVIDIA: the library whose SnapKV, KVzip, FastKVzip and Expected Attention implementations and timing notebook the paper uses for every baseline.
(20 min)
Hsieh et al., NVIDIA, 2024: the synthetic suite behind the paper's headline: needle retrieval, multi-hop tracing, aggregation and QA, 13 tasks per length.
(30 min)
latent-context on Hugging Face: model cards with the configuration of each released model (encoder window 1024, mean pooling, causal encoder, MLP adapter, no overlap); Apache-2.0.
(10 min)
the other route to spending more parameters on reading than writing, restructuring the model rather than compressing the input; the two disagree on whether the encoder should be causal.
the same instinct applied to memory rather than input context, putting state in continuous latents so reads and writes are differentiable.
the KV cache layout this paper's baselines are constrained by, and the reason systems-realisability is a real distinction.
MLA compresses the KV cache inside attention, the same goal one layer down; it composes with this rather than competing.
the recursive-language-model direction the authors name as naturally compatible, where a compressed working memory is the substrate.
the other way to avoid a growing cache, a fixed-size recurrent state, with the same exact-recall cost that shows up here at high compression.
the encoder-decoder and the attention whose per-token KV cache this paper is trying to shrink.
the KV cache arithmetic for latent attention, animated token by token.
KV cache, TTFT, memory.
context compression for RAG, REFRAG.
skim-then-expand as a harness pattern.
This page is one row of the Papers database; its properties (Paper, Takeaway, Topics, Year) live there.