LCLM: End-to-End Context Compression at Scale — an analysis originally posted on zhichai.net.
> Paper: End-to-End Context Compression at Scale > Link: https://arxiv.org/abs/2606.09659 > Authors: Ang Li, Sean McLeish, Haozhe Chen, Nimit Kalra, et al. (NYU, Modal, UMD, Princeton, Columbia, Harvard, LLNL, FAIR at Meta) > Code: github.com/LeonLixyz/LCLM > Models: huggingface.co/latent-context
Key points
- Problem: KV caches grow linearly with sequence length (memory blowup), and long-range attention degrades. Existing fixes fall short:
- *KV cache compression* (SnapKV, KVzip, H2O): loses accuracy or requires full prefill before eviction, so peak memory is not reduced; query-dependent caches can't be reused across turns; non-uniform eviction is incompatible with vLLM/SGLang.
- *Soft token compression* (E2LLM, LLoCO, ICE): theoretically better, but prior work degrades model capability or needs domain-specific fine-tuning.
- *Hard token compression* (summarization, truncation): severe information loss.
- Architecture: Encoder (Qwen3-Embedding-0.6B) processes 1024-token windows → pooling compresses N tokens into 1 latent token → lightweight MLP adapter → Decoder (Qwen3-4B-Instruct-2507). Compression ratios: 4x, 8x, 16x. Parallel encoder batching handles 131,072 raw tokens per forward pass with bounded memory, and output remains a standard KV-cache-compatible format for vLLM/SGLang.
- Architecture search (Qwen3-0.6B as both encoder and decoder, 38B-token from-scratch pretraining):
- Mean pooling best at 16x; concatenation slightly better at 4x.
- Encoder window W=1024 is optimal; window overlap adds compute without gains.
- Causal masking beats bidirectional — matching the encoder's causal pretraining distribution.
- MLP-only adapter beats attention-based adapters.
- Scaling the decoder matters more than scaling the encoder; a 0.6B encoder actually outperformed a 4B encoder on RULER (likely overfitting at larger size).
- Four-stage training recipe (350B tokens) prevents catastrophic forgetting: (0) adapter warmup, (1) encoder training with frozen decoder, (2) end-to-end continued pretraining, (3) SFT. Pretraining data interleaves compressed and uncompressed segments so the model can rely on latent context anywhere; auxiliary reconstruction data with 100 prompt templates preserves fine-grained retrieval ability. Full-parameter training beats LoRA / frozen-decoder variants.
- Results (H200): LCLM defines a new Pareto frontier on RULER, LongBench, LongHealth and GSM8K.
- TTFT decreases linearly with compression ratio, whereas KV-eviction baselines stay flat (they prefill fully first).
- Peak memory is nearly flat from 128K to 512K tokens; all baselines OOM at 1M tokens while LCLM still runs.
- Largest accuracy advantage at high compression ratios (16x).
- Agent on-demand decompression: the context is chunked (512 tokens per chunk); the agent receives the full compressed context plus an
EXPAND(i)tool to restore chunk i to raw text. On RULER needle-in-a-haystack tasks, this matches uncompressed-model accuracy in some settings — compression provides global overview, the agent drills into details as needed. - Comparison with FlashMemory (a same-day paper): LCLM compresses raw tokens to latent tokens offline/online at 4x–16x with standard KV compatibility and agent decompression, but needs 350B-token training; FlashMemory selects/loads KV blocks online (~7.4x) with ~1 hour of training on a single H20 and accuracy gains, but requires engine modifications, fails MRCR, and has limited length generalization.
One-line takeaway
> LCLM turns soft-token compression from a concept into a practical tool: four-stage large-scale training (350B tokens) plus a search-derived causal mean-pooling encoder delivers a new speed-accuracy-memory Pareto frontier on H200, with agent-driven on-demand decompression closing the precise-retrieval gap — the first time soft-token compression genuinely rivals or beats KV-cache compression.
Glossary
| Term | Meaning | |---|---| | KV Cache | Attention key-value matrices; grows linearly with sequence length | | Soft token / latent token | Continuous vector representations replacing discrete tokens | | TTFT | Time-To-First-Token latency | | Pareto frontier | Optimal boundary across multiple objectives | | Causal masking | Attention restricted to preceding tokens | | Mean pooling | Averaging N hidden states into one | | NIAH | Needle-In-A-Haystack retrieval test | | RULER / LongBench | Long-context benchmark suites |
*Paper released: 2026-06-08; analysis draft: 2026-06-10; project status: open-source, models and code published.*