README.md

June 22, 2026 ยท View on GitHub

๐Ÿ‘‰ LightThinker ๐Ÿ‘ˆ

LightThinker Family: From Thinking Compression to Adaptive Memory Management

Awesome License: MIT

๐Ÿ“„ LightThinker arXiv โ€ข ๐Ÿ“„ LightThinker++ arXiv โ€ข ๐Ÿค— Hugging Face

LightThinker overview

Table of Contents

๐Ÿ”” News

๐Ÿ‘€ Overview

LLMs can solve increasingly complex reasoning tasks, but long thought traces make inference expensive because the model must retain and attend to large contexts. The LightThinker family addresses this by compressing or actively managing intermediate reasoning states.

  • LightThinker compresses intermediate thoughts into compact gist-token representations. The implementation and AnLLM baseline are preserved under lightthinker_v1/.
  • LightThinker++ introduces explicit adaptive memory management. The model can use memory primitives such as commit, expand, fold, and final_answer to control its scratchpad while reasoning.

This top-level README is a quick-start guide. Detailed model links, data links, environment variables, script parameters, and evaluation options live in the module README files.

๐Ÿค— Resources

๐Ÿ“ Repository Structure

LightThinker/
โ”œโ”€โ”€ general_reasoning/       # LightThinker++ for math and general reasoning tasks
โ”œโ”€โ”€ agentic_reasoning/       # LightThinker++ for agentic deep-research tasks
โ”œโ”€โ”€ lightthinker_v1/         # LightThinker and AnLLM baseline code
โ”œโ”€โ”€ assets/                  # README assets
โ””โ”€โ”€ README.md
MethodFolderFull guide
LightThinker++ for general reasoninggeneral_reasoning/general_reasoning/README.md
LightThinker++ for agentic reasoningagentic_reasoning/agentic_reasoning/README.md
LightThinkerlightthinker_v1/lightthinker_v1/README.md

๐Ÿš€ LightThinker++ โ€” General Reasoning

Quick start for math and general reasoning tasks such as GSM8K, MMLU, GPQA, and BBH:

cd general_reasoning
conda env create -f environment.yml
conda activate lt_plus_general_reasoning
cp .env.example ../.env

# Generate synthetic trajectories after setting an input JSONL dataset.
DATASET_PATH=/path/to/input.jsonl bash scripts/synthetic.sh

# Run inference with a trained or downloaded model.
MODEL=/path/to/model bash scripts/infer.sh 0 gsm8k

See general_reasoning/README.md for configuration, datasets, and full arguments.

๐ŸŒ LightThinker++ โ€” Agentic Reasoning

Quick start for long-horizon deep-research and multi-hop QA tasks:

cd agentic_reasoning
bash setup.sh
cp .env.synthetic.example .env

# Run synthetic data generation with the included sample dataset.
bash scripts/synthetic.sh

For inference, use cp .env.infer.example .env, configure your model endpoint, and run bash scripts/inference.sh.

See agentic_reasoning/README.md for configuration, datasets, and full arguments.

๐Ÿ’ก LightThinker

Quick start for the LightThinker implementation:

cd lightthinker_v1
conda create -n lightthinker python=3.9 -y
conda activate lightthinker
pip install -r requirements.txt

# Train and run inference.
bash train.sh
bash inference.sh

See lightthinker_v1/README.md for configuration, datasets, and full arguments.

๐ŸŽ Acknowledgement

We use the ms-swift framework for full-parameter SFT of the LightThinker++ models. The general reasoning evaluation also builds on ideas from TokenSkip. The LightThinker evaluation includes baseline code inspired by H2O from Meta-llama and SepLLM from HKUDS.

๐Ÿšฉ Citation

If this work is helpful, please kindly cite:

@article{lightthinker++,
  author       = {Yuqi Zhu and
                  Jintian Zhang and
                  Zhenjie Wan and
                  Yujie Luo and
                  Shuofei Qiao and
                  Zhengke Gui and
                  Da Zheng and
                  Lei Liang and
                  Huajun Chen and
                  Ningyu Zhang},
  title        = {LightThinker++: From Reasoning Compression to Memory Management},
  journal      = {CoRR},
  volume       = {abs/2604.03679},
  year         = {2026},
  url          = {https://doi.org/10.48550/arXiv.2604.03679},
  doi          = {10.48550/ARXIV.2604.03679},
  eprinttype   = {arXiv},
  eprint       = {2604.03679},
  timestamp    = {Fri, 08 May 2026 07:40:46 +0200},
  biburl       = {https://dblp.org/rec/journals/corr/abs-2604-03679.bib},
  bibsource    = {dblp computer science bibliography, https://dblp.org}
}

@inproceedings{lightthinker,
  author       = {Jintian Zhang and
                  Yuqi Zhu and
                  Mengshu Sun and
                  Yujie Luo and
                  Shuofei Qiao and
                  Lun Du and
                  Da Zheng and
                  Huajun Chen and
                  Ningyu Zhang},
  editor       = {Christos Christodoulopoulos and
                  Tanmoy Chakraborty and
                  Carolyn Rose and
                  Violet Peng},
  title        = {LightThinker: Thinking Step-by-Step Compression},
  booktitle    = {Proceedings of the 2025 Conference on Empirical Methods in Natural
                  Language Processing, {EMNLP} 2025, Suzhou, China, November 4-9, 2025},
  pages        = {13307--13328},
  publisher    = {Association for Computational Linguistics},
  year         = {2025},
  url          = {https://doi.org/10.18653/v1/2025.emnlp-main.673},
  doi          = {10.18653/V1/2025.EMNLP-MAIN.673},
  timestamp    = {Mon, 02 Feb 2026 09:39:37 +0100},
  biburl       = {https://dblp.org/rec/conf/emnlp/ZhangZSLQDZCZ25.bib},
  bibsource    = {dblp computer science bibliography, https://dblp.org}
}