<?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:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Reinforced]]></title><description><![CDATA[A newsletter/blog about Reinforcement Learning and Generative AI]]></description><link>https://www.reinforced.info</link><image><url>https://substackcdn.com/image/fetch/$s_!iFm-!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1279623c-9a5c-4928-b19f-e5dface5928d_1280x1280.png</url><title>Reinforced</title><link>https://www.reinforced.info</link></image><generator>Substack</generator><lastBuildDate>Sun, 10 May 2026 11:49:41 GMT</lastBuildDate><atom:link href="https://www.reinforced.info/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Alex Nikulkov]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[reinforced@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[reinforced@substack.com]]></itunes:email><itunes:name><![CDATA[Alex Nikulkov]]></itunes:name></itunes:owner><itunes:author><![CDATA[Alex Nikulkov]]></itunes:author><googleplay:owner><![CDATA[reinforced@substack.com]]></googleplay:owner><googleplay:email><![CDATA[reinforced@substack.com]]></googleplay:email><googleplay:author><![CDATA[Alex Nikulkov]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Positive Gradients, Negative Gradients]]></title><description><![CDATA[+ the Importance of Pre-Training Priors]]></description><link>https://www.reinforced.info/p/positive-gradients-negative-gradients</link><guid isPermaLink="false">https://www.reinforced.info/p/positive-gradients-negative-gradients</guid><dc:creator><![CDATA[Alex Nikulkov]]></dc:creator><pubDate>Fri, 19 Dec 2025 06:17:30 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!vE3f!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12ede7f3-2173-40a8-b46c-dd5be3fb0511_3200x1312.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vE3f!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12ede7f3-2173-40a8-b46c-dd5be3fb0511_3200x1312.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vE3f!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12ede7f3-2173-40a8-b46c-dd5be3fb0511_3200x1312.png 424w, https://substackcdn.com/image/fetch/$s_!vE3f!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12ede7f3-2173-40a8-b46c-dd5be3fb0511_3200x1312.png 848w, https://substackcdn.com/image/fetch/$s_!vE3f!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12ede7f3-2173-40a8-b46c-dd5be3fb0511_3200x1312.png 1272w, https://substackcdn.com/image/fetch/$s_!vE3f!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12ede7f3-2173-40a8-b46c-dd5be3fb0511_3200x1312.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vE3f!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12ede7f3-2173-40a8-b46c-dd5be3fb0511_3200x1312.png" width="1456" height="597" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/12ede7f3-2173-40a8-b46c-dd5be3fb0511_3200x1312.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:597,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:5375468,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://www.reinforced.info/i/181963312?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12ede7f3-2173-40a8-b46c-dd5be3fb0511_3200x1312.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vE3f!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12ede7f3-2173-40a8-b46c-dd5be3fb0511_3200x1312.png 424w, https://substackcdn.com/image/fetch/$s_!vE3f!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12ede7f3-2173-40a8-b46c-dd5be3fb0511_3200x1312.png 848w, https://substackcdn.com/image/fetch/$s_!vE3f!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12ede7f3-2173-40a8-b46c-dd5be3fb0511_3200x1312.png 1272w, https://substackcdn.com/image/fetch/$s_!vE3f!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12ede7f3-2173-40a8-b46c-dd5be3fb0511_3200x1312.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In Reinforcement Learning (RL), particularly when fine-tuning Large Language Models (LLMs), we often treat <strong>positive and negative feedback</strong> as two sides of the same coin. Mathematically, the transition from positive to negative examples in the loss function is smooth. Whether you are maximizing the log-probability of a &#8220;good&#8221; response or minimizing the log-probability of a &#8220;bad&#8221; one, the gradient updates look qualitatively similar. However, <strong>their effects on the model couldn&#8217;t be more different</strong>.</p><p>Understanding this asymmetry explains why RL often leads to <strong>model collapse</strong> and why the <strong>prior established during pre-training</strong> deserves much more attention than it currently gets. The core difference lies in how the gradients affect the output distribution.</p><p>When we train on <strong>on-policy positive examples</strong>, we are reinforcing samples that already lie in high-density regions of the output distribution (since the model generated them). Applying a positive gradient here effectively says, &#8220;Do exactly this, but more.&#8221; This creates a &#8220;<strong>rich get richer</strong>&#8220; effect. The model pushes the peaks of the probability distribution even higher. Because probability must sum to 1, this mass is taken from the tail of the distribution. The result is a rapid reduction in entropy and a collapse in diversity. The model becomes extremely confident in its current path.</p><p><strong>Negative gradients</strong> operate differently. When we apply a negative gradient to an on-policy sample (which, again, is likely a high-probability error), we are chopping off the peak. The optimization process is forced to redistribute that probability mass elsewhere to maintain normalization. The loss function doesn&#8217;t specify <em>where</em> that mass should go, only that it cannot stay at the erroneous location. This forces the model to lift the lower-probability regions, naturally flattening the distribution and <strong>increasing the entropy</strong>. It&#8217;s important to note here that when the probability gets redistributed, it still generally remains within the support of the output distribution, with lower-prior regions receiving less of the redistribution.</p><p>The figure below illustrates the effects of positive (green) and negative (red) on-policy examples. The positive examples locally &#8220;absorb&#8221; the probability density, while the negative examples &#8220;expel&#8221; the density.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pb31!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4278da03-f57b-488a-bd2e-78d0331f4173_2480x3508.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pb31!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4278da03-f57b-488a-bd2e-78d0331f4173_2480x3508.png 424w, https://substackcdn.com/image/fetch/$s_!pb31!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4278da03-f57b-488a-bd2e-78d0331f4173_2480x3508.png 848w, https://substackcdn.com/image/fetch/$s_!pb31!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4278da03-f57b-488a-bd2e-78d0331f4173_2480x3508.png 1272w, https://substackcdn.com/image/fetch/$s_!pb31!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4278da03-f57b-488a-bd2e-78d0331f4173_2480x3508.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pb31!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4278da03-f57b-488a-bd2e-78d0331f4173_2480x3508.png" width="1456" height="2060" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4278da03-f57b-488a-bd2e-78d0331f4173_2480x3508.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:2060,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:224257,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.reinforced.info/i/181963312?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4278da03-f57b-488a-bd2e-78d0331f4173_2480x3508.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pb31!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4278da03-f57b-488a-bd2e-78d0331f4173_2480x3508.png 424w, https://substackcdn.com/image/fetch/$s_!pb31!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4278da03-f57b-488a-bd2e-78d0331f4173_2480x3508.png 848w, https://substackcdn.com/image/fetch/$s_!pb31!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4278da03-f57b-488a-bd2e-78d0331f4173_2480x3508.png 1272w, https://substackcdn.com/image/fetch/$s_!pb31!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4278da03-f57b-488a-bd2e-78d0331f4173_2480x3508.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">The effect of positive and negative examples on the probability density</figcaption></figure></div><h1>Evidence from the Literature</h1><p>The paper <em><a href="https://arxiv.org/pdf/2506.01347">&#8220;The Surprising Effectiveness of Negative Reinforcement in LLM Reasoning&#8221;</a></em> investigates this exact phenomenon. The authors find that <strong>positive on-policy examples quickly collapse entropy</strong>. While this might sharpen the model&#8217;s best guess (improving pass@1), <strong>it destroys the diversity needed for test-time compute scaling</strong> (hurting pass@k for large k).</p><p>Conversely, <strong>negative examples effectively prune the &#8220;wrong&#8221; modes without collapsing the distribution</strong>. They maintain higher entropy, preserving the model&#8217;s ability to generate diverse candidate solutions, which is critical for difficult reasoning problems where the first guess isn&#8217;t always right.</p><p>Figure 5 below shows that <strong>Positive Sample Reinforcement</strong> (PSR, on-policy RL on positive examples only) <strong>collapses the entropy</strong> and leads only to a small increase in accuracy, while <strong>Negative Sample Reinforcement</strong> (NSR, on-policy RL on negative examples only) <strong>avoids the entropy collapse</strong> and reaches the accuracy levels similar to PPO/GRPO. The authors make an analogy <strong>PSR being Exploitation</strong> and <strong>NSR being Exploration</strong>. PSR reinforces discovered positive behaviors, while NSR shifts the probability away from discovered negative behaviors and the allocation of this probability to other outputs causes some exploration. An important caveat is that  <strong>NSR redistributes probability within the support of the policy, so the extent of exploration is fairly limited</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!B5Lh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F957ccbfd-9868-4bd2-b99f-0fbf82f277b3_1640x1338.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!B5Lh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F957ccbfd-9868-4bd2-b99f-0fbf82f277b3_1640x1338.png 424w, https://substackcdn.com/image/fetch/$s_!B5Lh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F957ccbfd-9868-4bd2-b99f-0fbf82f277b3_1640x1338.png 848w, https://substackcdn.com/image/fetch/$s_!B5Lh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F957ccbfd-9868-4bd2-b99f-0fbf82f277b3_1640x1338.png 1272w, https://substackcdn.com/image/fetch/$s_!B5Lh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F957ccbfd-9868-4bd2-b99f-0fbf82f277b3_1640x1338.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!B5Lh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F957ccbfd-9868-4bd2-b99f-0fbf82f277b3_1640x1338.png" width="1456" height="1188" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/957ccbfd-9868-4bd2-b99f-0fbf82f277b3_1640x1338.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1188,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:503450,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.reinforced.info/i/181963312?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F957ccbfd-9868-4bd2-b99f-0fbf82f277b3_1640x1338.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!B5Lh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F957ccbfd-9868-4bd2-b99f-0fbf82f277b3_1640x1338.png 424w, https://substackcdn.com/image/fetch/$s_!B5Lh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F957ccbfd-9868-4bd2-b99f-0fbf82f277b3_1640x1338.png 848w, https://substackcdn.com/image/fetch/$s_!B5Lh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F957ccbfd-9868-4bd2-b99f-0fbf82f277b3_1640x1338.png 1272w, https://substackcdn.com/image/fetch/$s_!B5Lh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F957ccbfd-9868-4bd2-b99f-0fbf82f277b3_1640x1338.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Figure 5 from <em><a href="https://arxiv.org/pdf/2506.01347">The Surprising Effectiveness of Negative Reinforcement in LLM Reasoning</a></em></figcaption></figure></div><p>This aligns with findings from <em><a href="https://arxiv.org/pdf/2504.13837">&#8220;Does Reinforcement Learning Really Incentivize Reasoning Capacity in LLMs Beyond the Base Model?&#8221;</a></em>. This paper suggests that <strong>RL doesn&#8217;t teach the model </strong><em><strong>new</strong></em><strong> reasoning behaviors</strong>. Instead, <strong>it prioritizes useful patterns that already exist after pre-training</strong> (via positive gradients) and <strong>prunes incorrect ones</strong> (via negative gradients). Figure 1 illustrate this - <strong>RLVR training increases pass@1 rates, but reduces pass@k rates for large k&gt;64</strong>. Additionally, Table 2 shows that <strong>for AIME24 there isn&#8217;t a single problem which the base model couldn&#8217;t solve </strong>(with a large number of samples k=1024)<strong>, but the post-RLVR model can solve</strong>. Similarly, for MATH500 the post-RLVR model gains the ability to solve only 1% of problems which couldn&#8217;t be solved by the base model, but at the same time it loses the ability to solve 3.6% of problems which the pre-trained model could solve.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YKW7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff01d95b4-e912-47b5-b9e9-39a527312b5d_1018x974.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YKW7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff01d95b4-e912-47b5-b9e9-39a527312b5d_1018x974.png 424w, https://substackcdn.com/image/fetch/$s_!YKW7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff01d95b4-e912-47b5-b9e9-39a527312b5d_1018x974.png 848w, https://substackcdn.com/image/fetch/$s_!YKW7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff01d95b4-e912-47b5-b9e9-39a527312b5d_1018x974.png 1272w, https://substackcdn.com/image/fetch/$s_!YKW7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff01d95b4-e912-47b5-b9e9-39a527312b5d_1018x974.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YKW7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff01d95b4-e912-47b5-b9e9-39a527312b5d_1018x974.png" width="376" height="359.7485265225933" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f01d95b4-e912-47b5-b9e9-39a527312b5d_1018x974.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:974,&quot;width&quot;:1018,&quot;resizeWidth&quot;:376,&quot;bytes&quot;:222694,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.reinforced.info/i/181963312?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff01d95b4-e912-47b5-b9e9-39a527312b5d_1018x974.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!YKW7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff01d95b4-e912-47b5-b9e9-39a527312b5d_1018x974.png 424w, https://substackcdn.com/image/fetch/$s_!YKW7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff01d95b4-e912-47b5-b9e9-39a527312b5d_1018x974.png 848w, https://substackcdn.com/image/fetch/$s_!YKW7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff01d95b4-e912-47b5-b9e9-39a527312b5d_1018x974.png 1272w, https://substackcdn.com/image/fetch/$s_!YKW7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff01d95b4-e912-47b5-b9e9-39a527312b5d_1018x974.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Figure 1 from <em><a href="https://arxiv.org/pdf/2504.13837">&#8220;Does Reinforcement Learning Really Incentivize Reasoning Capacity in LLMs Beyond the Base Model?&#8221;</a></em></figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!S-bO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06bc3085-7983-457c-8268-1f014d04704b_1084x468.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!S-bO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06bc3085-7983-457c-8268-1f014d04704b_1084x468.png 424w, https://substackcdn.com/image/fetch/$s_!S-bO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06bc3085-7983-457c-8268-1f014d04704b_1084x468.png 848w, https://substackcdn.com/image/fetch/$s_!S-bO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06bc3085-7983-457c-8268-1f014d04704b_1084x468.png 1272w, https://substackcdn.com/image/fetch/$s_!S-bO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06bc3085-7983-457c-8268-1f014d04704b_1084x468.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!S-bO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06bc3085-7983-457c-8268-1f014d04704b_1084x468.png" width="422" height="182.19188191881918" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/06bc3085-7983-457c-8268-1f014d04704b_1084x468.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:468,&quot;width&quot;:1084,&quot;resizeWidth&quot;:422,&quot;bytes&quot;:85486,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.reinforced.info/i/181963312?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06bc3085-7983-457c-8268-1f014d04704b_1084x468.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!S-bO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06bc3085-7983-457c-8268-1f014d04704b_1084x468.png 424w, https://substackcdn.com/image/fetch/$s_!S-bO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06bc3085-7983-457c-8268-1f014d04704b_1084x468.png 848w, https://substackcdn.com/image/fetch/$s_!S-bO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06bc3085-7983-457c-8268-1f014d04704b_1084x468.png 1272w, https://substackcdn.com/image/fetch/$s_!S-bO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06bc3085-7983-457c-8268-1f014d04704b_1084x468.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Table 2 from <em><a href="https://arxiv.org/pdf/2504.13837">&#8220;Does Reinforcement Learning Really Incentivize Reasoning Capacity in LLMs Beyond the Base Model?&#8221;</a></em></figcaption></figure></div><p>The bottom line is fairly clear - <strong>on-policy RVLR reliably increases the accuracy (pass@1), but it reduces generation diversity, leading to a reduction in pass@k for large k</strong>. This training recipe can give us a reliable solver of simple problems<strong>,</strong> but it <strong>won&#8217;t produce a model which can get even close to pushing the frontier of knowledge</strong>.</p><h1>Training Example Sources: On-Policy vs Off-Policy</h1><p>The patterns described above apply only to on-policy training data. Off-policy training examples are substantially different.</p><p><strong>Off-policy positive examples</strong> are used for Supervised Fine-Tuning (SFT) and are generally known to improve both accuracy and diversity (unless we overfit by training for too many epochs). If we show the model a &#8220;Gold&#8221; solution that it currently assigns low probability to, we are <strong>forcing it to expand the support of its distribution</strong>. This <strong>increases diversity</strong> by teaching the model a new mode it hadn&#8217;t discovered on its own. The main downside of off-policy positive examples is that they by themselves don&#8217;t induce good generalization due to lack of pruning via negative on-policy examples.</p><p><strong>Off-policy negative examples</strong> are not well understood. My intuition here is that if you penalize a behavior which the model essentially never does (low probability mass), the gradient should be negligible. But such examples are a core part of some successful DPO-baed training recipes and their effect deserves a more thorough investigation.</p><p>We end up with the following priority list of types of training examples:</p><ol><li><p><strong>Negative On-Policy:</strong> High utility. Prunes errors, maintains diversity.</p></li><li><p><strong>Positive Off-Policy:</strong> High utility. Expands diversity, teaches new behaviors.</p></li><li><p><strong>Positive On-Policy:</strong> Mixed utility. Sharpens pass@1 but risks mode collapse.</p></li><li><p><strong>Negative Off-Policy:</strong> Unclear utility. Needs more research.</p></li></ol><h1>The Prior</h1><p>If on-policy RL is primarily a mechanism for reinforcing existing good behaviors (sharpening peaks) or pruning wrong ones (cutting peaks), then we are left with an uncomfortable conclusion: <strong>it can&#8217;t learn qualitatively new behaviors.</strong></p><p>The irony here is that <strong>a tight prior from pre-training is the very thing that makes RL possible for LLMs</strong> in the first place. After pre-training <strong>most of the output probability gets concentrated in just a few tokens</strong> and this effectively shrinks the action space to 2-5 options at each position, compared to the full unconstrained vocabulary size of ~130k tokens. <strong>It would be hopeless to start RL training from a uniform prior</strong> over a discrete action space with 130k elements, especially when you consider long trajectories with only terminal rewards.</p><p>The effectiveness of RL post-training pipeline is strictly bounded by the support of the prior produced by pre-training. To break these bounds, we cannot simply rely on standard LLM RL with high-temperature sampling. We have two main paths forward:</p><ol><li><p><strong>Fix the prior:</strong> We can encourage significantly <strong>more diversity during pre-training</strong>, ensuring the initial distribution extensively covers the space of responses. Synthetic data augmentation for pre-training could potentially help here, but we&#8217;d need to be careful to avoid regurgitating the data without substantially transforming it. Also, this introduces a <strong>risk of capability dilution</strong> if the output distribution includes too many low-quality outputs.</p></li><li><p><strong>Break out from the prior:</strong> A much more promising path, in my opinion. We need <strong>advanced exploration methods</strong> that go beyond the model&#8217;s current policy (true off-policy exploration) to expand the support of the output distribution, rather than just reshaping what is already there. The most useful thing would be to <strong>generate positive examples which are slightly off-policy to gradually expand the output distribution towards correct responses</strong>.</p></li></ol><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://www.reinforced.info/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://www.reinforced.info/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[Bandits vs Reinforcement Learning from Human Feedback]]></title><description><![CDATA[Are single-step or multi-step models better suited for RLHF? Find out the main differences between them in this post]]></description><link>https://www.reinforced.info/p/bandits-vs-reinforcement-learning</link><guid isPermaLink="false">https://www.reinforced.info/p/bandits-vs-reinforcement-learning</guid><dc:creator><![CDATA[Alex Nikulkov]]></dc:creator><pubDate>Tue, 30 Apr 2024 14:01:32 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!MVzv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7928c60e-278f-4680-83ba-b8b69e0b3350_1792x1024.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MVzv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7928c60e-278f-4680-83ba-b8b69e0b3350_1792x1024.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MVzv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7928c60e-278f-4680-83ba-b8b69e0b3350_1792x1024.webp 424w, https://substackcdn.com/image/fetch/$s_!MVzv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7928c60e-278f-4680-83ba-b8b69e0b3350_1792x1024.webp 848w, https://substackcdn.com/image/fetch/$s_!MVzv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7928c60e-278f-4680-83ba-b8b69e0b3350_1792x1024.webp 1272w, https://substackcdn.com/image/fetch/$s_!MVzv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7928c60e-278f-4680-83ba-b8b69e0b3350_1792x1024.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MVzv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7928c60e-278f-4680-83ba-b8b69e0b3350_1792x1024.webp" width="1456" height="832" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7928c60e-278f-4680-83ba-b8b69e0b3350_1792x1024.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:832,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:406012,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MVzv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7928c60e-278f-4680-83ba-b8b69e0b3350_1792x1024.webp 424w, https://substackcdn.com/image/fetch/$s_!MVzv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7928c60e-278f-4680-83ba-b8b69e0b3350_1792x1024.webp 848w, https://substackcdn.com/image/fetch/$s_!MVzv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7928c60e-278f-4680-83ba-b8b69e0b3350_1792x1024.webp 1272w, https://substackcdn.com/image/fetch/$s_!MVzv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7928c60e-278f-4680-83ba-b8b69e0b3350_1792x1024.webp 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Reinforcement Learning from Human Feedback (RLHF) has caused a surge of interest in Reinforcement Learning (RL) algorithms, specifically the Proximal Policy Optimization (PPO) <a href="https://arxiv.org/abs/1707.06347">[1]</a>, popularized for RLHF by the InstructGPT <a href="https://proceedings.neurips.cc/paper_files/paper/2022/hash/b1efde53be364a73914f58805a001731-Abstract-Conference.html">[2]</a> paper. The success of InstructGPT and its commercial successor ChatGPT has made PPO the de facto standard algorithm for LLM fine-tuning. But <strong>a recent paper <a href="https://arxiv.org/abs/2402.14740">[3]</a> questioned whether the complexity of PPO is necessary, and has shown that a simpler REINFORCE algorithm applied to a contextual bandit model works better</strong>. In this post, I&#8217;ll share the main ideas from this paper and discuss the differences between using contextual bandit and multi-step RL for LLM fine-tuning.</p><h1>REINFORCE paper</h1><p><a href="https://cohere.com/">Cohere</a> has recently published a paper &#8220;Back to Basics: Revisiting REINFORCE Style Optimization for Learning from Human Feedback in LLMs&#8221; <a href="https://arxiv.org/abs/2402.14740">[3]</a>, in which they <strong>argue that REINFORCE should replace PPO as the default RLHF algorithm</strong>. Moreover, they <strong>suggest that multi-step RL algorithms aren&#8217;t necessary for LLM fine-tuning and simpler single-step contextual bandit algorithms can be used instead</strong>. Even though REINFORCE is usually used as a multi-step RL algorithm, this paper uses its simplified contextual bandit version. Their arguments center around the fact that PPO was developed for different types of problems like robotics and control, which have their own challenges distinct from RLHF. Quoting from the paper: </p><blockquote><p>We note that PPO, as an approach, emphasizes stability across iterations, aiming to train an effective policy with the premise of small, stable updates. PPO was designed for a regime where off-policy gradient updates are large enough to introduce instability. This regime dominates traditional Deep-RL benchmarks [...] However, in this work, we posit that the setting of RLHF, which involves fine-tuning a pre-trained LLM, is lacking in these characteristics.</p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8ptG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5544f45-2f02-4ead-8798-158ba35208a3_976x98.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8ptG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5544f45-2f02-4ead-8798-158ba35208a3_976x98.png 424w, https://substackcdn.com/image/fetch/$s_!8ptG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5544f45-2f02-4ead-8798-158ba35208a3_976x98.png 848w, https://substackcdn.com/image/fetch/$s_!8ptG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5544f45-2f02-4ead-8798-158ba35208a3_976x98.png 1272w, https://substackcdn.com/image/fetch/$s_!8ptG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5544f45-2f02-4ead-8798-158ba35208a3_976x98.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8ptG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5544f45-2f02-4ead-8798-158ba35208a3_976x98.png" width="976" height="98" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a5544f45-2f02-4ead-8798-158ba35208a3_976x98.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:98,&quot;width&quot;:976,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8ptG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5544f45-2f02-4ead-8798-158ba35208a3_976x98.png 424w, https://substackcdn.com/image/fetch/$s_!8ptG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5544f45-2f02-4ead-8798-158ba35208a3_976x98.png 848w, https://substackcdn.com/image/fetch/$s_!8ptG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5544f45-2f02-4ead-8798-158ba35208a3_976x98.png 1272w, https://substackcdn.com/image/fetch/$s_!8ptG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5544f45-2f02-4ead-8798-158ba35208a3_976x98.png 1456w" sizes="100vw"></picture><div></div></div></a></figure></div><p>They identify <strong>3 distinct components of PPO</strong> (see the PPO objective above) and s<strong>how evidence that each of these components is unnecessary for RLHF of pre-trained LLMs</strong>. The 3 components are:</p><ol><li><p><strong>Clipped off-policy probability ratios</strong>. They found that clipping was applied &lt;5% of the time in their RLHF runs, so it&#8217;s rarely necessary. They found the algorithm to work better when clipping was turned off. This shows that large off-policy updates are uncommon when fine-tuning pre-trained LLMs.</p><ol><li><p>Moreover, they found that the probability ratios were close to 1 most of the time, so they removed the ratios from the loss without any impact on learning stability or quality. This switched the algorithm from being off-policy to a simpler on-policy PG algorithm.</p></li></ol></li><li><p><strong>Generalized Advantage Estimation (GAE) <a href="https://arxiv.org/abs/1506.02438">[4]</a> and separate value function</strong>. The advantage term in PPO is estimated by GAE, which bootstraps from the learned value function to reduce variance. GAE has a hyperparameter <code>lambda</code><em>, </em>which controls the bias-variance tradeoff. Turns out that setting <code>lambda=1 </code>results in the best performance. Under this setting the algorithm completely ignores the value function and just uses the reward model (highest variance, lowest bias).</p></li><li><p><strong>Multi-step RL modeling</strong>. In PPO it&#8217;s assumed that text generation is a token-by-token multi-step process. The paper shows that this is unnecessary and a simpler bandit approach that models the whole response as a single step consistently outperforms the multi-step RL approach. This allows us to avoid dealing with partial responses and only consider full responses.</p></li></ol><p>One of the core arguments about the ineffectiveness of PPO for LLM fine-tuning is related to its focus on reducing variance. <strong>It turns out that the RLHF of LLMs is much less exposed to high variance of gradients than classical deep RL environments, so it&#8217;s not worth it to increase bias for the sake of reducing variance</strong>. The main reasons for the low gradient variance during RLHF for pre-trained LLMs are:</p><ol><li><p><strong>High quality of pre-trained LLMs</strong>. Most classical RL environments cannot pre-train the agents before starting RL training, so the initial policy is very poor and requires variance reductions to prevent destructively large gradient updates.</p></li><li><p><strong>Small size of effective action space</strong>. While the full action space size at each decoding step is equal to the number of tokens in the dictionary (on the order of 10k-100k), pre-training leads to a strong concentration of probability mass in just a handful of tokens, making the action space effectively smaller. In their experiments, 60% of probability mass was concentrated in the top token and 90%+ in the top 16 tokens.</p></li></ol><h1>Comparison of RL and Bandits for LLM</h1><p>Why do we even have a choice of whether to use RL or bandit models for LLMs? After all, nobody in their right mind would consider modeling a robot or a chess agent as a bandit environment. It&#8217;s because <strong>in LLMs the transition dynamics are very simple and deterministic</strong>. The state is modeled as the sequence of previous tokens and the action is the choice of the next token to decode. This leads to a simple state transition rule: append the action token to the list of previous tokens. <strong>Since no new information is revealed after each token, selecting the tokens one by one is equivalent to pre-committing to a sequence of tokens and executing them one by one</strong>. This does not prevent us from updating the token probabilities autoregressively by feeding each new token back into the model before generating the next token.</p><p>The simplest definition of a contextual bandit environment is a single-step Markov Decision Process (MDP). The agent observes the state (context), executes an action, and receives a reward. Then, the episode terminates and the next episode arrives. A crucial assumption in contextual bandits is that each episode is independent of the actions taken during other episodes. RL, on the other hand, deals with multi-step MDPs in which several state-action-reward steps are repeated until the episode terminates. The state transitions are allowed to depend on the actions.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8UA4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa82110f4-160b-4585-9295-99a3aad75345_2580x1056.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8UA4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa82110f4-160b-4585-9295-99a3aad75345_2580x1056.png 424w, https://substackcdn.com/image/fetch/$s_!8UA4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa82110f4-160b-4585-9295-99a3aad75345_2580x1056.png 848w, https://substackcdn.com/image/fetch/$s_!8UA4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa82110f4-160b-4585-9295-99a3aad75345_2580x1056.png 1272w, https://substackcdn.com/image/fetch/$s_!8UA4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa82110f4-160b-4585-9295-99a3aad75345_2580x1056.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8UA4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa82110f4-160b-4585-9295-99a3aad75345_2580x1056.png" width="1456" height="596" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a82110f4-160b-4585-9295-99a3aad75345_2580x1056.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:596,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:209956,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8UA4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa82110f4-160b-4585-9295-99a3aad75345_2580x1056.png 424w, https://substackcdn.com/image/fetch/$s_!8UA4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa82110f4-160b-4585-9295-99a3aad75345_2580x1056.png 848w, https://substackcdn.com/image/fetch/$s_!8UA4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa82110f4-160b-4585-9295-99a3aad75345_2580x1056.png 1272w, https://substackcdn.com/image/fetch/$s_!8UA4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa82110f4-160b-4585-9295-99a3aad75345_2580x1056.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>To better understand the structural differences between RL and bandit approaches, let&#8217;s examine their <a href="https://lilianweng.github.io/posts/2018-04-08-policy-gradient/">Policy Gradient &nbsp;(PG, [5])</a> objectives more closely. PPO uses an off-policy PG expression, while REINFORCE uses an on-policy PG, but this distinction is orthogonal to using RL vs bandits, so I will use on-policy PG in both RL and bandit examples. I will strip away all bells and whistles of the algorithms and consider the simplest reasonable RL and bandit formulations for LLM fine-tuning to illustrate the difference between them.</p><p>First, a simple RL objective for a single trajectory of length <em>T</em> looks like this:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\sum_{t=1}^T A(y_t|x,y_1,...,y_{t-1})\\ln \\pi (y_t|x,y_1,...,y_{t-1})&quot;,&quot;id&quot;:&quot;DSXVVEFYLU&quot;}" data-component-name="LatexBlockToDOM"></div><p>Compare this to a bandit objective:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;A(y,x) \\ln \\pi (y|x) = A(y,x) \\ln \\prod_{t=1}^T \\pi (y_t|x,y_1,...,y_{t-1})= \\sum_{t=1}^T A(y,x)\\ln \\pi (y_t|x,y_1,...,y_{t-1})&quot;,&quot;id&quot;:&quot;SJRCPQVVRE&quot;}" data-component-name="LatexBlockToDOM"></div><p>The objective functions are remarkably similar. The main difference is that the multi-step RL uses a different advantage value at each step, estimated by an advantage function with partial responses as inputs, usually implemented via a learned value function. On the other hand, the bandit model uses the same advantage value for each step, and the advantage function takes full response as an input. In <a href="https://arxiv.org/abs/2402.14740">[3]</a> the bandit advantage is implemented through the Reinforce Leave One Out (RLOO) algorithm, which removes the need for a learned value/baseline function. It generates multiple responses for the same prompt and uses the average reward model scores of other responses as a baseline to calculate the advantage. <strong>The core difference between RL and bandit losses is whether the advantage function takes full or partial responses as an input</strong>.</p><p><strong>The most obvious disadvantage of the bandit approach to LLMs is that they only attribute the reward to the full response, not individual tokens.</strong> This is OK for vanilla RLHF, but <strong>it would not be efficient for more advanced approaches that attribute some reward values to individual tokens</strong>. Dense token-level feedback could be useful to reduce hallucinations and toxicity <a href="https://proceedings.neurips.cc/paper_files/paper/2023/file/b8c90b65739ae8417e61eadb521f63d5-Paper-Conference.pdf">[6]</a>, or reward the model for making partial progress <a href="https://arxiv.org/pdf/2304.01904">[7]</a>, <a href="https://arxiv.org/pdf/2305.20050">[8]</a>.</p><p>The table below summarizes the pros and cons of using multi-step RL and bandits for LLM fine-tuning.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!qdz_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfe0b9-0e37-4e01-acae-13d726f03c34_1272x1224.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qdz_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfe0b9-0e37-4e01-acae-13d726f03c34_1272x1224.png 424w, https://substackcdn.com/image/fetch/$s_!qdz_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfe0b9-0e37-4e01-acae-13d726f03c34_1272x1224.png 848w, https://substackcdn.com/image/fetch/$s_!qdz_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfe0b9-0e37-4e01-acae-13d726f03c34_1272x1224.png 1272w, https://substackcdn.com/image/fetch/$s_!qdz_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfe0b9-0e37-4e01-acae-13d726f03c34_1272x1224.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qdz_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfe0b9-0e37-4e01-acae-13d726f03c34_1272x1224.png" width="1272" height="1224" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8fdfe0b9-0e37-4e01-acae-13d726f03c34_1272x1224.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1224,&quot;width&quot;:1272,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:185148,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qdz_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfe0b9-0e37-4e01-acae-13d726f03c34_1272x1224.png 424w, https://substackcdn.com/image/fetch/$s_!qdz_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfe0b9-0e37-4e01-acae-13d726f03c34_1272x1224.png 848w, https://substackcdn.com/image/fetch/$s_!qdz_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfe0b9-0e37-4e01-acae-13d726f03c34_1272x1224.png 1272w, https://substackcdn.com/image/fetch/$s_!qdz_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8fdfe0b9-0e37-4e01-acae-13d726f03c34_1272x1224.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>It&#8217;s worth mentioning that the InstructGPT paper <a href="https://proceedings.neurips.cc/paper_files/paper/2022/hash/b1efde53be364a73914f58805a001731-Abstract-Conference.html">[2]</a> has caused a good amount of confusion in the community about whether they used a bandit or an RL setup for RLHF fine-tuning. Without open source code available, the community was left to guess how exactly RLHF was implemented in InstructGPT (and later in ChatGPT and GPT&#8211;4). This is not unlike religious scholars arguing over the meaning of passages from the Bible. My bet is on OpenAI having used multi-step RL and just not being clear in describing it.</p><p>Evidence for InstructGPT using multi-step RL:</p><ol><li><p>The paper refers to a separate reward model and value model. This makes sense only in a multi-step RL world.</p></li><li><p>The paper mentions GAE, which applies only to multi-step RL</p></li></ol><p>Evidence for InstructGPT using bandits:</p><ol><li><p>Quote from the paper: &#8220;<em>The environment is a bandit environment which presents a random customer prompt and expects a response to the prompt</em>&#8221;.</p></li><li><p>John Schulman (the main author of the PPO paper and one of the core contributors to InstructGPT) said in a <a href="https://www.talkrl.com/episodes/john-schulman/transcript">podcast interview</a> shortly after the release of the InstructGPT paper: ".<em>..we've been just looking at a contextual bandit problem. ... you get a query and you output a response and then that response gets a reward. So if we had a multi-step process, such as a conversation where you can't assign a reward until the very end of the conversation ... You would probably have to ... train a Q function. I think we'll have to start exploring this at some point soon, but so far we haven't"</em></p></li></ol><p>Framing LLM fine-tuning as a bandit problem opens the door to <strong>future applications of a rich set of bandit methods to LLMs</strong>. Contextual bandits are much simpler than RL mathematically, so a wider range of rigorous methods were developed. RL has often followed a more relaxed approach with fewer conclusive proofs and stronger reliance on empirical results. <strong>Some examples of bandit-based methods that could be applied to LLMs: offline learning <a href="https://openreview.net/forum?id=SJaP_-xAb">[9]</a>, offline evaluation <a href="https://proceedings.neurips.cc/paper_files/paper/2019/hash/d60678e8f2ba9c540798ebbde31177e8-Abstract.html">[10]</a>, and exploration <a href="https://www.jmlr.org/papers/v22/18-863.html">[11]</a>.</strong> Another development that I expect to happen is the <strong>customization of contextual bandit methods to work with a unique action space of LLMs: variable-size discrete action space</strong>. LLMs generate tokens until the EOS token is returned (or the maximum generation length is reached). Each token can be modeled as a discrete choice along one of the dimensions of the action space, but this leads to a variable dimensionality of the action space, depending on the number of generated tokens. The simple approach used now is to take a sequential product of individual token probabilities as the probability of the response, but more specialized approaches could be useful.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.reinforced.info/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Reinforced! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h1>Recap</h1><ol><li><p>LLM can be framed as a multi-step MDP and solved with Reinforcement Learning methods. Or it can be framed as a single-step MDP and solved with Contextual Bandit methods.</p></li><li><p>PPO applied to a multi-step MDP is the de-facto standard approach to RLHF, but a recent paper showed that a simpler REINFORCE algorithm applied to a single-step contextual bandit MDP outperforms PPO.</p></li><li><p>More research into Contextual Bandit methods for RLHF is likely to come out in the coming years, improving both training and evaluation.</p></li></ol><h1>References</h1><ol><li><p><a href="https://arxiv.org/abs/1707.06347">Schulman, John, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. "Proximal policy optimization algorithms." arXiv preprint arXiv:1707.06347 (2017).</a></p></li><li><p><a href="https://proceedings.neurips.cc/paper_files/paper/2022/hash/b1efde53be364a73914f58805a001731-Abstract-Conference.html">Ouyang, Long, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang et al. "Training language models to follow instructions with human feedback." Advances in neural information processing systems 35 (2022): 27730-27744.</a></p></li><li><p><a href="https://arxiv.org/abs/2402.14740">Ahmadian, Arash, Chris Cremer, Matthias Gall&#233;, Marzieh Fadaee, Julia Kreutzer, Ahmet &#220;st&#252;n, and Sara Hooker. "Back to Basics: Revisiting REINFORCE Style Optimization for Learning from Human Feedback in LLMs." arXiv preprint arXiv:2402.14740 (2024).</a></p></li><li><p><a href="https://arxiv.org/abs/1506.02438">Schulman, John, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. "High-dimensional continuous control using generalized advantage estimation." arXiv preprint arXiv:1506.02438 (2015).</a></p></li><li><p><a href="https://lilianweng.github.io/posts/2018-04-08-policy-gradient/">Weng, Lilian. "Policy Gradient Algorithms." lilianweng.github.io (2018)</a></p></li><li><p><a href="https://proceedings.neurips.cc/paper_files/paper/2023/file/b8c90b65739ae8417e61eadb521f63d5-Paper-Conference.pdf">Wu, Zeqiu, Yushi Hu, Weijia Shi, Nouha Dziri, Alane Suhr, Prithviraj Ammanabrolu, Noah A. Smith, Mari Ostendorf, and Hannaneh Hajishirzi. "Fine-grained human feedback gives better rewards for language model training." Advances in Neural Information Processing Systems 36 (2024).</a></p></li><li><p><a href="https://arxiv.org/pdf/2304.01904">Paul, Debjit, Mete Ismayilzada, Maxime Peyrard, Beatriz Borges, Antoine Bosselut, Robert West, and Boi Faltings. "Refiner: Reasoning feedback on intermediate representations." arXiv preprint arXiv:2304.01904 (2023).</a></p></li><li><p><a href="https://arxiv.org/pdf/2305.20050">Lightman, Hunter, Vineet Kosaraju, Yura Burda, Harri Edwards, Bowen Baker, Teddy Lee, Jan Leike, John Schulman, Ilya Sutskever, and Karl Cobbe. "Let's Verify Step by Step." arXiv preprint arXiv:2305.20050 (2023).</a></p></li><li><p><a href="https://openreview.net/forum?id=SJaP_-xAb">Joachims, Thorsten, Adith Swaminathan, and Maarten De Rijke. "Deep learning with logged bandit feedback." In International Conference on Learning Representations. 2018.</a></p></li><li><p><a href="https://proceedings.neurips.cc/paper_files/paper/2019/hash/d60678e8f2ba9c540798ebbde31177e8-Abstract.html">Dud&#237;k, Miroslav, Dumitru Erhan, John Langford, and Lihong Li. "Doubly robust policy evaluation and optimization." (2014): 485-511.</a></p></li><li><p><a href="https://www.jmlr.org/papers/v22/18-863.html">Hao, Botao, Tor Lattimore, and Csaba Szepesvari. "Adaptive exploration in linear contextual bandit." In International Conference on Artificial Intelligence and Statistics, pp. 3536-3545. PMLR, 2020.</a></p></li></ol>]]></content:encoded></item><item><title><![CDATA[Reward Model Overoptimization: Root Causes and Mitigations]]></title><description><![CDATA[When I first ran an RLHF training job, I was surprised at how easily the reward model scores increased during the training process.]]></description><link>https://www.reinforced.info/p/reward-model-overoptimization</link><guid isPermaLink="false">https://www.reinforced.info/p/reward-model-overoptimization</guid><dc:creator><![CDATA[Alex Nikulkov]]></dc:creator><pubDate>Sun, 07 Apr 2024 02:43:21 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!AbHS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd477dd0-a82b-4ffe-8d0a-2d2acaba4127_1024x1024.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!AbHS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd477dd0-a82b-4ffe-8d0a-2d2acaba4127_1024x1024.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AbHS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd477dd0-a82b-4ffe-8d0a-2d2acaba4127_1024x1024.webp 424w, https://substackcdn.com/image/fetch/$s_!AbHS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd477dd0-a82b-4ffe-8d0a-2d2acaba4127_1024x1024.webp 848w, https://substackcdn.com/image/fetch/$s_!AbHS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd477dd0-a82b-4ffe-8d0a-2d2acaba4127_1024x1024.webp 1272w, https://substackcdn.com/image/fetch/$s_!AbHS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd477dd0-a82b-4ffe-8d0a-2d2acaba4127_1024x1024.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!AbHS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd477dd0-a82b-4ffe-8d0a-2d2acaba4127_1024x1024.webp" width="426" height="426" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bd477dd0-a82b-4ffe-8d0a-2d2acaba4127_1024x1024.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:426,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;A comical illustration of a robot student in a classroom setting, trying to cheat on a school exam. The robot, designed with a sleek and futuristic appearance, is cleverly holding a cheat sheet with its mechanical hands under the desk. The cheat sheet is filled with equations and notes relevant to the exam. Despite its advanced technology, the robot peers at the cheat sheet with a look of intense concentration, mimicking human behavior. Around it, human students are diligently working on their exams, unaware of the robot's deceitful tactic. The classroom is typical, with a chalkboard in the background, wooden desks, and a teacher at the front of the room, monitoring the students but not noticing the robot's actions. This scene blends elements of futuristic technology with the classic high school exam scenario, creating a humorous contrast.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A comical illustration of a robot student in a classroom setting, trying to cheat on a school exam. The robot, designed with a sleek and futuristic appearance, is cleverly holding a cheat sheet with its mechanical hands under the desk. The cheat sheet is filled with equations and notes relevant to the exam. Despite its advanced technology, the robot peers at the cheat sheet with a look of intense concentration, mimicking human behavior. Around it, human students are diligently working on their exams, unaware of the robot's deceitful tactic. The classroom is typical, with a chalkboard in the background, wooden desks, and a teacher at the front of the room, monitoring the students but not noticing the robot's actions. This scene blends elements of futuristic technology with the classic high school exam scenario, creating a humorous contrast." title="A comical illustration of a robot student in a classroom setting, trying to cheat on a school exam. The robot, designed with a sleek and futuristic appearance, is cleverly holding a cheat sheet with its mechanical hands under the desk. The cheat sheet is filled with equations and notes relevant to the exam. Despite its advanced technology, the robot peers at the cheat sheet with a look of intense concentration, mimicking human behavior. Around it, human students are diligently working on their exams, unaware of the robot's deceitful tactic. The classroom is typical, with a chalkboard in the background, wooden desks, and a teacher at the front of the room, monitoring the students but not noticing the robot's actions. This scene blends elements of futuristic technology with the classic high school exam scenario, creating a humorous contrast." srcset="https://substackcdn.com/image/fetch/$s_!AbHS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd477dd0-a82b-4ffe-8d0a-2d2acaba4127_1024x1024.webp 424w, https://substackcdn.com/image/fetch/$s_!AbHS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd477dd0-a82b-4ffe-8d0a-2d2acaba4127_1024x1024.webp 848w, https://substackcdn.com/image/fetch/$s_!AbHS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd477dd0-a82b-4ffe-8d0a-2d2acaba4127_1024x1024.webp 1272w, https://substackcdn.com/image/fetch/$s_!AbHS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd477dd0-a82b-4ffe-8d0a-2d2acaba4127_1024x1024.webp 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>When I first ran an RLHF training job, I was surprised at how easily the reward model scores increased during the training process. It worked on the first attempt. No hyperparameter search, no deep analysis of network weights or gradients. It seemed almost too ideal. Well, it was. While PPO was easily able to push the reward model scores up into almost astronomical values, this didn&#8217;t result in perceived improvements to text quality. Instead, the model devolved, generating gibberish, like empty outputs or a single emoji repeated hundreds of times. My initial excitement turned into disappointment, as I was facing a case of <em><strong>reward model overoptimization</strong></em>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!TQ4u!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3774e2e8-8ff8-4ea4-a9f4-60a5a36baac0_912x858.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TQ4u!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3774e2e8-8ff8-4ea4-a9f4-60a5a36baac0_912x858.png 424w, https://substackcdn.com/image/fetch/$s_!TQ4u!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3774e2e8-8ff8-4ea4-a9f4-60a5a36baac0_912x858.png 848w, https://substackcdn.com/image/fetch/$s_!TQ4u!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3774e2e8-8ff8-4ea4-a9f4-60a5a36baac0_912x858.png 1272w, https://substackcdn.com/image/fetch/$s_!TQ4u!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3774e2e8-8ff8-4ea4-a9f4-60a5a36baac0_912x858.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!TQ4u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3774e2e8-8ff8-4ea4-a9f4-60a5a36baac0_912x858.png" width="416" height="391.36842105263156" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3774e2e8-8ff8-4ea4-a9f4-60a5a36baac0_912x858.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:858,&quot;width&quot;:912,&quot;resizeWidth&quot;:416,&quot;bytes&quot;:147746,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TQ4u!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3774e2e8-8ff8-4ea4-a9f4-60a5a36baac0_912x858.png 424w, https://substackcdn.com/image/fetch/$s_!TQ4u!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3774e2e8-8ff8-4ea4-a9f4-60a5a36baac0_912x858.png 848w, https://substackcdn.com/image/fetch/$s_!TQ4u!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3774e2e8-8ff8-4ea4-a9f4-60a5a36baac0_912x858.png 1272w, https://substackcdn.com/image/fetch/$s_!TQ4u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3774e2e8-8ff8-4ea4-a9f4-60a5a36baac0_912x858.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Figure 1. An illustration of reward model overoptimization: training reward scores are increasing, while the true quality peaks and then drops. Image credit: <a href="https://arxiv.org/pdf/2310.02743.pdf">[3]</a></figcaption></figure></div><p>Reward model overoptimization lives at the intersection of 2 well-known ML concepts: <strong>reward hacking</strong> and <strong>distribution shift</strong>. When combined, they create a perfect storm of deception during RLHF training.</p><p><strong>Reward hacking</strong> occurs when an objective specified for the Reinforcement Learning (RL) agent does not fully encapsulate the creator's intended outcome. Given the complexity of accurately codifying desired behaviors mathematically, it's common for system designers to opt for simpler reward functions. Similarly, <strong>RL agents also often seek the path of least resistance, optimizing for the specified rewards in unintended ways</strong>. A famous hypothetical <a href="https://en.wikipedia.org/wiki/Instrumental_convergence#Paperclip_maximizer">paperclip maximizer</a> is given a goal of producing as many paperclips as possible (a reasonable goal to specify for an AI managing a paperclip factory). It might deduce that converting all human matter into paperclips is the most efficient strategy - not quite the behavior we&#8217;d want from a factory manager. A less gloomy <a href="https://openai.com/research/faulty-reward-functions">example</a> comes from OpenAI using RL to train an agent to play CoastRunners, a boat racing game. While humans tend to focus on speed and agility to outpace opponents, the RL agent discovered that endlessly circling to collect bonus items, without ever finishing the race, resulted in a score roughly 20% higher than human players typically achieve. Figure 2 shows an example of this behavior. Victoria Krakovna has a <a href="https://docs.google.com/spreadsheets/d/e/2PACX-1vRPiprOaC3HsCf5Tuum8bRfzYUiKLRqJmbOoC-32JorNdfyTiRRsR7Ea5eWtvsWzuxo8bjOxCG84dAg/pubhtml">list of many more examples of reward hacking</a> by RL and other similar methods.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!UAuQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd46ffb29-4676-4642-970b-bd8ccc3c6169_478x360.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UAuQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd46ffb29-4676-4642-970b-bd8ccc3c6169_478x360.gif 424w, https://substackcdn.com/image/fetch/$s_!UAuQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd46ffb29-4676-4642-970b-bd8ccc3c6169_478x360.gif 848w, https://substackcdn.com/image/fetch/$s_!UAuQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd46ffb29-4676-4642-970b-bd8ccc3c6169_478x360.gif 1272w, https://substackcdn.com/image/fetch/$s_!UAuQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd46ffb29-4676-4642-970b-bd8ccc3c6169_478x360.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UAuQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd46ffb29-4676-4642-970b-bd8ccc3c6169_478x360.gif" width="478" height="360" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d46ffb29-4676-4642-970b-bd8ccc3c6169_478x360.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:360,&quot;width&quot;:478,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2753839,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UAuQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd46ffb29-4676-4642-970b-bd8ccc3c6169_478x360.gif 424w, https://substackcdn.com/image/fetch/$s_!UAuQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd46ffb29-4676-4642-970b-bd8ccc3c6169_478x360.gif 848w, https://substackcdn.com/image/fetch/$s_!UAuQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd46ffb29-4676-4642-970b-bd8ccc3c6169_478x360.gif 1272w, https://substackcdn.com/image/fetch/$s_!UAuQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd46ffb29-4676-4642-970b-bd8ccc3c6169_478x360.gif 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Figure 2. Example of  reward hacking by Reinforcement Learning agent. Image credit: <a href="https://openai.com/research/faulty-reward-functions">OpenAI blog post</a></figcaption></figure></div><p>The second critical factor for overoptimization is <strong>distribution shift</strong>. In RLHF we use a learned reward model to provide feedback for the agent. The reward model is trained to approximate human preferences, but this approximation is always imperfect. <strong>The approximation might be good inside the distribution of training data of the reward model, but it starts breaking down as we move outside of the distribution</strong>. Typically, in RLHF, we use the Supervised Fine-Tuned (SFT) checkpoint both to generate training data for the reward model and to initialize the LLM at the beginning of RLHF fine-tuning. In the first steps of RLHF fine-tuning, the LLM is still close to its initial state and its generations remain similar to the ones the reward model was trained on, making the reward scores generally trustworthy. However, as the LLM undergoes further fine-tuning, it begins to produce outputs that diverge from the initial training data, forcing the reward model to increasingly rely on extrapolation, as shown in Figure 3.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!UIW4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1fe078c-31a7-4270-81d1-0068bfd5ecbf_1787x1566.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UIW4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1fe078c-31a7-4270-81d1-0068bfd5ecbf_1787x1566.png 424w, https://substackcdn.com/image/fetch/$s_!UIW4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1fe078c-31a7-4270-81d1-0068bfd5ecbf_1787x1566.png 848w, https://substackcdn.com/image/fetch/$s_!UIW4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1fe078c-31a7-4270-81d1-0068bfd5ecbf_1787x1566.png 1272w, https://substackcdn.com/image/fetch/$s_!UIW4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1fe078c-31a7-4270-81d1-0068bfd5ecbf_1787x1566.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UIW4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1fe078c-31a7-4270-81d1-0068bfd5ecbf_1787x1566.png" width="333" height="291.8324175824176" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d1fe078c-31a7-4270-81d1-0068bfd5ecbf_1787x1566.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1276,&quot;width&quot;:1456,&quot;resizeWidth&quot;:333,&quot;bytes&quot;:285095,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UIW4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1fe078c-31a7-4270-81d1-0068bfd5ecbf_1787x1566.png 424w, https://substackcdn.com/image/fetch/$s_!UIW4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1fe078c-31a7-4270-81d1-0068bfd5ecbf_1787x1566.png 848w, https://substackcdn.com/image/fetch/$s_!UIW4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1fe078c-31a7-4270-81d1-0068bfd5ecbf_1787x1566.png 1272w, https://substackcdn.com/image/fetch/$s_!UIW4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1fe078c-31a7-4270-81d1-0068bfd5ecbf_1787x1566.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Figure 3. Conceptual image of distribution shift during RLHF fine-tuning</figcaption></figure></div><p><strong>A combination of reward hacking and distribution shift inevitably leads to overoptimization</strong>. It is easier for the RL agent to learn to exploit the inefficiencies of the reward model than to learn to genuinely improve text quality. Over time real text quality starts breaking down, while the reward model scores keep increasing. It&#8217;s easier to cheat on a test than to study for it and well-executed cheating can give you a perfect score. <strong>This discrepancy highlights a fundamental challenge in RLHF: ensuring that the pursuit of high reward scores aligns with a genuine improvement in output quality.</strong></p><p>The most comprehensive study of RLHF overoptimization comes from an <a href="https://proceedings.mlr.press/v202/gao23h.html">OpenAI paper [1]</a>, which introduced a &#8220;gold reward model&#8221; framework. They used a large transformer model as if it were a true source of human preferences. They then trained smaller reward models on generations labeled by the &#8220;gold&#8221; model and analyzed the patterns of how both the &#8220;gold&#8221; and learned reward model scores were changing during RLHF fine-tuning. They find that <strong>RLHF (PPO) typically causes more overoptimization than best-of-N sampling</strong>. Also, <strong>larger reward models and reward models trained on more data are less likely to be overoptimized</strong>, suggesting that the scale of the model and the size of its training data play crucial roles in mitigating the risks of overoptimization.</p><p>Having a good understanding of overoptimization, we can explore the <strong>most common strategies to counteract it</strong>. These methods <strong>mostly focus on limiting the distribution shift</strong>, as reward hacking is generally much harder to prevent without fundamental changes to the reward structure.</p><ol><li><p><strong>KL Regularization</strong>. All mainstream RLHF implementations use KL divergence from the SFT policy to regularize the training process and limit the extent of distribution shift. It&#8217;s typically implemented by setting a target value for KL divergence and adaptively tuning the weight on KL divergence in the reward to hit the target. Some tuning might be required to find the optimal target KL value, which strikes a good balance between preventing distribution shift and allowing the model enough room to fine-tune.</p></li><li><p><strong>Early Stopping</strong>. Another popular method is early stopping or a selection of an intermediate checkpoint. The main idea is to stop training early enough that overoptimization hasn&#8217;t damaged the quality of the model yet. The OpenAI paper [1] shows that <strong>early stopping has a very similar effect as KL regularization</strong> on overoptimization and on the overall quality of the fine-tuned model. The main advantage of early stopping is that the training run can finish faster and use fewer computational resources. This makes early stopping a compelling way of fighting overoptimization, especially if you can find a good stopping policy. One practical option suggested in the <a href="https://arxiv.org/pdf/2204.05862.pdf">Anthropic Helpful&amp;Harmless paper [2]</a> is to use a separate &#8220;validation&#8221; reward model (trained on a held-out dataset) to score the generations during training. The training is then stopped when the validation score peaks and starts decreasing.</p></li><li><p><strong>Uncertainty Quantification and Conservative Reward Models.</strong> The root cause of overoptimization is that during the distribution shift, the reward model is making wrong predictions with high confidence. <strong>Making the reward model output a confidence interval instead of a point prediction could help prevent reliance on overestimated scores.</strong> This requires epistemic uncertainty quantification methods, like ensembles or Bayesian neural networks. A recent <a href="https://arxiv.org/pdf/2310.02743.pdf">paper [3]</a> trains an ensemble of reward models and shows that using a <strong>conservative reward estimate</strong> (e.g. the lowest output of the ensemble members) prevents overoptimization and improves LLM quality.</p></li><li><p><strong>Constrained Optimization.</strong> Greed is the root of all evil, so we could try not to be greedy and <strong>target a limited improvement to the reward scores</strong> instead of pushing them up as high as they would go. A <a href="https://arxiv.org/pdf/2310.04373.pdf">paper [4]</a> proposes to use constrained optimization to run multi-objective RLHF on several reward models simultaneously without causing overoptimization. Similar to KL regularization and early stopping, the main challenge here is to figure out the right value for target reward score improvement.</p></li><li><p><strong>Offline Reinforcement Learning (RL).</strong> Learning from a limited set of logged data is a popular approach in RL. While typical PPO-based RLHF pipelines use online RL, <strong>the general idea of limiting the distribution shift applies to both Offline RL and overoptimization prevention</strong>. Papers like <a href="https://arxiv.org/abs/2206.11871">Implicit Language Q-Learning (ILQL) [5]</a> have applied Offline RL methods to RLHF but without an explicit focus on overoptimization prevention. There might be an opportunity to apply popular Offline RL methods like <a href="https://arxiv.org/abs/2006.04779">Conservative Q-Learning (CQL) [6]</a> to RLHF.</p></li><li><p><strong>Improved Reward Model Generalization</strong>. The OpenAI paper [1] showed that using larger reward models and training them on more data makes these models less likely to be overoptimized. &#8220;More data'' could mean one of 2 things: (a) more samples from the same distribution; or (b) more diverse training data distribution. It seems reasonable to assume that training on more diverse datasets would make the reward model more generalizable, especially if some of the training data covers regions into which RLHF fine-tuning is likely to push the LLM. <strong>This might be the most promising method for long-term improvements since it relaxes the limit on how much the LLM can change during RLHF fine-tuning.</strong></p></li></ol><p><strong>The first step to fight overoptimization is detection</strong>, especially outside the controlled conditions of a "gold model" setup. Without a reliable benchmark for true quality, it can be really hard to distinguish between reward scores increasing due to genuine quality improvement or overoptimization. We can&#8217;t fight what we can&#8217;t see, so better ways of detecting overoptimization need to be developed and popularized. Two promising methods for enhancing detectability are:</p><ol><li><p><strong>Epistemic Uncertainty Measurement</strong>. An ensemble of reward models or a Bayesian neural network could be used to measure the level of the reward model&#8217;s confidence in its predictions. When confidence intervals get too wide, it may indicate that the model is venturing into unfamiliar territory, signaling potential overoptimization.</p></li><li><p><strong>Separate Reward Model for Evaluation</strong>. We can train a separate reward to evaluate the quality of generated text during training. This model should be as different as possible from the main reward model used for RLHF training. It can be trained on separate data (a different split of a dataset, or a completely different dataset), and use different weight initialization and hyperparameter values. This model would be unlikely to have the same extrapolation error as the main training reward model, so it can be used as an impartial evaluator.</p></li></ol><p><strong>Takeaways</strong>:</p><ol><li><p>Reward model optimization happens during RLHF because RL finds a way to <strong>reward-hack an imperfect reward model</strong>, which crumbles under the induced <strong>distribution shift</strong>.</p></li><li><p>Many <strong>ways to minimize overoptimization</strong> have been developed, most of them focusing on <strong>limiting the distribution shift</strong> from the model that generated the reward model training data. However, <strong>improving reward model generalization properties might be the most promising long-term direction</strong>.</p></li><li><p>Overoptimization is hard to detect. <strong>Special measures need to be taken to detect and measure overoptimization.</strong></p></li></ol><p></p><p>References:</p><ol><li><p><a href="https://proceedings.mlr.press/v202/gao23h.html">Gao, Leo, John Schulman, and Jacob Hilton. "Scaling laws for reward model overoptimization." In International Conference on Machine Learning, pp. 10835-10866. PMLR, 2023.</a></p></li><li><p><a href="https://arxiv.org/pdf/2204.05862.pdf">Bai, Yuntao, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain et al. "Training a helpful and harmless assistant with reinforcement learning from human feedback." arXiv preprint arXiv:2204.05862 (2022).</a></p></li><li><p><a href="https://arxiv.org/pdf/2310.02743.pdf">Coste, Thomas, Usman Anwar, Robert Kirk, and David Krueger. "Reward model ensembles help mitigate overoptimization." arXiv preprint arXiv:2310.02743 (2023).</a></p></li><li><p><a href="https://arxiv.org/pdf/2310.04373.pdf">Moskovitz, Ted, Aaditya K. Singh, D. J. Strouse, Tuomas Sandholm, Ruslan Salakhutdinov, Anca D. Dragan, and Stephen McAleer. "Confronting reward model overoptimization with constrained rlhf." arXiv preprint arXiv:2310.04373 (2023).</a></p></li><li><p><a href="https://arxiv.org/abs/2206.11871">Snell, Charlie, Ilya Kostrikov, Yi Su, Mengjiao Yang, and Sergey Levine. "Offline rl for natural language generation with implicit language q learning." arXiv preprint arXiv:2206.11871 (2022).</a></p></li><li><p><a href="https://arxiv.org/abs/2006.04779">Kumar, Aviral, Aurick Zhou, George Tucker, and Sergey Levine. "Conservative q-learning for offline reinforcement learning." Advances in Neural Information Processing Systems 33 (2020): 1179-1191.</a></p></li></ol><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.reinforced.info/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Reinforced! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Reward Modeling for RLHF]]></title><description><![CDATA[An introduction to reward models]]></description><link>https://www.reinforced.info/p/reward-modeling-for-rlhf</link><guid isPermaLink="false">https://www.reinforced.info/p/reward-modeling-for-rlhf</guid><dc:creator><![CDATA[Alex Nikulkov]]></dc:creator><pubDate>Wed, 10 Jan 2024 06:05:58 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!zQUN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe278c44c-94a6-4b8f-ad1d-46ec1d13b38b_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zQUN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe278c44c-94a6-4b8f-ad1d-46ec1d13b38b_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zQUN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe278c44c-94a6-4b8f-ad1d-46ec1d13b38b_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!zQUN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe278c44c-94a6-4b8f-ad1d-46ec1d13b38b_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!zQUN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe278c44c-94a6-4b8f-ad1d-46ec1d13b38b_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!zQUN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe278c44c-94a6-4b8f-ad1d-46ec1d13b38b_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zQUN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe278c44c-94a6-4b8f-ad1d-46ec1d13b38b_1024x1024.png" width="380" height="380" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e278c44c-94a6-4b8f-ad1d-46ec1d13b38b_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:380,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zQUN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe278c44c-94a6-4b8f-ad1d-46ec1d13b38b_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!zQUN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe278c44c-94a6-4b8f-ad1d-46ec1d13b38b_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!zQUN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe278c44c-94a6-4b8f-ad1d-46ec1d13b38b_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!zQUN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe278c44c-94a6-4b8f-ad1d-46ec1d13b38b_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>Introduction</h2><p>Reward modeling - it&#8217;s an essential part of RLHF training pipelines, yet it doesn&#8217;t get even a fraction of the attention of other LLM topics like prompting, supervised fine-tuning and data collection. In this post we&#8217;ll take a closer look at reward modeling and shed some light on this dark corner of RLHF. All top-performing Large Language Models (LLMs) like <a href="https://openai.com/research/gpt-4">GPT-4</a> and <a href="https://arxiv.org/abs/2307.09288">Llama 2</a> used reward models as part of their training pipelines. A notable exception from this are recent LLMs trained with Direct Preference Optimization (<a href="https://arxiv.org/abs/2305.18290">DPO</a>), which doesn&#8217;t require a separate reward model for LLM training - more on that later.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yJia!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4137d311-252f-46ef-8b31-56169c6d7873_1600x935.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yJia!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4137d311-252f-46ef-8b31-56169c6d7873_1600x935.png 424w, https://substackcdn.com/image/fetch/$s_!yJia!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4137d311-252f-46ef-8b31-56169c6d7873_1600x935.png 848w, https://substackcdn.com/image/fetch/$s_!yJia!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4137d311-252f-46ef-8b31-56169c6d7873_1600x935.png 1272w, https://substackcdn.com/image/fetch/$s_!yJia!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4137d311-252f-46ef-8b31-56169c6d7873_1600x935.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yJia!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4137d311-252f-46ef-8b31-56169c6d7873_1600x935.png" width="614" height="358.8695054945055" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4137d311-252f-46ef-8b31-56169c6d7873_1600x935.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:851,&quot;width&quot;:1456,&quot;resizeWidth&quot;:614,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yJia!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4137d311-252f-46ef-8b31-56169c6d7873_1600x935.png 424w, https://substackcdn.com/image/fetch/$s_!yJia!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4137d311-252f-46ef-8b31-56169c6d7873_1600x935.png 848w, https://substackcdn.com/image/fetch/$s_!yJia!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4137d311-252f-46ef-8b31-56169c6d7873_1600x935.png 1272w, https://substackcdn.com/image/fetch/$s_!yJia!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4137d311-252f-46ef-8b31-56169c6d7873_1600x935.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Figure 1: Typical RLHF training pipeline. Step 2 is reward model training. Credit: <a href="https://arxiv.org/pdf/2203.02155.pdf">InstructGPT paper</a></figcaption></figure></div><p>Reward modeling is an intermediate step in the LLM training pipeline and the reward model usually isn&#8217;t published alongside the trained language model. Think of a reward model as the movie director - you can&#8217;t see it in the final product, yet its impact is undeniable. Quoting from the Llama 2 paper: &#8220;<em>We note that reward model accuracy is one of the most important proxies for the final performance of Llama 2-Chat</em>&#8221;. This will make sense once we understand the role which the reward model plays in the RLHF training pipeline. From the perspective of classical Reinforcement Learning, reward models have a role similar to that of the critic in actor-critic algorithms, with the main difference being that critic models are usually trained online in parallel with actor training, while the reward models are usually trained offline and held fixed during the LLM fine-tuning (or re-trained a handful of times if several rounds of human feedback collection are performed, like in the <a href="https://arxiv.org/abs/2307.09288">Llama 2 paper</a>).&nbsp;</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.reinforced.info/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Reinforced! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>So what is a reward model? It takes a prompt and a response as inputs and returns a single scalar - the predicted quality of the response. It is based on the same architecture as the language model (transformer), but the unembedding (output) linear layer of size (Embed_dim, Vocab_size) is replaced by another linear layer of size (Embed_dim, 1), which outputs the scalar predicted reward (see Figure 2). Optionally, a special reward readout token can be used. The predicted reward is read out from the output of the reward head at the last token of the response. Since the reward is read out just once for the whole response, it can only score the whole response, not individual tokens or partial responses. A pre-trained (e.g. SFT) language model weights are used to initialize the reward model weights to speed up training.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Fd-A!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcef0527-84ce-4adf-be52-3e583d788e94_1600x830.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Fd-A!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcef0527-84ce-4adf-be52-3e583d788e94_1600x830.png 424w, https://substackcdn.com/image/fetch/$s_!Fd-A!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcef0527-84ce-4adf-be52-3e583d788e94_1600x830.png 848w, https://substackcdn.com/image/fetch/$s_!Fd-A!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcef0527-84ce-4adf-be52-3e583d788e94_1600x830.png 1272w, https://substackcdn.com/image/fetch/$s_!Fd-A!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcef0527-84ce-4adf-be52-3e583d788e94_1600x830.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Fd-A!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcef0527-84ce-4adf-be52-3e583d788e94_1600x830.png" width="590" height="305.9409340659341" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fcef0527-84ce-4adf-be52-3e583d788e94_1600x830.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:755,&quot;width&quot;:1456,&quot;resizeWidth&quot;:590,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Fd-A!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcef0527-84ce-4adf-be52-3e583d788e94_1600x830.png 424w, https://substackcdn.com/image/fetch/$s_!Fd-A!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcef0527-84ce-4adf-be52-3e583d788e94_1600x830.png 848w, https://substackcdn.com/image/fetch/$s_!Fd-A!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcef0527-84ce-4adf-be52-3e583d788e94_1600x830.png 1272w, https://substackcdn.com/image/fetch/$s_!Fd-A!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffcef0527-84ce-4adf-be52-3e583d788e94_1600x830.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Figure 2: Reward model architecture (with optional reward readout tokens). Credit: <a href="https://karpathy.ai/stateofgpt.pdf">&#8220;State of GPT&#8221;</a> talk by Andrej Karpathy</figcaption></figure></div><h2>Reward Model Applications</h2><p>To better understand the role of the reward model in RLHF training, let&#8217;s take a closer look at Proximal Policy Optimization (<a href="https://arxiv.org/abs/1707.06347">PPO</a>) - the de-facto standard RLHF algorithm. PPO is an online RL algorithm - it requires live interaction with the environment to close the state-&gt;action-&gt;reward loop. The environment takes action as input and returns the reward and next state. To truly align with human preferences, we could show the model&#8217;s responses in real time to human raters and use their ratings as reward for training (with a caveat that PPO needs scalar reward, so we&#8217;d need some processing to turn relative preferences into scalar rewards). But this would be logistically impractical, so <strong>the trained reward model is used as a proxy for the environment during PPO training</strong> and we pretend that the reward predicted by the reward model is the true quality of the response. This points to one of the biggest problems in RLHF - the trained reward model is an imperfect representation of true human preferences and it&#8217;s easily overoptimized by RL, which is known to exploit imperfections in reward model definition in the spirit of <a href="https://en.wikipedia.org/wiki/Goodhart%27s_law">Goodhart&#8217;s law</a>. More on this at the end of the post (and even more in a separate upcoming post). Figure 3 shows how the reward model plugs into the PPO training loop.</p><p>Reward model has some similarity to model-based RL, but the similarity is superficial because in RLHF the reward model is used to score complete responses, while in model-based RL the models are used for multi-step trajectory planning. While the application of reward models to LLM tuning is a recent phenomenon, reward modeling for RLHF was first demonstrated at scale back in 2017 in an <a href="https://arxiv.org/abs/1706.03741">OpenAI paper</a> in application to classical RL environments like Atari.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!M69c!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15ed3f61-5573-4587-ae27-d24c43a62967_1600x336.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!M69c!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15ed3f61-5573-4587-ae27-d24c43a62967_1600x336.png 424w, https://substackcdn.com/image/fetch/$s_!M69c!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15ed3f61-5573-4587-ae27-d24c43a62967_1600x336.png 848w, https://substackcdn.com/image/fetch/$s_!M69c!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15ed3f61-5573-4587-ae27-d24c43a62967_1600x336.png 1272w, https://substackcdn.com/image/fetch/$s_!M69c!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15ed3f61-5573-4587-ae27-d24c43a62967_1600x336.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!M69c!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15ed3f61-5573-4587-ae27-d24c43a62967_1600x336.png" width="1456" height="306" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/15ed3f61-5573-4587-ae27-d24c43a62967_1600x336.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:306,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!M69c!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15ed3f61-5573-4587-ae27-d24c43a62967_1600x336.png 424w, https://substackcdn.com/image/fetch/$s_!M69c!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15ed3f61-5573-4587-ae27-d24c43a62967_1600x336.png 848w, https://substackcdn.com/image/fetch/$s_!M69c!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15ed3f61-5573-4587-ae27-d24c43a62967_1600x336.png 1272w, https://substackcdn.com/image/fetch/$s_!M69c!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F15ed3f61-5573-4587-ae27-d24c43a62967_1600x336.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Figure 3. RLHF PPO training: LLM and Reward Model input/output structure</figcaption></figure></div><p>Reward models have a few more important applications - (1) turn relative preferences into scalar rewards, (2) offline evaluation; (3) ranking. First, typical RLHF pipelines collect human preferences in the form of relative preferences (response A &gt; response B), while PPO requires a scalar reward. We can use the <a href="https://en.wikipedia.org/wiki/Bradley%E2%80%93Terry_model">Bradley-Terry model</a> to turn these relative preferences into continuous scalar rewards (more on this in the next paragraph). Second, the reward model estimates the quality of a response, so it could be used for offline evaluation of language models. The main thing to be careful about with offline evaluation is to prevent data leakage - the reward model used for offline evaluation should be trained on a separate dataset with no overlap with LLM training data. Finally, the reward model can be used to rank multiple LLM generations and choose the best one. This is sometimes known as &#8220;best-of-n&#8221; in RLHF literature (e.g. <a href="https://arxiv.org/pdf/2304.05302.pdf">RRHF paper</a>). The ranking can be done either at inference time (pros: no LLM fine-tuning required; cons: high inference compute cost because multiple generations are required) or at training time (e.g. <a href="https://arxiv.org/pdf/2304.06767.pdf">RAFT paper</a>).</p><h2>Reward Model Training</h2><p>The most popular method of training the reward model is based on the <a href="https://en.wikipedia.org/wiki/Bradley%E2%80%93Terry_model">Bradley-Terry model</a>, which assumes that each response has an unobserved intrinsic quality <em>u</em> and the probability that a rater prefers option <em>i</em> to option <em>j</em> is equal to:</p><p></p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;Pr\\{i\\: \\succ \\:j\\}=\\frac{\\exp(u_i)}{\\exp(u_i) + \\exp(u_j)}=\\sigma(u_i-u_j)&quot;,&quot;id&quot;:&quot;MZAHGBKHET&quot;}" data-component-name="LatexBlockToDOM"></div><p>This probability can be incorporated into a log-likelihood-based loss to train the reward model using pairs of responses to the same prompt labeled as better/worse. Note that in the Bradley-Terry model the qualities are defined up to an additive constant because <em>(u_i-u_j)=((u_i+C)-(u_j+C))</em>. This means that each individual quality score isn&#8217;t interpretable by itself and only has some meaning when compared to other scores. In practice, after the reward model is trained, its output can be normalized by adding a bias term, so that the reward scores have 0 mean on the training data. This isn&#8217;t strictly necessary, but normalizing the scores can help reduce the variance during PPO training.</p><p>The Bradley-Terry model is closely related to the <a href="https://en.wikipedia.org/wiki/Elo_rating_system">Elo rating system</a>, and the reward model scores have the same properties as the Elo scores (up to scale/offset transformation). There&#8217;s several more advanced implementation options for the Bradley-Terry model. In the <a href="https://arxiv.org/pdf/2203.02155.pdf">InstructGPT paper</a>, K&gt;2 responses are given to labelers and they are asked to rank the whole list, resulting in <em>(K choose 2)</em> pairwise comparisons, each of which is represented by a separate term in the loss function. This is reported to speed up data collection because each response can be compared to several other responses independently. In <a href="https://arxiv.org/pdf/2307.09288.pdf">Llama 2 paper</a>, confidence-based margin is added to the loss. The intuition here is that the difference between the reward model scores of better and worse options should be higher for pairs in which we have high confidence in their relative order, and can be lower if we&#8217;re not sure which of the options is really better.</p><p>An alternative way to train a reward model could use a regression loss with scalar reward labels. For example, if we want to train an LLM to write tweets which get as many likes as possible, we could use the number of likes on a tweet as the reward label and train a reward model to predict this continuous label using an MSE loss. Another possible option is to use the outputs of existing classifiers as reward scores. For example, in <a href="https://arxiv.org/pdf/2212.09611.pdf">this paper</a> an existing aesthetic classifier was used as a reward model for PPO training. Similarly, existing classifiers can be used as reward models to fine-tune the models to reduce hallucinations, improve conciseness, etc. Using feedback from classifier as a reward isn&#8217;t technically RLHF, but it&#8217;s close enough in spirit and in implementation details.</p><h2>RLHF without Reward Models</h2><p>But do we REALLY need the reward model for RLHF? The authors of <a href="https://arxiv.org/abs/2305.18290">DPO paper</a> show an attractive way to do something that looks very similar to RLHF (the debate is still on about whether DPO matches the &#8220;RL&#8221; part of RLHF), but without a separate reward model. Instead, they use a clever mathematical trick to derive the implicit reward model scores based on the LLM token likelihoods. This trick allows them to derive a loss which looks like a mix between reward model and language model losses. The jury is still out on whether DPO is the future of RLHF, but we start seeing more and more state-of-the-art LLMs like <a href="https://arxiv.org/abs/2310.16944">Zephyr</a> and <a href="https://arxiv.org/abs/2312.15166">Solar</a> trained with DPO instead of PPO. The DPO vs PPO debate deserves more space than I can afford here, but Nathan Lambert has several very insightful blog posts about DPO: <a href="https://www.interconnects.ai/p/the-dpo-debate">blog post 1</a>, <a href="https://www.interconnects.ai/p/rlhf-progress-scaling-dpo-to-70b">blog post 2</a> - I highly recommend them to anyone who&#8217;s interested in this topic.</p><h2>Open Questions</h2><p>Reward modeling for RLHF appeared relatively recently and has received less attention than language model training, so there are still plenty of open questions left. The most interesting ones, in my opinion, are:</p><ol><li><p><strong>Credit assignment</strong>. The reward model evaluates complete responses, but they are actually generated token-by-token. The current PPO implementation used in RLHF side-steps this problem by using a &#8220;bandit&#8221; formulation, in which the whole response is considered to be a single action by the agent. If we could assign granular rewards to individual tokens (or sub-sequences) in the response, we could use more powerful RL methods to perform forward-looking planning during token generation.</p></li><li><p><strong>Preventing overoptimization</strong>. Naively applying PPO to a trained reward model will result in reward model scores increasing significantly during training, while the quality of the text will actually degrade. This is a result of overoptimizing to an imperfect learned reward model. Preventing this overoptimization is one of the biggest questions in RLHF right now. A wide range of approaches has been proposed, but it&#8217;s unclear which of them work best: regularization (KL divergence, supervised or unsupervised language modeling losses), model ensembles, constrained optimization, early stopping. This is a very deep and interesting question, deserving a dedicated post. Stay tuned!</p></li><li><p><strong>Beyond Bradley-Terry</strong>. The ubiquitous Bradley-Terry model makes several simplifying assumptions: (1) pairwise preferences are determined by underlying single-item qualities; (2) the single-item qualities are scalars (no multidimensional preferences); (3) the pairwise preferences are stochastic with probabilities equal to the sigmoid of difference in qualities. While these simple assumptions are a good place to start, the field of <a href="https://books.google.com/books?hl=en&amp;lr=&amp;id=SHvzzuCnuv8C&amp;oi=fnd&amp;pg=PP2&amp;dq=Thinking,+Fast+and+Slow&amp;ots=NUohUG0kDF&amp;sig=6CZcjaOSz0RDLJt-9R7epRcUAs0#v=onepage&amp;q=Thinking%2C%20Fast%20and%20Slow&amp;f=false">Behavioral Economics has conclusively shown that human preferences are very complex</a> and can include effects like anchoring, framing, loss aversion, etc. which contradict the Bradley-Terry model. A few recent papers like <a href="https://arxiv.org/abs/2310.12036">IPO</a> and <a href="https://github.com/ContextualAI/HALOs/blob/main/assets/report.pdf">HALO</a> have relaxed these assumptions and showed promising results.</p></li><li><p><strong>Evaluation</strong>. How do we know if our reward model is good enough? The most common metric here is pairwise accuracy - the fraction of pairs of responses in which the better option has a higher reward model score than the worse option. This is a useful metric, but it misses important aspects like the magnitude of the difference in scores. Also, it&#8217;s unclear what kind of evaluation metrics could describe specifically whether the reward model is suitable as a reward for PPO training.</p></li></ol><h2>References</h2><ol><li><p><a href="https://proceedings.neurips.cc/paper_files/paper/2022/hash/b1efde53be364a73914f58805a001731-Abstract-Conference.html">Ouyang, Long, et al. "Training language models to follow instructions with human feedback." Advances in Neural Information Processing Systems 35 (2022): 27730-27744.</a></p></li><li><p><a href="https://arxiv.org/abs/2307.09288">Touvron, Hugo, et al. "Llama 2: Open foundation and fine-tuned chat models." </a><em><a href="https://arxiv.org/abs/2307.09288">arXiv preprint arXiv:2307.09288</a></em><a href="https://arxiv.org/abs/2307.09288"> (2023).</a></p></li><li><p><a href="https://arxiv.org/abs/2305.18290">Rafailov, Rafael, et al. "Direct preference optimization: Your language model is secretly a reward model." </a><em><a href="https://arxiv.org/abs/2305.18290">arXiv preprint arXiv:2305.18290</a></em><a href="https://arxiv.org/abs/2305.18290"> (2023).</a></p></li><li><p><a href="https://proceedings.neurips.cc/paper_files/paper/2017/hash/d5e2c0adad503c91f91df240d0cd4e49-Abstract.html">Christiano, Paul F., et al. "Deep reinforcement learning from human preferences." </a><em><a href="https://proceedings.neurips.cc/paper_files/paper/2017/hash/d5e2c0adad503c91f91df240d0cd4e49-Abstract.html">Advances in neural information processing systems</a></em><a href="https://proceedings.neurips.cc/paper_files/paper/2017/hash/d5e2c0adad503c91f91df240d0cd4e49-Abstract.html"> 30 (2017).</a></p></li><li><p><a href="https://arxiv.org/abs/2310.16944">Tunstall, Lewis, et al. "Zephyr: Direct distillation of lm alignment." </a><em><a href="https://arxiv.org/abs/2310.16944">arXiv preprint arXiv:2310.16944</a></em><a href="https://arxiv.org/abs/2310.16944"> (2023).</a></p></li><li><p><a href="https://arxiv.org/abs/2312.15166">Kim, Dahyun, et al. "SOLAR 10.7 B: Scaling Large Language Models with Simple yet Effective Depth Up-Scaling." </a><em><a href="https://arxiv.org/abs/2312.15166">arXiv preprint arXiv:2312.15166</a></em><a href="https://arxiv.org/abs/2312.15166"> (2023).</a></p></li><li><p><a href="https://arxiv.org/abs/2304.06767">Dong, Hanze, et al. "Raft: Reward ranked finetuning for generative foundation model alignment." </a><em><a href="https://arxiv.org/abs/2304.06767">arXiv preprint arXiv:2304.06767</a></em><a href="https://arxiv.org/abs/2304.06767"> (2023).</a></p></li><li><p><a href="https://arxiv.org/abs/2304.05302">Yuan, Hongyi, et al. "RRHF: Rank Responses to Align Language Models with Human Feedback." </a><em><a href="https://arxiv.org/abs/2304.05302">Thirty-seventh Conference on Neural Information Processing Systems</a></em><a href="https://arxiv.org/abs/2304.05302">. 2023.</a></p></li><li><p><a href="https://arxiv.org/abs/2212.09611">Hao, Yaru, et al. "Optimizing prompts for text-to-image generation." </a><em><a href="https://arxiv.org/abs/2212.09611">arXiv preprint arXiv:2212.09611</a></em><a href="https://arxiv.org/abs/2212.09611"> (2022).</a></p></li><li><p><a href="https://books.google.com/books?hl=en&amp;lr=&amp;id=SHvzzuCnuv8C&amp;oi=fnd&amp;pg=PP2&amp;dq=Thinking,+Fast+and+Slow&amp;ots=NUohUG0kDF&amp;sig=6CZcjaOSz0RDLJt-9R7epRcUAs0#v=onepage&amp;q=Thinking%2C%20Fast%20and%20Slow&amp;f=false">Kahneman, D. (2011). </a><em><a href="https://books.google.com/books?hl=en&amp;lr=&amp;id=SHvzzuCnuv8C&amp;oi=fnd&amp;pg=PP2&amp;dq=Thinking,+Fast+and+Slow&amp;ots=NUohUG0kDF&amp;sig=6CZcjaOSz0RDLJt-9R7epRcUAs0#v=onepage&amp;q=Thinking%2C%20Fast%20and%20Slow&amp;f=false">Thinking, fast and slow</a></em><a href="https://books.google.com/books?hl=en&amp;lr=&amp;id=SHvzzuCnuv8C&amp;oi=fnd&amp;pg=PP2&amp;dq=Thinking,+Fast+and+Slow&amp;ots=NUohUG0kDF&amp;sig=6CZcjaOSz0RDLJt-9R7epRcUAs0#v=onepage&amp;q=Thinking%2C%20Fast%20and%20Slow&amp;f=false">. macmillan.</a></p></li><li><p><a href="https://arxiv.org/abs/2310.12036">Azar, Mohammad Gheshlaghi, et al. "A general theoretical paradigm to understand learning from human preferences." </a><em><a href="https://arxiv.org/abs/2310.12036">arXiv preprint arXiv:2310.12036</a></em><a href="https://arxiv.org/abs/2310.12036"> (2023).</a></p></li></ol><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.reinforced.info/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Reinforced! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Hello World]]></title><description><![CDATA[Welcome to Reinforced!]]></description><link>https://www.reinforced.info/p/hello-world</link><guid isPermaLink="false">https://www.reinforced.info/p/hello-world</guid><dc:creator><![CDATA[Alex Nikulkov]]></dc:creator><pubDate>Sun, 07 Jan 2024 06:23:24 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!GUm7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a68ec49-87ac-4d28-b777-dd40433fa52b_1792x1024.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>Welcome to Reinforced!</h2><p>If you want to learn more about Reinforcement Learning, Generative AI and Reinforcement Learning from Human Feedback (RLHF) - you&#8217;ve come to the right place. In this blog/newsletter I will help you improve your understanding of how Reinforcement Learning is used to power the ongoing Generative AI revolution. You can expect deep dives into most common RLHF methods and components, overviews of new research papers and more.</p><p>First post coming soon!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GUm7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a68ec49-87ac-4d28-b777-dd40433fa52b_1792x1024.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GUm7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a68ec49-87ac-4d28-b777-dd40433fa52b_1792x1024.webp 424w, https://substackcdn.com/image/fetch/$s_!GUm7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a68ec49-87ac-4d28-b777-dd40433fa52b_1792x1024.webp 848w, https://substackcdn.com/image/fetch/$s_!GUm7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a68ec49-87ac-4d28-b777-dd40433fa52b_1792x1024.webp 1272w, https://substackcdn.com/image/fetch/$s_!GUm7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a68ec49-87ac-4d28-b777-dd40433fa52b_1792x1024.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GUm7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a68ec49-87ac-4d28-b777-dd40433fa52b_1792x1024.webp" width="453" height="258.85714285714283" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1a68ec49-87ac-4d28-b777-dd40433fa52b_1792x1024.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:832,&quot;width&quot;:1456,&quot;resizeWidth&quot;:453,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;An illustration in wide aspect ratio showing a robot typing on a typewriter, where the typewriter is correctly positioned to face the robot. The typewriter, designed in a classic style with round keys and a paper roll, is placed so that its keys and paper roll are oriented towards the robot, which is sitting in front of it. The robot, with a futuristic design, is engaging with the typewriter, its mechanical hands positioned for typing on the front keys of the typewriter. The scene is set in a well-lit room, emphasizing the interaction between the robot and the typewriter, ensuring there are no keys on the back of the typewriter.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="An illustration in wide aspect ratio showing a robot typing on a typewriter, where the typewriter is correctly positioned to face the robot. The typewriter, designed in a classic style with round keys and a paper roll, is placed so that its keys and paper roll are oriented towards the robot, which is sitting in front of it. The robot, with a futuristic design, is engaging with the typewriter, its mechanical hands positioned for typing on the front keys of the typewriter. The scene is set in a well-lit room, emphasizing the interaction between the robot and the typewriter, ensuring there are no keys on the back of the typewriter." title="An illustration in wide aspect ratio showing a robot typing on a typewriter, where the typewriter is correctly positioned to face the robot. The typewriter, designed in a classic style with round keys and a paper roll, is placed so that its keys and paper roll are oriented towards the robot, which is sitting in front of it. The robot, with a futuristic design, is engaging with the typewriter, its mechanical hands positioned for typing on the front keys of the typewriter. The scene is set in a well-lit room, emphasizing the interaction between the robot and the typewriter, ensuring there are no keys on the back of the typewriter." srcset="https://substackcdn.com/image/fetch/$s_!GUm7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a68ec49-87ac-4d28-b777-dd40433fa52b_1792x1024.webp 424w, https://substackcdn.com/image/fetch/$s_!GUm7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a68ec49-87ac-4d28-b777-dd40433fa52b_1792x1024.webp 848w, https://substackcdn.com/image/fetch/$s_!GUm7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a68ec49-87ac-4d28-b777-dd40433fa52b_1792x1024.webp 1272w, https://substackcdn.com/image/fetch/$s_!GUm7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a68ec49-87ac-4d28-b777-dd40433fa52b_1792x1024.webp 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.reinforced.info/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Reinforced! Subscribe for free to receive new posts.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item></channel></rss>