Reinforcement Learning for Reasoning LLMs: Training Practices and Key Techniques

    This article examines why multi-step reasoning has become a training priority for large language models and outlines the practical challenges of reinforcement learning in this setting, including sparse rewards, instability, entropy collapse or divergence, imbalanced data mixing, and inconsistent evaluation. It introduces Group Relative Policy Optimization (GRPO), a multi-stage training pipeline with cold-start supervised fine-tuning, verifiable-reward reinforcement learning, and general-capability alignment, as well as adaptive entropy control. It also covers model scale selection, evaluation and reproducibility practices, and deployment recommendations for teams building and evaluating reasoning models.

    1. Why Reasoning Ability Has Become a Training Priority

    General conversational ability in large language models is already relatively mature. The next wave of competition is concentrated on multi-step reasoning. Tasks such as mathematical proofs, code generation, and complex logical judgment require the model to break a problem into several steps and verify them progressively. Pretraining on massive amounts of text alone makes it difficult to obtain this ability reliably. As a result, more training pipelines add a reinforcement learning stage with verifiable rewards after supervised fine-tuning.

    For developers and enterprise users, reasoning ability directly affects performance in several scenarios: automated testing and code repair, data analysis and report generation, and rule-intensive review and customer service workflows. These scenarios have clear correctness criteria and are suitable for training with automatically verifiable reward signals.

    2. Core Challenges in Reasoning Model Training

    In practice, teams usually encounter the following problems.

    1. Sparse rewards. Long-chain reasoning problems often provide a correct-or-incorrect signal only at the final answer. If the model answers most problems incorrectly, the gradient signal is almost zero, and training cannot progress.

    2. Training instability. Policy updates that are too large can cause abrupt changes in response style, and the model may suddenly degrade on some tasks. A common approach is to limit the magnitude of each update and monitor fluctuations in key metrics.

    3. Entropy collapse and excessive divergence. Entropy measures the uncertainty of the policy output distribution. When entropy is too low, the model repeats only a few solutions and loses exploration ability; when entropy is too high, outputs become messy and answer quality drops. Both cases require active intervention.

    4. Imbalanced data mixing. Math, code, and general question-answering data differ greatly in volume and difficulty. If they are simply mixed for training, one type of capability may be suppressed by other categories.

    5. Inconsistent evaluation protocols. Different teams use different decoding parameters, answer extraction rules, and test set versions. Direct comparisons of results can easily lead to incorrect conclusions.

    3. Group Relative Policy Optimization

    Group Relative Policy Optimization (GRPO) is a commonly used policy gradient method. Its core idea is to sample a group of responses for the same problem and use the relative rewards within the group as the advantage signal, instead of training an additional value network comparable in size to the policy.

    Compared with classic Proximal Policy Optimization (PPO), this approach eliminates the training and memory footprint of the value model and is simpler to implement. The cost is that multiple responses must be sampled for each problem, which increases overhead during the inference stage.

    The advantage values are calculated as follows. For G responses under the same prompt, with rewards r_1 to r_G, the advantage of the i-th response is:

    A_i = (r_i - mean(r)) / (std(r) + ε)

    Here ε is a small constant that prevents division by zero. Responses with rewards above the group mean receive positive advantages, and responses below the mean receive negative advantages.

    The following code illustrates how to calculate group advantages:

    1. import numpy as np
    2. def group_advantages(rewards, eps=1e-6):
    3. """
    4. rewards: rewards for G responses under the same prompt, shape (G,)
    5. Returns the corresponding advantage values.
    6. """
    7. rewards = np.asarray(rewards, dtype=np.float32)
    8. mean = rewards.mean()
    9. std = rewards.std()
    10. return (rewards - mean) / (std + eps)
    11. # Example: sample 4 responses for one problem, two correct
    12. rewards = [1.0, 0.0, 1.0, 0.0]
    13. print(group_advantages(rewards))

    When all responses in a group have the same reward, the standard deviation is zero, all advantages are close to zero, and the problem produces no effective gradient. Therefore, during data construction, problems with moderate difficulty and an accuracy rate within a certain range should be prioritized so that each group of samples contains responses with discriminative value.

    4. Designing a Multi-Stage Training Pipeline

    A single-stage reinforcement learning process often struggles to balance format compliance, reasoning depth, and general capability. A more reliable approach is to proceed in stages.

    Stage 1: Cold-start supervised fine-tuning. Use a small amount of high-quality reasoning demonstration data so that the model first learns a standardized solution format, such as writing step by step and clearly providing the final answer. This step can significantly reduce invalid sampling in subsequent reinforcement learning.

    Stage 2: Reinforcement learning with verifiable rewards. Math problems can verify the final numerical value or symbolic expression, and code problems can run unit tests. The reward function should be as simple and clear as possible, and format errors should be penalized to prevent the model from gaining scores through shortcuts.

    Stage 3: General capability alignment. While maintaining reasoning ability, add general conversation and instruction-following data to avoid obvious degradation in everyday question answering.

    Checkpoints should be saved at each stage and compared on a fixed validation set. If a stage causes other capabilities to decline, roll back and adjust the data mix instead of proceeding directly to the next stage.

    5. Adaptive Entropy Control

    In policy gradient training, an entropy regularization term is usually added to the loss function to encourage the model to maintain exploration. A fixed entropy coefficient is difficult to adapt to the entire training process: stronger exploration is needed early in training, while later stages need to prevent outputs from becoming too divergent.

    The idea of adaptive entropy control is to set a target entropy value and dynamically adjust the regularization coefficient based on the deviation between the current entropy and the target. When entropy is low, increase the coefficient; when entropy is high, decrease it.

    The clipped policy loss can be written as:

    L = -E[min(ratio · A, clip(ratio, 1-ε_c, 1+ε_c) · A)] - β · H

    Here ratio is the probability ratio between the new and old policies, A is the advantage, H is the average entropy, and β is the entropy coefficient.

    The coefficient can be updated using a simple proportional controller:

    1. def update_entropy_coef(beta, current_entropy, target_entropy,
    2. lr=1e-3, beta_min=1e-4, beta_max=1e-1):
    3. """
    4. Adjust the entropy coefficient based on the gap between current and target entropy.
    5. Increase beta when entropy is below target; decrease it when entropy is above target.
    6. """
    7. error = target_entropy - current_entropy
    8. beta = beta + lr * error
    9. return min(max(beta, beta_min), beta_max)
    10. # Update once every few steps based on the statistical entropy
    11. beta = 0.01
    12. beta = update_entropy_coef(beta, current_entropy=0.6, target_entropy=0.8)

    There is no universal standard for the target entropy value; it needs to be determined in small-scale experiments according to the task and model scale. The update frequency should also not be too high, otherwise the coefficient will fluctuate sharply and interfere with training.

    6. Model Scale and Selection

    Models of different scales are suitable for different scenarios. Small parameter models (such as the 7B level) have low inference cost and are suitable for domain-specific models, for example, training only for math or only for code. Large parameter models (such as the 32B level) are more general and suitable as flagship models or teacher models, providing a data distillation source for small models.

    When selecting a model, three factors should be considered: the complexity of the target task, the inference latency and memory budget, and the concurrency requirements of the deployment environment. If the business only involves fixed-format data processing, a specialized small model is usually more cost-effective than a large model.

    When comparing different models, the comparison should be performed on the same hardware, decoding parameters, and test set, and confidence intervals or variance across multiple runs should be reported. Reporting only the single best result can easily overestimate model capability.

    7. Evaluation and Reproducibility Essentials

    Evaluation of reasoning models needs to focus on the following points.

    1. Unified benchmark. Clarify the test set version, answer extraction rules, and scoring script, and document them.
    2. Multiple sampling. Because decoding is stochastic, the same problem should be sampled multiple times, and the average pass rate and fluctuation range should be calculated.
    3. Contamination detection. Check whether the training data and test set contain duplicates or near-duplicates to avoid inflated scores.
    4. Report by category. Math, code, and general question answering should be reported separately to avoid a single total score masking weaknesses.
    5. Length and format metrics. Record the average output length and format compliance rate, and observe whether the model gains scores through meaningless verbose outputs.

    For claimed performance improvements, it is recommended to retain the complete training configuration during reproduction, including learning rate, batch size, number of samples, reward function, and training steps. Only comparisons under the same conditions are meaningful.

    8. Practical Deployment Recommendations

    • First validate the reward function and data pipeline with small-scale models, then invest in large-scale training.
    • Set clear exit criteria for each training stage, for example, when validation metrics no longer improve for several consecutive rounds.
    • Monitor entropy, mean reward, response length, and gradient norm. These metrics often reveal anomalies earlier than a single accuracy number.
    • Strictly separate training data from evaluation data, and update the evaluation set periodically to prevent overfitting.
    • When resources are limited, prioritize data quality and reward design. These two factors usually have a greater impact on results than simply increasing the number of training steps.

    Improving reasoning ability is a systems engineering effort that requires coordination among data, algorithms, and evaluation. Only by clearly recording the assumptions and metrics of each stage can teams determine where the effects come from and reliably reproduce results in subsequent iterations.