TokenSkip: Controllable Chain-of-Thought Compression in LLMs

Heming Xia, Yongqi Li, Chak Tou Leong, Wenjie Wang, Wenjie Li · DOI

TL;DR

Large Language Models (LLMs) use Chain-of-Thought (CoT) prompting to improve reasoning, but longer CoTs lead to slow inference. This paper introduces TokenSkip, a method that intelligently prunes less important tokens from CoTs, enabling significant compression with minimal impact on reasoning accuracy. TokenSkip allows for controllable CoT reduction, making LLM reasoning more efficient without sacrificing performance.

What Problem Does This Paper Address?

Chain-of-Thought (CoT) prompting has become a cornerstone for enhancing LLM reasoning capabilities. Recent research suggests that longer CoT sequences can further boost performance. However, the autoregressive nature of LLM decoding means that generating more tokens directly translates to increased inference latency and memory usage. This becomes a significant bottleneck, especially when CoTs extend to thousands of tokens, negatively impacting user experience. The core problem is finding a way to maintain the benefits of detailed reasoning (CoT) while mitigating its computational cost.

Methods

The authors propose TokenSkip, a method for controllable Chain-of-Thought compression. The core idea is that not all tokens in a CoT contribute equally to the final answer. TokenSkip operates in two main phases:

  1. Token Pruning:
    • They first analyze the semantic importance of tokens within CoT outputs. This is done using a pre-trained importance metric (LLMLingua-2).
  2. Based on a desired compression ratio ($\gamma$), they identify and prune tokens with lower importance scores. This effectively creates "shortcuts" between critical reasoning steps.
  3. The pruning process is guided by a $\gamma$-quantile of token importance scores, acting as a threshold.
  4. Fine-tuning:
    • The LLM is then fine-tuned on these compressed CoT trajectories. This teaches the LLM to generate CoTs in a compressed format, skipping less important tokens during inference.
  5. To ensure robustness, a portion of original, uncompressed CoTs are also included in the fine-tuning data.

Inference with TokenSkip involves the fine-tuned LLM generating a compressed CoT based on the input prompt and the desired compression ratio.

Datasets

The paper uses standard benchmarks for training and evaluation:

  • GSM8K: A dataset of grade-school math problems.
  • MATH-500: A subset of the MATH dataset, a collection of challenging mathematical problems.

They do not introduce new datasets but evaluate on existing ones to demonstrate the effectiveness of their method.

Key Insights and Ideas

  • Token Importance Varies: The fundamental insight is that CoT tokens are not equally important for reasoning. Mathematical equations and numerical values tend to be more critical than semantic connectors or transitional phrases.
  • Controllable Compression: TokenSkip allows users to specify a desired compression ratio, offering flexibility in balancing efficiency and accuracy.
  • LLMs Can Learn Shortcuts: The fine-tuning process effectively teaches LLMs to identify and utilize these "shortcuts" in CoTs, mimicking human ability to skip redundant steps.
  • Interpretability Maintained: Even with compression, the underlying reasoning process can be recovered, preserving interpretability.
  • Efficiency Gains are Significant: By pruning tokens, TokenSkip can dramatically reduce the number of tokens processed, leading to faster inference.

Key Results

  • Qwen2.5-14B-Instruct on GSM8K: Achieved a 40% reduction in reasoning tokens (from 313 to 181) with less than a 0.4% drop in accuracy.
  • LLaMA-3.1-8B-Instruct on MATH-500: Reduced CoT token usage by 30% with a performance drop of less than 4%, resulting in a 1.4x inference speedup.
  • Comparison to Baselines: TokenSkip significantly outperforms other methods like "Token-efficient Prompts" and "Truncation." While Truncation achieves compression, it leads to substantial accuracy degradation. Token-efficient prompts often fail to meet target compression ratios.
  • Out-of-Domain Performance: TokenSkip shows strong generalizability, maintaining accuracy on out-of-domain benchmarks like MMLU-STEM with significant compression.
  • Efficiency: Fine-tuning is efficient, with LoRA requiring only a small fraction of parameters to be updated. Training is completed in a few hours on standard GPUs.

Limitations and Future Work

  • Computational Constraints: Experiments were limited to certain model sizes (e.g., up to 14B parameters) due to computational constraints. Evaluating on larger models (like Qwen2.5-32B/72B) is a future direction.
  • Token Importance Metric: The LLMLingua-2 metric, while effective, was not specifically trained on mathematical data. This might affect compression effectiveness on highly numerical tasks. Exploring domain-specific importance metrics is a potential area for improvement.
  • Long-CoT LLMs: Experiments with very long-CoT LLMs were excluded.
  • Out-of-Domain Compression Ratios: The paper notes that at very low compression ratios (e.g., 0.3-0.4), adherence and performance can degrade, suggesting that excessive trimming might lose critical information.

Future work could explore these limitations, aiming to further optimize TokenSkip for larger models and more complex reasoning tasks.

Summary updated

BibTeX
@misc{xia2025tokenskip,
  author = {Heming Xia and Yongqi Li and Chak Tou Leong and Wenjie Wang and Wenjie Li},
  title = {{TokenSkip: Controllable Chain-of-Thought Compression in LLMs}},
  year = {2025},
  eprint = {2502.12067},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.12067},
}
Figure