Skip to content
paulius.rauba
← Home
← Short notes

#6 Advantage redistribution approaches in rubric-based reinforcement learning

· · 3 min read

Advantage redistribution approaches#

In rubric-based designs, we obain both a reward and subsequent advantages, but the judges also can identify which parts of the sequence are responsible for the correct/incorrect response. Can we use them? Some ideas how to apply the loss calculation to the trainer in a dynamic manner.

For rollout ii and criterion cc the verdict is vic∈{pass,fail,n/a}v_{ic}\in\{\text{pass},\text{fail},\text{n/a}\}. With pip_i passes and fif_i fails, Ri=pi−fipi+fi∈[−1,1]R_i = \frac{p_i - f_i}{p_i + f_i}\in[-1,1] The advantage from this is the standard is Ai=Ri−1G∑kRkA_i = R_i - \tfrac{1}{G}\sum_k R_k, and our LLM is any frozen LLM. Below I compare three approaches for such distribution.

(1) Uniform advantage distribution (common default). Every token receives the same advantage and we average the loss per-token-mean, scaled by importance weights. Every token that the policy wrote in rollout ii receives the same advantage AiA_i. Write those tokens as yi,1,…,yi,niy_{i,1},\dots,y_{i,n_i}, and let N=∑iniN=\sum_i n_i be their number over the whole batch. The loss is

L=−1N∑iAi∑t=1nisg⁡(ρi,t) log⁡πθ(yi,t∣yi,<t),ρi,t=πθ(yi,t∣yi,<t)πold(yi,t∣yi,<t)<2 (clipped),sg⁡=stop-gradient,\mathcal{L} = -\frac{1}{N}\sum_{i} A_i \sum_{t=1}^{n_i} \operatorname{sg}(\rho_{i,t})\,\log \pi_\theta(y_{i,t}\mid y_{i,<t}), \qquad \rho_{i,t}=\frac{\pi_\theta(y_{i,t}\mid y_{i,<t})}{\pi_{\text{old}}(y_{i,t}\mid y_{i,<t})} < 2 \text{ (clipped)}, \quad \operatorname{sg} = \text{stop-gradient},

(2) Targeted dvantage re-distribution. The loss in (1) uses a single number AiA_i for the whole rollout. To see what this assumes, it is convenient to allow each token its own advantage ai,ta_{i,t} and to consider the more general loss

L(a)=−1N∑i∑t=1niai,t sg⁡(ρi,t) log⁡πθ(yi,t∣yi,<t).\mathcal{L}(a) = -\frac{1}{N}\sum_{i}\sum_{t=1}^{n_i} a_{i,t}\,\operatorname{sg}(\rho_{i,t})\,\log \pi_\theta(y_{i,t}\mid y_{i,<t}).

The loss in (1) is the special case ai,t=Aia_{i,t}=A_i for all tt.

For a given rollout ii, we are assuming that every token is equally responsible for the outcome. That doesn't have to be the case. Suppose we are given a probability distribution on its tokens qi,t≥0q_{i,t}\ge 0 with ∑t=1niqi,t=1\sum_{t=1}^{n_i} q_{i,t}=1. Here, qi,tq_{i,t} can be thought of as the share of the rollout's credit that is assigned to token tt. Now set

ai,t=ni Ai qi,t.a_{i,t} = n_i\,A_i\,q_{i,t}.

Two important properties of this. First, the total amount of mass is conserved. For every choice of qiq_i,

∑t=1niai,t=niAi∑t=1niqi,t=niAi\sum_{t=1}^{n_i} a_{i,t} = n_i A_i \sum_{t=1}^{n_i} q_{i,t} = n_i A_i

Thus re-distribution moves credit between the tokens of a rollout.

Second, the current method is the uniform case. Taking qi,t=1/niq_{i,t}=1/n_i gives ai,t=Aia_{i,t}=A_i for every tt, which is exactly loss (1).

(3) Per-criterion re-distribution. In (2) we still collapse the rollout to a single number AiA_i before we assign any credit. But the reward is an average over criteria, and different criteria are decided by different tokens. So we can assign credit for each criterion separately, and average afterwards.

Let Ki=pi+fiK_i = p_i + f_i be the number of criteria that apply to rollout ii. Give each of them its own advantage Ai,cA_{i,c}: +1+1 for a pass or −1-1 for a fail, minus the group's mean reward 1G∑kRk\tfrac{1}{G}\sum_k R_k. By the definition of RiR_i, the rollout's advantage is the mean of these:

Ai=1Ki∑c=1KiAi,c.A_i = \frac{1}{K_i}\sum_{c=1}^{K_i} A_{i,c}.

Suppose that for each criterion cc we are given a probability distribution on the tokens, qi,c,t≥0q_{i,c,t}\ge 0 with ∑t=1niqi,c,t=1\sum_{t=1}^{n_i} q_{i,c,t}=1. Here, qi,c,tq_{i,c,t} can be thought of as the share of criterion cc's credit that is assigned to token tt (the judge tells us which model calls were responsible for each verdict). Now set

ai,t=niKi∑c=1KiAi,c qi,c,t.a_{i,t} = \frac{n_i}{K_i}\sum_{c=1}^{K_i} A_{i,c}\,q_{i,c,t}.

This is (2) applied to each criterion, then averaged.

Two important properties of this. First, the total amount of mass is still conserved. For every choice of the distributions,

∑t=1niai,t=niKi∑c=1KiAi,c∑t=1niqi,c,t=niKi∑c=1KiAi,c=niAi.\sum_{t=1}^{n_i} a_{i,t} = \frac{n_i}{K_i}\sum_{c=1}^{K_i} A_{i,c}\sum_{t=1}^{n_i} q_{i,c,t} = \frac{n_i}{K_i}\sum_{c=1}^{K_i} A_{i,c} = n_i A_i .

Second, (2) is the special case where all criteria share one distribution. Taking qi,c,t=qi,tq_{i,c,t}=q_{i,t} for every cc gives ai,t=ni Ai qi,ta_{i,t}=n_i\,A_i\,q_{i,t}.