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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
---
|
| 4 |
+
<div align="center">
|
| 5 |
+
<h1 align="center"> π LightThinker π </h1>
|
| 6 |
+
<b>LightThinker Family: From Thinking Compression to Adaptive Memory Management</b>
|
| 7 |
+
|
| 8 |
+
[](https://github.com/zjunlp/LightThinker)
|
| 9 |
+
[](https://opensource.org/licenses/MIT)
|
| 10 |
+

|
| 11 |
+
|
| 12 |
+
<p align="center">
|
| 13 |
+
<a href="https://github.com/zjunlp/lightthinker">Github</a> β’
|
| 14 |
+
<a href="https://arxiv.org/abs/2502.15589">π LightThinker arXiv</a> β’
|
| 15 |
+
<a href="http://arxiv.org/abs/2604.03679">π LightThinker++ arXiv</a> β’
|
| 16 |
+
<a href="https://huggingface.co/collections/zjunlp/lightthinker-67f9faaaa518f2e00b17386b">π€ Hugging Face</a>
|
| 17 |
+
</p>
|
| 18 |
+
</div>
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
## Table of Contents
|
| 22 |
+
|
| 23 |
+
- π [News](#news)
|
| 24 |
+
- π [Overview](#overview)
|
| 25 |
+
- π€ [Resources](#resources)
|
| 26 |
+
- π [Repository Structure](#repository-structure)
|
| 27 |
+
- π [LightThinker++ β General Reasoning](#lightthinker--general-reasoning)
|
| 28 |
+
- π [LightThinker++ β Agentic Reasoning](#lightthinker--agentic-reasoning)
|
| 29 |
+
- π‘ [LightThinker](#lightthinker)
|
| 30 |
+
- π [Acknowledgement](#acknowledgement)
|
| 31 |
+
- π© [Citation](#citation)
|
| 32 |
+
|
| 33 |
+
## π News
|
| 34 |
+
|
| 35 |
+
- **[2026-03]** We release a new paper: "[LightThinker++: From Reasoning Compression to Memory Management](http://arxiv.org/abs/2604.03679)".
|
| 36 |
+
- **[2025-08]** Our paper "[LightThinker: Thinking Step-by-Step Compression](https://arxiv.org/abs/2502.15589)" has been accepted to EMNLP 2025.
|
| 37 |
+
- **[2025-02]** We release "[LightThinker: Thinking Step-by-Step Compression](https://arxiv.org/abs/2502.15589)".
|
| 38 |
+
|
| 39 |
+
## π Overview
|
| 40 |
+
|
| 41 |
+
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.
|
| 42 |
+
|
| 43 |
+
- **LightThinker** compresses intermediate thoughts into compact gist-token representations. The implementation and AnLLM baseline are preserved under [`lightthinker_v1/`](./lightthinker_v1/).
|
| 44 |
+
- **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.
|
| 45 |
+
|
| 46 |
+
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.
|
| 47 |
+
|
| 48 |
+
## π€ Resources
|
| 49 |
+
|
| 50 |
+
- **LightThinker++ General Reasoning:** models, SFT data, and full configuration are in [`general_reasoning/README.md`](./general_reasoning/README.md).
|
| 51 |
+
- **LightThinker++ Agentic Reasoning:** models, SFT data, and full configuration are in [`agentic_reasoning/README.md`](./agentic_reasoning/README.md).
|
| 52 |
+
- **LightThinker:** models, data archive, and full configuration are in [`lightthinker_v1/README.md`](./lightthinker_v1/README.md).
|
| 53 |
+
|
| 54 |
+
## π Repository Structure
|
| 55 |
+
|
| 56 |
+
```
|
| 57 |
+
LightThinker/
|
| 58 |
+
βββ general_reasoning/ # LightThinker++ for math and general reasoning tasks
|
| 59 |
+
βββ agentic_reasoning/ # LightThinker++ for agentic deep-research tasks
|
| 60 |
+
βββ lightthinker_v1/ # LightThinker and AnLLM baseline code
|
| 61 |
+
βββ assets/ # README assets
|
| 62 |
+
βββ README.md
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
| Method | Folder | Full guide |
|
| 66 |
+
|--------|--------|------------|
|
| 67 |
+
| LightThinker++ for general reasoning | [`general_reasoning/`](./general_reasoning/) | [`general_reasoning/README.md`](./general_reasoning/README.md) |
|
| 68 |
+
| LightThinker++ for agentic reasoning | [`agentic_reasoning/`](./agentic_reasoning/) | [`agentic_reasoning/README.md`](./agentic_reasoning/README.md) |
|
| 69 |
+
| LightThinker | [`lightthinker_v1/`](./lightthinker_v1/) | [`lightthinker_v1/README.md`](./lightthinker_v1/README.md) |
|
| 70 |
+
|
| 71 |
+
## π LightThinker++ β General Reasoning
|
| 72 |
+
|
| 73 |
+
Quick start for math and general reasoning tasks such as GSM8K, MMLU, GPQA, and BBH:
|
| 74 |
+
|
| 75 |
+
```bash
|
| 76 |
+
cd general_reasoning
|
| 77 |
+
conda env create -f environment.yml
|
| 78 |
+
conda activate lt_plus_general_reasoning
|
| 79 |
+
cp .env.example ../.env
|
| 80 |
+
|
| 81 |
+
# Generate synthetic trajectories after setting an input JSONL dataset.
|
| 82 |
+
DATASET_PATH=/path/to/input.jsonl bash scripts/synthetic.sh
|
| 83 |
+
|
| 84 |
+
# Run inference with a trained or downloaded model.
|
| 85 |
+
MODEL=/path/to/model bash scripts/infer.sh 0 gsm8k
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
See [`general_reasoning/README.md`](./general_reasoning/README.md) for configuration, datasets, and full arguments.
|
| 89 |
+
|
| 90 |
+
## π LightThinker++ β Agentic Reasoning
|
| 91 |
+
|
| 92 |
+
Quick start for long-horizon deep-research and multi-hop QA tasks:
|
| 93 |
+
|
| 94 |
+
```bash
|
| 95 |
+
cd agentic_reasoning
|
| 96 |
+
bash setup.sh
|
| 97 |
+
cp .env.synthetic.example .env
|
| 98 |
+
|
| 99 |
+
# Run synthetic data generation with the included sample dataset.
|
| 100 |
+
bash scripts/synthetic.sh
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
For inference, use `cp .env.infer.example .env`, configure your model endpoint, and run `bash scripts/inference.sh`.
|
| 104 |
+
|
| 105 |
+
See [`agentic_reasoning/README.md`](./agentic_reasoning/README.md) for configuration, datasets, and full arguments.
|
| 106 |
+
|
| 107 |
+
## π‘ LightThinker
|
| 108 |
+
|
| 109 |
+
Quick start for the LightThinker implementation:
|
| 110 |
+
|
| 111 |
+
```bash
|
| 112 |
+
cd lightthinker_v1
|
| 113 |
+
conda create -n lightthinker python=3.9 -y
|
| 114 |
+
conda activate lightthinker
|
| 115 |
+
pip install -r requirements.txt
|
| 116 |
+
|
| 117 |
+
# Train and run inference.
|
| 118 |
+
bash train.sh
|
| 119 |
+
bash inference.sh
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
See [`lightthinker_v1/README.md`](./lightthinker_v1/README.md) for configuration, datasets, and full arguments.
|
| 123 |
+
|
| 124 |
+
## π Acknowledgement
|
| 125 |
+
|
| 126 |
+
We use the [`ms-swift`](https://github.com/modelscope/ms-swift) framework for full-parameter SFT of the LightThinker++ models. The general reasoning evaluation also builds on ideas from [TokenSkip](https://github.com/carriex/TokenSkip). The LightThinker evaluation includes baseline code inspired by H2O from [Meta-llama](https://github.com/meta-llama/llama-cookbook) and SepLLM from [HKUDS](https://github.com/HKUDS/SepLLM).
|
| 127 |
+
|
| 128 |
+
## π© Citation
|
| 129 |
+
|
| 130 |
+
If this work is helpful, please kindly cite:
|
| 131 |
+
|
| 132 |
+
```bibtex
|
| 133 |
+
@article{lightthinker++,
|
| 134 |
+
author = {Yuqi Zhu and
|
| 135 |
+
Jintian Zhang and
|
| 136 |
+
Zhenjie Wan and
|
| 137 |
+
Yujie Luo and
|
| 138 |
+
Shuofei Qiao and
|
| 139 |
+
Zhengke Gui and
|
| 140 |
+
Da Zheng and
|
| 141 |
+
Lei Liang and
|
| 142 |
+
Huajun Chen and
|
| 143 |
+
Ningyu Zhang},
|
| 144 |
+
title = {LightThinker++: From Reasoning Compression to Memory Management},
|
| 145 |
+
journal = {CoRR},
|
| 146 |
+
volume = {abs/2604.03679},
|
| 147 |
+
year = {2026},
|
| 148 |
+
url = {https://doi.org/10.48550/arXiv.2604.03679},
|
| 149 |
+
doi = {10.48550/ARXIV.2604.03679},
|
| 150 |
+
eprinttype = {arXiv},
|
| 151 |
+
eprint = {2604.03679},
|
| 152 |
+
timestamp = {Fri, 08 May 2026 07:40:46 +0200},
|
| 153 |
+
biburl = {https://dblp.org/rec/journals/corr/abs-2604-03679.bib},
|
| 154 |
+
bibsource = {dblp computer science bibliography, https://dblp.org}
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
@inproceedings{lightthinker,
|
| 158 |
+
author = {Jintian Zhang and
|
| 159 |
+
Yuqi Zhu and
|
| 160 |
+
Mengshu Sun and
|
| 161 |
+
Yujie Luo and
|
| 162 |
+
Shuofei Qiao and
|
| 163 |
+
Lun Du and
|
| 164 |
+
Da Zheng and
|
| 165 |
+
Huajun Chen and
|
| 166 |
+
Ningyu Zhang},
|
| 167 |
+
editor = {Christos Christodoulopoulos and
|
| 168 |
+
Tanmoy Chakraborty and
|
| 169 |
+
Carolyn Rose and
|
| 170 |
+
Violet Peng},
|
| 171 |
+
title = {LightThinker: Thinking Step-by-Step Compression},
|
| 172 |
+
booktitle = {Proceedings of the 2025 Conference on Empirical Methods in Natural
|
| 173 |
+
Language Processing, {EMNLP} 2025, Suzhou, China, November 4-9, 2025},
|
| 174 |
+
pages = {13307--13328},
|
| 175 |
+
publisher = {Association for Computational Linguistics},
|
| 176 |
+
year = {2025},
|
| 177 |
+
url = {https://doi.org/10.18653/v1/2025.emnlp-main.673},
|
| 178 |
+
doi = {10.18653/V1/2025.EMNLP-MAIN.673},
|
| 179 |
+
timestamp = {Mon, 02 Feb 2026 09:39:37 +0100},
|
| 180 |
+
biburl = {https://dblp.org/rec/conf/emnlp/ZhangZSLQDZCZ25.bib},
|
| 181 |
+
bibsource = {dblp computer science bibliography, https://dblp.org}
|
| 182 |
+
}
|
| 183 |
+
```
|