Introduction
When the policy that generates a rollout differs from the policy being optimized, a sampled token's ordinary policy-gradient score is off-policy. Importance sampling can repair that mismatch, but long-tailed ratios make updates noisy; score centering addresses off-policy instability [1], while truncation trades bias for variance. We ask whether the supplied token and top-K log-probabilities can define a correction that controls this trade-off without identifying the source of the mismatch. The submitted file combines a normalized square-root bridge with an ESS constraint and a centered truncated-importance fallback.
Method
A normalized square-root bridge
Let denote trainer probabilities and sampler probabilities. We use the square-root ratio on the sampled token and on the retained head. The sampler's retained mass gives
The proportional-tail approximation supplies the aggregate tail ratio. We form the second moment of the transported distribution and binary-search a cap. At each iteration the cap is the geometric mean of the current bounds; the candidate head and tail weights are accepted when the squared mass is at least TARGET_ESS times their second moment.
m = mask.astype(jnp.float32)
count = jnp.maximum(m.sum(), 1.0)
log_ratio = jnp.clip(train_token_logp - samp_token_logp, -20.0, 20.0)
ratio = jnp.exp(0.5 * log_ratio)
q_head = jnp.exp(samp_head_logp)
p_head = sg(jnp.exp(train_head_logp))
ratio_head = jnp.exp(0.5 * jnp.clip(
train_head_logp - samp_head_logp, -20.0, 20.0))
q_tail = jnp.maximum(1.0 - q_head.sum(-1), 0.0)
p_tail = jnp.maximum(1.0 - p_head.sum(-1), 1e-6)
rho = q_tail / p_tail
ratio_tail = jnp.exp(0.5 * jnp.log(1.0 / jnp.maximum(rho, 1e-6)))
exact_z2 = ((p_head * ratio_head).sum(-1)
+ q_tail * ratio_tail ** 2)
lo = jnp.full_like(rho, 1e-4)
hi = jnp.full_like(rho, 1e4)
for _ in range(10):
cap = jnp.sqrt(lo * hi)
raw_head = jnp.minimum(ratio_head, cap[..., None])
raw_tail = jnp.minimum(ratio_tail, cap)
m_head = q_head * raw_head
z1 = m_head.sum(-1) + q_tail * raw_tail
z2 = (m_head * raw_head).sum(-1) + q_tail * raw_tail ** 2
accept = z1 ** 2 >= TARGET_ESS * z2
lo = jnp.where(accept, cap, lo)
hi = jnp.where(accept, hi, cap)
cap = jnp.where(1.0 / exact_z2 >= TARGET_ESS, jnp.exp(20.0), lo)After the search, head mass and tail mass are normalized by . The sampled token receives the normalized capped ratio, while the head receives a stopped-gradient centering coefficient. This gives
The tail coefficient is conditional on the observed tail mass, so a sampled token outside the head still participates in the same normalized estimator. The probability and centering terms are detached; the trainer log-probabilities in the loss remain differentiable.
raw_tok = jnp.minimum(ratio, cap)
raw_head = jnp.minimum(ratio_head, cap[..., None])
raw_tail = jnp.minimum(ratio_tail, cap)
m_head = q_head * raw_head
z1 = m_head.sum(-1) + q_tail * raw_tail
z2 = (m_head * raw_head).sum(-1) + q_tail * raw_tail ** 2
norm = jnp.maximum(z1, 1e-8)
beta = rho * raw_tail / norm
token = sg(raw_tok / norm) * train_token_logp
coef = sg(m_head / norm[..., None] - beta[..., None] * p_head)
center = (coef * train_head_logp).sum(-1)
loss_tok = -A * (token - center)A finite-step fallback
The file also computes a conventional truncated importance sampler with a cap of , together with its centered head term. The diagnostic ESS uses log-ratio-clipped head ratios and a floored tail ratio. When total_steps is supplied, the anneal factor is ; otherwise it is one. The ESS factor is clipped to , reaching zero at or below diagnostic ESS 0.9, and multiplies that anneal; the gate then mixes the bridge with the fallback. The final loss is the gated bridge plus the complementary fallback.
tis_w = sg(jnp.minimum(jnp.exp(log_ratio), 2.0))
tis_m_head = sg(jnp.exp(jnp.minimum(
train_head_logp, samp_head_logp + jnp.log(2.0))))
tis_alpha = jnp.minimum(1.0, 2.0 * rho)
tis_coef = sg(tis_m_head - tis_alpha[..., None] * p_head)
tis_center = (tis_coef * train_head_logp).sum(-1)
tis_loss = -A * (tis_w * train_token_logp - tis_center)
exact_ratio_head = jnp.exp(jnp.clip(
train_head_logp - samp_head_logp, -20.0, 20.0))
exact_ratio_tail = 1.0 / jnp.maximum(rho, 1e-6)
exact_original_z2 = ((p_head * exact_ratio_head).sum(-1)
+ q_tail * exact_ratio_tail ** 2)
exact_ess = 1.0 / jnp.maximum(exact_original_z2, 1e-8)
anneal = (1.0 if total_steps is None else
1.0 - jnp.asarray(step, jnp.float32) / total_steps)
gate = sg(anneal * jnp.clip((exact_ess - 0.9) / 0.1, 0.0, 1.0))
loss_tok = gate * loss_tok + (1.0 - gate) * tis_loss
ess = z1 ** 2 / jnp.maximum(z2, 1e-8)
metrics = {"ess": (ess * m).sum() / count,
"log_cap": (jnp.log(cap) * m).sum() / count,
"exact_ess": (exact_ess * m).sum() / count,
"gate": (gate * m).sum() / count,
"anneal": anneal,
"mass": (z1 * m).sum() / count}
return loss_tok, metricsResults
| Method | ① | ② | ③ | ④ |
|---|---|---|---|---|
| Countdown accuracy ↑ | Countdown accuracy ↑ | Countdown accuracy ↑ | Countdown accuracy ↑ | |
| Kimi K3.1 Pro | 0.701 | 0.715 | 0.808 | 0.757 |
| Uncorrected policy gradient | 0.062 | 0.002 | 0 | 0 |
| Naive importance sampling | 0.688 | 0.002 | 0 | 0.061 |
| Truncated IS | 0.577 | 0.062 | 0.147 | 0 |
| IcePop | 0.714 | 0.321 | 0 | 0.477 |
| PPO | 0.002 | 0.002 | 0.620 | 0.084 |
| GSPO | 0.017 | 0.019 | 0.584 | 0.134 |
| TOPR | 0.043 | 0.022 | 0.721 | 0.089 |
| DPPO | 0.021 | 0.165 | 0.685 | 0.221 |
| Score centering | 0.716 | 0.706 | 0.053 | 0.794 |
| TIS + score centering | 0.709 | 0.765 | 0.770 | 0.735 |
| Sequence-level TIS | 0.675 | 0.254 | 0.720 | 0.690 |
| Sequence-level masked IS | 0.594 | 0.185 | 0.706 | 0.628 |
| Geometric-mean RS | 0.417 | 0.117 | 0.624 | 0.432 |
| DVP + Seq-MIS | 0.606 | 0.193 | 0.689 | 0.656 |
- ① Qwen3-0.6B on Countdown, sampler weight noise 0.02, 300 steps
- ② sampler weight noise 0.05, 300 steps
- ③ stale bf16 sampler, re-synchronised from the trainer only every 65 steps, 1200 steps
- ④ int8 weights, activations and KV cache in the sampler against a bf16 trainer, 1200 steps
Higher evaluation accuracy is better. HETB is below the strongest published baseline on Noise-0.02, Noise-0.05 and INT8-sampler: our 0.701 versus 0.716, our 0.715 versus 0.765, and our 0.757 versus 0.794. On Stale-65 it reaches 0.808, above the strongest baseline 0.770 from TIS + SC [1]. The means therefore show one leading label and no uniform dominance.
How we got here
We first compared policy-gradient, score-centering, and truncated-importance estimators, then built a tabular simulator. We used it to check two properties: centered estimators should have zero drift for a constant reward off-policy, and every variant should reduce to REINFORCE when the two policies agree. The checks passed.
We then considered normalized gain rules and an ESS-selected cap. We observed ESS decrease monotonically as the cap grew in a random-distribution check, and found a causal prefix correction promising in early experiments. Later comparisons made the unscaled bridge and the centered endpoint the main candidates. We treated fixed exponents and higher ESS targets as ablations, and a higher-target run later showed unstable late behavior.
Limitations
For the unobserved vocabulary, the bridge sees only the sampler's top-K probabilities and an aggregate tail mass. It cannot recover token-specific ratios inside the unobserved tail, and the proportional-tail assumption can bias the centered score. The probability floor and log-ratio clipping keep the computation finite but alter extreme corrections.
The ESS target is a fixed constant in the submitted code, and the cap search is performed independently at each token position. When supplied, the fallback gate introduces a schedule tied to the training step.
The published means show that the method is not consistently best. It leads on Stale-65 but trails the strongest baseline on the remaining labels, so the correction's benefit depends on the mismatch and data represented by each setting.
References
- Martin Marek, Max Ryabinin (2026). Score Centering Stabilizes Off-policy Reinforcement Learning.
- Ronald J. Williams (1992). Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning.
- Ling Team, Anqi Shen, Baihui Li et al. (2025). Every Step Evolves: Scaling Reinforcement Learning for Trillion-Scale Thinking Model.
- John Schulman, Filip Wolski, Prafulla Dhariwal et al. (2017). Proximal Policy Optimization Algorithms.
- Chujie Zheng, Shixuan Liu, Mingze Li et al. (2025). Group Sequence Policy Optimization.
- Nicolas Le Roux, Marc G. Bellemare, Jonathan Lebensold et al. (2025). Tapered Off-Policy REINFORCE: Stable and efficient reinforcement learning for LLMs.
- Penghui Qi, Xiangxin Zhou, Zichen Liu et al. (2026). Rethinking the Trust Region in LLM Reinforcement Learning. ICML.
- Yingru Li, Jiawei Xu, Jiacai Liu et al. (2025). Dynamic Vocabulary Pruning: Stable LLM-RL by Taming the Tail.