Manuscript Offprint

arXiv:2610.24188

On Reparameterizing the Score Function

Mohammad Hossein Amani, Leonardo Bocchieri, Maxime Peyrard, Clément Hongler, Robert West

Abstract

Policy gradients for autoregressive sequence models differentiate each token's log-probability while holding the conditioning history fixed. This discards information about how earlier decisions shape later conditional distributions, creating a credit-assignment bottleneck when rewards are sparse. We introduce History-Reparameterized (HR) policy gradients, which replace the frozen prefix in the score function with a differentiable reparameterized or relaxed history, allowing gradients of downstream log-probabilities to propagate backward through the generated trajectory. The resulting history-pathwise term is generally biased when added directly, so we derive Optimal HR (OHR), a centered control-variate estimator with a closed-form coefficient that minimizes the trace of the gradient variance at the population level. The variance reduction is governed by temporal structure in the policy dynamics: random or weakly structured policies provide little benefit, while policies with learned sequential dependencies yield informative history-pathwise corrections. For discrete tokens, the choice of relaxation is crucial: embedding-level relaxation yields substantial variance reduction that grows with horizon, whereas straight-through Gumbel-Softmax yields essentially none in our diagnostics. We validate the method on a Gaussian linear Markov model, a sparse-reward T-maze with a recurrent policy, and an autoregressive Transformer model for small Traveling Salesman Problem (TSP) instances.

1 Introduction

Policy gradient methods for autoregressive sequence models—REINFORCE [Williams, 1992], PPO [Schulman et al., 2017], or their descendants—are all built on the same primitive: the score function ∇θlog⁡pθ(xt∣x<t)\nabla_{\theta} \log p_{\theta}(x_t \mid x_{<t}). Regardless of the algorithm built around it, this object treats the conditioning history x<tx_{<t} as a fixed constant, differentiating only the direct dependence on θ\theta at step tt and discarding how θ\theta shaped the history that produced x<tx_{<t}. When a single scalar reward is assigned to an entire sequence, the resulting estimator is order-agnostic: the causal dependence of xtx_t on x<tx_{<t}—the entire content of the autoregressive factorization—is invisible to the gradient, and the variance of credit assignment to early tokens grows with horizon length [Williams, 1992, Schulman et al., 2016].

To illustrate, consider a model solving a math problem step by step, with a binary reward for the correct final answer. Suppose the model makes an arithmetic error at an early step, then reasons correctly from that wrong intermediate result for the remainder. The score-function estimator assigns the same negative reward to every step. Yet the model's own conditional probabilities contain a diagnosis: the log-probabilities of the later steps, conditioned on the erroneous intermediate, are already high—the later reasoning is sound given its premise. If we could ask “how would the downstream log-probabilities have changed had the early step been slightly different?”, we would obtain a gradient signal that is sensitive to the downstream consequences of the early step, rather than assigning the same scalar reward uniformly across all score terms.

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

In standard RL, this frozen-history treatment is not a design choice but a necessity. The state transition is governed by an external environment whose dynamics are unknown and non-differentiable with respect to the policy parameters—there is no gradient path from the policy to the states it visits. Autoregressive sequence generation without an external environment is fundamentally different. Each token's distribution is a function of the model's own previous outputs, and the conditioning history is itself a differentiable function of θ\theta. In this environment-less setting, treating the history as frozen is a convention inherited from the MDP framework, not a structural constraint.

This raises a fundamental question: does the policy’s own temporal structure contain information that can improve credit assignment? If so, a policy with learned autoregressive structure is not merely a warm initialization for optimization—it is itself a source of credit-assignment signal, with richer sequential dependencies yielding stronger signal.

We answer affirmatively by introducing History-Reparameterized (HR) policy gradients, which replace the frozen history in the score function with a differentiable reparameterized or relaxed history. This exposes an additional history-pathwise term that propagates gradients of downstream log-probabilities backward through the generated prefix, crucially without requiring a differentiable reward. Because the reparameterization modifies only the conditioning argument of the log-probability, it applies to any algorithm built on the score function. The raw HR estimator is generally biased, so we derive Optimal HR (OHR), an unbiased control-variate estimator with a closed-form coefficient that minimizes the trace of the estimator variance (Theorem 2). Because HR reparameterizes the conditioning history rather than the reward, it exploits sequential structure that reward-reparameterization methods such as REBAR [Tucker et al., 2017] and RELAX [Grathwohl et al., 2018] cannot access; the two ideas are orthogonal and composable.

Experimentally, embedding-level history reparameterization yields variance reduction that grows with horizon (reaching approximately 5×5\times in the minimal embedding model), while straight-through Gumbel-Softmax yields negligible reduction, highlighting that the choice of relaxation is decisive. This effect appears in a minimal autoregressive model (Section 5.1), a sparse-reward T-maze with a GRU policy (Section 5.2), and a small Transformer-style model for the TSP (Section 5.3). The effect of variance reduction increases when HR is combined with reward-side methods such as RLOO or learned value functions Section G.4.

References (51)