<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Janhu on Medium]]></title>
        <description><![CDATA[Stories by Janhu on Medium]]></description>
        <link>https://medium.com/@janhu9527?source=rss-51fadc08e156------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*mQY1ULN9ZQV964NP.jpg</url>
            <title>Stories by Janhu on Medium</title>
            <link>https://medium.com/@janhu9527?source=rss-51fadc08e156------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 04:38:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@janhu9527/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[REINFORCE++-baseline is all you need in RLVR]]></title>
            <link>https://medium.com/@janhu9527/reinforce-baseline-is-all-you-need-in-rlvr-f5406930aa85?source=rss-51fadc08e156------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5406930aa85</guid>
            <dc:creator><![CDATA[Janhu]]></dc:creator>
            <pubDate>Thu, 14 Aug 2025 00:59:41 GMT</pubDate>
            <atom:updated>2025-08-18T06:49:20.971Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is REINFORCE++-baseline?</h3><p>In essence, REINFORCE++-baseline (detailed in <a href="https://arxiv.org/abs/2501.03262">arXiv:2501.03262</a>) replaces the critic network used in PPO with the group mean reward and applies global batch advantage normalization. The KL loss is computed using the unbiased K2 KL estimator. Because the global batch standard deviation is significantly more stable than the local group standard deviation used in GRPO, this approach enhances training stability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZepugIKn9NmvfoednFVhew.png" /></figure><p>The purpose of the “- local mean” term in Equation (11) is to automatically reshape the rewards. This makes the algorithm robust to different reward patterns, such as sequences like 0 (incorrect), 1 (correct), -0.5 (format reward) or -1 (incorrect), 1 (correct), -0.5 (format reward).</p><p>The relationship with PPO:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bwDAdqi9ZDRUZhXt53uOOA.png" /></figure><p>This method was initially proposed and implemented in OpenRLHF in February 2025, available here:</p><p><a href="https://github.com/OpenRLHF/OpenRLHF/pull/730">https://github.com/OpenRLHF/OpenRLHF/pull/730</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0RI9zRNiDOVrUs7x.png" /></figure><p>Moreover, this algorithm is also supported and used in other frameworks including <a href="https://github.com/volcengine/verl/blob/main/examples/reinforce_plus_plus_trainer/run_qwen2-7b_math_rf_baseline.sh">veRL </a>, <a href="https://github.com/THUDM/slime/pull/59/files#diff-e992874352ffc7f8e7f2eb36a64a19cb6b47bb4b203b14de86f6b8b1ed1378e6">SLIME</a> and Alibaba ROLL (set reward_shift:True and adv_estimator: reinforce and whiten_advantages:True)</p><h3>Tool-Integrated Reasoning and Agent Experiments</h3><p>We have thoroughly validated the effectiveness of global standard deviation and global advantage normalization in complex multi-turn tool call scenarios. Our experiments utilize the framework established by <a href="https://arxiv.org/abs/2505.07773">arXiv:2505.07773</a>, which features a zero-shot agent environment designed for large language models to tackle mathematical problems using Qwen 2.5 Base 7B.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*caTJqs7sjFTdkeb1.png" /><figcaption>REINFORCE++-baseline achieves the best performance in the multi-turn tool call tasks.</figcaption></figure><p>The REINFORCE++ baseline can be combined with dynamic sampling, clip-higher, and <a href="https://fengyao.notion.site/off-policy-rl">truncated importance sampling</a> (vLLM correction in the figure) to continuously improve performance.</p><h3>More detailed ablation analysis</h3><p>Further verification of the effectiveness of global standard deviation in reasoning tasks is presented in <a href="https://arxiv.org/pdf/2508.08221">arXiv:2508.08221</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jdKotOaRJbJArkxHZRFprA.png" /><figcaption>Lite PPO = REINFORCE++-baseline (Local mean / Global std) + Token-level Loss</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n8639O0-RYGVYQPN.png" /><figcaption>Global std in REINFORCE++ is better than Local std in GRPO</figcaption></figure><h3>An extremely long experiment</h3><p>ProRLv2 uses the REINFORCE++ baseline to train a 1.5B model for over 3,000 steps, achieving state-of-the-art performance.</p><p><a href="https://huggingface.co/nvidia/Nemotron-Research-Reasoning-Qwen-1.5B">https://huggingface.co/nvidia/Nemotron-Research-Reasoning-Qwen-1.5B</a></p><p><strong>Nemotron-Research-Reasoning-Qwen-1.5B</strong> (16k context length) vs <strong>Nemotron-Research-Reasoning-Qwen-1.5B-v2</strong> (8k context length)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z2goQeORBsLHpnsU.png" /></figure><h3>The effectiveness of global standard deviation in traditional reinforcement learning (RL)</h3><p>This method’s effectiveness transcends RLHF and is also validated in conventional reinforcement learning tasks in gaming environments, as demonstrated in</p><p><a href="https://arxiv.org/pdf/2503.11019">https://arxiv.org/pdf/2503.11019</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zdeKfKGlSrrOtF0F.png" /><figcaption>Global std is better than State std in RL games</figcaption></figure><h3>Theoretical analysis</h3><p>We found that theory also shows that the larger the batch, the smaller the bias in the estimated advantage, so using the global standard deviation is both intuitive and theoretically sound.</p><p><a href="https://arxiv.org/pdf/2501.03262#page=15.10">https://arxiv.org/pdf/2501.03262#page=15.10</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5406930aa85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[REINFORCE++: A Simple and Efficient Approach for Aligning Large Language Models]]></title>
            <link>https://medium.com/@janhu9527/reinforce-a-simple-and-efficient-approach-for-aligning-large-language-models-721cd3f71918?source=rss-51fadc08e156------2</link>
            <guid isPermaLink="false">https://medium.com/p/721cd3f71918</guid>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[efficiency]]></category>
            <category><![CDATA[alignment]]></category>
            <dc:creator><![CDATA[Janhu]]></dc:creator>
            <pubDate>Wed, 01 Jan 2025 13:16:45 GMT</pubDate>
            <atom:updated>2025-01-01T13:16:45.493Z</atom:updated>
            <content:encoded><![CDATA[<p>Technical Report <a href="https://www.researchgate.net/publication/387487679_REINFORCE_A_SIMPLE_AND_EFFICIENT_APPROACH_FOR_ALIGNING_LARGE_LANGUAGE_MODELS">https://www.researchgate.net/publication/387487679_REINFORCE_A_SIMPLE_AND_EFFICIENT_APPROACH_FOR_ALIGNING_LARGE_LANGUAGE_MODELS</a></p><h3>Introduction</h3><p>RLHF (Reinforcement Learning from Human Feedback) is rapidly evolving, with algorithms such as PPO, DPO, RLOO, ReMax and GRPO emerging one after another. <strong>By integrating various optimization techniques from Proximal Policy Optimization (PPO) into the traditional REINFORCE algorithm</strong>, we “proposed” <strong>REINFORCE++,</strong> which aims to enhance performance and stability in RLHF while reducing computational resource requirements without the critic network.</p><p><strong>The key feature of REINFORCE++ is that it is more stable than GRPO and faster than PPO.</strong></p><h3>What is REINFORCE?</h3><p>REINFORCE is a crucial and simple policy gradient method in reinforcement learning designed to maximize expected cumulative rewards through direct policy optimization. The algorithm operates based on Monte Carlo methods, following these key steps:</p><ul><li><strong>Policy Sampling</strong>: The agent interacts with the environment according to its current policy, generating a sequence of states, actions, and rewards (trajectories).</li><li><strong>Return Calculation</strong>: For each trajectory, returns are computed using discounted cumulative rewards:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NGeFYHrMxJ7PBu_ePuQcQw.png" /></figure><ul><li><strong>Gradient Estimation</strong>: The policy gradient is calculated using Monte Carlo methods, updating the policy parameters $\theta$ as follows:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*XvMeUz1nsEozb8v_vLmsuQ.png" /></figure><ul><li><strong>Policy Update</strong>: The policy parameters are updated using gradient ascent:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*AZgg4yd2KrjF81Hrhktdbw.png" /></figure><h3>Key Implementation Tricks in REINFORCE++</h3><p>To stabilize model training, several optimization tricks are integrated into REINFORCE:</p><h3>Token Level KL-Penalty</h3><p>The KL-Divergence between the response distributions of the RL model and the SFT model is calculated for each token. This divergence is then incorporated as a penalty term in the reward function during training. Specifically, the per-token reward is represented as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*es6p540gquSBpkjHACE-1g.png" /></figure><p><strong>The advantage of this Token-level KL is that it seamlessly integrates with Process Reward Models (PRM) and achieves credit assignment.</strong></p><h3>Mini-batch Updates</h3><p>Mini-batch updates enhance training efficiency and stability by:</p><ul><li>Dividing training data into smaller batches rather than using the entire dataset for updates.</li><li>Allowing multiple parameter updates per mini-batch, which accelerates convergence and reduces memory usage.</li><li>Introducing randomness that helps avoid local optima and improves generalization.</li></ul><h3>Reward Normalization and Clipping</h3><p>This approach addresses instability in reward signals through:</p><ul><li><strong>Reward Normalization</strong>: Standardizing rewards (e.g., subtracting the mean and dividing by the standard deviation) to achieve smoother reward signals, enhancing training stability.</li><li><strong>Reward Clipping</strong>: Limiting reward values within a specific range to mitigate the impact of extreme rewards on model updates, thus preventing gradient explosion.</li></ul><h3>Advantage Normalization</h3><p>Advantage normalization helps manage variance in advantage function of REINFORCE++ estimates defined as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bqegfB8XKWxF1kQjozApzw.png" /></figure><h3>PPO-Clip</h3><p>A critical technique from PPO that limits policy update magnitudes by introducing a clipping mechanism to ensure that updates do not exceed certain thresholds. This can be expressed as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HjJufGKW2ZjIoF49xhc_Rw.png" /></figure><p><strong>Indeed, we are using the PPO loss function in REINFORCE.</strong></p><p>More implementation tricks are in <a href="https://www.notion.so/158d9a33ecc980459d9ceafd7ec784d5?pvs=21">From In Context Learning to Supervised Fine-tuning</a></p><h3>Code Implementation</h3><p>The REINFORCE++ algorithm has been implemented based on OpenRLHF. The implementation details can be found in the GitHub repository.</p><p><a href="https://github.com/OpenRLHF/OpenRLHF/blob/main/examples/scripts/train_reinforce_llama_ray.sh">https://github.com/OpenRLHF/OpenRLHF/blob/main/examples/scripts/train_reinforce_llama_ray.sh</a></p><h3>Experimental Comparisons and Parameters</h3><p>The experiments conducted with REINFORCE++ reveal its advantages over other methods such as GRPO. Key hyper-parameters include:</p><ul><li>KL coefficient: 0.01 (for BT reward model) or $0.001$ (for Math Test)</li><li>Maximum samples: 25000</li><li>Samples per prompt: 4</li><li>Rollout batch size: 256</li><li>Training batch size: 128</li><li>Actor learning rate: 5e^{-7}</li><li>Critic learning rate: 9e^{-6}</li></ul><p><strong>Experiment 1 for Bradley-Terry Reward Models and general scenarios (PPO / REINFORCE++ &gt; GRPO)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A8uh5FcClhmHZ6kHBP_fEw.png" /></figure><p><strong>Experiment 2 for rule-based reward and mathmatical scenarios 1 (REINFORCE++ == GRPO)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f6uiB228t_-YDQYrVB3obQ.jpeg" /></figure><p><strong>Experiment 3 for mathmatical scenarios 2 ( REINFORCE++ / RLOO &gt; GRPO)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6RPETwD1HFAnq8wn1JHs9Q.jpeg" /></figure><p><strong>The results indicate that REINFORCE++ demonstrates greater stability compared to GRPO while achieving higher reward increases per unit KL consumption.</strong> Additionally, it mitigates issues related to response length hacking. And it also conserves computational resources without the critic network compared to PPO.</p><h3>Citation</h3><pre>@misc{hu2024reinforceplusplus,<br>	author = {Hu, Jian},<br>	year = {2024},<br>	month = {12},<br>	pages = {},<br>	title = {REINFORCE++: A SIMPLE AND EFFICIENT APPROACH FOR ALIGNING LARGE LANGUAGE MODELS},<br>	doi = {10.13140/RG.2.2.15090.62409}<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=721cd3f71918" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>