TL;DR
Models like DeepSeek-R1 and OpenAI's o1 achieve state-of-the-art reasoning by generating massive, step-by-step "Long Chain-of-Thought" (Long-CoT) sequences, but this comes with huge computational and memory costs. R1-Compress introduces a two-stage chunk-level compression and search framework that slashes token usage by roughly 20% while maintaining near-baseline accuracy. By compressing reasoning steps in chunks rather than globally or token-by-token, it successfully preserves crucial self-correction signals ("reflections") and linguistic coherence.
What Problem Does This Paper Address?
While Long-CoT reasoning drastically improves an LLM's performance on complex math and coding tasks, the sheer length of these reasoning chains creates a massive bottleneck. Long sequences slow down inference and cause KV cache memory usage to skyrocket, making deployment expensive and hardware-demanding.
Existing attempts to compress these reasoning chains fall into two flawed paradigms:
- Instance-level compression: Compressing the entire sequence at once (e.g., using GPT-4 to rewrite it). This tends to strip away vital local reasoning signals, such as "reflection" steps where the model pauses, catches an error, and self-corrects.
- Token-level compression: Pruning individual tokens dynamically. This preserves local details but frequently results in grammatically broken, incoherent text that deviates from natural language patterns, ultimately hurting the model's fine-tuning stability.
R1-Compress targets the sweet spot: compressing text enough to save hardware resources without destroying the model's internal logic or linguistic fluency.
Methods
R1-Compress operates at the chunk level using a two-stage framework: Inner-Chunk Compression and Inter-Chunk Search.
- Chunk Segmentation: The original long reasoning chain is broken into semantically meaningful chunks based on structural cues like double newlines (
\n\n) and a minimum token length constraint. - Inner-Chunk Compression: For each chunk, a powerful LLM (like LLaMA-3.1-70B-Instruct) generates multiple shortened candidate variations. Crucially, the prompt instructs the model not to omit reasoning steps, mistakes, or reflection markers (e.g., "wait", "hmm").
- Inter-Chunk Search: Because chunks are compressed independently, context can be lost between them. To fix this, the authors use a two-step greedy search mechanism:
- Length-based filtering: Discards the longest candidate chunks to prioritize brevity.
- Probability-based selection: Uses the base model to evaluate the remaining candidates, selecting the chunk that maximizes conditional probability given the preceding chosen chunks. This ensures the final concatenated sequence flows naturally.
- Supervised Fine-Tuning (SFT): The final, coherent, compressed CoT datasets are used to fine-tune the target base models.
Datasets
- Training: The authors sampled 5,000 examples from the OpenR1-Math-220k dataset, which contains math problems paired with reasoning traces generated by DeepSeek-R1. After applying filtering strategies (ensuring valid and matching answers), 2,513 samples were retained for training.
- Evaluation:
- MATH500: A standard benchmark of 500 high school competition math problems.
- AIME24: 30 highly challenging problems from the American Invitational Mathematics Examination.
- GPQA-Diamond: A difficult, graduate-level QA dataset used to test out-of-distribution generalization.
Key Insights and Ideas
- Reflections are non-negotiable: The authors proved that when instance-level compression methods remove self-correction phrases (like "Wait, let me recheck..."), accuracy plummets. Models need to see the process of making and fixing mistakes to retain high reasoning capabilities.
- Token-skipping breaks the language model's brain: Token-level pruning methods result in high token-level loss curves. LLMs struggle with disjointed text because it violates the natural language distributions they were pre-trained on. Chunk-level compression preserves local syntax, keeping the text "natural" to the model.
Key Results
The authors evaluated R1-Compress on Qwen2.5-14B-Instruct and Qwen2.5-32B-Instruct, comparing it against competitive baselines like CoT-Valve and TokenSkip.
- High Accuracy, Fewer Tokens: On the MATH500 benchmark with the Qwen2.5-32B model, R1-Compress achieved 92.4% accuracy—a negligible 0.6% drop from the uncompressed Long-CoT baseline (93.0%). Crucially, it reduced the average valid token length by 20% (from 2406 down to 1949 tokens).
- Out-of-Distribution Generalization: On GPQA-Diamond, R1-Compress achieved a significant token reduction (saving over 1,000 tokens on the 14B model) while outperforming token- and instance-level baselines in accuracy.
- Reflection Retention: R1-Compress successfully preserved roughly 78% of the reflection steps found in the original DeepSeek-R1 traces, far outperforming methods like C3oT, which wiped them out almost entirely.
Limitations and Future Work
Despite its success, the authors note a few limitations:
- LLM Randomness: Because the inner-chunk compression relies on LLM generation, variations in prompts, model choice, and sampling parameters mean that high-quality compression cannot be 100% guaranteed for every single instance.
- Residual Incoherence: While the inter-chunk search drastically improves continuity, minor contextual slips between chunks can still occur.
The authors conclude that compressing Long-CoT efficiently without losing reasoning depth remains an open, fertile ground for future AI systems research.
Summary updated