Paper link: From Token to Action: State Machine Reasoning to Mitigate Overthinking in Information Retrieval
State Machine Reasoning (SMR) is a lightweight framework that replaces token-level Chain-of-Thought (CoT) traces with three discrete, IR-focused actions—REFINE, RERANK, and STOP—to prevent overthinking in retrieval.
Token-based CoT often leads to:
Figure 1: (a) Standard CoT, (b) Compressed CoT, (c) SMR.
SMR treats retrieval as a sequence of state transitions ((q_t, D_t)):
At each step, SMR’s prompt-based LLM selects one of three actions:
Figure 2: SMR’s state transitions (REFINE, RERANK, STOP).
Fewer Tokens
Effective Steps
Clear Control
SMR cuts redundant and off-track reasoning by modeling retrieval as a state machine of ((q, D)) states, guided by explicit IR actions. This yields improved retrieval and lower token usage compared to traditional CoT methods.
conda create -n smr -c anaconda python=3.12.2
conda activate smr
conda install -c conda-forge openjdk=21 maven -y
pip install -r requirements.txt
apt-get update
apt-get install pciutils udev lshw
curl -fsSL https://ollama.com/install.sh | sh
ollama serve
# e.g. ollama pull qwen2.5:32b-instruct-q4_K_M
ollama pull {your_model}
bash main.sh
This command downloads the BRIGHT dataset and performs inference from start to finish.
MODEL=bm25 # 1st-stage retriever
cache_dir=cache # path to cache directory
agent=qwen2.5:32b-instruct-q4_K_M # Ollama LLM model
agent_tokenizer=Qwen/Qwen2.5-32B-Instruct # Hugging Face tokenizer path
for TASK in biology earth_science economics psychology robotics stackoverflow sustainable_living leetcode pony aops theoremqa_theorems theoremqa_questions; do
python main.py \
--task $TASK \
--model $MODEL \
--output_dir output/${MODEL} \
--cache_dir ${cache_dir} \
--agent $agent \
--agent_tokenizer $agent_tokenizer
done
If you find our work useful, please consider citing our paper:
@article{lee2025state,
title={From Token to Action: State Machine Reasoning to Mitigate Overthinking in Information Retrieval},
author={Lee, Dohyeon and Jeong, Yeonseok and Hwang, Seung-won},
journal={arXiv preprint arXiv:2505.23059},
year={2025}
}
We also referenced the ReasonIR code from facebookresearch/ReasonIR.
5 commits
Python
99.4%
Paper link: From Token to Action: State Machine Reasoning to Mitigate Overthinking in Information Retrieval
State Machine Reasoning (SMR) is a lightweight framework that replaces token-level Chain-of-Thought (CoT) traces with three discrete, IR-focused actions—REFINE, RERANK, and STOP—to prevent overthinking in retrieval.
Token-based CoT often leads to:
Figure 1: (a) Standard CoT, (b) Compressed CoT, (c) SMR.
SMR treats retrieval as a sequence of state transitions ((q_t, D_t)):
At each step, SMR’s prompt-based LLM selects one of three actions:
Figure 2: SMR’s state transitions (REFINE, RERANK, STOP).
Fewer Tokens
Effective Steps
Clear Control
SMR cuts redundant and off-track reasoning by modeling retrieval as a state machine of ((q, D)) states, guided by explicit IR actions. This yields improved retrieval and lower token usage compared to traditional CoT methods.
conda create -n smr -c anaconda python=3.12.2
conda activate smr
conda install -c conda-forge openjdk=21 maven -y
pip install -r requirements.txt
apt-get update
apt-get install pciutils udev lshw
curl -fsSL https://ollama.com/install.sh | sh
ollama serve
# e.g. ollama pull qwen2.5:32b-instruct-q4_K_M
ollama pull {your_model}
bash main.sh
This command downloads the BRIGHT dataset and performs inference from start to finish.
MODEL=bm25 # 1st-stage retriever
cache_dir=cache # path to cache directory
agent=qwen2.5:32b-instruct-q4_K_M # Ollama LLM model
agent_tokenizer=Qwen/Qwen2.5-32B-Instruct # Hugging Face tokenizer path
for TASK in biology earth_science economics psychology robotics stackoverflow sustainable_living leetcode pony aops theoremqa_theorems theoremqa_questions; do
python main.py \
--task $TASK \
--model $MODEL \
--output_dir output/${MODEL} \
--cache_dir ${cache_dir} \
--agent $agent \
--agent_tokenizer $agent_tokenizer
done
If you find our work useful, please consider citing our paper:
@article{lee2025state,
title={From Token to Action: State Machine Reasoning to Mitigate Overthinking in Information Retrieval},
author={Lee, Dohyeon and Jeong, Yeonseok and Hwang, Seung-won},
journal={arXiv preprint arXiv:2505.23059},
year={2025}
}
We also referenced the ReasonIR code from facebookresearch/ReasonIR.
5 commits
Python
99.4%