MOTIF: Modular Thinking via Reinforcement Fine-tuning in LLMs

Purbesh Mitra, Sennur Ulukus
7/3/2025
cs.CLcs.AIcs.IT

Official code: purbeshmitra/MOTIF (17 stars, MIT, last commit 2025-07-06).

Abstract

Recent advancements in the reasoning capabilities of large language models (LLMs) show that employing group relative policy optimization (GRPO) algorithm for reinforcement learning (RL) training allows the models to use more thinking/reasoning tokens for generating better responses. However, LLMs can generate only a finite amount of tokens while maintaining attention to the previously generated tokens. This limit, also known as the context size of an LLM, is a bottleneck in LLM reasoning with arbitrarily large number of tokens. To think beyond the limit of context size, an LLM must employ a modular thinking strategy to reason over multiple rounds. In this work, we propose $\textbf{MOTIF: Modular Thinking via Reinforcement Finetuning}$ -- an RL training method for generating thinking tokens in multiple rounds, effectively allowing the model to think with additional context size. We trained the open-source model Qwen2.5-3B-Instruct on GSM8K dataset via parameter efficient fine-tuning and tested its accuracy on MATH500 and AIME2024 benchmarks. Our experiments show 3.8\% and 3.3\% improvements over vanilla GRPO based training in the respective benchmarks. Furthermore, this improvement was achieved with only 15\% of samples, thus demonstrating sample efficiency of MOTIF. Our code and models are available at https://github.com/purbeshmitra/MOTIF and https://huggingface.co/purbeshmitra/MOTIF, respectively.

View on arXivView PDF

Code Implementations(1)

purbeshmitra/MOTIFOfficial100%
MIT

MOTIF: Modular Thinking via Reinforcement Fine-tuning in LLMs

171PythonJun 22, 20251 years agoMIT
llm-trainingreinforcement-learningrlvr

Similar Papers

Cite this paper

@article{mitra2025motif,
  title  = {MOTIF: Modular Thinking via Reinforcement Fine-tuning in LLMs},
  author = {Purbesh Mitra and Sennur Ulukus},
  year   = {2025},
  eprint = {2507.02851},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.02851v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.02851.svg)](https://codeofpaper.com/paper/2507.02851)

Discussion