LightThinker: Thinking Step-by-Step Compression

Jintian Zhang, Yuqi Zhu, Mengshu Sun, Yujie Luo, Shuofei Qiao, Lun Du, Da Zheng, Huajun Chen, Ningyu Zhang

arXiv:2502.15589 · 2026-07-27 공개 · arXiv · PDF

memory-optimization inference-speed context-window token-reduction llm-compression attention-masking reasoning-efficiency hidden-state-mapping

Abstract

Large language models (LLMs) have shown remarkable performance in complex reasoning tasks, but their efficiency is hindered by the substantial memory and computational costs associated with generating lengthy tokens. In this paper, we propose LightThinker, a novel method that enables LLMs to dynamically compress intermediate thoughts during reasoning. Inspired by human cognitive processes, LightThinker compresses verbose thought steps into compact representations and discards the original reasoning chains, thereby significantly reducing the number of tokens stored in the context window. This is achieved by training the model on when and how to perform compression through data construction, mapping hidden states to condensed gist tokens, and creating specialized attention masks. Additionally, we introduce the Dependency (Dep) metric to quantify the degree of compression by measuring the reliance on historical tokens during generation. Extensive experiments on four datasets and two models show that LightThinker reduces peak memory usage and inference time, while maintaining competitive accuracy. Our work provides a new direction for improving the efficiency of LLMs in complex reasoning tasks without sacrificing performance. Code is released at https://github.com/zjunlp/LightThinker.

한국어 요약

한 줄 요약

LightThinker는 추론 중 중간 사고 단계를 동적으로 압축하여 LLM의 메모리 사용량과 추론 시간을 줄이는 새로운 방법이다.

핵심 기여도

핵심 아이디어

LightThinker는 인간의 사고 과정에서 핵심 단계만 기억하고 나머지를 정리하는 방식을 모방하여, LLM이 추론 중 생성된 긴 사고 체인을 **compact한 gist token**으로 압축하게 훈련시킨다. 이는 사고 단계의 **hidden state**를 압축된 토큰에 매핑하고, **attention mask**를 통해 이 토큰만 기반으로 추론을 계속하도록 유도하는 방식이다.

기존의 CoT나 o1-like thinking mode는 복잡한 문제 해결 능력을 향상시키지만, 토큰 생성량 증가로 인해 메모리와 계산 비용이 급증한다. LightThinker는 이 문제를 해결하기 위해 **사고 단계의 압축 타이밍과 방법**을 학습하는 새로운 훈련 전략을 도입한다. 특히, **KV Cache의 선형 증가**와 **attention 메커니즘의 이차적 복잡도**를 고려하여, 토큰 수를 줄이는 동시에 추론 정확도를 유지하는 것이 핵심이다.

기술적 접근법

주요 결과

의의 및 한계

LightThinker는 복잡한 추론 과정에서 토큰 생성량을 줄이는 새로운 방식으로, LLM의 실용적 효율성을 향상시킨다. 특히, **KV Cache 메모리 사용량**과 **attention 메커니즘의 계산 비용**을 동시에 줄이는 점에서 기존 방법과 차별화된다. 또한, **Dep 메트릭**은 압축 정도를 정량적으로 평가할 수 있는 새로운 지표로, 추후 연구에 활용될 수 있다.

그러나, 압축이 과도하게 이루어질 경우 정확도가 저하될 수 있으며, 압축 타이밍과 방법을 학습하는 과정에서 **데이터 구성의 복잡성**이 증가할 수 있다. 또한, **모델 아키텍처에 따라 압축 효과가 달라질 수 있는 가능성**이 있다.

실용적 활용

LightThinker는 대규모 언어 모델을 활용한 **복잡한 추론 작업**, **긴 텍스트 생성**, **실시간 대화 시스템** 등에서 메모리 효율을 향상시키는 데 활용될 수 있다. 특히, **KV Cache 메모리 제약이 큰 서버 환경**이나 **모바일 기기**에서 추론 성능을 개선하는 데 유용할 것으로 기대된다.