Introduction
The "long context" problem is a primary bottleneck for Large Language Models (LLMs). Standard Transformer architectures suffer from quadratic computational complexity, causing memory and processing time to explode as input sequences grow. Existing solutions, such as attention sparsification or fixed-length compression (e.g., "gist" tokens), often struggle with performance degradation or lack the flexibility to adapt to varying document lengths.
DODO (Dynamic Contextual Compression) introduces a novel approach by dynamically selecting a subset of "nugget" tokens to represent the context. By using a differentiable selection process, DODO achieves up to 20x context compression with nearly lossless reconstruction, outperforming fixed-length methods in language modeling, QA, and summarization.
Methodology
DODO implements dynamic compression within a decoder-only architecture through several key technical innovations.
The Scorer and Nugget Selection
DODO employs a "Scorer"—a two-layer MLP—to evaluate hidden states from an early layer (typically layer 3). The Scorer assigns a score to each token, and those with the highest scores are selected as "nuggets." Only the KV cache for these nuggets is preserved for future layers, significantly reducing the computational footprint of self-attention.
Differentiable Selection and Mixed Resolution
To enable end-to-end training, DODO uses a Straight-Through Estimator (STE) for the top-k selection process. This allows gradients to flow through the discrete selection operation, teaching the model which tokens are most critical for predicting subsequent tokens. Additionally, DODO uses a mixed-resolution approach: the most recent $\tau$ tokens are kept in full resolution, while older "distant" tokens are compressed into nuggets.
Experimental Results
The model was evaluated across standard benchmarks, including The Pile, WikiText-103, SQuAD, and CNN/DailyMail, using LoRA for parameter-efficient adaptation of LLaMA models.
Autoencoding and Efficiency
In autoencoding tasks, DODO demonstrated remarkable fidelity, achieving a BLEU score of 98% even at 20x compression. This indicates that LLM hidden states possess significant redundancy that can be pruned without losing semantic meaning. In memory-restricted settings, DODO's perplexity (4.01) significantly outperformed full models that were forced to truncate their history (4.94).
Downstream Task Performance
- Summarization: On CNN/DailyMail, DODO with 10x compression achieved a 39.9 ROUGE-1 score, notably outperforming a fine-tuned full LLaMA model (37.7).
- Question Answering: On SQuAD, DODO (5x compression) reached 59.1% accuracy, remaining competitive with the uncompressed baseline of 64.5%.
Discussion and Insights
A key finding is that DODO naturally learns to select clausal text delimiters—such as periods, commas, and conjunctions—as nuggets. This suggests the model identifies these tokens as structural anchors that summarize the preceding clause's meaning. Furthermore, unlike fixed-length methods, DODO’s performance scales with input length because its memory grows proportionally with the data.
Conclusion
DODO demonstrates that dynamic, learned compression is a viable path for scaling LLMs to long contexts. By identifying and preserving only the most informative "nuggets," DODO maintains high performance across diverse tasks while drastically reducing the costs associated with long-sequence processing.
Summary updated