How Reinforcement Learning Post-Training Improves LLM Reasoning
Reinforcement learning-based post-training has become a key technique for improving the reasoning capabilities of large language models. This article explains why post-training matters, how reinforcement learning drives reasoning improvements, how to design rewards and keep training stable, and how to break a full training pipeline into engineering stages. It also covers reasoning distillation from large to small models and how to build a practical evaluation system for reasoning tasks.
1. Background: Why Reasoning Has Become a Core Competitiveness Factor
Large language models are already quite mature at text generation and information retrieval, but their error rates remain noticeably high on multi-step mathematical derivations, complex code writing, and question answering that requires logical chains. These tasks require the model to break a problem into intermediate steps and ensure each step can be verified. Simply scaling up pretraining data rarely improves this capability in a stable way.
This is why the industry is paying increasing attention to the post-training stage. Post-training is the process of further optimizing model behavior on top of a base model, using targeted data and feedback signals. It determines whether the model organizes its thinking step by step, follows agreed output formats, and reaches reliable conclusions when information is incomplete.
2. Core Idea: Driving Reasoning with Reinforcement Learning
2.1 The Basic Reinforcement Learning Framework
Reinforcement learning treats the model as a policy. The model generates a complete response to a prompt, the system assigns a reward based on response quality, and the policy adjusts its parameters according to the reward, increasing the probability of generating high-reward responses. Supervised fine-tuning relies on imitating standard answers word by word, whereas reinforcement learning focuses on whether the outcome achieves the goal—making it better suited for searching effective solution paths.
2.2 The Value of a Small Amount of Labeled Data
Labeling reasoning tasks is expensive. Annotating the solution process for every problem step by step requires substantial time from domain experts. Reinforcement learning only needs problems with verifiable answers and a way to judge them—no per-step demonstrations required. For math problems, you can compare final answers; for coding problems, you can run unit tests. These verifiable rewards allow even a small set of high-quality problems to produce sufficient training signal.
2.3 Three Levels of Reward Design
Rewards are usually composed of multiple parts and should be designed in layers:
- Correctness reward: whether the final answer is correct, or whether the code passes all test cases. This is the primary signal.
- Format reward: whether the output follows the agreed structure—for example, whether the reasoning process and the final answer are presented in separate sections. Once the format is stable, parsing and evaluation become more reliable.
- Language consistency reward: in multilingual settings, whether the reasoning and the response use the same language. This term prevents the model from switching between languages arbitrarily.
Reward design also needs to guard against reward hacking. If the judgment logic relies only on string matching, the model may learn to produce answers that look right in format but are wrong in content. Judgments should use normalized, structured comparisons whenever possible, with periodic manual sampling for review.
Example code (reward function):
def compute_reward(response, reference):answer = extract_final_answer(response)correct = 1.0 if normalize(answer) == normalize(reference) else 0.0fmt_ok = has_required_sections(response)return correct + (0.1 if fmt_ok else 0.0)
2.4 Training Stability
Reinforcement learning is sensitive to hyperparameters. Common practices include: limiting the magnitude of each parameter update; sampling multiple responses per prompt and computing relative advantages within the group; and setting an upper bound on response length. These measures reduce the probability of training divergence and make it easier to monitor reward curves and response length trends.
3. Engineering Breakdown of the Training Pipeline
A complete reasoning model training pipeline typically includes the following stages. Each stage has a different goal, so they should not be merged.
3.1 Cold Start
Applying large-scale reinforcement learning directly to a base model sometimes produces outputs with poor readability and mixed languages. For this reason, teams often start with supervised fine-tuning on a small set of high-quality long-form reasoning examples, so the model learns a well-structured output format before entering the reinforcement learning stage.
3.2 Reasoning-Oriented Reinforcement Learning
On top of the cold-start model, reinforcement learning is applied to math, coding, and logic problems. Training data should be stratified by difficulty. Problems that are too easy provide almost no gradient signal, while problems that are too hard fail entirely—both cases waste compute. In practice, teams usually keep problems with pass rates in the middle range.
3.3 Rejection Sampling and Re-Fine-Tuning
After reinforcement learning, the current model generates candidate responses for a large set of prompts. Only responses that pass verification are kept, then mixed with general instruction data for supervised fine-tuning. This step extends reasoning ability to more tasks while preserving general conversation and writing skills.
3.4 Alignment of General Capabilities
The final stage uses preference data or rule-based constraints to tune the model’s safety, helpfulness, and style. Improvements in reasoning should not come at the cost of everyday user experience, so evaluation at this stage must cover ordinary Q&A scenarios.
4. From Large to Small Models: Reasoning Distillation
Large models reason well but are expensive to deploy. Distillation is a common method for transferring a large model’s capabilities to a smaller one. The core idea is to use the large model to generate training data, then have the small model learn from that data.
The distillation pipeline typically involves these steps:
- Prepare a prompt set that covers the target tasks;
- Sample multiple responses from the teacher model for each prompt;
- Use a verifier to filter for correct responses, avoiding the transfer of faulty reasoning to the student model;
- Perform supervised fine-tuning on the small model and evaluate on a held-out test set.
Example code (building the distillation dataset):
def build_distill_dataset(teacher, prompts, verify, k=4):dataset = []for prompt in prompts:candidates = [teacher.generate(prompt, temperature=0.7) for _ in range(k)]passed = [c for c in candidates if verify(prompt, c)]if passed:dataset.append({"prompt": prompt, "response": passed[0]})return dataset
One practical caveat: the teacher model’s reasoning traces are often very long. If transferred directly, the small model’s inference latency increases significantly. You can limit reasoning length during data construction, or filter out verbose derivations for easy problems.
5. Designing the Evaluation System
Evaluation is the primary basis for judging whether training is effective. Evaluation of reasoning models should cover at least three task categories:
- Math: use standardized problem sets and measure accuracy on final answers.
- Code: measure pass rates via unit tests, while also tracking the proportion of timeouts and runtime errors.
- Natural language reasoning: includes reading comprehension, logical judgment, and commonsense reasoning—checking whether the model can produce interpretable conclusions.
During evaluation, decoding parameters such as temperature, maximum generation length, and the number of samples should be fixed.
