References:
Blogs:
Mini-R1: Reproduce Deepseek R1 “aha moment“ a RL tutorial https://huggingface.co/blog/open-r1/mini-r1-contdown-game
Commercial Models
OpenAI O1: Learning to reason with LLMs https://openai.com/index/learning-to-reason-with-llms/
- We are introducing OpenAI o1, a new large language model trained with reinforcement learning to perform complex reasoning. o1 thinks before it answers—it can produce a long internal chain of thought before responding to the user.
- Our large-scale reinforcement learning algorithm teaches the model how to think productively using its chain of thought in a highly data-efficient training process. We have found that the performance of o1 consistently improves with more reinforcement learning (train-time compute) and with more time spent thinking (test-time compute).
- On the 2024 AIME exams, GPT-4o only solved on average 12% (1.8/15) of problems. o1 averaged 74% (11.1/15) with a single sample per problem, 83% (12.5/15) with consensus among 64 samples, and 93% (13.9/15) when re-ranking 1000 samples with a learned scoring function (test-time compute). A score of 13.9 places it among the top 500 students nationally and above the cutoff for the USA Mathematical Olympiad.
COT in O1:
- Through reinforcement learning, o1 learns to hone its chain of thought and refine the strategies it uses. It learns to recognize and correct its mistakes. It learns to break down tricky steps into simpler ones. It learns to try a different approach when the current one isn’t working. This process dramatically improves the model’s ability to reason.
OpenAI O3:
OpenAI Coding — Competitive Programming with Large Reasoning Models https://arxiv.org/abs/2502.06807
DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning https://arxiv.org/abs/2501.12948
Qwen Models
Qwen 2.5: https://arxiv.org/abs/2412.15115
Gemini Model:
Gemini 2.0:
Kimi Models:
Kimi1.5: https://arxiv.org/abs/2501.12599?
Replication of O1/R1 (Train a Model that Performs LongCOT Reasoning)
Codebases:
- Blog: # $30 Deep Seek Breakthrough by UC Berkeley PhD Student
The UC Berkeley Experiment
The PhD student applied this technique to the “Countdown Game,” a task where players combine numbers using basic arithmetic to reach a target value. Because this game has a single correct answer, it provides a clear and effective reward signal for reinforcement learning.
Example:
- Given the numbers 19, 36, 55, and 7, the model is tasked with creating an equation that equals 65.
- The model iteratively works through possible solutions, validates its approach, and arrives at the correct answer.
- notion: https://hkust-nlp.notion.site/simplerl-reason
- We reproduce the training of DeepSeek-R1-Zero and DeepSeek-R1 for complex mathematical reasoning, starting from Qwen-2.5-Math-7B (base model), and only using 8K (query, final answer) examples from the original MATH dataset.
- SimpleRL-Zero: We perform RL directly from the base model without doing SFT first. We only use the 8K MATH (query, answer) pairs
- SimpleRL: We perform long-cot SFT first as a cold start. The SFT data is the 8K MATH queries with responses distilled from QwQ-32B-Preview. Then we perform our RL recipe using the same 8K MATH examples.
(Distillation) Bespoke-Stratos: The unreasonable effectiveness of reasoning distillation https://www.bespokelabs.ai/blog/bespoke-stratos-the-unreasonable-effectiveness-of-reasoning-distillation
(Distillation) Sky-T1: Train your own O1 preview model within $450 https://novasky-ai.github.io/posts/sky-t1/
(Distillation) S1 https://github.com/simplescaling/s1/tree/main
(Distillation) LIMO: https://github.com/GAIR-NLP/LIMO
Generate data from a model capable of Long COT + SFT
RedStar: Does Scaling Long-CoT Data Unlock Better Slow-Reasoning Systems?
S1: Simple test-time scaling
LIMO: Less is More for Reasoning
Comparison of these papers
These three papers present different approaches to improving reasoning capabilities in large language models (LLMs), particularly focusing on mathematical problem-solving. Here’s a summary and comparison of their approaches:
s1: Simple test-time scaling
- Approach: Focuses on test-time scaling and supervised fine-tuning (SFT) with a small, high-quality dataset.
- Data generation:
- Uses Gemini Thinking Experimental to generate reasoning traces for 59K problems.
- Curates a subset of 1,000 samples (s1K) based on difficulty, diversity, and quality.
- Data selection:
- Filters problems using Qwen2.5-7B-Instruct and Qwen2.5-32B-Instruct for difficulty.
- Classifies problems into domains using Claude 3.5 Sonnet.
- Samples one problem from each domain, favoring longer reasoning traces.
- Model: Fine-tunes Qwen2.5-32B-Instruct on s1K.
- Key technique: Introduces “budget forcing” for test-time scaling.
RedStar: Scaling Long-CoT Data
- Approach: Explores scaling Long Chain-of-Thought (Long-CoT) data to improve reasoning.
- Data generation:
- Uses QwQ model to generate responses for math problems.
- Collects code responses from QwQ for programming tasks.
- Data selection:
- Selects problems with difficulty levels 7 and above using a model trained on MATH and Omni-MATH datasets.
- Filters responses based on correctness and quality.
- Model: Trains on Qwen-32B-Instruct with 4k math-derived and 16k code-derived Long-CoT data.
- Key technique: Combines supervised fine-tuning with reinforcement learning (RL) techniques.
LIMO: Less is More for Reasoning
- Approach: Demonstrates that complex reasoning can be achieved with a small, high-quality dataset.
- Data generation:
- Collects solutions from official sources, human experts, AI specialists, and state-of-the-art models like DeepSeek R1 and Qwen2.5-32b-Instruct.
- Uses self-distillation techniques based on Qwen2.5-32b-Instruct.
- Data selection:
- Starts with tens of millions of problems, filtering down to 817 carefully curated problems.
- Uses Qwen2.5-Math-7B-Instruct for initial difficulty filtering.
- Further evaluates using R1, DeepSeek-R1-Distill-Qwen-32B, and other models.
- Model: Fine-tunes Qwen2.5-32B-Instruct on the curated dataset of 817 examples.
- Key technique: Focuses on high-quality, minimal data to elicit inherent reasoning capabilities.
Comparison
-
Data scale:
- s1: Uses 1,000 samples
- RedStar: Scales up to 1000k samples
- LIMO: Uses only 817 samples
-
Data generation:
- s1: Relies primarily on Gemini Thinking Experimental
- RedStar: Uses QwQ model for both math and code
- LIMO: Employs a diverse range of sources, including human experts and multiple AI models
-
Model base:
- All three use Qwen models as their base, but with different versions and sizes
-
Training approach:
- s1: Focuses on supervised fine-tuning and test-time scaling
- RedStar: Combines supervised fine-tuning with reinforcement learning
- LIMO: Emphasizes minimal, high-quality data for supervised fine-tuning
-
Key innovation:
- s1: Introduces “budget forcing” for test-time scaling
- RedStar: Explores the impact of scaling Long-CoT data
- LIMO: Proposes the “Less-Is-More Reasoning Hypothesis”
These approaches demonstrate different strategies for improving reasoning capabilities in LLMs, ranging from test-time scaling to data scaling and quality-focused minimal data training. Each method offers unique insights into enhancing mathematical problem-solving abilities in language models.
Citations:
[1] https://arxiv.org/html/2501.19393v2
[2] https://arxiv.org/html/2501.11284v1
[3] https://arxiv.org/html/2502.03387v1
Train RL without distillation
Scaling of Search and Learning: A Roadmap to Reproduce o1 from Reinforcement Learning Perspective
Methodology Paper
This paper analyzes the roadmap to achieving o1 from the perspective of reinforcement learning, focusing on four key components: policy initialization, reward design, search, and learning.
- Policy initialization enables models to develop human-like reasoning behaviors, equipping them with the ability to effectively explore solution spaces for complex problems.
- Reward design provides dense and effective signals via reward shaping or reward modeling, which is the guidance for both search and learning.
- Search plays a crucial role in generating high-quality solutions during both training and testing phases, which can produce better solutions with more computation.
- Learning utilizes the data generated by search for improving policy, which can achieve the better performance with more parameters and more searched data.
BOLT: Bootstrap Long Chain-of-Thought in Language Models without Distillation
- This paper introduces a novel approach to enable LLM’s LongCoT capacity without distillation from o1-like models or expensive human annotations, where we bootstrap LongCoT (BOLT) from a standard instruct model. BOLT involves three stages:
- (i) LongCoT data bootstrapping with in-context learning on a standard instruct model;
- (ii) LongCoT supervised finetuning;
- (iii) online training to further refine LongCoT capacities.
- In BOLT, only a few in-context examples need to be constructed during the bootstrapping stage; in our experiments, we created 10 examples.
- We use Llama-3.1-70B-Instruct to bootstrap LongCoT and apply our method to various model scales (7B, 8B, 70B).
Towards System 2 Reasoning in LLMs: Learning How to Think With Meta Chain-of-Thought
Exploring the Limit of Outcome Reward for Learning Mathematical Reasoning
rStar-Math: Small LLMs Can Master Math Reasoning with Self-Evolved Deep Thinking
Other “RL + LLM for Reasoning” Papers
Huggingface collections:
LLM + RL (before O1/R1)
ReFT: Reasoning with Reinforced Fine-Tuning
In math problem-solving, for example, there is usually only one annotated reasoning path for each question in the training data. Intuitively, it would be better for the algorithm to learn from multiple annotated reasoning paths given a question.
To address this issue, we propose a simple yet effective approach called Reinforced Fine-Tuning (ReFT) to enhance the generalizability of learning LLMs for reasoning, with math problem-solving as an example.
ReFT first warmups the model with SFT, and then employs on-line reinforcement learning, specifically the PPO algorithm in this paper, to further fine-tune the model, where an abundance of reasoning paths are automatically sampled given the question and the rewards are naturally derived from the ground-truth answers.
Importance Sampling
Language Models are Hidden Reasoners: Unlocking Latent Reasoning Capabilities via Self-Rewarding
We introduce LaTent Reasoning Optimization (LaTRO), a principled framework that formulates reasoning as sampling from a latent distribution and optimizes it via variational approaches.
LaTRO enables LLMs to concurrently improve both their reasoning process and ability to evaluate reasoning quality, without requiring external feedback or reward models.
- LaTRO is reward model-free: Surprisingly but reasonable, the log probabilities of producing the correct answer after the reasoning trajectory serves as a natural reward function, which we call “Self-rewarding”. No need to train additional reward models as in RLHF! ()
- LaTRO shifts the inference-time scaling back to training time - by self-generating multiple reasoning trajectories and self-rewarding them with groundtruth during each training update
LLM Self-Correction with RL
Training Language Models to Self-Correct via Reinforcement Learning
To build SCoRe, we first show that variants of supervised fine-tuning (SFT) on offline model-generated correction traces are insufficient for instilling self-correction behavior.
In particular, we observe that training via SFT either suffers from a distribution mismatch between the training data and the model’s own responses or implicitly prefers only a certain mode of correction behavior that is often not effective at test time.
SCoRe addresses these challenges by training under the model’s own distribution of self-generated correction traces and using appropriate regularization to steer the learning process into learning a self-correction strategy that is effective at test time as opposed to simply fitting high-reward responses for a given prompt. This regularization prescribes running a first phase of RL on a base model to generate a policy initialization that is less susceptible to collapse and then using a reward bonus to amplify self-correction during training.
Agent-R: Training Language Model Agents to Reflect via Iterative Self-Training https://arxiv.org/abs/2501.11425
In this work, we propose an iterative self-training framework, Agent-R, that enables language Agent to Reflect on the fly.
Unlike traditional methods that reward or penalize actions based on correctness, Agent-R leverages MCTS to construct training data that recover correct trajectories from erroneous ones.
Dagger-type data augmentation
A key challenge of agent reflection lies in the necessity for timely revision rather than waiting until the end of a rollout.
To address this, we introduce a model-guided critique construction mechanism: the actor model identifies the first error step (within its current capability) in a failed trajectory. Starting from it, we splice it with the adjacent correct path, which shares the same parent node in the tree. This strategy enables the model to learn reflection based on its current policy, therefore yielding better learning efficiency.
To further explore the scalability of this self-improvement paradigm, we investigate iterative refinement of both error correction capabilities and dataset construction.
AgentRefine: Enhancing Agent Generalization through Refinement Tuning https://arxiv.org/abs/2501.01702
In this paper, we focus on improving the agent generalization capabilities of LLMs via instruction tuning.
We analyze that the poor generalization ability comes from overfitting to several manual agent environments and a lack of adaptation to new situations. They struggle with the wrong action steps and can not learn from the experience but just memorize existing observation-action relations.
Inspired by the insight, we propose a novel AgentRefine framework for agent-tuning. The core idea is to enable the model to learn to correct its mistakes via observation in the trajectory. Specifically, we propose an agent synthesis framework to encompass a diverse array of environments and tasks and prompt a strong LLM to refine its error action according to the environment feedback.
Tool Use / Python Function as Tools/ Agentic System
Teaching LLMs to Refine with Tools https://huggingface.co/papers/2412.16871
We propose CaP, a novel approach that uses external tools to refine chain-of-thought (CoT) responses generated by the same or other LLMs.
CaP employs a two-stage training process: supervised fine-tuning followed by preference optimization with DPO variants.
Our observations highlight the critical role of preference optimization in enabling effective refinement.
rStar-Math: Small LLMs Can Master Math Reasoning with Self-Evolved Deep Thinking
rStar-Math achieves this (math reasoning) by exercising “deep thinking” through Monte Carlo Tree Search (MCTS), where a math policy SLM performs test-time search guided by an SLM-based process reward model.
rStar-Math introduces three innovations to tackle the challenges in training the two SLMs:
- (1) a novel code-augmented CoT data sythesis method, which performs extensive MCTS rollouts to generate step-by-step verified reasoning trajectories used to train the policy SLM;
- (2) a novel process reward model training method that avoids naïve step-level score annotation, yielding a more effective process preference model (PPM);
- (3) a self-evolution recipe in which the policy SLM and PPM are built from scratch and iteratively evolved to improve reasoning capabilities.
Understanding LLM + RL
Compare SFT vs RL
SFT Memorizes, RL Generalizes: A Comparative Study of Foundation Model Post-training
We show that RL, especially when trained with an outcome-based reward, generalizes in both the rule-based textual and visual environments.
SFT, in contrast, tends to memorize the training data and struggles to generalize out-of-distribution in either scenario.
Further analysis reveals that RL improves the model’s underlying visual recognition capabilities, contributing to its enhanced generalization in visual domains.
Demystifying Long Chain-of-Thought Reasoning in LLMs (Good Paper)
In this study, we systematically investigate the mechanics of long CoT reasoning, identifying the key factors that enable models to generate long CoT trajectories. Through extensive supervised fine-tuning (SFT) and RL experiments, we present four main findings:
- (1) While SFT is not strictly necessary, it simplifies training and improves efficiency;
- (2) Reasoning capabilities tend to emerge with increased training compute, but their development is not guaranteed, making reward shaping crucial for stabilizing CoT length growth;
- (3) Scaling verifiable reward signals is critical for RL. We find that leveraging noisy, web-extracted solutions with filtering mechanisms shows strong potential, particularly for out-of-distribution (OOD) tasks such as STEM reasoning;
- (4) Core abilities like error correction are inherently present in base models, but incentivizing these skills effectively for complex tasks via RL demands significant compute, and measuring their emergence requires a nuanced approach.
In this work, we use the term long chain-of-thought (long CoT) to describe an extended sequence of reasoning tokens that not only exhibits a larger-than-usual token length but also demonstrates more sophisticated behaviors such as:
-
Branching and Backtracking: The model systematically explores multiple paths (branching) and reverts to earlier points if a particular path proves wrong (backtracking).
-
Error Validation and Correction: The model detects inconsistencies or mistakes in its intermediate steps and takes corrective actions to restore coherence and accuracy.
Findings
1) Supervised fine-tuning (SFT) for long CoTs – the most direct way to enable long CoT reasoning. We analyze its scaling behavior and impact on RL, finding that long CoT SFT allows models to reach higher performance and also facilitates easier RL improvements than short CoT.
2) Challenges in RL-driven CoT scaling – we observe that RL does not always stably extend CoT length and complexity. To address this, we introduce a cosine length-scaling reward with a repetition penalty, which stabilizes CoT growth while encouraging emergent reasoning behaviors such as branching and backtracking.
3) Scaling up verifiable signals for long CoT RL – Verifiable reward signals are essential for stabilizing long CoT RL. However, scaling them up remains challenging due to the limited availability of high-quality, verifiable data. To address this, we explore the use of data containing noisy, web-extracted solutions (Yue et al., 2024b). While these “silver” supervision signals introduce uncertainty, we find that, with an appropriate mixture in SFT and filtration in RL, they show promise, especially in out-of-distribution (OOD) reasoning scenarios such as STEM problem-solving.
4) Origins of Long CoT Abilities and RL Challenges – Core skills like branching and error validation are inherently present in base models, but effective RL-driven incentivization demands careful designs. We examine RL incentives on long CoT generation, trace reasoning patterns in pre-training data, and discuss nuances in measuring their emergence.
Interesting Observations
-
As we scale up the SFT tokens, long CoT SFT continues to improve model accuracy, whereas short CoT SFT saturates early at a lower accuracy level.
-
Models initialized with long CoT SFT can usually be further significantly improved by RL, while models initialized with short CoT SFT see little gains from RL.
-
Source of Long COT Data:
- To curate long CoT data, we compare two approaches: (1) Construct long CoT trajectories by prompting short CoT models to generate primitive actions and sequentially combining them; (2) Distill long CoT trajectories from existing long CoT models that exhibit emergent long CoT patterns.
- Model distilled from emergent long CoT patterns generalizes better than the constructed pattern, and can be further significantly improved with RL, while the model trained on constructed patterns cannot. Models trained with the emergent long CoT pattern achieve significantly higher accuracies on OOD benchmarks AIME 2024 and MMLU-Pro-1k,
-
RL with the rule-based verifier on the filtered prompt set with short-form answers achieves the best performance across most benchmarks under the same number of RL samples. This might indicate that rule-based verifier after appropriate filtration can produce the highest-quality reward signals from noisy verifiable data.
-
Nuances in Analysis Based on Emergent Behaviors
- However, we notice that sometimes self-validation behaviors already exist in the base model and reinforcing them through RL requires strict conditions, such as a strong base model.
- Note that we use zero-shot prompting for the base model to avoid introducing biases to the output pattern. We select five representative keywords, “wait”, “recheck”, “alternatively”, “retry” and “however” from long CoT cases in previous works, and calculate their frequencies to quantify the extent to which the model does self-validation.
- Figure 7 shows that our RL from Qwen2.5- Math-7B effectively boosts the accuracies, but does not increase the frequency of the “recheck“ pattern existing in the output of the base model, nor effectively incentivize other reflection patterns such as “retry” and “alternatively”. This indicates that RL from the base model does not necessarily incentivize reflection patterns, though significantly boosting the performance.
-
Nuances in Analysis Based on Length Scaling
- We notice that sometimes length scaling up can be accompanied by the KL divergence decreasing, which raises the possibility that the length is influenced by the KL penalty and is just reverting back to the base model’s longer outputs, rather than reflecting the acquisition of long CoT ability.
- That is, length increases and KL between and decreases.
-
Long CoT Patterns in Pre-training Data
-
we hypothesize that incentivized behaviors, such as the model revisiting its solutions, may have already been partially learned during pre-training.
-
Firstly, we used a generative search engine Perplexity.ai to identify webpages explicitly containing problem-solving steps that approach problems from multiple angles or perform verification after providing an answer.
-
Secondly, we used GPT-4o to generate a list of phrases that are characteristic of the “aha moment”, a dataset filtered from the CommonCrawl frequently used in pre-training. We found that there was a significant number of matches in discussion forum threads, where the dialogue between multiple users showed similarity to long CoT, with multiple approaches being discussed along with backtracking and error correction (Appendix F.2.2). This raises the intriguing possibility that long CoT originated from human dialogue, although we should also note that discussion forums are a common source of data in OpenWebMath.
-
COT in Latent Space:
- Motivation: LLMs can reason more effectively in latent space — without explicitly using language tokens
Implicit Chain of Thought Reasoning via Knowledge Distillation https://arxiv.org/abs/2311.01460
- In this work, we explore an alternative reasoning approach: instead of explicitly producing the chain of thought reasoning steps, we use the language model’s internal hidden states to perform implicit reasoning.
- The implicit reasoning steps are distilled from a teacher model trained on explicit chain-of-thought reasoning, and instead of doing reasoning “horizontally” by producing intermediate words one-by-one, we distill it such that the reasoning happens “vertically” among the hidden states in different layers.
From Explicit CoT to Implicit CoT: Learning to Internalize CoT Step by Step
- In this paper, we investigate if models can be taught to internalize these CoT steps.
- To this end, we propose a simple yet effective method for internalizing CoT steps: starting with a model trained for explicit CoT reasoning, we gradually remove the intermediate steps and finetune the model.
Training Large Language Models to Reason in a Continuous Latent Space
- We introduce a new paradigm Coconut (Chain of Continuous Thought).
- We utilize the last hidden state of the LLM as a representation of the reasoning state (termed “continuous thought”).
- Rather than decoding this into a word token, we feed it back to the LLM as the subsequent input embedding directly in the continuous space.
- Experiments show that Coconut can effectively augment the LLM on several reasoning tasks. This novel latent reasoning paradigm leads to emergent advanced reasoning patterns: the continuous thought can encode multiple alternative next reasoning steps, allowing the model to perform a breadth-first search (BFS) to solve the problem, rather than prematurely committing to a single deterministic path like CoT.
Scaling up Test-Time Compute with Latent Reasoning: A Recurrent Depth Approach
- We study a novel language model architecture that is capable of scaling test-time computation by implicitly reasoning in latent space.
- Our model works by iterating a recurrent block, thereby unrolling to arbitrary depth at test-time. This stands in contrast to mainstream reasoning models that scale up compute by producing more tokens.



