Introduction
Picture life on a planet with three suns, whose chaotic motion brings lethal heat and cold at unexpected times [27 ] . Having barely survived after taking shelter a day too late, one could evaluate alternative times to shelter by trying to imagine the skies and their outcomes [48 , 18 ] . Yet realistic imagination needs predicting the motion of the three suns, a chaotic three-body system beyond anyone’s control. Moreover, random variations across independently simulated skies can obscure whether sheltering earlier would actually help.
This example illustrates two challenges for learning with world models in a big world [23 ] . World models allow agents to evaluate alternative actions without additional environment interaction, but their usefulness depends on both predictive accuracy and the informativeness of simulated outcomes. When environmental complexity exceeds an agent’s modeling capacity, errors can compound across imagined trajectories [21 , 4 ] . Even with an accurate model, environmental randomness can dominate simulated returns, obscuring action effects and increasing the variance of policy gradient estimates [28 ] .
In this paper, we study counterfactual world models , which take observed trajectories to predict alternative outcomes under the same underlying environmental randomness. Looking back [13 ] , one might ask: given how the suns actually moved, would taking shelter a day earlier have helped? Answering this question may be easier since the actual experience provides a reference for predicting what would change under a different decision [39 ] . A counterfactual model can use information about how the world unfolded and focus its predictive capacity on action-dependent changes [8 ] . Holding environmental randomness fixed can also help distinguish action effects from luck, reducing the variance of policy gradient estimates [30 ] .
We explore two approaches to constructing counterfactual world models: (i) directly training models on paired trajectories generated under shared environmental randomness, and (ii) applying diffusion counterfactual inference [40 ] to trained diffusion world models [3 , 50 ] . To leverage these models for reinforcement learning, we build on RLOO [24 ] and introduce REINFORCE Look Back (RLB), a policy gradient algorithm that generates multiple counterfactual trajectories and uses their predicted returns as baselines.
Figure 1. Overview. To evaluate an action jump against the observed action stand, a world model imagines the future anew (top), mixing the action’s effect with luck, whereas a counterfactual world model edits the observed experience, isolating it (bottom).
Our main contributions are:
We formalize counterfactual world models and two approaches to building them, covering settings with and without access to trajectory pairs generated under shared environmental randomness.
We introduce RLB, a policy gradient algorithm based on counterfactual return baselines, and prove conditions for unbiasedness and variance reduction, and error bounds under learned models.
We show that counterfactual world models are easier to learn and yield better policies than ordinary world models when action effects are more predictable than environmental evolution.
Our results suggest that looking back at past experience can reduce the predictive burden of learning in complex environments and help agents more precisely identify the consequences of their actions.
Background
We provide an overview of the background on policy gradient methods for reinforcement learning and refer the reader to Sutton & Barto [49 ] for further details.
Setup. We consider Markov decision processes (MDPs) with state x ∈ R d x \in\mathbb{R}^{d} x ∈ R d , action a ∈ A a \in A a ∈ A in finite A A A , initial state distribution μ \mu μ , transition probability p p p , reward function r r r , finite horizon n n n , and discount factor γ ∈ ( 0 , 1 ] \gamma\in(0,1] γ ∈ ( 0 , 1 ] . Given a policy π θ \pi_{\theta} π θ parameterized with θ \theta θ , where the environment is independent of θ \theta θ , a trajectory τ : = ( x 0 , a 0 , … , x n ) \tau:= (x_{0},a_{0},\ldots,x_{n}) τ := ( x 0 , a 0 , … , x n ) with state x i x_{i} x i and action a i a_{i} a i at step i i i is sampled as:
x 0 ∼ μ , a i ∼ π θ ( ⋅ ∣ x i ) , x i + 1 ∼ p ( ⋅ ∣ x i , a i ) , i = 0 , … , n − 1. (1) x_{0} \sim\mu,\qquad a_{i} \sim\pi_{\theta}(\cdot\mid x_{i}),\qquad x_{i+1} \sim p(\cdot\mid x_{i},a_{i}),\qquad i=0,\ldots,n-1. \tag*{(1)} x 0 ∼ μ , a i ∼ π θ ( ⋅ ∣ x i ) , x i + 1 ∼ p ( ⋅ ∣ x i , a i ) , i = 0 , … , n − 1. (1)
We write τ ∼ p θ \tau\sim p_{\theta} τ ∼ p θ for a trajectory sampled with (1) , and write τ ≥ i ∼ p θ ( ⋅ ∣ x i ) \tau_{\geq i} \sim p_{\theta}(\cdot\mid x_{i}) τ ≥ i ∼ p θ ( ⋅ ∣ x i ) for suffix ( x i , a i , … , x n ) (x_{i},a_{i},\ldots,x_{n}) ( x i , a i , … , x n ) given x i x_{i} x i . We denote the reward by r i : = r ( x i , a i ) r_{i} := r(x_{i},a_{i}) r i := r ( x i , a i ) , and assume the usual regularity conditions for exchanging differentiation with expectation. Our goal is to optimize the policy to maximize the expected total return J ( θ ) : = E τ ∼ p θ [ G 0 ] J(\theta) := \mathbb{E}_{\tau\sim p_{\theta}}[G_{0}] J ( θ ) := E τ ∼ p θ [ G 0 ] where G i : = ∑ j = i n − 1 γ j − i r j G_{i} := \sum_{j=i}^{n-1}\gamma^{j-i}r_{j} G i := ∑ j = i n − 1 γ j − i r j is the return-to-go at step i i i .
Policy gradient methods. The policy can be optimized by updating θ \theta θ with the gradient ∇ θ J ( θ ) \nabla_{\theta}J(\theta) ∇ θ J ( θ ) . Denoting the score of the policy at step i i i as z i : = ∇ θ log π θ ( a i ∣ x i ) z_{i} := \nabla_{\theta}\log\pi_{\theta}(a_{i}\mid x_{i}) z i := ∇ θ log π θ ( a i ∣ x i ) , REINFORCE [53 ] estimates the policy gradient using m ≥ 1 m \geq1 m ≥ 1 independently sampled trajectories:
∇ θ J ( θ ) = E [ ∑ i = 0 n − 1 γ i G i z i ] ≈ 1 m ∑ j = 1 m ∑ i = 0 n − 1 γ i G i ( j ) z i ( j ) , τ ( 1 ) , … , τ ( m ) ∼ i i d p θ , (2) \nabla_{\theta}J(\theta) = \mathbb{E}\left[\sum_{i=0}^{n-1}\gamma^{i}G_{i}z_{i}\right] \approx\frac{1}{m}\sum_{j=1}^{m}\sum_{i=0}^{n-1}\gamma^{i}G_{i}^{(j)}z_{i}^{(j)},\qquad\tau^{(1)},\ldots,\tau^{(m)} \mathrel{\overset{\mathrm{iid}}{\sim}} p_{\theta}, \tag*{(2)} ∇ θ J ( θ ) = E [ i = 0 ∑ n − 1 γ i G i z i ] ≈ m 1 j = 1 ∑ m i = 0 ∑ n − 1 γ i G i ( j ) z i ( j ) , τ ( 1 ) , … , τ ( m ) ∼ iid p θ , (2)
where G i ( j ) G_{i}^{(j)} G i ( j ) and z i ( j ) z_{i}^{(j)} z i ( j ) denote the return-to-go and score of each trajectory τ ( j ) \tau^{(j)} τ ( j ) at step i i i , respectively. While the estimation is unbiased, sampled returns can vary substantially, leading to a high variance.
A common approach to reduce the variance without biasing the estimate is to use a possibly random baseline b i b_i b i that is independent of the action a i a_i a i given the state x i x_i x i [16 ] :
∇ θ J ( θ ) = E [ ∑ i = 0 n − 1 γ i ( G i − b i ) z i ] , b i ⊥ a i ∣ x i . (3) \nabla_\theta J(\theta) = \mathbb{E}\left[\sum_{i=0}^{n-1} \gamma^i (G_i-b_i)z_i\right], \qquad b_i \perp a_i\mid x_i. \tag*{(3)} ∇ θ J ( θ ) = E [ i = 0 ∑ n − 1 γ i ( G i − b i ) z i ] , b i ⊥ a i ∣ x i . (3)
A standard choice is to fit a value function b i = V ^ i ( x i ) b_i=\hat{V}_i(x_i) b i = V ^ i ( x i ) to approximate the expected return E [ G i ∣ x i ] \mathbb{E}[G_i\mid x_i] E [ G i ∣ x i ] . REINFORCE Leave-One-Out (RLOO) [24 , 2 ] instead samples m ≥ 2 m\ge2 m ≥ 2 trajectories at each step and uses leave-one-out returns to construct an empirical baseline:
∇ θ J ( θ ) ≈ 1 m ∑ j = 1 m ∑ i = 0 n − 1 γ i ( G i ( j ) − b i ( j ) ) z i ( j ) , b i ( j ) : = 1 m − 1 ∑ ℓ ≠ j G i ( ℓ ) , τ ≥ i ( 1 ) , … , τ ≥ i ( m ) ∼ i i d p θ ( ⋅ ∣ x i ) , (4) \nabla_\theta J(\theta)\approx\frac{1}{m}\sum_{j=1}^{m}\sum_{i=0}^{n-1}\gamma^i\left(G_i^{(j)}-b_i^{(j)}\right)z_i^{(j)}, \qquad b_i^{(j)}:=\frac{1}{m-1}\sum_{\ell\ne j}G_i^{(\ell)}, \qquad\tau_{\ge i}^{(1)},\ldots,\tau_{\ge i}^{(m)}\mathrel{\overset{\mathrm{iid}}{\sim}}p_\theta(\cdot\mid x_i), \tag*{(4)} ∇ θ J ( θ ) ≈ m 1 j = 1 ∑ m i = 0 ∑ n − 1 γ i ( G i ( j ) − b i ( j ) ) z i ( j ) , b i ( j ) := m − 1 1 ℓ = j ∑ G i ( ℓ ) , τ ≥ i ( 1 ) , … , τ ≥ i ( m ) ∼ iid p θ ( ⋅ ∣ x i ) , (4)
where G i ( j ) G_i^{(j)} G i ( j ) and z i ( j ) z_i^{(j)} z i ( j ) are return-to-go and score of each trajectory τ ≥ i ( j ) \tau_{\ge i}^{(j)} τ ≥ i ( j ) at step i i i , and the trajectories at step i i i are sampled independently from the same state x i ∼ p θ x_i\sim p_\theta x i ∼ p θ . To implement (4), one can sample a trajectory as root and then sample m − 1 m-1 m − 1 branching trajectories from every state, or a subset B ⊆ R d B\subseteq\mathbb{R}^d B ⊆ R d to reduce cost [41 ] . Either way, this requires sampling new trajectories from an observed state. This can be done by resetting the environment, or by using a world model (WM) p ω ( x i + 1 ∣ x i , a i ) p_\omega(x_{i+1}\mid x_i,a_i) p ω ( x i + 1 ∣ x i , a i ) [18 , 55 ] with parameters ω \omega ω learned via:
L W M ( ω ) : = ∑ i = 0 n − 1 E ( x i , a i , x i + 1 ) ∼ p ϕ [ − log p ω ( x i + 1 ∣ x i , a i ) ] , (5) \mathcal{L}_{\mathrm{WM}}(\omega):=\sum_{i=0}^{n-1}\mathbb{E}_{(x_i,a_i,x_{i+1})\sim p_\phi}\left[-\log p_\omega(x_{i+1}\mid x_i,a_i)\right], \tag*{(5)} L WM ( ω ) := i = 0 ∑ n − 1 E ( x i , a i , x i + 1 ) ∼ p ϕ [ − log p ω ( x i + 1 ∣ x i , a i ) ] , (5)
where a reference policy π ϕ \pi_\phi π ϕ collects data ( x i , a i , x i + 1 ) ∼ p ϕ (x_i,a_i,x_{i+1})\sim p_\phi ( x i , a i , x i + 1 ) ∼ p ϕ . In this way, policy gradient estimates can be improved by evaluating alternative actions using a world model. Yet, complex and stochastic environments, or “big worlds” [23 ] , remain challenging. When environmental complexity exceeds the capacity of the world model, its predictions would suffer from errors [21 , 4 ] . Even with an accurate model, environmental randomness can dominate simulated returns, obscuring action effects and increasing the variance [28 ] .
Methods
We define counterfactual world models (CWMs), show that they can be easier to learn than ordinary WMs when environmental complexity exceeds actions, and outline two methods for their learning. Then, we present a policy gradient estimator REINFORCE Look Back (RLB) via CWMs, separating action effects from environmental luck to reduce variance. All proofs are in Appendix § 8 .
Counterfactual world models
RLOO with a world model (4) predicts branching trajectories independently from the root. Our idea behind counterfactual world models is that conditioning on the whole root trajectory and predicting how it would become different under an alternative action can be easier, as it allows reusing observed environmental information. We formalize this intuition using structural causal models [38 ] .
Structural causal models (SCMs). Any MDP in the form of (1) can be expressed as a collection of deterministic functions that take noise variables [8 ] , defining an SCM:
x 0 = μ ( u − 1 ) , x i + 1 = f ( x i , a i , u i ) , a i = π θ ( x i , ϵ i ) , i = 0 , … , n − 1 , (6) x_0=\mu(u_{-1}), \qquad x_{i+1}=f(x_i,a_i,u_i), \qquad a_i=\pi_\theta(x_i,\epsilon_i), \qquad i=0,\ldots,n-1, \tag*{(6)} x 0 = μ ( u − 1 ) , x i + 1 = f ( x i , a i , u i ) , a i = π θ ( x i , ϵ i ) , i = 0 , … , n − 1 , (6)
where all noise variables u − 1 , u 0 , … , u n − 1 u_{-1},u_0,\ldots,u_{n-1} u − 1 , u 0 , … , u n − 1 and ϵ 0 , … , ϵ n − 1 \epsilon_0,\ldots,\epsilon_{n-1} ϵ 0 , … , ϵ n − 1 are mutually independent, and we abuse notations to write the functions underlying the initial distribution and the policy by μ \mu μ and π θ \pi_\theta π θ , respectively. Through the SCM formulation, all randomness in the MDP is captured by ( u , ϵ ) (u,\epsilon) ( u , ϵ ) . There could be multiple SCMs consistent with a given MDP [37 ] . This is not an issue, as arbitrarily choosing one of them suffices for unbiasedness of policy gradient estimation (§ 3.2 ). Without loss of generality, we can write the environmental noise u i = ( v i , h i ) u_i=(v_i,h_i) u i = ( v i , h i ) with a visible part v i v_i v i , deducible from a transition ( x i , a i , x i + 1 ) (x_i,a_i,x_{i+1}) ( x i , a i , x i + 1 ) deterministically, and a hidden part h i h_i h i , such as unobserved events (Appendix § 8 .§ 2 ). We assume that this decomposition is the same across i i i .
Counterfactuals. Having expressed our MDP as an SCM, we can formalize counterfactual thinking after observing a transition o i : = ( x ^ i , a ^ i , x ^ i + 1 ) o_i := (\hat{x}_i,\hat{a}_i,\hat{x}_{i+1}) o i := ( x ^ i , a ^ i , x ^ i + 1 ) . If we took an alternative action a i ∼ π θ ( ⋅ ∣ x i ) a_i \sim\pi_\theta(\cdot\mid x_i) a i ∼ π θ ( ⋅ ∣ x i ) , and if all other factors in the environment unfolded identically, will the outcome change? Under the SCM, this amounts to evaluating an alternative outcome x i + 1 = f ( x i , a i , u i ) x_{i+1} = f(x_i,a_i,\mathbf{u}_i) x i + 1 = f ( x i , a i , u i ) where u i \mathbf{u}_i u i is the environmental noise that has produced the factual observation x ^ i + 1 = f ( x ^ i , a ^ i , u i ) \hat{x}_{i+1} = f(\hat{x}_i,\hat{a}_i,\mathbf{u}_i) x ^ i + 1 = f ( x ^ i , a ^ i , u i ) . In general, u i \mathbf{u}_i u i can be uncertain given o i o_i o i (due to its hidden part h i \mathbf{h}_i h i ), and the counterfactual transition probability is
p ( x i + 1 ∣ x i , a i , o i ) = ∫ p ( u i ∣ o i ) ⋅ 1 ( x i + 1 = f ( x i , a i , u i ) ) d u i , (7) p(x_{i+1}\mid x_i,a_i,o_i)=\int p(\mathbf{u}_i\mid o_i)\cdot\mathbf{1}(x_{i+1}=f(x_i,a_i,\mathbf{u}_i))\,\mathrm{d}\mathbf{u}_i, \tag*{(7)} p ( x i + 1 ∣ x i , a i , o i ) = ∫ p ( u i ∣ o i ) ⋅ 1 ( x i + 1 = f ( x i , a i , u i )) d u i , (7)
where 1 ( ⋅ ) \mathbf{1}(\cdot) 1 ( ⋅ ) is delta function. Here, x ^ i \hat{x}_i x ^ i and x i x_i x i need not be the same, which allows us to reuse environmental noise underlying the transition ( x ^ i , a ^ i , x ^ i + 1 ) (\hat{x}_i,\hat{a}_i,\hat{x}_{i+1}) ( x ^ i , a ^ i , x ^ i + 1 ) to make predictions at a different state x i x_i x i .
Counterfactual world models (CWMs). Based on the SCM framework, we define a counterfactual world model as a model p ω ( x i + 1 ∣ x i , a i , o i ) p_\omega(x_{i+1}\mid x_i,a_i,o_i) p ω ( x i + 1 ∣ x i , a i , o i ) of the counterfactual probability (7) with parameters ω \omega ω . It is distinguished from an ordinary WM p ω ( x i + 1 ∣ x i , a i ) p_\omega(x_{i+1}\mid x_i,a_i) p ω ( x i + 1 ∣ x i , a i ) , as it additionally conditions on factual observation o i = ( x ^ i , a ^ i , x ^ i + 1 ) o_i=(\hat{x}_i,\hat{a}_i,\hat{x}_{i+1}) o i = ( x ^ i , a ^ i , x ^ i + 1 ) and predicts alternative outcome of taking an action a i a_i a i instead. The relation between WM and CWM is roughly that between a generative model and an editing model.
In cases where paired observations with shared environmental noise can be obtained or simulated, a CWM can be learned with ordinary maximum likelihoods, using the following loss:
L C W M ( ω ) : = ∑ i = 0 n − 1 E x i , x ^ i , a i , a ^ i , u i [ − log p ω ( x i + 1 ∣ x i , a i , o i ) ] , o i = ( x ^ i , a ^ i , x ^ i + 1 ) , (8) \mathcal{L}_{\mathrm{CWM}}(\omega):=\sum_{i=0}^{n-1}\mathbb{E}_{x_i,\hat{x}_i,a_i,\hat{a}_i,\mathbf{u}_i}\left[-\log p_\omega(x_{i+1}\mid x_i,a_i,o_i)\right],\qquad o_i=(\hat{x}_i,\hat{a}_i,\hat{x}_{i+1}), \tag*{(8)} L CWM ( ω ) := i = 0 ∑ n − 1 E x i , x ^ i , a i , a ^ i , u i [ − log p ω ( x i + 1 ∣ x i , a i , o i ) ] , o i = ( x ^ i , a ^ i , x ^ i + 1 ) , (8)
where x i , x ^ i ∼ p ϕ x_i,\hat{x}_i\sim p_\phi x i , x ^ i ∼ p ϕ , a i ∼ π ϕ ( ⋅ ∣ x i ) a_i\sim\pi_\phi(\cdot\mid x_i) a i ∼ π ϕ ( ⋅ ∣ x i ) , a ^ i ∼ π ϕ ( ⋅ ∣ x ^ i ) \hat{a}_i\sim\pi_\phi(\cdot\mid\hat{x}_i) a ^ i ∼ π ϕ ( ⋅ ∣ x ^ i ) are drawn with a reference policy π ϕ \pi_\phi π ϕ , the environmental noise u i \mathbf{u}_i u i is independently drawn from its SCM distribution, and the factual and counterfactual outcomes for training are obtained as x i + 1 = f ( x i , a i , u i ) x_{i+1}=f(x_i,a_i,\mathbf{u}_i) x i + 1 = f ( x i , a i , u i ) and x ^ i + 1 = f ( x ^ i , a ^ i , u i ) \hat{x}_{i+1}=f(\hat{x}_i,\hat{a}_i,\mathbf{u}_i) x ^ i + 1 = f ( x ^ i , a ^ i , u i ) , respectively. We prove that, under mild assumptions, minimizing L C W M \mathcal{L}_{\mathrm{CWM}} L CWM (8) recovers true counterfactuals (7) :
Proposition 1. Assume that, for every step i i i ,
(i) The true and learned counterfactuals admit densities w.r.t. a reference measure at each input, whose log densities at x i + 1 x_{i+1} x i + 1 are integrable under the training distribution, and
(ii) There exists ω ∗ \omega_* ω ∗ s.t. p ω ∗ ( ⋅ ∣ x i , a i , o i ) = p ( ⋅ ∣ x i , a i , o i ) p_{\omega_*}(\cdot\mid x_i,a_i,o_i)=p(\cdot\mid x_i,a_i,o_i) p ω ∗ ( ⋅ ∣ x i , a i , o i ) = p ( ⋅ ∣ x i , a i , o i ) a.s. under the training distribution.
Then ω ∗ \omega_* ω ∗ is a population minimizer of L C W M \mathcal{L}_{\mathrm{CWM}} L CWM , and every population minimizer recovers the true counterfactual distribution a.s. under the training distribution.
A proof is in Appendix A.3. The result holds for any reference policy π ϕ \pi_\phi π ϕ . We now prove that, for maximum likelihood training of CWMs, paired samples logarithmic in the model class suffice:
Proposition 2. Let Ω \Omega Ω be a finite set of parameters containing ω ∗ \omega_* ω ∗ where p ω ∗ p_{\omega_*} p ω ∗ is the true counterfactual, and let D \mathcal{D} D be a set of N N N i.i.d. paired transitions with shared noise. Then every maximum likelihood CWM p ^ ω \hat{p}_\omega p ^ ω on D \mathcal{D} D has the following expected error in squared Hellinger distance H 2 H^2 H 2 :
E D E x i , a i , o i [ H 2 ( p ω ^ ( ⋅ ∣ x i , a i , o i ) , p ( ⋅ ∣ x i , a i , o i ) ) ] ≤ 1 + log ∣ Ω ∣ N . (9) \mathbb{E}_{\mathcal{D}}\mathbb{E}_{x_i,a_i,o_i}\left[H^2\left(p_{\hat{\omega}}(\cdot\mid x_i,a_i,o_i),p(\cdot\mid x_i,a_i,o_i)\right)\right]\leq\frac{1+\log|\Omega|}{N}. \tag*{(9)} E D E x i , a i , o i [ H 2 ( p ω ^ ( ⋅ ∣ x i , a i , o i ) , p ( ⋅ ∣ x i , a i , o i ) ) ] ≤ N 1 + log ∣Ω∣ . (9)
A proof is in Appendix A.4. In contrast, for ordinary WMs, the learning error of is at least that of the environmental noise distribution, leading to an irreducible worst-case lower bound on their error:
Proposition 3. Suppose the decomposition u i = ( v i , h i ) \mathbf{u}_i = (v_i, h_i) u i = ( v i , h i ) is the same for every step i i i , and the true distribution ν \nu ν of the visible noise v i v_i v i is only known to belong to a family P \mathcal{P} P . For a set D ′ D' D ′ of 2 N 2N 2 N i.i.d. transitions, every WM p ω ^ p_{\hat{\omega}} p ω ^ estimated from D ′ D' D ′ has worst-case expected error
sup ν ∈ P E D ′ E x i , a i [ H 2 ( p ω ^ ( ⋅ ∣ x i , a i ) , p ( ⋅ ∣ x i , a i ) ) ] ≥ inf ν ^ sup ν ∈ P E v ( 1 ) , … , v ( M ) ∼ ν [ H 2 ( ν ^ , ν ) ] , \sup_{\nu\in\mathcal{P}} \mathbb{E}_{D'}\mathbb{E}_{x_i,a_i}\left[H^2\left(p_{\hat{\omega}}(\cdot\mid x_i,a_i),p(\cdot\mid x_i,a_i)\right)\right] \geq\inf_{\hat{\nu}}\sup_{\nu\in\mathcal{P}} \mathbb{E}_{v^{(1)},\ldots,v^{(M)}\sim\nu}\left[H^2(\hat{\nu},\nu)\right], ν ∈ P sup E D ′ E x i , a i [ H 2 ( p ω ^ ( ⋅ ∣ x i , a i ) , p ( ⋅ ∣ x i , a i ) ) ] ≥ ν ^ inf ν ∈ P sup E v ( 1 ) , … , v ( M ) ∼ ν [ H 2 ( ν ^ , ν ) ] , where M : = 2 N ( i + 1 ) + i M := 2N(i+1)+i M := 2 N ( i + 1 ) + i and the infimum is over all estimates ν ^ \hat{\nu} ν ^ of ν \nu ν from M M M i.i.d. visible noise.
A proof is in Appendix § 8 .§ 5 . Whenever the RHS of (24) exceeds that of (9), N N N paired data yield a more accurate CWM than 2 N 2N 2 N data yield any WM in the worst case. A sufficient condition is when action effect is more predictable than the environment, in the sense of the following two cases:
Proposition 4. If the visible noise ranges over at least 3 4 ( i + 1 ) ( 1 + log ∣ Ω ∣ ) 3^{4}(i+1)(1+\log|\Omega|) 3 4 ( i + 1 ) ( 1 + log ∣Ω∣ ) values and its distribution is unrestricted, the upper bound of the CWM error is smaller than the worst-case lower bound of the WM error whenever N ≥ 3 4 ( 1 + log ∣ Ω ∣ ) N \geq3^{4}(1+\log|\Omega|) N ≥ 3 4 ( 1 + log ∣Ω∣ ) .
A proof is in Appendix § 8 .§ 6 . This intuitively amounts to complex environmental noise. Another is:
Proposition 5. Suppose that, at a given step i i i ,
(i) It holds that E x i + 1 ∼ p ω ( ⋅ ∣ x i , a i , o i ) ∥ x i + 1 − x ^ i + 1 ∥ 2 ≤ A 2 \mathbb{E}_{x_{i+1}\sim p_\omega(\cdot\mid x_i,a_i,o_i)}\lVert x_{i+1}-\hat{x}_{i+1}\rVert^2 \leq A^2 E x i + 1 ∼ p ω ( ⋅ ∣ x i , a i , o i ) ∥ x i + 1 − x ^ i + 1 ∥ 2 ≤ A 2 for all ω ∈ Ω \omega\in\Omega ω ∈ Ω and all pairs of factual and counterfactual transitions, and
(ii) The distribution of visible noise is unrestricted, and there are two values of visible noise whose next states, averaged over hidden noise, are at distance ≥ E \geq E ≥ E at every state-action.
Then, in squared 1-Wasserstein distance W 2 W^2 W 2 , the upper bound of CWM error is smaller than the worst-case lower bound of WM error whenever E 2 > 48 A 2 ( 3 i + 4 ) ( 1 + log ∣ Ω ∣ ) E^2 > 48A^2(3i+4)(1+\log|\Omega|) E 2 > 48 A 2 ( 3 i + 4 ) ( 1 + log ∣Ω∣ ) .
A proof is in Appendix § 8 .7. This amounts to noise outweighing action effect, as A A A upper-bounds the effect of action with fixed noise, and E E E lower-bounds the effect of noise with fixed action.
WM-induced CWMs. Training CWMs with (8) needs access to paired factual and counterfactual observations, which can be unavailable for realistic environments. In these cases, we propose to train an ordinary WM p ω ( x i + 1 ∣ x i , a i ) p_\omega(x_{i+1}\mid x_i,a_i) p ω ( x i + 1 ∣ x i , a i ) based on state-action-conditioned diffusion models [3 , 50 ] to maximize the observation likelihood (5) , then apply diffusion counterfactual inference [40 ] to turn it into a CWM p ω ( x i + 1 ∣ x i , a i , o i ) p_\omega(x_{i+1}\mid x_i,a_i,o_i) p ω ( x i + 1 ∣ x i , a i , o i ) . This can be done, for each observation o i = ( x ^ i , a ^ i , x ^ i + 1 ) o_i=(\hat{x}_i,\hat{a}_i,\hat{x}_{i+1}) o i = ( x ^ i , a ^ i , x ^ i + 1 ) , by inferring the latent noise u ~ i \tilde{u}_i u ~ i underlying the transition ( x ^ i , a ^ i ) ↦ x ^ i + 1 (\hat{x}_i,\hat{a}_i)\mapsto\hat{x}_{i+1} ( x ^ i , a ^ i ) ↦ x ^ i + 1 via noise inversion [46 ] , and then starting deterministic generation x i + 1 = f ω ( x i , a i , u ~ i ) x_{i+1}=f_\omega(x_i,a_i,\tilde{u}_i) x i + 1 = f ω ( x i , a i , u ~ i ) from u ~ i \tilde{u}_i u ~ i , with altered condition ( x i , a i ) (x_i,a_i) ( x i , a i ) to get x i + 1 x_{i+1} x i + 1 (Figure 2 ). While this approach requires learning a WM, its prediction during inference is now counterfactual. We now show that those diffusion counterfactuals can be exact even when the WM itself has errors:
Figure 2. Counterfactual world models (CWMs). (Left) A CWM transforms the factual outcome under the same environmental noise u i \mathbf{u}_i u i , requiring no model of p ( u ) p(\mathbf{u}) p ( u ) . (Right) CWMs can be learned from paired outcomes with shared noise, or from unpaired data by inverting a (diffusion) WM.
Proposition 6. Suppose a WM f ω f_\omega f ω uses noise u ~ ∼ N ( 0 , I ) \tilde{u}\sim\mathcal{N}(0,I) u ~ ∼ N ( 0 , I ) , and f ω ( x i , a i , ⋅ ) f_\omega(x_i,a_i,\cdot) f ω ( x i , a i , ⋅ ) is invertible. If there is a distribution ν ~ \tilde{\nu} ν ~ s.t. setting u ~ ∼ ν ~ \tilde{u}\sim\tilde{\nu} u ~ ∼ ν ~ removes the WM’s error, then the induced CWM gives exact counterfactuals of an SCM consistent with the MDP, whereas the WM has error H 2 ( N ( 0 , I ) , ν ~ ) H^2(\mathcal{N}(0,I),\tilde{\nu}) H 2 ( N ( 0 , I ) , ν ~ ) .
A proof is in Appendix § 8 .8. Whenever ν ~ ≠ N ( 0 , I ) \tilde{\nu}\ne\mathcal{N}(0,I) ν ~ = N ( 0 , I ) , the WM is wrong about the noise distribution, an error no learned WM can avoid (Proposition 3 ). Yet this error cancels between inversion and generation for the counterfactuals, making them exact, although obtained without paired data. We note that the above result holds for any WM invertible on its noise. While in practice there can be errors in f ω f_\omega f ω and its inversion, their impact is scaled at most by a constant under proper conditions:
Proposition 7. Let f f f be an SCM consistent with the MDP such that, for some constant Λ \Lambda Λ ,
∥ f ( x , a , u ) − f ( x , a , u ′ ) ∥ ≤ Λ ∥ f ( x ^ , a ^ , u ) − f ( x ^ , a ^ , u ′ ) ∥ , ∀ ( x , a ) , ( x ^ , a ^ ) , u , u ′ . (10) \lVert f(x,a,u)-f(x,a,u')\rVert\leq\Lambda\lVert f(\hat{x},\hat{a},u)-f(\hat{x},\hat{a},u')\rVert,\qquad\forall(x,a),(\hat{x},\hat{a}),u,u'. \tag*{(10)} ∥ f ( x , a , u ) − f ( x , a , u ′ )∥ ≤ Λ ∥ f ( x ^ , a ^ , u ) − f ( x ^ , a ^ , u ′ )∥ , ∀ ( x , a ) , ( x ^ , a ^ ) , u , u ′ . (10) Suppose that ∥ f ω ( x , a , u ~ ) − f ( x , a , T ( u ~ ) ) ∥ ≤ ε \lVert f_\omega(x,a,\tilde{u})-f(x,a,T(\tilde{u}))\rVert\leq\varepsilon ∥ f ω ( x , a , u ~ ) − f ( x , a , T ( u ~ ))∥ ≤ ε for all ( x , a ) (x,a) ( x , a ) and u ~ \tilde{u} u ~ , for some map T T T that does not depend on ( x , a ) (x,a) ( x , a ) , and that inversion returns a latent u u u that reproduces the factual next state
up to ε i n v \varepsilon_{\mathrm{inv}} ε inv , i.e., ∥ f ω ( x ^ i , a ^ i , u ~ ) − x ^ i + 1 ∥ ≤ ε i n v \lVert f_{\omega}(\hat{x}_{i},\hat{a}_{i},\tilde{u})-\hat{x}_{i+1}\rVert\le\varepsilon_{\mathrm{inv}} ∥ f ω ( x ^ i , a ^ i , u ~ ) − x ^ i + 1 ∥ ≤ ε inv . Then the CWM is within ( 1 + Λ ) ε + Λ ε i n v (1+\Lambda)\varepsilon+\Lambda\varepsilon_{\mathrm{inv}} ( 1 + Λ ) ε + Λ ε inv of the true counterfactual of f f f , for every factual transition of f f f and every ( x i , a i ) (x_i,a_i) ( x i , a i ) .
A proof is in Appendix § 8 .9. In summary, WM-induced CWMs allow learning an approximate SCM and leveraging its counterfactuals from only observational data. This is useful for training agents with CWMs as we describe next.
REINFORCE Look Back
We now present our policy gradient estimator. To motivate the method, we remark that the RLOO estimator (4) samples the root trajectory, here denoted τ ^ \hat{\tau} τ ^ , and branching trajectories, independently:
τ ( 1 ) = τ ^ = ( x ^ 0 , a ^ 0 , … , x ^ n ) ∼ p θ , τ ≥ i ( 2 ) , … , τ ≥ i ( m ) ∼ i i d p θ ( ⋅ ∣ x ^ i ) . (11) \tau^{(1)}=\hat{\tau}=(\hat{x}_0,\hat{a}_0,\ldots,\hat{x}_n)\sim p_\theta,\qquad\tau_{\geq i}^{(2)},\ldots,\tau_{\geq i}^{(m)}\stackrel{\mathrm{iid}}{\sim}p_\theta(\mathord{\cdot}\mid\hat{x}_i). \tag*{(11)} τ ( 1 ) = τ ^ = ( x ^ 0 , a ^ 0 , … , x ^ n ) ∼ p θ , τ ≥ i ( 2 ) , … , τ ≥ i ( m ) ∼ iid p θ ( ⋅ ∣ x ^ i ) . (11)
While modeling the branches with a world model allows evaluating alternative actions, it can obscure action effects with environmental randomness. Our key idea is to replace the branching trajectories with counterfactuals relative to the root as the factual, thereby coupling environmental randomness. This leads to our policy gradient estimator, REINFORCE Look Back (RLB) (Figure 3 ):
Figure 3. RLOO vs. RLB. Independent branches differ by both action and luck, whereas counterfactual branches share the factual noise and differ by action only.
∇ θ J ( θ ) ≈ 1 m ∑ i = 1 n ∑ j = 1 m γ i ( G i ( j ) − b i ( j ) ) z i ( j ) , b i ( j ) : = 1 m − 1 ∑ ℓ ≠ j G i ( ℓ ) , τ ≥ i ( 2 ) , … , τ ≥ i ( m ) ∼ i i d p θ ( ⋅ ∣ x ^ i , τ ^ ) (12) \nabla_\theta J(\theta)\approx\frac{1}{m}\sum_{i=1}^{n}\sum_{j=1}^{m}\gamma^i\left(G_i^{(j)}-b_i^{(j)}\right)z_i^{(j)},\qquad b_i^{(j)}:=\frac{1}{m-1}\sum_{\ell\ne j}G_i^{(\ell)},\qquad\tau_{\geq i}^{(2)},\ldots,\tau_{\geq i}^{(m)}\stackrel{\mathrm{iid}}{\sim}p_\theta(\mathord{\cdot}\mid\hat{x}_i,\hat{\tau}) \tag*{(12)} ∇ θ J ( θ ) ≈ m 1 i = 1 ∑ n j = 1 ∑ m γ i ( G i ( j ) − b i ( j ) ) z i ( j ) , b i ( j ) := m − 1 1 ℓ = j ∑ G i ( ℓ ) , τ ≥ i ( 2 ) , … , τ ≥ i ( m ) ∼ iid p θ ( ⋅ ∣ x ^ i , τ ^ ) (12)
where we define the trajectory-level counterfactual probability p θ ( τ ≥ i ∣ x ^ i , τ ^ ) p_\theta(\tau_{\geq i}\mid\hat{x}_i,\hat{\tau}) p θ ( τ ≥ i ∣ x ^ i , τ ^ ) as follows:
p θ ( τ ≥ i ∣ x i , τ ^ ) : = ∏ k = i n − 1 π θ ( a k ∣ x k ) ⋅ p ( x k + 1 ∣ x k , a k , o k ) , o k = ( x ^ k , a ^ k , x ^ k + 1 ) , (13) p_\theta(\tau_{\geq i}\mid x_i,\hat{\tau}):=\prod_{k=i}^{n-1}\pi_\theta(a_k\mid x_k)\cdot p(x_{k+1}\mid x_k,a_k,o_k),\qquad o_k=(\hat{x}_k,\hat{a}_k,\hat{x}_{k+1}), \tag*{(13)} p θ ( τ ≥ i ∣ x i , τ ^ ) := k = i ∏ n − 1 π θ ( a k ∣ x k ) ⋅ p ( x k + 1 ∣ x k , a k , o k ) , o k = ( x ^ k , a ^ k , x ^ k + 1 ) , (13)
and model p ( x k + 1 ∣ x k , a k , o k ) p(x_{k+1}\mid x_k,a_k,o_k) p ( x k + 1 ∣ x k , a k , o k ) using a CWM p ω p_\omega p ω (§ 3.1 ). By coupling environmental randomness across trajectories, much of the sampled return can be attributed to the specific action taken, potentially improving the policy gradient estimate. RLB is unbiased under proper conditions:
Proposition 8. Assume that all noise variables in the SCM (6) are mutually independent and have distributions independent of θ \theta θ . Let m ≥ 2 m\geq2 m ≥ 2 and τ ^ ∼ p θ \hat{\tau}\sim p_\theta τ ^ ∼ p θ . At every step i i i , sample the counterfactual trajectories as in (13), using exact counterfactual distributions and fresh independent policy randomness. Under the usual regularity and integrability conditions, RLB is unbiased.
A proof is in Appendix § 8 .10.
Notably, RLB does not require identifiability of the SCM, as the choice of the SCM does not affect unbiasedness as we show next. It affects only the variance of estimation, which we discuss shortly.
Corollary 1. Under the assumptions of Proposition 8, RLB is unbiased when using the exact counterfactuals of any other SCM of the form (6) that is consistent with the MDP.
A proof is in Appendix § 8 .11. This allows (i) using a simulator of the environment for paired training of CWMs as long as it matches transition probabilities of the MDP, and (ii) using WM-induced CWMs built from unpaired data without the need to know the true SCM of the environment.
We now characterize when RLB reduces variance. For simplicity, we consider one group, the factual and its m − 1 m-1 m − 1 branches from a state x ^ i \hat{\mathbf{x}}_i x ^ i . Let g ^ R L B \hat{\mathbf{g}}_{\mathrm{RLB}} g ^ RLB be its term in (13) without the factor γ i \gamma^i γ i , and g ^ R L O O \hat{\mathbf{g}}_{\mathrm{RLOO}} g ^ RLOO that of (4). The return of each trajectory is a function G ( ϵ , u ) G(\boldsymbol{\epsilon},\mathbf{u}) G ( ϵ , u ) of action ϵ \boldsymbol{\epsilon} ϵ and environmental noise u \mathbf{u} u . We define some quantities that measure environmental luck and its interactions with action effect:
V ( u ) : = E ϵ [ G ( ϵ , u ) ] , σ l u c k 2 : = Var u V ( u ) , σ i n t e r 2 : = sup ϵ Var u ( G ( ϵ , u ) − V ( u ) ) . (14) V(\mathbf{u}) := \mathbb{E}_{\boldsymbol{\epsilon}}[G(\boldsymbol{\epsilon},\mathbf{u})], \qquad\sigma_{\mathrm{luck}}^2 := \operatorname{Var}_{\mathbf{u}} V(\mathbf{u}), \qquad\sigma_{\mathrm{inter}}^2 := \sup_{\boldsymbol{\epsilon}} \operatorname{Var}_{\mathbf{u}}(G(\boldsymbol{\epsilon},\mathbf{u}) - V(\mathbf{u})). \tag*{(14)} V ( u ) := E ϵ [ G ( ϵ , u )] , σ luck 2 := Var u V ( u ) , σ inter 2 := ϵ sup Var u ( G ( ϵ , u ) − V ( u )) . (14)
Here, V ( u ) V(\mathbf{u}) V ( u ) is the return that depends on environmental noise but not on the actions. Its variance σ l u c k 2 \sigma_{\mathrm{luck}}^2 σ luck 2 measures luck that no action is responsible for. The difference G ( ϵ , u ) − V ( u ) G(\boldsymbol{\epsilon},\mathbf{u}) - V(\mathbf{u}) G ( ϵ , u ) − V ( u ) is the effect of actions relative to luck, and σ i n t e r 2 \sigma_{\mathrm{inter}}^2 σ inter 2 measures how much this effect changes with the noise. We show:
Proposition 9. Suppose that counterfactuals are exact. Then, for every group and given x ^ i \hat{\mathbf{x}}_i x ^ i ,
Cov ( g ^ R L O O ) − Cov ( g ^ R L B ) ⪰ ( σ l u c k − σ i n t e r ) 2 − ( m + 4 ) σ i n t e r 2 m − 1 E [ z i z i T ] , (15) \operatorname{Cov}(\hat{\mathbf{g}}_{\mathrm{RLOO}}) - \operatorname{Cov}(\hat{\mathbf{g}}_{\mathrm{RLB}}) \succeq\frac{(\sigma_{\mathrm{luck}}-\sigma_{\mathrm{inter}})^2-(m+4)\sigma_{\mathrm{inter}}^2}{m-1}\mathbb{E}[\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}], \tag*{(15)} Cov ( g ^ RLOO ) − Cov ( g ^ RLB ) ⪰ m − 1 ( σ luck − σ inter ) 2 − ( m + 4 ) σ inter 2 E [ z i z i T ] , (15) with equality if σ i n t e r = 0 \sigma_{\mathrm{inter}}=0 σ inter = 0 , where A ⪰ B A \succeq B A ⪰ B means A − B A-B A − B is PSD. Against REINFORCE with m m m independent trajectories and exact value baseline, the bound holds with
2 Var ( G ) − σ l u c k 2 m ( m − 1 ) E [ z i z i T ] \frac{2\operatorname{Var}(G)-\sigma_{\mathrm{luck}}^2}{m(m-1)}\mathbb{E}[\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}] m ( m − 1 ) 2 Var ( G ) − σ luck 2 E [ z i z i T ] subtracted. Hence RLB has the smaller covariance whenever σ l u c k ≥ ( 1 + m + 4 ) σ i n t e r \sigma_{\mathrm{luck}} \ge(1+\sqrt{m+4})\sigma_{\mathrm{inter}} σ luck ≥ ( 1 + m + 4 ) σ inter against RLOO, and whenever 2 Var ( G ) / ( m + 1 ) \sqrt{2\operatorname{Var}(G)/(m+1)} 2 Var ( G ) / ( m + 1 ) is added to the threshold against REINFORCE.
A proof is in Appendix § 8 .12. For variance reduction, the condition on σ l u c k \sigma_{\mathrm{luck}} σ luck asks that luck outweighs the interaction of actions and noise. In Appendix § 8 .13, we prove that this condition is tight up to a constant. For σ i n t e r = 0 \sigma_{\mathrm{inter}}=0 σ inter = 0 , the bound is the classical effect of common random numbers [14 ] , which we extend to noise that interacts with actions and is partly hidden. We note that only σ l u c k \sigma_{\mathrm{luck}} σ luck and σ i n t e r \sigma_{\mathrm{inter}} σ inter depend on the choice of SCM. Every consistent SCM gives an unbiased estimate (Corollary 1), but SCMs whose noise consistently acts as luck reduce variance more.
We now bound errors under learned models.
Proposition 10. Let the branches of RLB be generated by a CWM, let η \eta η be the mean absolute error of the model’s expected return of a branch, and let scores be bounded by z max z_{\max} z m a x . Then, for every group and x ^ i \hat{\mathbf{x}}_i x ^ i , the bias of RLB is at most z max η z_{\max}\eta z m a x η in norm. If returns of a branch and its factual differ by at most A A A , then
Cov ( g ^ ) − Cov ( g ^ R L B ) ⪰ ( ( σ l u c k − σ i n t e r ) + 2 m ( m − 1 ) − A 2 ) E [ z i z i T ] (16) \operatorname{Cov}(\hat{\mathbf{g}})-\operatorname{Cov}(\hat{\mathbf{g}}_{\mathrm{RLB}}) \succeq\left(\frac{(\sigma_{\mathrm{luck}}-\sigma_{\mathrm{inter}})_+^2}{m(m-1)}-A^2\right)\mathbb{E}[\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}] \tag*{(16)} Cov ( g ^ ) − Cov ( g ^ RLB ) ⪰ ( m ( m − 1 ) ( σ luck − σ inter ) + 2 − A 2 ) E [ z i z i T ] (16) for g ^ \hat{\mathbf{g}} g ^ either RLOO with any WM or REINFORCE with any state-dependent baseline, where ( ⋅ ) + (\cdot)_+ ( ⋅ ) + is the positive part. Hence RLB has the smaller covariance whenever σ l u c k ≥ σ i n t e r + m A \sigma_{\mathrm{luck}} \ge\sigma_{\mathrm{inter}}+mA σ luck ≥ σ inter + m A , and the smaller mean squared error if also z max η ≤ A ( E [ ∥ z i ∥ 2 ] / m ) 1 / 2 z_{\max}\eta\le A(\mathbb{E}[\lVert\mathbf{z}_i\rVert^2]/m)^{1/2} z m a x η ≤ A ( E [∥ z i ∥ 2 ] / m ) 1/2 .
A proof is in Appendix § 8 .14. Here η \eta η may refer to the error with respect to the exact counterfactuals of any SCM consistent with the MDP, so the model need not identify a particular one. The result shows that the bias of RLB is bounded by the model error η \eta η , whereas variance reduction requires a condition on environmental luck similar as in Proposition 9.
We finally show that the bias of RLB for the whole estimator in (13) decays with the number of paired transitions for CWM training, at a rate independent of the noise distribution:
Proposition 11. In Propositions 2 and 10, suppose that every input of the CWM along the branches is at most κ \kappa κ times as likely as in the training distribution. Then, on average over the training set, every maximum likelihood CWM has E x ^ i [ η ] ≤ 2 A ( n − i ) 2 κ ( 1 + log ∣ Ω ∣ ) / N \mathbb{E}_{\hat{\mathbf{x}}_i}[\eta] \le2A(n-i)\sqrt{2\kappa(1+\log|\Omega|)/N} E x ^ i [ η ] ≤ 2 A ( n − i ) 2 κ ( 1 + log ∣Ω∣ ) / N for step i i i . Hence RLB (13) has a bias at most A z max n ( n + 1 ) 2 κ ( 1 + log ∣ Ω ∣ ) / N A z_{\max} n(n+1)\sqrt{2\kappa(1+\log|\Omega|)/N} A z m a x n ( n + 1 ) 2 κ ( 1 + log ∣Ω∣ ) / N in norm.
A proof is in Appendix § 8 .15. Here κ \kappa κ bounds the distribution shift from training data, collected with the reference policy π ϕ \pi_{\phi} π ϕ , to the branches of the policy π θ \pi_{\theta} π θ .
In Appendix § 8 .16, we further provide an extension of the main results to sparse branching.
Related Work
We provide an overview of related work. An extended discussion can be found in Appendix § 9 .
World models. In model-based reinforcement learning, world models support policy learning through imagined experience [48 , 18 ] . Yet, model errors arising from limited capacity can limit their utility [21 ] , especially when modeling a big world [23 ] . Prior work has addressed this challenge by directing model capacity toward predictions needed for value estimation and planning [17 , 26 ] . We study a complementary approach of using observed trajectories as conditioning information when predicting the consequences of alternative actions. This can simplify prediction when environmental evolution is difficult to model but action effects are comparatively simple [8 ] .
Counterfactual reinforcement learning. Prior work has used counterfactual reasoning [39 ] to improve reinforcement learning methods. Buesing et al. [8 ] show that conditioning simulations on logged experience can improve policy evaluation and search. CCA [30 ] learns value baselines that estimate counterfactual returns in order to better distinguish action effects from environmental luck, adding an action-independence loss to encourage unbiasedness. Our approach learns imaginations using a counterfactual world model to construct policy gradient baselines, harnessing benefits of counterfactuals in both model learning and credit assignment.
Policy gradient baselines. Our policy gradient estimator builds on prior work on baselines, which can reduce variance without biasing the gradient under proper conditions [16 ] . RLOO [24 ] constructs baselines from independent trajectories from the same initial state, and world models can provide these trajectories when the environment cannot be reset [55 ] . For environments with simulators, prior work has shown that constructing baselines from trajectories with shared randomness can further reduce variance [41 , 28 , 7 ] through a common random number effect.
Counterfactual modeling. Counterfactual modeling builds upon the causal inference framework [38 ] , with approaches including learning from paired observations with shared underlying randomness [6 ] and learning a diffusion model to generate counterfactuals from noise inversion of observed data [40 ] . We adapt both to world modeling, using trajectory pairs generated under different actions and shared environmental randomness, or extending diffusion counterfactuals to action-conditioned prediction. The latter fits naturally with model-based reinforcement learning, as it builds upon diffusion world models trained on interaction data [3 , 50 ] without requiring paired counterfactual supervision.
Experiments
Through our experiments, we aim to answer the following key questions:
Details can be found in Appendix § 10 , and supplementary results can be found in Appendix § 11 .
Contextual bandit
We first study the benefits of counterfactuals in a setting where the optimal policy is known.
Setup. We consider a contextual bandit problem, adapted from Mesnard et al. [30 ] . The agent receives a context c ∈ { − 10 , … , 10 } c \in\{-10,\ldots,10\} c ∈ { − 10 , … , 10 } , and based on the context, selects an action a ∈ { − 10 , … , 10 } a \in\{-10,\ldots,10\} a ∈ { − 10 , … , 10 } . Then, based on an environmental noise u ∼ N ( 0 , σ 2 ) u \sim\mathcal{N}(0,\sigma^{2}) u ∼ N ( 0 , σ 2 ) with noise level σ > 0 \sigma> 0 σ > 0 , the agent receives a reward r = σ 2 − ( c − ( a + u ) ) 2 r = \sigma^{2} - (c - (a + u))^{2} r = σ 2 − ( c − ( a + u ) ) 2 . This decision process can be expressed as an SCM of the form (6) :
c ∼ U ( { − 10 , … , 10 } ) , x = ( c , a + u ) = f ( c , a , u ) , a = π θ ( c , ϵ ) . (17) c \sim U(\{-10,\ldots,10\}), \qquad\mathbf{x} = (c,a+u) = f(c,a,u), \qquad a = \pi_{\theta}(c,\epsilon). \tag*{(17)} c ∼ U ({ − 10 , … , 10 }) , x = ( c , a + u ) = f ( c , a , u ) , a = π θ ( c , ϵ ) . (17)
For this problem, the optimal policy is choosing a = c a = c a = c , which yields an average reward of zero. Yet, the reward signal is contaminated by the environmental noise u u u which is uncorrelated to the action. The higher the noise level σ \sigma σ is, the more difficult it becomes to clarify the effect of an action, since high rewards could be due to a fortunate draw u ≈ c − a u \approx c-a u ≈ c − a instead of a proper choice of action.
In this setting, we evaluate REINFORCE, REINFORCE with a learned value baseline, RLOO, and the proposed RLB. We additionally test CCA (Mesnard et al. [30 ] ), a method that learns a hindsight value baseline and is specialized for settings with high environmental uncertainty. For RLOO and RLB, we use groups of m = 4 m = 4 m = 4 trajectories, and test both branching with ground-truth transitions and counterfactuals, and also with a world model p ( x ∣ c , a ) p(x|c,a) p ( x ∣ c , a ) or with a counterfactual world model p ( x ∣ c , a , o ) p(x|c,a,o) p ( x ∣ c , a , o ) conditioned on factual observations o = ( c ^ , a ^ , x ^ ) o = (\hat{c},\hat{a},\hat{x}) o = ( c ^ , a ^ , x ^ ) , trained with maximum likelihoods.
Results. Figure 4 shows the results. As stochasticity in the environment increases, REINFORCE and RLOO degrade rapidly, presumably due to the difficulty of isolating action effects from environmental luck. Although CCA attains better performance, it exhibits substantial variation across runs, which we conjecture is caused by optimization instabilities from having to balance policy learning and auxiliary independence regularizer. In contrast, RLB with ground-truth counterfactuals can separate action effects without using an additional loss, converging faster and in a more stable manner than the baselines as noise increases (Q1). Furthermore, learning a counterfactual world model saves m − 1 = 3 m - 1 = 3 m − 1 = 3 environment interactions out of m = 4 m = 4 m = 4 , attaining the best result. In addition, we find that as environmental noise becomes larger, it becomes easier to learn counterfactual world models than ordinary ones. This is reflected in policy learning, as when compared at matched environment interactions and model imaginations, RLB with counterfactual model matches using true counterfactuals, whereas RLOO with world model lags behind using true simulations (Q2).
Figure 4. Results for the contextual bandit problem across six independent randomized trials. (Left) Policy learning across various levels of environmental noise σ \sigma σ . (Right) Prediction error of ordinary and counterfactual world models over training, where for both, the minimum attainable error is zero.
Multi-agent bandit
In the prior experiment, difficulties in policy and model learning primarily arose from large environmental noise with a relatively simple distribution. We now consider a setting where complexity of the environment exceeds that of learners. We achieve this through a multi-agent setting where each agent faces a strictly bigger environment than itself in terms of computational capacity, because there are multiple other agents of equal capacity [23 ] , as illustrated in Figure 6 .
Figure 6. An agent among others of equal capacity (top). A world model must simulate them (left). A counterfactual world model observes them (right).
Setup. For the environment, we employ K > 1 K > 1 K > 1 copies of the previous contextual bandit [30 ] . Each of the K K K agents interacts with its own version of the environment, but rewards are now tied across agents. The i i i -th agent receives a context c i ∼ U ( { − 10 , … , 10 } ) \mathbf{c}^{i} \sim\mathrm{U}(\{-10,\ldots,10\}) c i ∼ U ({ − 10 , … , 10 }) and selects an action a i ∈ { − 10 , … , 10 } \mathbf{a}^{i} \in\{-10,\ldots,10\} a i ∈ { − 10 , … , 10 } , where c \mathbf{c} c and a \mathbf{a} a now denote the concatenation of all agents’ contexts and actions. Then, every agent receives reward r = − ∑ i ( c i − a i ) 2 r = -\sum_i(c^i-a^i)^2 r = − ∑ i ( c i − a i ) 2 . We write this as an SCM (6):
x i = ∑ j ( c j − a j ) 2 = f i ( c i , a i , u i ) , u i = ( c j , ϵ j ) j ≠ i , a i = π θ i ( c i , ϵ i ) , (18) \mathbf{x}^{i} = \sum_j(\mathbf{c}^{j}-\mathbf{a}^{j})^2 = f^{i}(\mathbf{c}^{i},\mathbf{a}^{i},\mathbf{u}^{i}), \qquad\mathbf{u}^{i} = (\mathbf{c}^{j},\epsilon^{j})_{j\ne i}, \qquad\mathbf{a}^{i} = \pi_{\theta}^{i}(\mathbf{c}^{i},\epsilon^{i}), \tag*{(18)} x i = j ∑ ( c j − a j ) 2 = f i ( c i , a i , u i ) , u i = ( c j , ϵ j ) j = i , a i = π θ i ( c i , ϵ i ) , (18)
where x i \mathbf{x}^{i} x i , f i f^{i} f i , π θ i \pi_{\theta}^{i} π θ i denote the state, transition, and policy for the i i i -th agent, respectively. The optimal policy for every agent is choosing a i = c i a^{i}=c^{i} a i = c i , yielding an average reward of zero for all agents. Yet, the reward signal is corrupted by other agents’ contexts and actions, constituting the environmental noise u i \mathbf{u}^{i} u i . As the number of interacting agents increases, it becomes harder for each agent to understand the effect of its action, because high or low rewards could be due to other agents’ decisions.
We test RLB along with baselines from § 5.1 . For RLOO and RLB with true simulations, there is one shared environmental interaction across the agents, and m − 1 m-1 m − 1 branching simulations for each of the K K K agents, where we use m = 4 m=4 m = 4 . This makes them costly, as each policy gradient estimation costs 1 + K ( m − 1 ) 1+K(m-1) 1 + K ( m − 1 ) environmental interactions. If each agent has its own world model p ( x i ∣ c i , a i ) p(x^{i}|c^{i},a^{i}) p ( x i ∣ c i , a i ) or a counterfactual world model p ( x i ∣ c i , a i , o i ) p(x^{i}|c^{i},a^{i},o^{i}) p ( x i ∣ c i , a i , o i ) with o i = ( c ^ i , a ^ i , x ^ i ) o^{i}=(\hat{c}^{i},\hat{a}^{i},\hat{x}^{i}) o i = ( c ^ i , a ^ i , x ^ i ) , this can be substantially reduced to a single interaction by replacing the rest with imaginations. However, world model of each agent needs to predict the return contribution of all other agents, while the counterfactual one can condition on their observed contributions. We thus expect counterfactual modeling to be easier (Figure 6 ).
Results. Figure 5 shows the results. As complexity of the environment increases, standard policy gradient methods degrade rapidly, and RLB with true counterfactuals overall outperform RLOO with true simulations (Q1). While RLB with true counterfactuals is outperformed by CCA at matched interactions due to its high cost, we find that counterfactual world models can be learned well and easier than ordinary ones even with a large number of other agents, thereby substantially improving data efficiency of RLB and outperforming CCA at matched real interactions (Q2).
Figure 5. Results for the multi-agent bandit problem across six randomized trials. (Left) Policy learning across various numbers K K K of agents in the environment. (Right) Prediction error of ordinary and counterfactual world models over training, where for both, the minimum attainable error is zero.
The dinosaur game
The preceding experiments show the benefits of counterfactual modeling, but the models therein are trained with paired data with coupled environmental noise, which might be unavailable in practice. Therefore, we now test whether a counterfactual world model can be obtained by training a diffusion world model and employing diffusion counterfactual inference, as proposed in § 3.1 .
Setup. We use Chrome Dino (Google [15 ] ), a platform game with a known method to train diffusion world models. At each timestep, the agent receives 128 × 64 128 \times64 128 × 64 image as an observation x i x_i x i and chooses an action a i ∈ { stand , jump , duck } a_i \in\{\text{stand}, \text{jump}, \text{duck}\} a i ∈ { stand , jump , duck } . The goal is to survive by avoiding incoming obstacles including cacti on the ground and birds at varying heights, and the agent gets the reward r i = + 1 r_i = +1 r i = + 1 if it passes an obstacle and − 1 -1 − 1 if it collides. Since the obstacles are generated randomly independent of the action, we can view their generation as the environmental noise u i u_i u i that obscures action effect. We train a diffusion world model based on the protocol of Valevski et al. [50 ] and turn it into a counterfactual world model using diffusion counterfactual inference (Sanchez & Tsaftaris [40 ] ) which was originally tested only on class-conditional image generation. Further details are in Appendix § 10 . We evaluate model imaginations following the criteria proposed in Melistas et al. [29 ] , measuring composition, effectiveness, realism, and minimality (see Appendix § 10 for details). We use m = 4 m = 4 m = 4 for RLB and RLOO training, and evaluate each learned policy by running 100 test episodes and measuring collision rate per obstacle and mean survival time before the first collision.
Results. Figure 7 and Table 1 demonstrate the quality of counterfactual world model imaginations. In addition to CLD, we measure minimality by the pixel ℓ 1 \ell_1 ℓ 1 error between factual and imagined obstacles within the red regions in Figure 7 . We find that the counterfactual predictions preserve environmental randomness given in the factual observation while incorporating the effect of an alternative action, thereby attaining good quantitative metrics of being a proper counterfactual. This supports that diffusion world models trained with observational data can be turned into counterfactual world models (Q3 ). Table 2 shows the results for downstream policy learning. Using either true simulations or model imaginations, RLB overall outperforms other methods, supporting that diffusion counterfactual modeling supports effective policy learning (Q1–Q3 ).
Figure 7. Visualization of an environmental transition under action stand, a counterfactual world model imagination under action jump, and a world model imagination under action jump.
Table 1. Model imaginations assessed following Melistas et al. [29 ] .
Table 2. Results for policy learning across fifteen independent training runs.
Conclusion
We studied counterfactual world models, which predict how observations would change under alternative actions. REINFORCE Look Back (RLB) uses their predicted returns as baselines to separate action effects from environmental luck. It is unbiased under exact counterfactuals, has a bias bounded by the model error otherwise, and can reduce variance when environmental noise dominates. When action effects are more predictable than the environment, counterfactual world models are easier to learn and yield better policies than ordinary ones. Future work includes larger diffusion models and connecting to GRPO-style methods. Our results suggest that agents in big worlds may learn by looking back at what happened, without modeling the full complexity of their environments.
Acknowledgment
This work is supported in part by the National Research Foundation of Korea (RS-2024-00351212) and the Institute of Information & Communications Technology Planning & Evaluation (IITP) (RS-202400509279, RS-2026-25518317, and RS-2019-II190075), funded by the Korean Government (MSIT).
Theoretical results
Assumptions
We first summarize the assumptions of our results. Propositions 1 and 2 assume a model class that contains the true counterfactual distribution, finite in Proposition 2 for simplicity, and do not restrict the form of the noise or the reference policy. Propositions 4 and 5 take the worst case over the distribution of the visible noise, so they concern environments whose noise distribution is not known in advance. Proposition 6 assumes exact inversion and a WM that is exact up to its noise distribution, which Proposition 7 relaxes under (11), as holds for additive noise with Λ = 1 \Lambda= 1 Λ = 1 . Propositions 8 and 9 assume exact counterfactuals and hold for any return and horizon, also with hidden noise. Propositions 10 and 11 instead assume bounded scores, a bound A A A on the difference between the returns of a branch and its factual, and for the rate, coverage of the branches by the training pairs, which is comparably more restrictive (see Appendix § 8 .15).
Remarks on environmental noise
The noise in the SCM (6) is indexed by time and independent across steps and of the action noise, which is a representation that every MDP admits ([8 ] ). A branch reuses the noise of the factual at the same step, even after its state has left that of the factual. This does not alter the MDP, as every branch follows it by itself (Lemma 5) and only its joint distribution with the factual is coupled, as with common random numbers ([14 ] ). Which consistent SCM is used affects the variance of RLB but not its unbiasedness (Corollary 1).
The split into visible and hidden parts loses no generality, as noise can be re-expressed freely ([5 ] ). A function of the noise is visible if and only if it agrees on any two noise values that lead to the same next state for some state and action, so there is a largest visible part, possibly trivial. All noise is visible when the next state records it, as for additive, multiplicative or other bijective mechanisms ([35 ] ) and for exogenous processes in the state, such as arrivals, obstacles, or the actions of other agents. Noise is hidden when the factual transition leaves the outcome of other actions uncertain, as for randomness specific to the action taken, such as a gamble that was not played, or when the environment is only partly observed. We treat partial observability only in this sense, as unobserved variables that persist over time violate the independence of the noise across steps in (6) and may confound actions and outcomes, which we leave for future work.
Proof of Proposition 1
Proposition 1. Assume that, for every step i i i ,
(i) The true and learned counterfactuals admit densities w.r.t. a reference measure at each input, whose log densities at x i + 1 x_{i+1} x i + 1 are integrable under the training distribution, and
(ii) There exists ω ∗ \omega_* ω ∗ s.t. p ω ∗ ( ⋅ ∣ x i , a i , o i ) = p ( ⋅ ∣ x i , a i , o i ) p_{\omega_*}(\cdot\mid x_i, a_i, o_i) = p(\cdot\mid x_i, a_i, o_i) p ω ∗ ( ⋅ ∣ x i , a i , o i ) = p ( ⋅ ∣ x i , a i , o i ) a.s. under the training distribution.
Then ω ∗ \omega_* ω ∗ is a population minimizer of L C W M \mathcal{L}_{\mathrm{CWM}} L CWM , and every population minimizer recovers the true counterfactual distribution a.s. under the training distribution.
Proof. By construction of the training distribution in (8), u i u_i u i is independent of ( x i , x ^ i , a i , a ^ i ) (x_i,\hat{x}_i,a_i,\hat{a}_i) ( x i , x ^ i , a i , a ^ i ) before the two next states are generated. Conditional on the factual state and action, the factual next state depends on u i u_i u i through x ^ i + 1 = f ( x ^ i , a ^ i , u i ) \hat{x}_{i+1}=f(\hat{x}_i,\hat{a}_i,u_i) x ^ i + 1 = f ( x ^ i , a ^ i , u i ) . Consequently, after conditioning on o i = ( x ^ i , a ^ i , x ^ i + 1 ) o_i=(\hat{x}_i,\hat{a}_i,\hat{x}_{i+1}) o i = ( x ^ i , a ^ i , x ^ i + 1 ) , the queried state and action provide no additional information about u i u_i u i , that is, p ( u i ∣ x i , a i , o i ) = p ( u i ∣ o i ) p(u_i\mid x_i,a_i,o_i)=p(u_i\mid o_i) p ( u i ∣ x i , a i , o i ) = p ( u i ∣ o i ) . Since x i + 1 = f ( x i , a i , u i ) x_{i+1}=f(x_i,a_i,u_i) x i + 1 = f ( x i , a i , u i ) , its conditional distribution given ( x i , a i , o i ) (x_i,a_i,o_i) ( x i , a i , o i ) is the distribution obtained by applying f ( x i , a i , ⋅ ) f(x_i,a_i,\cdot) f ( x i , a i , ⋅ ) to u i ∼ p ( ⋅ ∣ o i ) u_i\sim p(\cdot\mid o_i) u i ∼ p ( ⋅ ∣ o i ) , which is the counterfactual distribution p ( ⋅ ∣ x i , a i , o i ) p(\cdot\mid x_i,a_i,o_i) p ( ⋅ ∣ x i , a i , o i ) (7).
Integrability and the existence of ω ∗ \omega_* ω ∗ allow us to subtract the expected loss at ω ∗ \omega_* ω ∗ from that at ω \omega ω , and taking the expectation of x i + 1 x_{i+1} x i + 1 given ( x i , a i , o i ) (x_i,a_i,o_i) ( x i , a i , o i ) first gives
L C W M ( ω ) − L C W M ( ω ∗ ) = ∑ i = 0 n − 1 E [ log p ( x i + 1 ∣ x i , a i , o i ) p ω ( x i + 1 ∣ x i , a i , o i ) ] = ∑ i = 0 n − 1 E [ KL ( p ( ⋅ ∣ x i , a i , o i ) ∥ p ω ( ⋅ ∣ x i , a i , o i ) ) ] . \mathcal{L}_{\mathrm{CWM}}(\omega)-\mathcal{L}_{\mathrm{CWM}}(\omega_*)=\sum_{i=0}^{n-1}\mathbb{E}\left[\log\frac{p(x_{i+1}\mid x_i,a_i,o_i)}{p_\omega(x_{i+1}\mid x_i,a_i,o_i)}\right]=\sum_{i=0}^{n-1}\mathbb{E}\left[\operatorname{KL}\left(p(\cdot\mid x_i,a_i,o_i)\mathbin{\|}p_\omega(\cdot\mid x_i,a_i,o_i)\right)\right]. L CWM ( ω ) − L CWM ( ω ∗ ) = i = 0 ∑ n − 1 E [ log p ω ( x i + 1 ∣ x i , a i , o i ) p ( x i + 1 ∣ x i , a i , o i ) ] = i = 0 ∑ n − 1 E [ KL ( p ( ⋅ ∣ x i , a i , o i ) ∥ p ω ( ⋅ ∣ x i , a i , o i ) ) ] .
Every term on the right-hand side is nonnegative, so ω ∗ \omega_\ast ω ∗ is a population minimizer. For any other population minimizer, the left-hand side is zero. Since the sum has finitely many nonnegative terms, each conditional KL divergence must be zero almost surely under the corresponding training distribution, which gives p ω ( ⋅ ∣ x i , a i , o i ) = p ( ⋅ ∣ x i , a i , o i ) p_\omega(\cdot\mid x_i,a_i,o_i)=p(\cdot\mid x_i,a_i,o_i) p ω ( ⋅ ∣ x i , a i , o i ) = p ( ⋅ ∣ x i , a i , o i ) almost surely, for every i i i .
Proof of Proposition 2
We show a useful lemma.
Lemma 1. A pair of transitions following the MDP in (1) with shared environmental noise (6) has the same joint distribution as a factual transition and its counterfactual transition (7).
Proof. Let the pair of transitions be x ^ i + 1 = f ( x ^ i , a ^ i , u i ) \hat{x}_{i+1}=f(\hat{x}_i,\hat{a}_i,u_i) x ^ i + 1 = f ( x ^ i , a ^ i , u i ) and x i + 1 = f ( x i , a i , u i ) x_{i+1}=f(x_i,a_i,u_i) x i + 1 = f ( x i , a i , u i ) with shared noise u i u_i u i , and write o i = ( x ^ i , a ^ i , x ^ i + 1 ) o_i=(\hat{x}_i,\hat{a}_i,\hat{x}_{i+1}) o i = ( x ^ i , a ^ i , x ^ i + 1 ) . By the definition of the SCM (6), the noise u i u_i u i is independent of the two state-action pairs. Thus, given the state-actions, the joint density of the two next states is
p ( x ^ i + 1 , x i + 1 ∣ x ^ i , a ^ i , x i , a i ) = ∫ p ( u i ) ⋅ 1 ( x ^ i + 1 = f ( x ^ i , a ^ i , u i ) ) ⋅ 1 ( x i + 1 = f ( x i , a i , u i ) ) d u i = ∫ p ( u i ) ⋅ p ( x ^ i + 1 ∣ u i , x ^ i , a ^ i ) ⋅ 1 ( x i + 1 = f ( x i , a i , u i ) ) d u i = p ( x ^ i + 1 ∣ x ^ i , a ^ i ) ∫ p ( u i ∣ o i ) ⋅ 1 ( x i + 1 = f ( x i , a i , u i ) ) d u i = p ( x ^ i + 1 ∣ x ^ i , a ^ i ) ⋅ p ( x i + 1 ∣ x i , a i , o i ) , \begin{aligned}
p(\hat{x}_{i+1},x_{i+1}\mid\hat{x}_i,\hat{a}_i,x_i,a_i)
&=\int p(u_i)\cdot\mathbf{1}(\hat{x}_{i+1}=f(\hat{x}_i,\hat{a}_i,u_i))\cdot\mathbf{1}(x_{i+1}=f(x_i,a_i,u_i))\,\mathrm{d}u_i\\
&=\int p(u_i)\cdot p(\hat{x}_{i+1}\mid u_i,\hat{x}_i,\hat{a}_i)\cdot\mathbf{1}(x_{i+1}=f(x_i,a_i,u_i))\,\mathrm{d}u_i\\
&=p(\hat{x}_{i+1}\mid\hat{x}_i,\hat{a}_i)\int p(u_i\mid o_i)\cdot\mathbf{1}(x_{i+1}=f(x_i,a_i,u_i))\,\mathrm{d}u_i\\
&=p(\hat{x}_{i+1}\mid\hat{x}_i,\hat{a}_i)\cdot p(x_{i+1}\mid x_i,a_i,o_i),
\end{aligned} p ( x ^ i + 1 , x i + 1 ∣ x ^ i , a ^ i , x i , a i ) = ∫ p ( u i ) ⋅ 1 ( x ^ i + 1 = f ( x ^ i , a ^ i , u i )) ⋅ 1 ( x i + 1 = f ( x i , a i , u i )) d u i = ∫ p ( u i ) ⋅ p ( x ^ i + 1 ∣ u i , x ^ i , a ^ i ) ⋅ 1 ( x i + 1 = f ( x i , a i , u i )) d u i = p ( x ^ i + 1 ∣ x ^ i , a ^ i ) ∫ p ( u i ∣ o i ) ⋅ 1 ( x i + 1 = f ( x i , a i , u i )) d u i = p ( x ^ i + 1 ∣ x ^ i , a ^ i ) ⋅ p ( x i + 1 ∣ x i , a i , o i ) ,
where the third equality is Bayes’ rule for p ( u i ∣ o i ) p(u_i\mid o_i) p ( u i ∣ o i ) . The factor p ( x ^ i + 1 ∣ x ^ i , a ^ i ) p(\hat{x}_{i+1}\mid\hat{x}_i,\hat{a}_i) p ( x ^ i + 1 ∣ x ^ i , a ^ i ) is the distribution of a factual transition, and p ( x i + 1 ∣ x i , a i , o i ) p(x_{i+1}\mid x_i,a_i,o_i) p ( x i + 1 ∣ x i , a i , o i ) is the counterfactual transition probability (7).
We now prove Proposition 2 by a classical argument for maximum likelihood over a finite class of models that contains the truth [see 51 also for infinite classes] .
Proposition 2. Let Ω \Omega Ω be a finite set of parameters containing ω ∗ \omega_\ast ω ∗ where p ω ∗ p_{\omega_\ast} p ω ∗ is the true counterfactual, and let D \mathcal{D} D be a set of N N N i.i.d. paired transitions with shared noise. Then every maximum likelihood CWM p ω ^ p_{\hat{\omega}} p ω ^ on D \mathcal{D} D has the following expected error in squared Hellinger distance H 2 H^2 H 2 :
E D E x i , a i , o i [ H 2 ( p ω ^ ( ⋅ ∣ x i , a i , o i ) , p ( ⋅ ∣ x i , a i , o i ) ) ] ≤ 1 + log ∣ Ω ∣ N . (19) \mathbb{E}_{\mathcal{D}}\mathbb{E}_{x_i,a_i,o_i}\left[H^2\bigl(p_{\hat{\omega}}(\cdot\mid x_i,a_i,o_i),p(\cdot\mid x_i,a_i,o_i)\bigr)\right]\leq\frac{1+\log|\Omega|}{N}. \tag*{(19)} E D E x i , a i , o i [ H 2 ( p ω ^ ( ⋅ ∣ x i , a i , o i ) , p ( ⋅ ∣ x i , a i , o i ) ) ] ≤ N 1 + log ∣Ω∣ . (19)
Proof. Denote the squared Hellinger distance between two distributions with densities ν \nu ν and ρ \rho ρ by
H 2 ( ν , ρ ) = 1 − ∫ ν ( x ) ρ ( x ) d x = 1 2 ∫ ( ν ( x ) − ρ ( x ) ) 2 d x ∈ [ 0 , 1 ] . (20) H^2(\nu,\rho)=1-\int\sqrt{\nu(x)\rho(x)}\,\mathrm{d}x=\frac{1}{2}\int\left(\sqrt{\nu(x)}-\sqrt{\rho(x)}\right)^2\,\mathrm{d}x\in[0,1]. \tag*{(20)} H 2 ( ν , ρ ) = 1 − ∫ ν ( x ) ρ ( x ) d x = 2 1 ∫ ( ν ( x ) − ρ ( x ) ) 2 d x ∈ [ 0 , 1 ] . (20)
By Lemma 1, a pair of transitions with shared environmental noise consists of a factual transition o i o_i o i and a counterfactual transition ( x i , a i , x i + 1 ) (x_i,a_i,x_{i+1}) ( x i , a i , x i + 1 ) . For each ω ∈ Ω \omega\in\Omega ω ∈ Ω , let
error ( ω ) : = E x i , a i , o i [ H 2 ( p ω ( ⋅ ∣ x i , a i , o i ) , p ( ⋅ ∣ x i , a i , o i ) ) ] (21) \operatorname{error}(\omega):=\mathbb{E}_{x_i,a_i,o_i}\left[H^2\bigl(p_\omega(\cdot\mid x_i,a_i,o_i),p(\cdot\mid x_i,a_i,o_i)\bigr)\right] \tag*{(21)} error ( ω ) := E x i , a i , o i [ H 2 ( p ω ( ⋅ ∣ x i , a i , o i ) , p ( ⋅ ∣ x i , a i , o i ) ) ] (21)
be its expected error in terms of squared Hellinger distance on average over ( x i , a i , o i ) (x_i,a_i,o_i) ( x i , a i , o i ) , where densities are taken with respect to a common reference measure for the models in { p ω : ω ∈ Ω } \{p_\omega:\omega\in\Omega\} { p ω : ω ∈ Ω } at ( x i , a i , o i ) (x_i,a_i,o_i) ( x i , a i , o i ) , e.g., their sum. We start with the fact that
E x i , a i , o i , x i + 1 [ p ω ( x i + 1 ∣ x i , a i , o i ) p ( x i + 1 ∣ x i , a i , o i ) ] = 1 − error ( ω ) ≤ e − error ( ω ) . (22) \mathbb{E}_{x_i,a_i,o_i,x_{i+1}}\left[\sqrt{\frac{p_\omega(x_{i+1}\mid x_i,a_i,o_i)}{p(x_{i+1}\mid x_i,a_i,o_i)}}\right]=1-\operatorname{error}(\omega)\leq e^{-\operatorname{error}(\omega)}. \tag*{(22)} E x i , a i , o i , x i + 1 [ p ( x i + 1 ∣ x i , a i , o i ) p ω ( x i + 1 ∣ x i , a i , o i ) ] = 1 − error ( ω ) ≤ e − error ( ω ) . (22)
Let us denote the training data by D : = ( x i ( l ) , a i ( l ) , o i ( l ) , x i + 1 ( l ) ) l = 1 N \mathcal{D}:=(x_i^{(l)},a_i^{(l)},o_i^{(l)},x_{i+1}^{(l)})_{l=1}^{N} D := ( x i ( l ) , a i ( l ) , o i ( l ) , x i + 1 ( l ) ) l = 1 N . By independence, they satisfy
E D [ ∏ l = 1 N p ω ( x i + 1 ( l ) ∣ x i ( l ) , a i ( l ) , o i ( l ) ) p ( x i + 1 ( l ) ∣ x i ( l ) , a i ( l ) , o i ( l ) ) ] ≤ e − N error ( ω ) . \mathbb{E}_{\mathcal{D}}\left[\prod_{l=1}^{N}\sqrt{\frac{p_\omega(x_{i+1}^{(l)}\mid x_i^{(l)},a_i^{(l)},o_i^{(l)})}{p(x_{i+1}^{(l)}\mid x_i^{(l)},a_i^{(l)},o_i^{(l)})}}\right]\leq e^{-N\operatorname{error}(\omega)}. E D l = 1 ∏ N p ( x i + 1 ( l ) ∣ x i ( l ) , a i ( l ) , o i ( l ) ) p ω ( x i + 1 ( l ) ∣ x i ( l ) , a i ( l ) , o i ( l ) ) ≤ e − N error ( ω ) .
By Markov’s inequality, the probability that any given model p ω p_\omega p ω assigns equal or higher likelihood on training data than the true counterfactual distribution p p p is at most e − N error ( ω ) e^{-N\operatorname{error}(\omega)} e − N error ( ω ) . This is smaller than e − N t e^{-Nt} e − N t for any t < error ( ω ) t < \operatorname{error}(\omega) t < error ( ω ) . Let us denote the set of parameters with model error larger than t t t by Ω t : = { ω ∈ Ω : error ( ω ) > t } \Omega_t := \{\omega\in\Omega: \operatorname{error}(\omega) > t\} Ω t := { ω ∈ Ω : error ( ω ) > t } . By union bound, the probability that p ω p_\omega p ω for some ω ∈ Ω t \omega\in\Omega_t ω ∈ Ω t attains at least the likelihood of p p p is at most ∣ Ω ∣ e − t N |\Omega|e^{-tN} ∣Ω∣ e − tN . If no model in Ω t \Omega_t Ω t matches or beats p p p , every maximum likelihood model p ω ^ p_{\hat{\omega}} p ω ^ satisfies error ( ω ^ ) ≤ t \operatorname{error}(\hat{\omega}) \le t error ( ω ^ ) ≤ t , because p ∈ { p ω : ω ∈ Ω } p \in\{p_\omega: \omega\in\Omega\} p ∈ { p ω : ω ∈ Ω } . The largest value error max \operatorname{error}_{\max} error m a x of error ( ω ^ ) \operatorname{error}(\hat{\omega}) error ( ω ^ ) among the maximum likelihood models therefore satisfies P ( error max > t ) ≤ min { 1 , ∣ Ω ∣ e − t N } \mathbb{P}(\operatorname{error}_{\max} > t) \le\min\{1,|\Omega|e^{-tN}\} P ( error m a x > t ) ≤ min { 1 , ∣Ω∣ e − tN } for all t ≥ 0 t \ge0 t ≥ 0 . Hence
E D [ error max ] = ∫ 0 ∞ P ( error max > t ) d t ≤ ∫ 0 ∞ min { 1 , ∣ Ω ∣ e − t N } d t = ∫ 0 log ∣ Ω ∣ N 1 d t + ∫ log ∣ Ω ∣ N ∞ ∣ Ω ∣ e − t N d t = 1 + log ∣ Ω ∣ N . (23) \mathbb{E}_{D}[\operatorname{error}_{\max}] = \int_0^\infty\mathbb{P}(\operatorname{error}_{\max} > t)\,\mathrm{d}t \le\int_0^\infty\min\{1,|\Omega|e^{-tN}\}\,\mathrm{d}t
= \int_0^{\frac{\log|\Omega|}{N}} 1\,\mathrm{d}t + \int_{\frac{\log|\Omega|}{N}}^\infty|\Omega|e^{-tN}\,\mathrm{d}t = \frac{1+\log|\Omega|}{N}. \tag*{(23)} E D [ error m a x ] = ∫ 0 ∞ P ( error m a x > t ) d t ≤ ∫ 0 ∞ min { 1 , ∣Ω∣ e − tN } d t = ∫ 0 N l o g ∣Ω∣ 1 d t + ∫ N l o g ∣Ω∣ ∞ ∣Ω∣ e − tN d t = N 1 + log ∣Ω∣ . (23)
which shows (9).
Proof of Proposition 3
Let us write the environmental noise u i = ( v i , h i ) \mathbf{u}_i = (\mathbf{v}_i,\mathbf{h}_i) u i = ( v i , h i ) with a visible part v i \mathbf{v}_i v i and a hidden part h i \mathbf{h}_i h i , where the visible noise is a function of the transition ( x i , a i , f ( x i , a i , u i ) ) (x_i,a_i,f(x_i,a_i,\mathbf{u}_i)) ( x i , a i , f ( x i , a i , u i )) for all x i , a i , u i x_i,a_i,\mathbf{u}_i x i , a i , u i , which can be done without loss of generality (Appendix A.2). We prove that sample complexity of ordinary WMs depends on the distribution of the visible noise, leading to a worst-case lower bound on the H2 ^2 2 error.
Proposition 3. Suppose the decomposition u i = ( v i , h i ) \mathbf{u}_i = (\mathbf{v}_i,\mathbf{h}_i) u i = ( v i , h i ) is the same for every step i i i , and the true distribution ν \nu ν of the visible noise v i \mathbf{v}_i v i is only known to belong to a family P P P . For a set D ′ D' D ′ of 2 N 2^N 2 N i.i.d. transitions, every WM p ω ^ p_{\hat{\omega}} p ω ^ estimated from D ′ D' D ′ has worst-case expected error
sup ν ∈ P E D ′ E x i , a i [ H 2 ( p ω ^ ( ⋅ ∣ x i , a i ) , p ( ⋅ ∣ x i , a i ) ) ] ≥ inf ν ^ sup ν ∈ P E v ( 1 ) , … , v ( M ) ∼ ν [ H 2 ( ν ^ , ν ) ] , (24) \sup_{\nu\in P}\mathbb{E}_{D'}\mathbb{E}_{x_i,a_i}\left[\mathrm{H}^2\left(p_{\hat{\omega}}(\cdot|x_i,a_i),p(\cdot|x_i,a_i)\right)\right] \ge\inf_{\hat{\nu}}\sup_{\nu\in P}\mathbb{E}_{\mathbf{v}^{(1)},\ldots,\mathbf{v}^{(M)}\sim\nu}\left[\mathrm{H}^2(\hat{\nu},\nu)\right], \tag*{(24)} ν ∈ P sup E D ′ E x i , a i [ H 2 ( p ω ^ ( ⋅ ∣ x i , a i ) , p ( ⋅ ∣ x i , a i ) ) ] ≥ ν ^ inf ν ∈ P sup E v ( 1 ) , … , v ( M ) ∼ ν [ H 2 ( ν ^ , ν ) ] , (24) where M : = 2 N ( i + 1 ) + i M := 2N(i+1)+i M := 2 N ( i + 1 ) + i and the infimum is over all estimates ν ^ \hat{\nu} ν ^ of ν \nu ν from M M M i.i.d. visible noise.
Proof. The idea is that a world model contains an estimate of the noise distribution, because the visible noise can be read off its predictions. If the model were more accurate than the right side of (10), this would give an estimate of ν \nu ν that is better than the best possible one.
We write p ν p_\nu p ν for p p p (1) when the visible noise has distribution ν \nu ν at every step. Throughout, f f f and the distribution of the hidden noise given the visible noise are fixed, and only ν \nu ν varies in P P P .
Let us construct an estimate ν ~ \tilde{\nu} ν ~ of ν \nu ν from M M M i.i.d. samples of the visible noise such that
E [ H 2 ( ν ~ , ν ) ] ≤ E D ′ E x i , a i [ H 2 ( p ω ^ ( ⋅ ∣ x i , a i ) , p ν ( ⋅ ∣ x i , a i ) ) ] for every ν ∈ P . (25) \mathbb{E}\left[\mathrm{H}^2(\tilde{\nu},\nu)\right] \le\mathbb{E}_{D'}\mathbb{E}_{x_i,a_i}\left[\mathrm{H}^2\left(p_{\hat{\omega}}(\cdot|x_i,a_i),p_\nu(\cdot|x_i,a_i)\right)\right] \qquad\text{for every } \nu\in P. \tag*{(25)} E [ H 2 ( ν ~ , ν ) ] ≤ E D ′ E x i , a i [ H 2 ( p ω ^ ( ⋅ ∣ x i , a i ) , p ν ( ⋅ ∣ x i , a i ) ) ] for every ν ∈ P . (25)
Taking the supremum over ν ∈ P \nu\in P ν ∈ P on both sides then shows (10), because the infimum on its right side is at most the worst-case expected error of the particular estimate ν ~ \tilde{\nu} ν ~ .
For the construction, we start with the fact that since the visible noise is a function of every transition, there is a map g g g with v i = g ( x i , a i , x i + 1 ) \mathbf{v}_i = g(x_i,a_i,x_{i+1}) v i = g ( x i , a i , x i + 1 ) . For a state-action ( x , a ) (x,a) ( x , a ) , let ν ^ x , a \hat{\nu}_{x,a} ν ^ x , a be the distribution of g ( x , a , y ) g(x,a,y) g ( x , a , y ) for a next state y ∼ p ω ^ ( ⋅ ∣ x , a ) y \sim p_{\hat{\omega}}(\cdot|x,a) y ∼ p ω ^ ( ⋅ ∣ x , a ) predicted by the world model, where g g g is extended arbitrarily to next states that cannot occur. For a next state y ∼ p ν ( ⋅ ∣ x , a ) y \sim p_\nu(\cdot|x,a) y ∼ p ν ( ⋅ ∣ x , a ) of the environment, g ( x , a , y ) g(x,a,y) g ( x , a , y ) is the visible noise and has distribution ν \nu ν . Applying the same map to two distributions does not increase their squared Hellinger distance, as a deterministic map can only merge outcomes, and ∫ p q \int\sqrt{pq} ∫ pq does not decrease when outcomes are merged, by the Cauchy–Schwarz inequality. Hence
H 2 ( p ω ^ ( ⋅ ∣ x , a ) , p ν ( ⋅ ∣ x , a ) ) ≥ H 2 ( ν ^ x , a , ν ) for all ( x , a ) and ν ∈ P . (26) \mathrm{H}^2\left(p_{\hat{\omega}}(\cdot|x,a),p_\nu(\cdot|x,a)\right) \ge\mathrm{H}^2(\hat{\nu}_{x,a},\nu) \qquad\text{for all } (x,a) \text{ and } \nu\in P. \tag*{(26)} H 2 ( p ω ^ ( ⋅ ∣ x , a ) , p ν ( ⋅ ∣ x , a ) ) ≥ H 2 ( ν ^ x , a , ν ) for all ( x , a ) and ν ∈ P . (26)
The estimate ν ^ x , a \hat{\nu}_{x,a} ν ^ x , a is computed from a world model, and hence from a dataset of transitions, whereas the right side of (10) concerns estimates computed from samples of the visible noise. To compare the two, we generate the data from such samples. Given M = 2 N ( i + 1 ) + i M = 2N(i+1)+i M = 2 N ( i + 1 ) + i i.i.d. samples of the visible noise, the below procedure, which does not use D ′ D' D ′ and a state-action ( x ~ i , a ~ i ) (\tilde{x}_i,\tilde{a}_i) ( x ~ i , a ~ i ) with the same joint distribution as D ′ : = ( x i ( l ) , a i ( l ) , x i + 1 ( l ) ) l = 1 2 N D' := (x_i^{(l)},a_i^{(l)},x_{i+1}^{(l)})_{l=1}^{2N} D ′ := ( x i ( l ) , a i ( l ) , x i + 1 ( l ) ) l = 1 2 N and a new state-action ( x i , a i ) (x_i,a_i) ( x i , a i ) :
For each sample, draw a hidden part from the distribution of the hidden noise given the visible noise. This gives M M M values of the environmental noise.
For each of 2 N 2N 2 N trajectories, draw the initial state and the actions as in (6), compute i + 1 i+1 i + 1 transitions with f f f from i + 1 i+1 i + 1 unused values of the noise, and add the last transition to D ~ ′ \widetilde{\mathcal{D}}' D ′ .
For one more trajectory, compute i i i transitions in the same way from the remaining i i i values of the noise, and let ( x ~ i , a ~ i ) (\widetilde{x}_i,\widetilde{a}_i) ( x i , a i ) be its last state-action.
Let ν ~ : = ν ^ x ~ i , a ~ i \widetilde{\nu}:=\widehat{\nu}_{\widetilde{x}_i,\widetilde{a}_i} ν := ν x i , a i be the noise distribution read off at ( x ~ i , a ~ i ) (\widetilde{x}_i,\widetilde{a}_i) ( x i , a i ) from the world model p ω ^ p_{\widehat{\omega}} p ω computed from D ~ ′ \widetilde{\mathcal{D}}' D ′ . It is an estimate of ν \nu ν computed from the M M M samples, and
E [ H 2 ( ν ~ , ν ) ] ≤ E D ~ ′ , x ~ i , a ~ i [ H 2 ( p ω ^ ( ⋅ ∣ x ~ i , a ~ i ) , p ν ( ⋅ ∣ x ~ i , a ~ i ) ) ] = E D ′ , x i , a i [ H 2 ( p ω ^ ( ⋅ ∣ x i , a i ) , p ν ( ⋅ ∣ x i , a i ) ) ] . \begin{aligned}
\mathbb{E}\left[H^2(\widetilde{\nu},\nu)\right] \le\mathbb{E}_{\widetilde{\mathcal{D}}',\widetilde{x}_i,\widetilde{a}_i}\left[H^2\left(p_{\widehat{\omega}}(\cdot\mid\widetilde{x}_i,\widetilde{a}_i),p_\nu(\cdot\mid\widetilde{x}_i,\widetilde{a}_i)\right)\right] \\
&= \mathbb{E}_{\mathcal{D}',x_i,a_i}\left[H^2\left(p_{\widehat{\omega}}(\cdot\mid x_i,a_i),p_\nu(\cdot\mid x_i,a_i)\right)\right].
\end{aligned} E [ H 2 ( ν , ν ) ] ≤ E D ′ , x i , a i [ H 2 ( p ω ( ⋅ ∣ x i , a i ) , p ν ( ⋅ ∣ x i , a i ) ) ] = E D ′ , x i , a i [ H 2 ( p ω ( ⋅ ∣ x i , a i ) , p ν ( ⋅ ∣ x i , a i ) ) ] .
where the inequality is (25), and the equality holds because the generated data have the same distribution as the real data. This shows (24).
Finally, ν ~ \widetilde{\nu} ν depends on the randomness of the procedure in addition to the samples, whereas the infimum in (10) is over estimates computed from the samples alone. This makes no difference, as the average of ν ~ \widetilde{\nu} ν over this randomness is computed from the samples alone, and its error is not larger, because the squared Hellinger distance is convex in the estimate.
Proof of Proposition 4
We show a useful lemma.
Lemma 2. Every estimate of a distribution ν \nu ν on S S S values from M M M independent samples has, for the worst-case distribution, an expected H 2 H^2 H 2 error of at least ( S − 3 ) / ( 10 ( M + S ) ) (S-3)/(10(M+S)) ( S − 3 ) / ( 10 ( M + S )) .
Proof. To construct the worst case, let the distribution ν \nu ν be drawn uniformly from the simplex, and let M j M_j M j be the number of samples equal to the j j j -th value. Given the samples, ν \nu ν has the Dirichlet distribution with parameters β j = 1 + M j \beta_j=1+M_j β j = 1 + M j , which sum to M + S M+S M + S . For any estimate ν ^ \widehat{\nu} ν , the expected H 2 H^2 H 2 error given the samples is
1 − ∑ j = 1 S ν ^ ( j ) E [ ν ( j ) ] ≥ 1 − ( ∑ j = 1 S E [ ν ( j ) ] 2 ) 1 / 2 1-\sum_{j=1}^{S}\sqrt{\widehat{\nu}(j)}\mathbb{E}\left[\sqrt{\nu(j)}\right]\ge1-\left(\sum_{j=1}^{S}\mathbb{E}\left[\sqrt{\nu(j)}\right]^2\right)^{1/2} 1 − j = 1 ∑ S ν ( j ) E [ ν ( j ) ] ≥ 1 − ( j = 1 ∑ S E [ ν ( j ) ] 2 ) 1/2
by the Cauchy–Schwarz inequality, where the expectations are under this Dirichlet distribution. It is the distribution of ( Y 1 , … , Y S ) / Y (Y_1,\ldots,Y_S)/Y ( Y 1 , … , Y S ) / Y for independent Gamma variables Y j Y_j Y j with shapes β j \beta_j β j and their sum Y Y Y , which is a Gamma variable with shape M + S M+S M + S and independent of the ratios, so that E [ ν ( j ) ] = E [ Y j ] / E [ Y ] \mathbb{E}[\sqrt{\nu(j)}]=\mathbb{E}[\sqrt{Y_j}]/\mathbb{E}[\sqrt{Y}] E [ ν ( j ) ] = E [ Y j ] / E [ Y ] . A Gamma variable Y Y Y with shape β \beta β has mean and variance β \beta β and satisfies E [ Y 3 / 2 ] = ( β + 1 2 ) E [ Y ] \mathbb{E}[Y^{3/2}]=(\beta+\frac{1}{2})\mathbb{E}[\sqrt{Y}] E [ Y 3/2 ] = ( β + 2 1 ) E [ Y ] . Thus Cov ( Y , Y ) = 1 2 E [ Y ] \operatorname{Cov}(Y,\sqrt{Y})=\frac{1}{2}\mathbb{E}[\sqrt{Y}] Cov ( Y , Y ) = 2 1 E [ Y ] , and the Cauchy–Schwarz inequality gives 1 4 E [ Y ] 2 ≤ β ( β − E [ Y ] 2 ) \frac{1}{4}\mathbb{E}[\sqrt{Y}]^2\le\beta(\beta-\mathbb{E}[\sqrt{Y}]^2) 4 1 E [ Y ] 2 ≤ β ( β − E [ Y ] 2 ) , i.e., E [ Y ] 2 ≤ β − β / ( 4 β + 1 ) \mathbb{E}[\sqrt{Y}]^2\le\beta-\beta/(4\beta+1) E [ Y ] 2 ≤ β − β / ( 4 β + 1 ) , which is at most β − 1 5 \beta-\frac{1}{5} β − 5 1 if β ≥ 1 \beta\ge1 β ≥ 1 . It also gives β 2 = E [ Y 1 / 4 Y 3 / 4 ] 2 ≤ ( β + 1 2 ) E [ Y ] 2 \beta^2=\mathbb{E}[Y^{1/4}Y^{3/4}]^2\le(\beta+\frac{1}{2})\mathbb{E}[\sqrt{Y}]^2 β 2 = E [ Y 1/4 Y 3/4 ] 2 ≤ ( β + 2 1 ) E [ Y ] 2 . Applying the first bound to each Y j Y_j Y j and the second to their sum,
∑ j = 1 S E [ ν ( j ) ] 2 ≤ ( M + S − S 5 ) M + S + 1 2 ( M + S ) 2 ≤ 1 − 2 S − 5 10 ( M + S ) . \sum_{j=1}^{S}\mathbb{E}\left[\sqrt{\nu(j)}\right]^2\le\left(M+S-\frac{S}{5}\right)\frac{M+S+\frac{1}{2}}{(M+S)^2}\le1-\frac{2S-5}{10(M+S)}. j = 1 ∑ S E [ ν ( j ) ] 2 ≤ ( M + S − 5 S ) ( M + S ) 2 M + S + 2 1 ≤ 1 − 10 ( M + S ) 2 S − 5 .
Since 1 − 1 − S 5 ≥ S / 2 1-\sqrt{1-\frac{S}{5}}\ge S/2 1 − 1 − 5 S ≥ S /2 , the expected error given the samples is at least ( 2 S − 5 ) / ( 20 ( M + S ) ) ≥ ( S − 3 ) / ( 10 ( M + S ) ) (2S-5)/(20(M+S))\ge(S-3)/(10(M+S)) ( 2 S − 5 ) / ( 20 ( M + S )) ≥ ( S − 3 ) / ( 10 ( M + S )) , whatever the samples and the estimate. The worst case over ν \nu ν is at least the average.
We now prove Proposition 4.
Proposition 4. If the visible noise ranges over at least 34 ( i + 1 ) ( 1 + log ∣ Ω ∣ ) 34(i+1)(1+\log|\Omega|) 34 ( i + 1 ) ( 1 + log ∣Ω∣ ) values and its distribution is unrestricted, the upper bound of the CWM error is smaller than the worst-case lower bound of the WM error whenever N ≥ 34 ( 1 + log ∣ Ω ∣ ) N \ge34(1+\log|\Omega|) N ≥ 34 ( 1 + log ∣Ω∣ ) .
Proof. By Lemma 2, for the family of all distributions on the S S S values, the RHS of (10) is at least ( S − 3 ) / ( 10 ( M + S ) ) (S-3)/(10(M+S)) ( S − 3 ) / ( 10 ( M + S )) with M = 2 N ( i + 1 ) + i M=2N(i+1)+i M = 2 N ( i + 1 ) + i . This exceeds ( 1 + log ∣ Ω ∣ ) / N (1+\log|\Omega|)/N ( 1 + log ∣Ω∣ ) / N if and only if N ( S − 3 − 20 ( i + 1 ) ( 1 + log ∣ Ω ∣ ) ) > 10 ( S + i ) ( 1 + log ∣ Ω ∣ ) N(S-3-20(i+1)(1+\log|\Omega|))>10(S+i)(1+\log|\Omega|) N ( S − 3 − 20 ( i + 1 ) ( 1 + log ∣Ω∣ )) > 10 ( S + i ) ( 1 + log ∣Ω∣ ) . If N ≥ 34 ( 1 + log ∣ Ω ∣ ) N \ge34(1+\log|\Omega|) N ≥ 34 ( 1 + log ∣Ω∣ ) and S ≥ 34 ( i + 1 ) ( 1 + log ∣ Ω ∣ ) S \ge34(i+1)(1+\log|\Omega|) S ≥ 34 ( i + 1 ) ( 1 + log ∣Ω∣ ) , the left side is at least 34 ( 1 + log ∣ Ω ∣ ) ( S − 3 − 20 ( i + 1 ) ( 1 + log ∣ Ω ∣ ) ) 34(1+\log|\Omega|)(S-3-20(i+1)(1+\log|\Omega|)) 34 ( 1 + log ∣Ω∣ ) ( S − 3 − 20 ( i + 1 ) ( 1 + log ∣Ω∣ )) , which exceeds the RHS because 24 S ≥ 816 ( i + 1 ) ( 1 + log ∣ Ω ∣ ) > 102 + 10 i + 680 ( i + 1 ) ( 1 + log ∣ Ω ∣ ) 24S \ge816(i+1)(1+\log|\Omega|)>102+10i+680(i+1)(1+\log|\Omega|) 24 S ≥ 816 ( i + 1 ) ( 1 + log ∣Ω∣ ) > 102 + 10 i + 680 ( i + 1 ) ( 1 + log ∣Ω∣ ) .
Proof of Proposition 5
We show two useful lemmas. Since the H2 ^{2} 2 distance compares probabilities of next states, not their physical distances, we measure effects in the state space by the 1-Wasserstein distance W W W .
Lemma 3. In Proposition 2, suppose E x i + 1 ∼ p ω ( ⋅ ∣ x i , a i , o i ) ∥ x i + 1 − x ^ i + 1 ∥ 2 ≤ A 2 \mathbb{E}_{x_{i+1}\sim p_\omega(\cdot\mid x_i,a_i,o_i)}\lVert x_{i+1}-\hat{x}_{i+1}\rVert^{2}\le A^{2} E x i + 1 ∼ p ω ( ⋅ ∣ x i , a i , o i ) ∥ x i + 1 − x ^ i + 1 ∥ 2 ≤ A 2 for all ω ∈ Ω \omega\in\Omega ω ∈ Ω and all pairs of factual and counterfactual transitions. Then, the maximum likelihood CWM has an expected error, in squared 1-Wasserstein distance W 2 W^{2} W 2 , of at most 8 A 2 ( 1 + log ∣ Ω ∣ ) / N 8A^{2}(1+\log|\Omega|)/N 8 A 2 ( 1 + log ∣Ω∣ ) / N .
Proof. We remark that the 1-Wasserstein distance W ( ν , ρ ) W(\nu,\rho) W ( ν , ρ ) is defined by the infimum of E ∥ y − y ′ ∥ \mathbb{E}\lVert y-y'\rVert E ∥ y − y ′ ∥ over all pairs of random variables y ∼ ν y\sim\nu y ∼ ν and y ′ ∼ ρ y'\sim\rho y ′ ∼ ρ .
Fix a pair. We write p ω p_\omega p ω and p p p for the densities of p ω ( ⋅ ∣ x i , a i , o i ) p_\omega(\cdot\mid x_i,a_i,o_i) p ω ( ⋅ ∣ x i , a i , o i ) and of the counterfactual distribution p ( ⋅ ∣ x i , a i , o i ) p(\cdot\mid x_i,a_i,o_i) p ( ⋅ ∣ x i , a i , o i ) at a next state x i + 1 x_{i+1} x i + 1 , with respect to a common reference measure, and W W W and H 2 H^{2} H 2 for the 1-Wasserstein and the squared Hellinger distance between these two distributions. We first prove
W 2 ≤ 8 A 2 H 2 (27) W^{2}\le8A^{2}H^{2} \tag*{(27)} W 2 ≤ 8 A 2 H 2 (27)
for every ω ∈ Ω \omega\in\Omega ω ∈ Ω .
The two distributions share the mass min ( p ω , p ) \min(p_\omega,p) min ( p ω , p ) . We obtain two random next states with these distributions by leaving the shared mass in place and moving the remaining mass ( p ω − p ) + (p_\omega-p)_{+} ( p ω − p ) + of the model to the remaining mass ( p − p ω ) + (p-p_\omega)_{+} ( p − p ω ) + of the counterfactual distribution in any way. By the triangle inequality, a move from x i + 1 x_{i+1} x i + 1 to x i + 1 ′ x'_{i+1} x i + 1 ′ has a length of at most ∥ x i + 1 − x ^ i + 1 ∥ + ∥ x i + 1 ′ − x ^ i + 1 ∥ \lVert x_{i+1}-\hat{x}_{i+1}\rVert+\lVert x'_{i+1}-\hat{x}_{i+1}\rVert ∥ x i + 1 − x ^ i + 1 ∥ + ∥ x i + 1 ′ − x ^ i + 1 ∥ . Hence, the expected distance between the two next states, and thus W W W , satisfies
W ≤ ∫ ∥ x i + 1 − x ^ i + 1 ∥ ( p ω − p ) + d x i + 1 + ∫ ∥ x i + 1 − x ^ i + 1 ∥ ( p − p ω ) + d x i + 1 = ∫ ∥ x i + 1 − x ^ i + 1 ∥ ( p ω + p ) ∣ p ω − p ∣ d x i + 1 , \begin{aligned}
W\le\int\lVert x_{i+1}-\hat{x}_{i+1}\rVert(p_\omega-p)_{+}\,dx_{i+1}+\int\lVert x_{i+1}-\hat{x}_{i+1}\rVert(p-p_\omega)_{+}\,dx_{i+1} \\
&=\int\lVert x_{i+1}-\hat{x}_{i+1}\rVert(\sqrt{p_\omega}+\sqrt{p})\lvert\sqrt{p_\omega}-\sqrt{p}\rvert\,dx_{i+1},
\end{aligned} W ≤ ∫ ∥ x i + 1 − x ^ i + 1 ∥ ( p ω − p ) + d x i + 1 + ∫ ∥ x i + 1 − x ^ i + 1 ∥ ( p − p ω ) + d x i + 1 = ∫ ∥ x i + 1 − x ^ i + 1 ∥ ( p ω + p ) ∣ p ω − p ∣ d x i + 1 ,
where the equality holds as ( p ω − p ) + + ( p − p ω ) + = ∣ p ω − p ∣ (p_\omega-p)_{+}+(p-p_\omega)_{+}=\lvert p_\omega-p\rvert ( p ω − p ) + + ( p − p ω ) + = ∣ p ω − p ∣ . By the Cauchy–Schwarz inequality,
W 2 ≤ ∫ ∥ x i + 1 − x ^ i + 1 ∥ 2 ( p ω + p ) 2 d x i + 1 ∫ ( p ω − p ) 2 d x i + 1 . W^{2}\le\int\lVert x_{i+1}-\hat{x}_{i+1}\rVert^{2}(\sqrt{p_\omega}+\sqrt{p})^{2}\,dx_{i+1}\int(\sqrt{p_\omega}-\sqrt{p})^{2}\,dx_{i+1}. W 2 ≤ ∫ ∥ x i + 1 − x ^ i + 1 ∥ 2 ( p ω + p ) 2 d x i + 1 ∫ ( p ω − p ) 2 d x i + 1 .
The second integral is 2 H 2 2H^{2} 2 H 2 . The first is at most 4 A 2 4A^{2} 4 A 2 , because ( p ω + p ) 2 ≤ 2 ( p ω + p ) (\sqrt{p_\omega}+\sqrt{p})^{2}\le2(p_\omega+p) ( p ω + p ) 2 ≤ 2 ( p ω + p ) and both distributions have a mean squared distance of at most A 2 A^{2} A 2 to x ^ i + 1 \hat{x}_{i+1} x ^ i + 1 . For the counterfactual distribution, this holds because it belongs to the class. This shows (26). For ω = ω ^ \omega=\hat{\omega} ω = ω ^ , taking the expectation over the training pairs and the new pair and applying (9) gives the bound 8 A 2 ( 1 + log ∣ Ω ∣ ) / N 8A^{2}(1+\log|\Omega|)/N 8 A 2 ( 1 + log ∣Ω∣ ) / N .
Lemma 4. In Proposition 3, suppose that the visible noise distribution is unrestricted, and that there are two values of visible noise whose next states, averaged over hidden noise, are at distance at least E E E at every state-action. Then, every WM has a worst-case expected W 2 W^{2} W 2 error of at least E 2 / ( 6 ( 3 ι + 4 ) N ) E^{2}/(6(3\iota+4)N) E 2 / ( 6 ( 3 ι + 4 ) N ) .
Proof. The 1-Wasserstein distance between two distributions is at least the distance between their means, as ∥ E [ y − y ′ ] ∥ ≤ E ∥ y − y ′ ∥ \lVert\mathbb{E}[y-y']\rVert\le\mathbb{E}\lVert y-y'\rVert ∥ E [ y − y ′ ]∥ ≤ E ∥ y − y ′ ∥ for any two random variables y y y and y ′ y' y ′ . It thus suffices to prove the bound for the squared distance between the mean of p ω ^ p_{\hat{\omega}} p ω ^ and that of the transition distribution.
Let v \mathbf{v} v and v ′ \mathbf{v}' v ′ be the two values of the visible noise, and let the visible noise of every transition equal v ′ \mathbf{v}' v ′ with probability λ \lambda λ and v \mathbf{v} v otherwise, where λ ∼ U [ 0 , 1 ] \lambda\sim U[0,1] λ ∼ U [ 0 , 1 ] . We prove that the mean of every estimate p ω ^ p_{\hat{\omega}} p ω ^ then has an expected squared distance of at least E 2 / ( 6 ( 3 i + 4 ) N ) E^2/(6(3i+4)N) E 2 / ( 6 ( 3 i + 4 ) N ) to the mean of the transition distribution, on average over λ \lambda λ . This shows the claim, because the worst case is at least the average.
At a state-action ( x , a ) (x,a) ( x , a ) , let y \mathbf{y} y and y ′ \mathbf{y}' y ′ be the next states for v \mathbf{v} v and v ′ \mathbf{v}' v ′ , averaged over the hidden noise, so that the transition distribution has the mean m ( x , a ) = y + λ ( y ′ − y ) \mathbf{m}(x,a)=\mathbf{y}+\lambda(\mathbf{y}'-\mathbf{y}) m ( x , a ) = y + λ ( y ′ − y ) . Let m ^ ( x , a ) \hat{\mathbf{m}}(x,a) m ^ ( x , a ) be the mean of p ω ^ ( ⋅ ∣ x , a ) p_{\hat{\omega}}(\cdot\mid x,a) p ω ^ ( ⋅ ∣ x , a ) , and let λ ^ : = ( y ′ − y ) ⊤ ( m ^ ( x , a ) − y ) / ∥ y ′ − y ∥ 2 \hat{\lambda}:=(\mathbf{y}'-\mathbf{y})^{\top}(\hat{\mathbf{m}}(x,a)-\mathbf{y})/\|\mathbf{y}'-\mathbf{y}\|^2 λ ^ := ( y ′ − y ) ⊤ ( m ^ ( x , a ) − y ) /∥ y ′ − y ∥ 2 . Then
( λ ^ − λ ) 2 = ( ( y ′ − y ) ⊤ ( m ^ ( x , a ) − m ( x , a ) ) ) 2 ∥ y ′ − y ∥ 4 ≤ ∥ m ^ ( x , a ) − m ( x , a ) ∥ 2 E 2 (28) (\hat{\lambda}-\lambda)^2=\frac{\left((\mathbf{y}'-\mathbf{y})^{\top}(\hat{\mathbf{m}}(x,a)-\mathbf{m}(x,a))\right)^2}{\|\mathbf{y}'-\mathbf{y}\|^4}\leq\frac{\|\hat{\mathbf{m}}(x,a)-\mathbf{m}(x,a)\|^2}{E^2} \tag*{(28)} ( λ ^ − λ ) 2 = ∥ y ′ − y ∥ 4 ( ( y ′ − y ) ⊤ ( m ^ ( x , a ) − m ( x , a )) ) 2 ≤ E 2 ∥ m ^ ( x , a ) − m ( x , a ) ∥ 2 (28)
by the Cauchy–Schwarz inequality and ∥ y ′ − y ∥ ≥ E \|\mathbf{y}'-\mathbf{y}\|\geq E ∥ y ′ − y ∥ ≥ E .
We use the above at the new state-action ( x i , a i ) (x_i,a_i) ( x i , a i ) . As in the proof of Proposition 3 , the 2 N 2N 2 N transitions and ( x i , a i ) (x_i,a_i) ( x i , a i ) are determined by the initial states, the action noise, and the environmental noise of M = 2 N ( i + 1 ) + i M=2N(i+1)+i M = 2 N ( i + 1 ) + i transitions. Among these, only the visible noise has a distribution that depends on λ \lambda λ , as the distribution of the hidden noise given the visible noise is fixed. Thus, λ ^ \hat{\lambda} λ ^ is an estimate of λ \lambda λ from M M M independent samples that equal v ′ \mathbf{v}' v ′ with probability λ \lambda λ . Given that k k k of the samples equal v ′ \mathbf{v}' v ′ , the posterior distribution of λ \lambda λ is Beta ( k + 1 , M − k + 1 ) \operatorname{Beta}(k+1,M-k+1) Beta ( k + 1 , M − k + 1 ) , and its variance ( k + 1 ) ( M − k + 1 ) ( M + 2 ) 2 ( M + 3 ) \frac{(k+1)(M-k+1)}{(M+2)^2(M+3)} ( M + 2 ) 2 ( M + 3 ) ( k + 1 ) ( M − k + 1 ) is the smallest expected squared error with which any estimate can recover λ \lambda λ given the samples. Since k ∼ U { 0 , … , M } k\sim U\{0,\ldots,M\} k ∼ U { 0 , … , M } , the average of ( k + 1 ) ( M − k + 1 ) (k+1)(M-k+1) ( k + 1 ) ( M − k + 1 ) is ( M + 2 ) ( M + 3 ) / 6 (M+2)(M+3)/6 ( M + 2 ) ( M + 3 ) /6 , so the expected squared error of λ ^ \hat{\lambda} λ ^ is at least 1 / ( 6 ( M + 2 ) ) 1/(6(M+2)) 1/ ( 6 ( M + 2 )) . By (27), the expected squared distance of m ^ ( x i , a i ) \hat{\mathbf{m}}(x_i,a_i) m ^ ( x i , a i ) to m ( x i , a i ) \mathbf{m}(x_i,a_i) m ( x i , a i ) is ≥ E 2 / ( 6 ( M + 2 ) ) \geq E^2/(6(M+2)) ≥ E 2 / ( 6 ( M + 2 )) , which is ≥ E 2 / ( 6 ( 3 i + 4 ) N ) \geq E^2/(6(3i+4)N) ≥ E 2 / ( 6 ( 3 i + 4 ) N ) as M + 2 ≤ ( 3 i + 4 ) N M+2\leq(3i+4)N M + 2 ≤ ( 3 i + 4 ) N .
We now prove Proposition 5.
Proposition 5. Suppose that, at a given step i i i ,
(i) It holds that E x i + 1 ∼ p ω ( ⋅ ∣ x i , a i , o i ) ∥ x i + 1 − x ^ i + 1 ∥ 2 ≤ A 2 \mathbb{E}_{x_{i+1}\sim p_{\omega}(\cdot\mid x_i,a_i,o_i)}\|x_{i+1}-\hat{x}_{i+1}\|^2\leq A^2 E x i + 1 ∼ p ω ( ⋅ ∣ x i , a i , o i ) ∥ x i + 1 − x ^ i + 1 ∥ 2 ≤ A 2 for all ω ∈ Ω \omega\in\Omega ω ∈ Ω and all pairs of factual and counterfactual transitions, and
(ii) The distribution of visible noise is unrestricted, and there are two values of visible noise whose next states, averaged over hidden noise, are at distance ≥ E \geq E ≥ E at every state-action.
Then, in squared 1-Wasserstein distance W 2 W^2 W 2 , the upper bound of CWM error is smaller than the worst-case lower bound of WM error whenever E 2 > 48 A 2 ( 3 i + 4 ) ( 1 + log ∣ Ω ∣ ) E^2>48A^2(3i+4)(1+\log|\Omega|) E 2 > 48 A 2 ( 3 i + 4 ) ( 1 + log ∣Ω∣ ) .
Proof. 8 A 2 ( 1 + log ∣ Ω ∣ ) / N < E 2 / ( 6 ( 3 i + 4 ) N ) 8A^2(1+\log|\Omega|)/N<E^2/(6(3i+4)N) 8 A 2 ( 1 + log ∣Ω∣ ) / N < E 2 / ( 6 ( 3 i + 4 ) N ) if and only if E 2 > 48 ( 3 i + 4 ) A 2 ( 1 + log ∣ Ω ∣ ) E^2>48(3i+4)A^2(1+\log|\Omega|) E 2 > 48 ( 3 i + 4 ) A 2 ( 1 + log ∣Ω∣ ) .
Proof of Proposition 6
Proposition 6. Suppose a WM f ω f_{\omega} f ω uses noise u ~ ∼ N ( 0 , I ) \tilde{\mathbf{u}}\sim N(0,I) u ~ ∼ N ( 0 , I ) , and f ω ( x i , a i , ⋅ ) f_{\omega}(x_i,a_i,\cdot) f ω ( x i , a i , ⋅ ) is invertible. If there is a distribution ν ~ \tilde{\nu} ν ~ s.t. setting u ~ ∼ ν ~ \tilde{\mathbf{u}}\sim\tilde{\nu} u ~ ∼ ν ~ removes the WM’s error, then the induced CWM gives exact counterfactuals of an SCM consistent with the MDP, whereas the WM has error H 2 ( N ( 0 , I ) , ν ~ ) H^2(N(0,I),\tilde{\nu}) H 2 ( N ( 0 , I ) , ν ~ ) .
Proof. For an observation o i = ( x ^ i , a ^ i , x ^ i + 1 ) o_i=(\hat{x}_i,\hat{a}_i,\hat{x}_{i+1}) o i = ( x ^ i , a ^ i , x ^ i + 1 ) , inversion returns the latent u ~ \tilde{\mathbf{u}} u ~ with f ω ( x ^ i , a ^ i , u ~ ) = x ^ i + 1 f_{\omega}(\hat{x}_i,\hat{a}_i,\tilde{\mathbf{u}})=\hat{x}_{i+1} f ω ( x ^ i , a ^ i , u ~ ) = x ^ i + 1 , and the diffusion returns f ω ( x i , a i , u ~ ) f_{\omega}(x_i,a_i,\tilde{\mathbf{u}}) f ω ( x i , a i , u ~ ) .
Let τ ^ \hat{\tau} τ ^ be a trajectory of the MDP and let the latent inverted from its k k k -th transition. Given the past ( x ^ 0 , a ^ 0 , … , x ^ k , a ^ k ) (\hat{x}_0,\hat{a}_0,\ldots,\hat{x}_k,\hat{a}_k) ( x ^ 0 , a ^ 0 , … , x ^ k , a ^ k ) and all action noise, x ^ k + 1 \hat{x}_{k+1} x ^ k + 1 has distribution p ( ⋅ ∣ x ^ k , a ^ k ) p(\cdot\mid\hat{x}_k,\hat{a}_k) p ( ⋅ ∣ x ^ k , a ^ k ) , which by assumption is the distribution of f ω ( x ^ k , a ^ k , u ~ ) f_{\omega}(\hat{x}_k,\hat{a}_k,\tilde{\mathbf{u}}) f ω ( x ^ k , a ^ k , u ~ ) for u ~ ∼ ν ~ \tilde{\mathbf{u}}\sim\tilde{\nu} u ~ ∼ ν ~ . As f ω ( x ^ k , a ^ k , ⋅ ) f_{\omega}(\hat{x}_k,\hat{a}_k,\cdot) f ω ( x ^ k , a ^ k , ⋅ ) is invertible, u ~ k \tilde{\mathbf{u}}_k u ~ k has distribution ν ~ \tilde{\nu} ν ~ given this past and the action noise. It is therefore independent of them, and in particular of u ~ 0 , … , u ~ k − 1 \tilde{\mathbf{u}}_0,\ldots,\tilde{\mathbf{u}}_{k-1} u ~ 0 , … , u ~ k − 1 , which are functions of the past. Hence, τ ^ \hat{\tau} τ ^ is generated by the equations x k + 1 = f ω ( x k , a k , u ~ k ) x_{k+1}=f_{\omega}(x_k,a_k,\tilde{\mathbf{u}}_k) x k + 1 = f ω ( x k , a k , u ~ k ) with mutually independent noise u ~ k ∼ ν ~ \tilde{\mathbf{u}}_k\sim\tilde{\nu} u ~ k ∼ ν ~ as in (6), which is thus an SCM consistent with the MDP. Its counterfactual distribution (7) is the point mass at f ω ( x k , a k , u ~ k ) f_{\omega}(x_k,a_k,\tilde{\mathbf{u}}_k) f ω ( x k , a k , u ~ k ) , because u ~ k \tilde{\mathbf{u}}_k u ~ k is determined by o k o_k o k . This is the output of the diffusion CWM.
The diffusion WM predicts f ω ( x i , a i , u ~ ) f_{\omega}(x_i,a_i,\tilde{\mathbf{u}}) f ω ( x i , a i , u ~ ) with u ~ ∼ N ( 0 , I ) \tilde{\mathbf{u}}\sim N(0,I) u ~ ∼ N ( 0 , I ) , whereas the transition distribution is that of f ω ( x i , a i , u ~ ) f_{\omega}(x_i,a_i,\tilde{\mathbf{u}}) f ω ( x i , a i , u ~ ) with u ~ ∼ ν ~ \tilde{\mathbf{u}}\sim\tilde{\nu} u ~ ∼ ν ~ . Applying a map to two distributions does not increase their squared Hellinger distance (Appendix § 8 .§ 5 ). As f ω ( x i , a i , ⋅ ) f_\omega(x_i,a_i,\cdot) f ω ( x i , a i , ⋅ ) is invertible, this holds for the map and for its inverse, so the squared Hellinger distance between the two distributions equals H 2 ( N ( 0 , I ) , ν ~ ) H^2(\mathcal{N}(0,I),\tilde{\nu}) H 2 ( N ( 0 , I ) , ν ~ ) .
Proof of Proposition 7
Proposition 7. Let f f f be an SCM consistent with the MDP such that, for some constant Λ \Lambda Λ ,
∥ f ( x , a , u ) − f ( x , a , u ′ ) ∥ ≤ Λ ∥ f ( x ^ , a ^ , u ) − f ( x ^ , a ^ , u ′ ) ∥ , ∀ ( x , a ) , ( x ^ , a ^ ) , u , u ′ . (29) \lVert f(x,a,u)-f(x,a,u')\rVert\leq\Lambda\lVert f(\hat{x},\hat{a},u)-f(\hat{x},\hat{a},u')\rVert,\qquad\forall(x,a),(\hat{x},\hat{a}),u,u'. \tag*{(29)} ∥ f ( x , a , u ) − f ( x , a , u ′ )∥ ≤ Λ ∥ f ( x ^ , a ^ , u ) − f ( x ^ , a ^ , u ′ )∥ , ∀ ( x , a ) , ( x ^ , a ^ ) , u , u ′ . (29) Suppose that ∥ f ω ( x , a , u ~ ) − f ( x , a , T ( u ~ ) ) ∥ ≤ ε \lVert f_\omega(x,a,\tilde{u})-f(x,a,T(\tilde{u}))\rVert\leq\varepsilon ∥ f ω ( x , a , u ~ ) − f ( x , a , T ( u ~ ))∥ ≤ ε for all ( x , a ) (x,a) ( x , a ) and u ~ \tilde{u} u ~ , for some map T T T that does not depend on ( x , a ) (x,a) ( x , a ) , and that inversion returns a latent u ~ \tilde{u} u ~ that reproduces the factual next state up to ε i n v \varepsilon_{\mathrm{inv}} ε inv , i.e., ∥ f ω ( x ^ i , a ^ i , u ~ ) − x ^ i + 1 ∥ ≤ ε i n v \lVert f_\omega(\hat{x}_i,\hat{a}_i,\tilde{u})-\hat{x}_{i+1}\rVert\leq\varepsilon_{\mathrm{inv}} ∥ f ω ( x ^ i , a ^ i , u ~ ) − x ^ i + 1 ∥ ≤ ε inv . Then the CWM is within ( 1 + Λ ) ε + Λ ε i n v (1+\Lambda)\varepsilon+\Lambda\varepsilon_{\mathrm{inv}} ( 1 + Λ ) ε + Λ ε inv of the true counterfactual of f f f , for every factual transition of f f f and every ( x i , a i ) (x_i,a_i) ( x i , a i ) .
Proof. Let u i u_i u i be the noise of f f f behind the factual transition, so that x ^ i + 1 = f ( x ^ i , a ^ i , u i ) \hat{x}_{i+1}=f(\hat{x}_i,\hat{a}_i,u_i) x ^ i + 1 = f ( x ^ i , a ^ i , u i ) . By (11), two noise values that lead to the same next state at ( x ^ i , a ^ i ) (\hat{x}_i,\hat{a}_i) ( x ^ i , a ^ i ) lead to the same next state at ( x i , a i ) (x_i,a_i) ( x i , a i ) , so the counterfactual of f f f is the point mass at f ( x i , a i , u i ) f(x_i,a_i,u_i) f ( x i , a i , u i ) . Let u ~ \tilde{u} u ~ be the latent returned by inversion, and let w : = T ( u ~ ) w:=T(\tilde{u}) w := T ( u ~ ) . We first show that the noise value w w w nearly reproduces the factual transition:
∥ f ( x ^ i , a ^ i , w ) − f ( x ^ i , a ^ i , u i ) ∥ ≤ ∥ f ( x ^ i , a ^ i , T ( u ~ ) ) − f ω ( x ^ i , a ^ i , u ~ ) ∥ + ∥ f ω ( x ^ i , a ^ i , u ~ ) − x ^ i + 1 ∥ ≤ ε + ε i n v . \begin{aligned}
\lVert f(\hat{x}_i,\hat{a}_i,w)-f(\hat{x}_i,\hat{a}_i,u_i)\rVert
&\leq\lVert f(\hat{x}_i,\hat{a}_i,T(\tilde{u}))-f_\omega(\hat{x}_i,\hat{a}_i,\tilde{u})\rVert\\
&\quad+\lVert f_\omega(\hat{x}_i,\hat{a}_i,\tilde{u})-\hat{x}_{i+1}\rVert\\
&\leq\varepsilon+\varepsilon_{\mathrm{inv}}.
\end{aligned} ∥ f ( x ^ i , a ^ i , w ) − f ( x ^ i , a ^ i , u i )∥ ≤ ∥ f ( x ^ i , a ^ i , T ( u ~ )) − f ω ( x ^ i , a ^ i , u ~ )∥ + ∥ f ω ( x ^ i , a ^ i , u ~ ) − x ^ i + 1 ∥ ≤ ε + ε inv .
By (11), it thus nearly reproduces the counterfactual, ∥ f ( x i , a i , w ) − f ( x i , a i , u i ) ∥ ≤ Λ ( ε + ε i n v ) \lVert f(x_i,a_i,w)-f(x_i,a_i,u_i)\rVert\leq\Lambda(\varepsilon+\varepsilon_{\mathrm{inv}}) ∥ f ( x i , a i , w ) − f ( x i , a i , u i )∥ ≤ Λ ( ε + ε inv ) . Finally, the output of the diffusion CWM satisfies ∥ f ω ( x i , a i , u ~ ) − f ( x i , a i , w ) ∥ ≤ ε \lVert f_\omega(x_i,a_i,\tilde{u})-f(x_i,a_i,w)\rVert\leq\varepsilon ∥ f ω ( x i , a i , u ~ ) − f ( x i , a i , w )∥ ≤ ε , and the triangle inequality gives the claim.
The result requires neither that f ω f_\omega f ω is invertible nor that the inversion is exact. The error ε i n v \varepsilon_{\mathrm{inv}} ε inv is the distance between the factual next state and its reconstruction from the inverted latent under the factual action, which can be measured empirically (see the composition criterion in Table 1 ). Along a rollout, such errors can accumulate as for any learned model, but the bias of RLB depends on them only through the error η \eta η of the expected return of a branch (Proposition 10).
Proof of Proposition 8
We first fix the notation used in the remainder of the appendix. A group consists of the m m m trajectories of (13) at a step i i i , the factual τ ^ ≥ i ( 1 ) = τ ^ ≥ i \hat{\tau}_{\geq i}^{(1)}=\hat{\tau}_{\geq i} τ ^ ≥ i ( 1 ) = τ ^ ≥ i and counterfactual branches τ ≥ i ( 2 ) , … , τ ≥ i ( m ) \tau_{\geq i}^{(2)},\ldots,\tau_{\geq i}^{(m)} τ ≥ i ( 2 ) , … , τ ≥ i ( m ) , which all start from x ^ i \hat{x}_i x ^ i . As in (13), G i ( j ) G_i^{(j)} G i ( j ) is the return-to-go of trajectory j j j and Z i ( j ) Z_i^{(j)} Z i ( j ) is the score of its first action. The estimator of the group and its target are
g ^ i : = 1 m ∑ j = 1 m ( G i ( j ) − b i ( j ) ) Z i ( j ) , g i ( x ) : = E τ ∼ p θ [ G i Z i ∣ x i = x ] , (30) \hat{g}_i:=\frac{1}{m}\sum_{j=1}^{m}(G_i^{(j)}-b_i^{(j)})Z_i^{(j)},\qquad
g_i(x):=\mathbb{E}_{\tau\sim p_\theta}\left[G_iZ_i\mid x_i=x\right], \tag*{(30)} g ^ i := m 1 j = 1 ∑ m ( G i ( j ) − b i ( j ) ) Z i ( j ) , g i ( x ) := E τ ∼ p θ [ G i Z i ∣ x i = x ] , (30)
so that (13) is ∑ i γ i g ^ i \sum_i\gamma^i\hat{g}_i ∑ i γ i g ^ i , and ∇ θ J ( θ ) = ∑ i γ i E [ g i ( x i ) ] \nabla_\theta J(\theta)=\sum_i\gamma^i\mathbb{E}[g_i(x_i)] ∇ θ J ( θ ) = ∑ i γ i E [ g i ( x i )] by (2). Expanding the baselines b i ( j ) b_i^{(j)} b i ( j ) gives
g ^ i = 1 m − 1 ∑ j = 1 m G i ( j ) ( Z i ( j ) − Z ˉ i ) , Z ˉ i : = 1 m ∑ j = 1 m Z i ( j ) , (31) \hat{g}_i=\frac{1}{m-1}\sum_{j=1}^{m}G_i^{(j)}(Z_i^{(j)}-\bar{Z}_i),\qquad
\bar{Z}_i:=\frac{1}{m}\sum_{j=1}^{m}Z_i^{(j)}, \tag*{(31)} g ^ i = m − 1 1 j = 1 ∑ m G i ( j ) ( Z i ( j ) − Z ˉ i ) , Z ˉ i := m 1 j = 1 ∑ m Z i ( j ) , (31)
and since ∑ j ( Z i ( j ) − Z ˉ i ) = 0 \sum_j(Z_i^{(j)}-\bar{Z}_i)=0 ∑ j ( Z i ( j ) − Z ˉ i ) = 0 , the estimator is unchanged when the same quantity is added to all returns of the group.
The score Z i ( j ) Z_i^{(j)} Z i ( j ) depends only on x ^ i \hat{x}_i x ^ i and on the first action of trajectory j j j , which by (6) is drawn from π θ ( ⋅ ∣ x ^ i ) \pi_\theta(\cdot\mid\hat{x}_i) π θ ( ⋅ ∣ x ^ i ) using its own action noise. Hence
E [ Z i ( j ) ∣ x ^ i ] = ∑ a ∈ A ∇ θ π θ ( a ∣ x ^ i ) = 0 , (32) \mathbb{E}\left[Z_i^{(j)}\mid\hat{x}_i\right]=\sum_{a\in\mathcal{A}}\nabla_\theta\pi_\theta(a\mid\hat{x}_i)=0, \tag*{(32)} E [ Z i ( j ) ∣ x ^ i ] = a ∈ A ∑ ∇ θ π θ ( a ∣ x ^ i ) = 0 , (32)
and the same holds given any further variables that are independent of this action noise.
We now prove a useful lemma.
Lemma 5. Assume that all noise variables in (6) are mutually independent. Let τ ^ \hat{\tau} τ ^ be generated by (6) under any policy, with noise u ^ = ( u ^ i , … , u ^ n − 1 ) \hat{\mathbf{u}}=(\hat{u}_i,\ldots,\hat{u}_{n-1}) u ^ = ( u ^ i , … , u ^ n − 1 ) from step i i i on, and let a branch from x ^ i \hat{x}_i x ^ i be drawn from p θ ( ⋅ ∣ x ^ i , τ ^ ) p_\theta(\cdot\mid\hat{x}_i,\hat{\tau}) p θ ( ⋅ ∣ x ^ i , τ ^ ) with the exact counterfactuals (7). Then, jointly with τ ^ \hat{\tau} τ ^ , the branch has the same distribution as the trajectory from x ^ i \hat{x}_i x ^ i that uses the environmental noise u ^ \hat{\mathbf{u}} u ^ of the factual and fresh action noise. In particular, given x ^ i \hat{x}_i x ^ i , the branch is distributed as p θ ( ⋅ ∣ x ^ i ) p_\theta(\cdot\mid\hat{x}_i) p θ ( ⋅ ∣ x ^ i ) .
Proof. By (7), the branch is generated by x k + 1 = f ( x k , a k , u k ′ ) x_{k+1}=f(x_k,a_k,u'_k) x k + 1 = f ( x k , a k , u k ′ ) for k ≥ i k\ge i k ≥ i , where u k ′ u'_k u k ′ is drawn from p ( u k ∣ o k ) p(u_k\mid o_k) p ( u k ∣ o k ) independently over k k k given τ ^ \hat{\tau} τ ^ , and a k a_k a k is drawn with fresh action noise. By the independence of the noise variables and the form of (6), the environmental noise of the factual satisfies p ( u ^ i , … , u ^ n − 1 ∣ τ ^ ) = ∏ k = i n − 1 p ( u ^ k ∣ o k ) p(\hat{u}_i,\ldots,\hat{u}_{n-1}\mid\hat{\tau})=\prod_{k=i}^{n-1}p(\hat{u}_k\mid o_k) p ( u ^ i , … , u ^ n − 1 ∣ τ ^ ) = ∏ k = i n − 1 p ( u ^ k ∣ o k ) . Hence ( u i ′ , … , u n − 1 ′ ) (u'_i,\ldots,u'_{n-1}) ( u i ′ , … , u n − 1 ′ ) and u ^ \hat{\mathbf{u}} u ^ have the same conditional distribution given τ ^ \hat{\tau} τ ^ , and therefore the same joint distribution with τ ^ \hat{\tau} τ ^ , which proves the first claim. The second claim follows because u ^ \hat{\mathbf{u}} u ^ is independent of x ^ i \hat{x}_i x ^ i and has its original distribution.
We now prove Proposition 8.
Proposition 8. Assume that all noise variables in the SCM (6) are mutually independent and have distributions independent of θ \theta θ . Let m ≥ 2 m\ge2 m ≥ 2 and τ ^ ∼ p θ \hat{\tau}\sim p_\theta τ ^ ∼ p θ . At every step i i i , sample the counterfactual trajectories as in (13), using exact counterfactual distributions and fresh independent policy randomness. Under the usual regularity and integrability conditions, RLB is unbiased.
Proof. We show E [ g ^ i ∣ x ^ i ] = g i ( x ^ i ) \mathbb{E}[\hat{g}_i\mid\hat{x}_i]=g_i(\hat{x}_i) E [ g ^ i ∣ x ^ i ] = g i ( x ^ i ) for every step i i i . Expanding the baselines in (28),
g ^ i = 1 m ∑ j = 1 m G i ( j ) z i ( j ) − 1 m ( m − 1 ) ∑ j = 1 m ∑ ℓ ≠ j G i ( ℓ ) z i ( j ) . (33) \hat{g}_i=\frac{1}{m}\sum_{j=1}^{m}G_i^{(j)}z_i^{(j)}-\frac{1}{m(m-1)}\sum_{j=1}^{m}\sum_{\ell\ne j}G_i^{(\ell)}z_i^{(j)}. \tag*{(33)} g ^ i = m 1 j = 1 ∑ m G i ( j ) z i ( j ) − m ( m − 1 ) 1 j = 1 ∑ m ℓ = j ∑ G i ( ℓ ) z i ( j ) . (33)
In the first sum, E [ G i ( 1 ) z i ( 1 ) ∣ x ^ i ] = g i ( x ^ i ) \mathbb{E}[G_i^{(1)}z_i^{(1)}\mid\hat{x}_i]=g_i(\hat{x}_i) E [ G i ( 1 ) z i ( 1 ) ∣ x ^ i ] = g i ( x ^ i ) by definition, and the same holds for j ≥ 2 j\ge2 j ≥ 2 since a branch is distributed as p θ ( ⋅ ∣ x ^ i ) p_\theta(\cdot\mid\hat{x}_i) p θ ( ⋅ ∣ x ^ i ) given x ^ i \hat{x}_i x ^ i by Lemma 5.
Every term of the second sum has zero mean. If j ≥ 2 j\ge2 j ≥ 2 , the first action of branch j j j is drawn with fresh action noise, which is independent of τ ^ \hat{\tau} τ ^ and of the other branches, and these determine G i ( ℓ ) G_i^{(\ell)} G i ( ℓ ) . Hence E [ G i ( ℓ ) z i ( j ) ∣ x ^ i ] = 0 \mathbb{E}[G_i^{(\ell)}z_i^{(j)}\mid\hat{x}_i]=0 E [ G i ( ℓ ) z i ( j ) ∣ x ^ i ] = 0 by (30). If j = 1 j=1 j = 1 and ℓ ≥ 2 \ell\ge2 ℓ ≥ 2 , Lemma 5 lets us replace branch ℓ \ell ℓ by the trajectory that uses the noise u ^ \hat{\mathbf{u}} u ^ of the factual and fresh action noise. Its return is then determined by x ^ i \hat{x}_i x ^ i , u ^ \hat{\mathbf{u}} u ^ , and this fresh noise, all of which are independent of the action noise of a ^ i \hat{a}_i a ^ i . Hence E [ G i ( ℓ ) z i ( 1 ) ∣ x ^ i ] = 0 \mathbb{E}[G_i^{(\ell)}z_i^{(1)}\mid\hat{x}_i]=0 E [ G i ( ℓ ) z i ( 1 ) ∣ x ^ i ] = 0 by (30) again.
Therefore, we conclude that E [ g ^ i ∣ x ^ i ] = g i ( x ^ i ) \mathbb{E}[\hat{g}_i\mid\hat{x}_i]=g_i(\hat{x}_i) E [ g ^ i ∣ x ^ i ] = g i ( x ^ i ) . The same holds given the whole factual past ( x ^ 0 , a ^ 0 , … , x ^ i ) (\hat{x}_0,\hat{a}_0,\ldots,\hat{x}_i) ( x ^ 0 , a ^ 0 , … , x ^ i ) , of which the noise from step i i i on is independent. Summing over the steps of the factual τ ^ ∼ p θ \hat{\tau}\sim p_\theta τ ^ ∼ p θ gives E [ ∑ i γ i g ^ i ] = ∑ i γ i E [ g i ( x ^ i ) ] = ∇ θ J ( θ ) \mathbb{E}[\sum_i\gamma^i\hat{g}_i]=\sum_i\gamma^i\mathbb{E}[g_i(\hat{x}_i)]=\nabla_\theta J(\theta) E [ ∑ i γ i g ^ i ] = ∑ i γ i E [ g i ( x ^ i )] = ∇ θ J ( θ ) .
Proof of Corollary 1
Corollary 1. Under the assumptions of Proposition 8, RLB is unbiased when using the exact counterfactuals of any other SCM of the form (6) that is consistent with the MDP.
Proof. The estimator is a function of the factual τ ^ \hat{\tau} τ ^ and its branches. The distribution of τ ^ \hat{\tau} τ ^ is p θ p_\theta p θ for every SCM consistent with the MDP, and the branches are drawn given τ ^ \hat{\tau} τ ^ from the counterfactual distribution of the SCM in use. Their joint distribution is therefore the same as if τ ^ \hat{\tau} τ ^ had been generated by this SCM, to which Proposition 8 applies. As ∇ θ J ( θ ) \nabla_\theta J(\theta) ∇ θ J ( θ ) depends on the MDP only, the estimators for all consistent SCMs have the same expectation (and can differ only in variance).
Proof of Proposition 9
Throughout this section we consider one group, condition on its branching state x ^ i \hat{x}_i x ^ i without writing it, and use the notation of Appendix A.10. As in Section 3.2, the return-to-go of a trajectory of the group is a function G ( ϵ , u ) G(\epsilon,\mathbf{u}) G ( ϵ , u ) of its action noise ϵ = ( ϵ i , … , ϵ n − 1 ) \epsilon=(\epsilon_i,\ldots,\epsilon_{n-1}) ϵ = ( ϵ i , … , ϵ n − 1 ) and environmental noise u = ( u i , … , u n − 1 ) \mathbf{u}=(u_i,\ldots,u_{n-1}) u = ( u i , … , u n − 1 ) , and we write G i ( j ) G_i^{(j)} G i ( j ) for G i ( j ) G_i^{(j)} G i ( j ) . We assume G G G , z i z_i z i and G z i Gz_i G z i have finite second moments. RLOO gives every trajectory of the group its own environmental noise. We compare it with a group whose m m m trajectories share the environmental noise u \mathbf{u} u of the factual, and write g ^ s h r \hat{\mathbf{g}}_{\mathrm{shr}} g ^ shr for the estimator (28) of such a group. If no noise is hidden, this is RLB, as the factual transition determines its noise, which the branches use at every step. Lemma 8 below accounts for hidden noise. In all cases, the action noises of the m m m trajectories are independent of each other and of the environmental noise. For REINFORCE, we write g ^ b : = 1 m ∑ j ( G ( j ) − b ) z i ( j ) \hat{\mathbf{g}}_{\mathrm{b}} := \frac{1}{m}\sum_j (G^{(j)}-b)\mathbf{z}^{(j)}_i g ^ b := m 1 ∑ j ( G ( j ) − b ) z i ( j ) , with m m m independent trajectories from x ^ i \hat{x}_i x ^ i as for RLOO and a baseline b b b that may depend on x ^ i \hat{x}_i x ^ i but not on the noise of these trajectories.
Recall V ( u ) = E [ G ∣ u ] V(\mathbf{u})=\mathbb{E}[G\mid\mathbf{u}] V ( u ) = E [ G ∣ u ] , which we call the hindsight value, and let
G ~ : = G − V ( u ) , g ( u ) : = E [ G z i ∣ u ] , g : = E [ G z i ] , S : = E [ z i z i T ] , \widetilde{G}:=G-V(\mathbf{u}), \qquad\mathbf{g}(\mathbf{u}):=\mathbb{E}[G\mathbf{z}_i\mid\mathbf{u}], \qquad\mathbf{g}:=\mathbb{E}[G\mathbf{z}_i], \qquad S:=\mathbb{E}[\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}], G := G − V ( u ) , g ( u ) := E [ G z i ∣ u ] , g := E [ G z i ] , S := E [ z i z i T ] ,
so that g ( u ) \mathbf{g}(\mathbf{u}) g ( u ) is the target given the noise and g = E [ g ( u ) ] = g i ( x ^ i ) \mathbf{g}=\mathbb{E}[\mathbf{g}(\mathbf{u})]=\mathbf{g}_i(\hat{x}_i) g = E [ g ( u )] = g i ( x ^ i ) is the target of the group. A subscript u \mathbf{u} u , as in Var u \operatorname{Var}_{\mathbf{u}} Var u and Cov u \operatorname{Cov}_{\mathbf{u}} Cov u , means that the action noise is held fixed. As in Proposition 9, A ⪰ B A\succeq B A ⪰ B means that A − B A-B A − B is positive semidefinite, that is, v T A v ≥ v T B v \mathbf{v}^{\mathsf{T}}A\mathbf{v}\ge\mathbf{v}^{\mathsf{T}}B\mathbf{v} v T A v ≥ v T B v for every vector v \mathbf{v} v .
We now prove some useful lemmas.
Lemma 6. Let ( G j , z j ) (G_j,z_j) ( G j , z j ) for j = 1 , … , m j=1,\ldots,m j = 1 , … , m be independent and identically distributed, with E [ z 1 ] = 0 \mathbb{E}[z_1]=0 E [ z 1 ] = 0 and finite second moments of G 1 G_1 G 1 , z 1 z_1 z 1 and G 1 z 1 G_1z_1 G 1 z 1 , and let
g ^ = 1 m ∑ j ( G j − b j ) z j , b j = 1 m − 1 ∑ ℓ ≠ j G ℓ . \hat{\mathbf{g}}=\frac{1}{m}\sum_j(G_j-b_j)\mathbf{z}_j,\qquad b_j=\frac{1}{m-1}\sum_{\ell\ne j}G_\ell. g ^ = m 1 j ∑ ( G j − b j ) z j , b j = m − 1 1 ℓ = j ∑ G ℓ . Then E [ g ^ ] = d : = E [ G 1 z 1 ] \mathbb{E}[\hat{\mathbf{g}}]=\mathbf{d}:=\mathbb{E}[G_1\mathbf{z}_1] E [ g ^ ] = d := E [ G 1 z 1 ] and
Cov ( g ^ ) = 1 m E [ ( G 1 − E [ G 1 ] ) 2 z 1 z 1 T ] + Var ( G 1 ) m ( m − 1 ) E [ z 1 z 1 T ] − m − 2 m ( m − 1 ) d d T . (34) \operatorname{Cov}(\hat{\mathbf{g}})=\frac{1}{m}\mathbb{E}\left[(G_1-\mathbb{E}[G_1])^2\mathbf{z}_1\mathbf{z}_1^{\mathsf{T}}\right]+\frac{\operatorname{Var}(G_1)}{m(m-1)}\mathbb{E}\left[\mathbf{z}_1\mathbf{z}_1^{\mathsf{T}}\right]-\frac{m-2}{m(m-1)}\mathbf{d}\mathbf{d}^{\mathsf{T}}. \tag*{(34)} Cov ( g ^ ) = m 1 E [ ( G 1 − E [ G 1 ] ) 2 z 1 z 1 T ] + m ( m − 1 ) Var ( G 1 ) E [ z 1 z 1 T ] − m ( m − 1 ) m − 2 d d T . (34)
Proof. By (29), g ^ \hat{\mathbf{g}} g ^ is unchanged when a constant is subtracted from all G j G_j G j , so we may assume E [ G 1 ] = 0 \mathbb{E}[G_1]=0 E [ G 1 ] = 0 . Write g ^ = H − K \hat{\mathbf{g}}=\mathbf{H}-\mathbf{K} g ^ = H − K , H = 1 m ∑ j G j z j \mathbf{H}=\frac{1}{m}\sum_jG_j\mathbf{z}_j H = m 1 ∑ j G j z j , and K = 1 m ( m − 1 ) ∑ j ≠ ℓ G ℓ z j \mathbf{K}=\frac{1}{m(m-1)}\sum_{j\ne\ell}G_\ell\mathbf{z}_j K = m ( m − 1 ) 1 ∑ j = ℓ G ℓ z j . By independence, and since G j G_j G j and z j z_j z j have zero mean, E [ H ] = d \mathbb{E}[\mathbf{H}]=\mathbf{d} E [ H ] = d , E [ K ] = 0 \mathbb{E}[\mathbf{K}]=0 E [ K ] = 0 , and Cov ( H ) = 1 m ( E [ G 1 2 z 1 z 1 T ] − d d T ) \operatorname{Cov}(\mathbf{H})=\frac{1}{m}(\mathbb{E}[G_1^2\mathbf{z}_1\mathbf{z}_1^{\mathsf{T}}]-\mathbf{d}\mathbf{d}^{\mathsf{T}}) Cov ( H ) = m 1 ( E [ G 1 2 z 1 z 1 T ] − d d T ) . In E [ K K T ] \mathbb{E}[\mathbf{K}\mathbf{K}^{\mathsf{T}}] E [ K K T ] , the term with indices ( j , ℓ ) (j,\ell) ( j , ℓ ) and ( j ′ , ℓ ′ ) (j',\ell') ( j ′ , ℓ ′ ) is E [ G ℓ G ℓ ′ z j z j ′ T ] \mathbb{E}[G_\ell G_{\ell'}\mathbf{z}_j\mathbf{z}_{j'}^{\mathsf{T}}] E [ G ℓ G ℓ ′ z j z j ′ T ] . It vanishes unless every index occurs twice, that is, unless ( j ′ , ℓ ′ ) = ( j , ℓ ) (j',\ell')=(j,\ell) ( j ′ , ℓ ′ ) = ( j , ℓ ) , which contributes E [ G 1 2 ] E [ z 1 z 1 T ] \mathbb{E}[G_1^2]\mathbb{E}[\mathbf{z}_1\mathbf{z}_1^{\mathsf{T}}] E [ G 1 2 ] E [ z 1 z 1 T ] , or ( j ′ , ℓ ′ ) = ( ℓ , j ) (j',\ell')=(\ell,j) ( j ′ , ℓ ′ ) = ( ℓ , j ) , which contributes d d T \mathbf{d}\mathbf{d}^{\mathsf{T}} d d T . Hence Cov ( K ) = 1 m ( m − 1 ) ( E [ G 1 2 ] E [ z 1 z 1 T ] + d d T ) \operatorname{Cov}(\mathbf{K})=\frac{1}{m(m-1)}(\mathbb{E}[G_1^2]\mathbb{E}[\mathbf{z}_1\mathbf{z}_1^{\mathsf{T}}]+\mathbf{d}\mathbf{d}^{\mathsf{T}}) Cov ( K ) = m ( m − 1 ) 1 ( E [ G 1 2 ] E [ z 1 z 1 T ] + d d T ) . Likewise, every term of E [ H K T ] \mathbb{E}[\mathbf{H}\mathbf{K}^{\mathsf{T}}] E [ H K T ] contains a factor G ℓ G_\ell G ℓ or z j \mathbf{z}_j z j whose index occurs only once, so Cov ( H , K ) = 0 \operatorname{Cov}(\mathbf{H},\mathbf{K})=0 Cov ( H , K ) = 0 . Adding Cov ( H ) \operatorname{Cov}(\mathbf{H}) Cov ( H ) and Cov ( K ) \operatorname{Cov}(\mathbf{K}) Cov ( K ) gives (32).
Lemma 7. The covariances of RLOO and of a group with shared noise satisfy
Cov ( g ^ R L O O ) − Cov ( g ^ s h r ) = σ l u c k 2 m − 1 E [ z i z i T ] + 2 m E [ Cov u ( V ( u ) , G ~ ) z i z i T ] − ( 1 − m − 2 m ( m − 1 ) ) Cov ( g ( u ) ) . (35) \operatorname{Cov}(\hat{\mathbf{g}}_{\mathrm{RLOO}})-\operatorname{Cov}(\hat{\mathbf{g}}_{\mathrm{shr}})=\frac{\sigma_{\mathrm{luck}}^2}{m-1}\mathbb{E}[\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}]+\frac{2}{m}\mathbb{E}\left[\operatorname{Cov}_{\mathbf{u}}(V(\mathbf{u}),\widetilde{G})\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}\right]-\left(1-\frac{m-2}{m(m-1)}\right)\operatorname{Cov}(\mathbf{g}(\mathbf{u})). \tag*{(35)} Cov ( g ^ RLOO ) − Cov ( g ^ shr ) = m − 1 σ luck 2 E [ z i z i T ] + m 2 E [ Cov u ( V ( u ) , G ) z i z i T ] − ( 1 − m ( m − 1 ) m − 2 ) Cov ( g ( u )) . (35)
Proof. For RLOO, the pairs ( G ( j ) , z i ( j ) ) (G^{(j)},\mathbf{z}^{(j)}_i) ( G ( j ) , z i ( j ) ) are independent and identically distributed, with E [ z i ( j ) ] = 0 \mathbb{E}[\mathbf{z}^{(j)}_i]=0 E [ z i ( j ) ] = 0 by (30), so Lemma 6 applies. We have G − E [ G ] = ( V ( u ) − E [ V ( u ) ] ) + G ~ G-\mathbb{E}[G]=(V(\mathbf{u})-\mathbb{E}[V(\mathbf{u})])+\widetilde{G} G − E [ G ] = ( V ( u ) − E [ V ( u )]) + G , where V ( u ) V(\mathbf{u}) V ( u ) is independent of the score z i \mathbf{z}_i z i , which depends on the action noise only. Hence E [ ( G − E [ G ] ) 2 z i z i T ] = σ l u c k 2 S + 2 E [ Cov u ( V ( u ) , G ~ ) z i z i T ] + E [ G ~ 2 z i z i T ] \mathbb{E}[(G-\mathbb{E}[G])^2\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}]=\sigma_{\mathrm{luck}}^2S+2\mathbb{E}[\operatorname{Cov}_{\mathbf{u}}(V(\mathbf{u}),\widetilde{G})\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}]+\mathbb{E}[\widetilde{G}^2\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}] E [( G − E [ G ] ) 2 z i z i T ] = σ luck 2 S + 2 E [ Cov u ( V ( u ) , G ) z i z i T ] + E [ G 2 z i z i T ] , and Var ( G ) = σ l u c k 2 + E [ G ~ 2 ] \operatorname{Var}(G)=\sigma_{\mathrm{luck}}^2+\mathbb{E}[\widetilde{G}^2] Var ( G ) = σ luck 2 + E [ G 2 ] because E [ G ~ ∣ u ] = 0 \mathbb{E}[\widetilde{G}\mid\mathbf{u}]=0 E [ G ∣ u ] = 0 . As 1 m + 1 m ( m − 1 ) = 1 m − 1 \frac{1}{m}+\frac{1}{m(m-1)}=\frac{1}{m-1} m 1 + m ( m − 1 ) 1 = m − 1 1 , (32) gives
Cov ( g ^ R L O O ) = σ l u c k 2 m − 1 S + 2 m E [ Cov u ( V ( u ) , G ~ ) z i z i T ] + 1 m E [ G ~ 2 z i z i T ] + E [ G ~ 2 ] m ( m − 1 ) S − m − 2 m ( m − 1 ) g g T . \operatorname{Cov}(\hat{\mathbf{g}}_{\mathrm{RLOO}})=\frac{\sigma_{\mathrm{luck}}^2}{m-1}S+\frac{2}{m}\mathbb{E}\left[\operatorname{Cov}_{\mathbf{u}}(V(\mathbf{u}),\widetilde{G})\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}\right]
+\frac{1}{m}\mathbb{E}[\widetilde{G}^2\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}]+\frac{\mathbb{E}[\widetilde{G}^2]}{m(m-1)}S-\frac{m-2}{m(m-1)}\mathbf{g}\mathbf{g}^{\mathsf{T}}. Cov ( g ^ RLOO ) = m − 1 σ luck 2 S + m 2 E [ Cov u ( V ( u ) , G ) z i z i T ] + m 1 E [ G 2 z i z i T ] + m ( m − 1 ) E [ G 2 ] S − m ( m − 1 ) m − 2 g g T .
For shared noise, the pairs are independent and identically distributed given u \mathbf{u} u , with zero-mean scores and G − E [ G ∣ u ] = G ~ G-\mathbb{E}[G\mid\mathbf{u}]=\widetilde{G} G − E [ G ∣ u ] = G . Lemma 6 applied given u \mathbf{u} u yields E [ g ^ s h r ∣ u ] = g ( u ) \mathbb{E}[\widehat{\mathbf{g}}_{\mathrm{shr}}\mid\mathbf{u}]=\mathbf{g}(\mathbf{u}) E [ g shr ∣ u ] = g ( u ) and
Cov ( g ^ s h r ∣ u ) = 1 m E [ G ~ 2 z i z i T ∣ u ] + E [ G ~ 2 ∣ u ] m ( m − 1 ) S − m − 2 m ( m − 1 ) g ( u ) g ( u ) T . \operatorname{Cov}(\widehat{\mathbf{g}}_{\mathrm{shr}}\mid\mathbf{u})=\frac{1}{m}\mathbb{E}\left[\widetilde{G}^{2}\mathbf{z}_{i}\mathbf{z}_{i}^{\mathsf{T}}\mid\mathbf{u}\right]+\frac{\mathbb{E}[\widetilde{G}^{2}\mid\mathbf{u}]}{m(m-1)}S-\frac{m-2}{m(m-1)}\mathbf{g}(\mathbf{u})\mathbf{g}(\mathbf{u})^{\mathsf{T}}. Cov ( g shr ∣ u ) = m 1 E [ G 2 z i z i T ∣ u ] + m ( m − 1 ) E [ G 2 ∣ u ] S − m ( m − 1 ) m − 2 g ( u ) g ( u ) T .
By the law of total covariance, Cov ( g ^ s h r ) = E [ Cov ( g ^ s h r ∣ u ) ] + Cov ( g ( u ) ) \operatorname{Cov}(\widehat{\mathbf{g}}_{\mathrm{shr}})=\mathbb{E}[\operatorname{Cov}(\widehat{\mathbf{g}}_{\mathrm{shr}}\mid\mathbf{u})]+\operatorname{Cov}(\mathbf{g}(\mathbf{u})) Cov ( g shr ) = E [ Cov ( g shr ∣ u )] + Cov ( g ( u )) , and E [ g ( u ) g ( u ) T ] = Cov ( g ( u ) ) + g g T \mathbb{E}[\mathbf{g}(\mathbf{u})\mathbf{g}(\mathbf{u})^{\mathsf{T}}]=\operatorname{Cov}(\mathbf{g}(\mathbf{u}))+\mathbf{g}\mathbf{g}^{\mathsf{T}} E [ g ( u ) g ( u ) T ] = Cov ( g ( u )) + g g T . Hence
Cov ( g ^ s h r ) = 1 m E [ G ~ 2 z i z i T ] + E [ G ~ 2 ] m ( m − 1 ) S − m − 2 m ( m − 1 ) g g T + ( 1 − m − 2 m ( m − 1 ) ) Cov ( g ( u ) ) . \operatorname{Cov}(\widehat{\mathbf{g}}_{\mathrm{shr}})=\frac{1}{m}\mathbb{E}\left[\widetilde{G}^{2}\mathbf{z}_{i}\mathbf{z}_{i}^{\mathsf{T}}\right]+\frac{\mathbb{E}[\widetilde{G}^{2}]}{m(m-1)}S-\frac{m-2}{m(m-1)}\mathbf{g}\mathbf{g}^{\mathsf{T}}+\left(1-\frac{m-2}{m(m-1)}\right)\operatorname{Cov}(\mathbf{g}(\mathbf{u})). Cov ( g shr ) = m 1 E [ G 2 z i z i T ] + m ( m − 1 ) E [ G 2 ] S − m ( m − 1 ) m − 2 g g T + ( 1 − m ( m − 1 ) m − 2 ) Cov ( g ( u )) .
Subtracting the two covariances gives (33).
The three terms of (33) have a clear meaning. The first is the environmental luck that affects RLOO but not RLB, as shared noise cancels the luck. The second is the covariance between luck and the rest of the return, which can be positive or negative. The third is the price of sharing one noise sample in RLB, as g ( u ) \mathbf{g}(\mathbf{u}) g ( u ) varies with that sample, and a group cannot average this variation out.
Lemma 8. Let counterfactuals be exact. Then
Cov ( g ^ R L B ) ⪯ Cov ( g ^ s h r ) + 4 σ i n t e r 2 m E [ z i z i T ] , (36) \operatorname{Cov}(\widehat{\mathbf{g}}_{\mathrm{RLB}})\preceq\operatorname{Cov}(\widehat{\mathbf{g}}_{\mathrm{shr}})+\frac{4\sigma_{\mathrm{inter}}^{2}}{m}\mathbb{E}\left[\mathbf{z}_{i}\mathbf{z}_{i}^{\mathsf{T}}\right], \tag*{(36)} Cov ( g RLB ) ⪯ Cov ( g shr ) + m 4 σ inter 2 E [ z i z i T ] , (36) and Cov ( g ^ R L B ) = Cov ( g ^ s h r ) \operatorname{Cov}(\widehat{\mathbf{g}}_{\mathrm{RLB}})=\operatorname{Cov}(\widehat{\mathbf{g}}_{\mathrm{shr}}) Cov ( g RLB ) = Cov ( g shr ) if no noise is hidden or if σ i n t e r = 0 \sigma_{\mathrm{inter}}=0 σ inter = 0 .
Proof. We first show what RLOO, shared noise and RLB have in common.
Let a : = ( a i ( 1 ) , … , a i ( m ) ) \mathbf{a}:=(a_i^{(1)},\ldots,a_i^{(m)}) a := ( a i ( 1 ) , … , a i ( m ) ) be the first actions of the group, which determine its scores. In all three cases, these are independent draws from π θ ( ⋅ ∣ x ^ i ) \pi_{\theta}(\cdot\mid\hat{\mathbf{x}}_i) π θ ( ⋅ ∣ x ^ i ) , and given a \mathbf{a} a , every return G ( j ) G^{(j)} G ( j ) is distributed as the return of a trajectory from x ^ i \hat{\mathbf{x}}_i x ^ i with first action a i ( j ) a_i^{(j)} a i ( j ) . For a branch of RLB, this holds by Lemma 5: jointly with the factual, it is distributed as the trajectory that uses the noise u ^ \hat{\mathbf{u}} u ^ of the factual and fresh action noise, and u ^ \hat{\mathbf{u}} u ^ is independent of the first actions. By (29) and the law of total covariance, each of the three estimators satisfies
Cov ( g ^ ) = Cov ( E [ g ^ ∣ a ] ) + 1 ( m − 1 ) 2 E [ ∑ j , ℓ Cov ( G ( j ) , G ( ℓ ) ∣ a ) ( z i ( j ) − z ˉ i ) ( z i ( ℓ ) − z ˉ i ) T ] , (37) \operatorname{Cov}(\widehat{\mathbf{g}})=\operatorname{Cov}\left(\mathbb{E}[\widehat{\mathbf{g}}\mid\mathbf{a}]\right)+\frac{1}{(m-1)^2}\mathbb{E}\left[\sum_{j,\ell}\operatorname{Cov}\left(G^{(j)},G^{(\ell)}\mid\mathbf{a}\right)(\mathbf{z}_i^{(j)}-\bar{\mathbf{z}}_i)(\mathbf{z}_i^{(\ell)}-\bar{\mathbf{z}}_i)^{\mathsf{T}}\right], \tag*{(37)} Cov ( g ) = Cov ( E [ g ∣ a ] ) + ( m − 1 ) 2 1 E j , ℓ ∑ Cov ( G ( j ) , G ( ℓ ) ∣ a ) ( z i ( j ) − z ˉ i ) ( z i ( ℓ ) − z ˉ i ) T , (37)
where E [ g ^ ∣ a ] \mathbb{E}[\widehat{\mathbf{g}}\mid\mathbf{a}] E [ g ∣ a ] and the terms with j = ℓ j=\ell j = ℓ are the same for the three. The estimators thus differ only through the covariances of the returns of two different trajectories.
We next compare these covariances for shared noise and for RLB. Let Q ( a , u ) : = E [ G ( ϵ , u ) ∣ a i = a ] Q(\mathbf{a},\mathbf{u}):=\mathbb{E}[G(\boldsymbol{\epsilon},\mathbf{u})\mid a_i=\mathbf{a}] Q ( a , u ) := E [ G ( ϵ , u ) ∣ a i = a ] be the expected return of a trajectory from x ^ i \hat{\mathbf{x}}_i x ^ i with first action a \mathbf{a} a and environmental noise u \mathbf{u} u . For shared noise, the returns are independent given u \mathbf{u} u and a \mathbf{a} a with means Q ( a i ( j ) , u ) Q(a_i^{(j)},\mathbf{u}) Q ( a i ( j ) , u ) , so that Cov ( G ( j ) , G ( ℓ ) ∣ a ) = Cov u ( Q ( a i ( j ) , u ) , Q ( a i ( ℓ ) , u ) ) \operatorname{Cov}(G^{(j)},G^{(\ell)}\mid\mathbf{a})=\operatorname{Cov}_{\mathbf{u}}(Q(a_i^{(j)},\mathbf{u}),Q(a_i^{(\ell)},\mathbf{u})) Cov ( G ( j ) , G ( ℓ ) ∣ a ) = Cov u ( Q ( a i ( j ) , u ) , Q ( a i ( ℓ ) , u )) for j ≠ ℓ j\ne\ell j = ℓ . For RLB, the same holds for the factual and a branch, again by Lemma 5. Two branches j ≠ ℓ j\ne\ell j = ℓ , in contrast, are independent given τ ^ \hat{\tau} τ ^ and a \mathbf{a} a , and each uses a noise with the conditional distribution of u ^ \hat{\mathbf{u}} u ^ given τ ^ \hat{\tau} τ ^ , so that their returns have the conditional means E [ Q ( a i ( j ) , u ^ ) ∣ τ ^ ] \mathbb{E}[Q(a_i^{(j)},\hat{\mathbf{u}})\mid\hat{\tau}] E [ Q ( a i ( j ) , u ^ ) ∣ τ ^ ] and E [ Q ( a i ( ℓ ) , u ^ ) ∣ τ ^ ] \mathbb{E}[Q(a_i^{(\ell)},\hat{\mathbf{u}})\mid\hat{\tau}] E [ Q ( a i ( ℓ ) , u ^ ) ∣ τ ^ ] . Since u \mathbf{u} u is independent of a ^ i \hat{a}_i a ^ i , the law of total covariance shows that it equals Cov u ( Q ( a i ( j ) , u ) , Q ( a i ( ℓ ) , u ) ) − Γ a ^ i ( a i ( j ) , a i ( ℓ ) ) \operatorname{Cov}_{\mathbf{u}}(Q(a_i^{(j)},\mathbf{u}),Q(a_i^{(\ell)},\mathbf{u}))-\Gamma_{\hat{a}_i}(a_i^{(j)},a_i^{(\ell)}) Cov u ( Q ( a i ( j ) , u ) , Q ( a i ( ℓ ) , u )) − Γ a ^ i ( a i ( j ) , a i ( ℓ ) ) , where
Γ a ^ i ( a , a ′ ) : = E [ Cov ( Q ( a , u ^ ) , Q ( a ′ , u ^ ) ∣ τ ^ ) ∣ a ^ i = a ^ ] \Gamma_{\hat{a}_i}(a,a'):=\mathbb{E}\left[\operatorname{Cov}\left(Q(a,\hat{\mathbf{u}}),Q(a',\hat{\mathbf{u}})\mid\hat{\tau}\right)\mid\hat{a}_i=\hat{a}\right] Γ a ^ i ( a , a ′ ) := E [ Cov ( Q ( a , u ^ ) , Q ( a ′ , u ^ ) ∣ τ ^ ) ∣ a ^ i = a ^ ]
is the part of the covariance that the factual does not reveal. Subtracting (35) for shared noise from (35) for RLB gives
Cov ( g ^ R L B ) = Cov ( g ^ s h r ) − 1 ( m − 1 ) 2 E [ ∑ j ≠ ℓ j , ℓ ≥ 2 Γ a ^ i ( a i ( j ) , a i ( ℓ ) ) ( z i ( j ) − z ˉ i ) ( z i ( ℓ ) − z ˉ i ) T ] . (38) \operatorname{Cov}(\widehat{\mathbf{g}}_{\mathrm{RLB}})=\operatorname{Cov}(\widehat{\mathbf{g}}_{\mathrm{shr}})-\frac{1}{(m-1)^2}\mathbb{E}\left[\sum_{\substack{j\ne\ell\\j,\ell\ge2}}\Gamma_{\hat{a}_i}(a_i^{(j)},a_i^{(\ell)})(\mathbf{z}_i^{(j)}-\bar{\mathbf{z}}_i)(\mathbf{z}_i^{(\ell)}-\bar{\mathbf{z}}_i)^{\mathsf{T}}\right]. \tag*{(38)} Cov ( g RLB ) = Cov ( g shr ) − ( m − 1 ) 2 1 E j = ℓ j , ℓ ≥ 2 ∑ Γ a ^ i ( a i ( j ) , a i ( ℓ ) ) ( z i ( j ) − z ˉ i ) ( z i ( ℓ ) − z ˉ i ) T . (38)
We now show the two cases of equality. If no noise is hidden, u ^ \hat{\mathbf{u}} u ^ is determined by τ ^ \hat{\tau} τ ^ , so that Γ = 0 \Gamma=0 Γ = 0 . If σ i n t e r = 0 \sigma_{\mathrm{inter}}=0 σ inter = 0 , then G ( ϵ , u ) = V ( u ) + R ( ϵ ) G(\boldsymbol{\epsilon},\mathbf{u})=V(\mathbf{u})+R(\boldsymbol{\epsilon}) G ( ϵ , u ) = V ( u ) + R ( ϵ ) for a function R R R . Every noise in the support of the posterior given τ ^ \hat{\tau} τ ^ reproduces all transitions of τ ^ \hat{\tau} τ ^ , and hence, with the action noise ϵ ^ \hat{\epsilon} ϵ ^ of the factual, the trajectory τ ^ \hat{\tau} τ ^ itself. Thus V ( u ) = G ( ϵ ^ , u ) − R ( ϵ ^ ) V(\mathbf{u}) = G(\hat{\epsilon}, \mathbf{u}) - R(\hat{\epsilon}) V ( u ) = G ( ϵ ^ , u ) − R ( ϵ ^ ) is the same for all such u \mathbf{u} u , that is, the factual reveals all luck. As Q ( a , u ) = V ( u ) + E [ R ( ϵ ) ∣ a i = a ] Q(a,\mathbf{u}) = V(\mathbf{u}) + \mathbb{E}[R(\epsilon)|a_i = a] Q ( a , u ) = V ( u ) + E [ R ( ϵ ) ∣ a i = a ] , again Γ = 0 \Gamma= 0 Γ = 0 .
Finally, we show (34). Let v \mathbf{v} v be a vector and w j : = v T ( z i ( j ) − z ˉ i ) w_j := \mathbf{v}^{\mathsf{T}}(\mathbf{z}_i^{(j)}-\bar{\mathbf{z}}_i) w j := v T ( z i ( j ) − z ˉ i ) . In general, Γ a ^ \Gamma_{\hat{a}} Γ a ^ is a positive semidefinite kernel, being an average of covariances, so that ∑ j , ℓ ≥ 2 Γ a ^ ( a i ( j ) , a i ( ℓ ) ) w j w ℓ ≥ 0 \sum_{j,\ell\geq2}\Gamma_{\hat{a}}(a_i^{(j)},a_i^{(\ell)})w_jw_\ell\geq0 ∑ j , ℓ ≥ 2 Γ a ^ ( a i ( j ) , a i ( ℓ ) ) w j w ℓ ≥ 0 . The sum over j ≠ ℓ j\ne\ell j = ℓ is therefore at least − ∑ j ≥ 2 Γ a ^ ( a i ( j ) , a i ( j ) ) w j 2 -\sum_{j\geq2}\Gamma_{\hat{a}}(a_i^{(j)},a_i^{(j)})w_j^2 − ∑ j ≥ 2 Γ a ^ ( a i ( j ) , a i ( j ) ) w j 2 . Here Γ a ^ ( a , a ) ≤ 4 σ i n t e r 2 \Gamma_{\hat{a}}(a,a)\leq4\sigma_{\mathrm{inter}}^2 Γ a ^ ( a , a ) ≤ 4 σ inter 2 . To see this, write Q ( a , u ) = V ( u ) + Q ~ ( a , u ) Q(a,\mathbf{u}) = V(\mathbf{u}) + \widetilde{Q}(a,\mathbf{u}) Q ( a , u ) = V ( u ) + Q ( a , u ) with Q ~ ( a , u ) : = E [ G ~ ( ϵ , u ) ∣ a i = a ] \widetilde{Q}(a,\mathbf{u}) := \mathbb{E}[\widetilde{G}(\epsilon,\mathbf{u})|a_i = a] Q ( a , u ) := E [ G ( ϵ , u ) ∣ a i = a ] . As shown above, every noise u \mathbf{u} u in the support of the posterior given τ ^ \hat{\tau} τ ^ reproduces τ ^ \hat{\tau} τ ^ with the action noise ϵ ^ \hat{\epsilon} ϵ ^ of the factual, so V ( u ) + G ~ ( ϵ ^ , u ) V(\mathbf{u}) + \widetilde{G}(\hat{\epsilon},\mathbf{u}) V ( u ) + G ( ϵ ^ , u ) is the return of τ ^ \hat{\tau} τ ^ for all such u \mathbf{u} u . As u ^ \hat{\mathbf{u}} u ^ and ϵ ^ \hat{\epsilon} ϵ ^ remain independent given τ ^ \hat{\tau} τ ^ , the conditional variance of V ( u ^ ) V(\hat{\mathbf{u}}) V ( u ^ ) given τ ^ \hat{\tau} τ ^ is that of G ~ ( ϵ ^ , u ^ ) \widetilde{G}(\hat{\epsilon},\hat{\mathbf{u}}) G ( ϵ ^ , u ^ ) given τ ^ \hat{\tau} τ ^ and ϵ ^ \hat{\epsilon} ϵ ^ , whose mean given ϵ ^ \hat{\epsilon} ϵ ^ is at most Var u ( G ~ ( ϵ ^ , u ) ) ≤ σ i n t e r 2 \operatorname{Var}_{\mathbf{u}}(\widetilde{G}(\hat{\epsilon},\mathbf{u}))\leq\sigma_{\mathrm{inter}}^2 Var u ( G ( ϵ ^ , u )) ≤ σ inter 2 by the law of total variance. Likewise, the mean conditional variance of Q ~ ( a , u ^ ) \widetilde{Q}(a,\hat{\mathbf{u}}) Q ( a , u ^ ) given τ ^ \hat{\tau} τ ^ is at most Var u ( Q ~ ( a , u ) ) ≤ σ i n t e r 2 \operatorname{Var}_{\mathbf{u}}(\widetilde{Q}(a,\mathbf{u}))\leq\sigma_{\mathrm{inter}}^2 Var u ( Q ( a , u )) ≤ σ inter 2 , as Q ~ ( a , u ) \widetilde{Q}(a,\mathbf{u}) Q ( a , u ) averages G ~ ( ϵ , u ) \widetilde{G}(\epsilon,\mathbf{u}) G ( ϵ , u ) over the action noise, and the variance of an average is at most the largest variance. The bound on Γ a ^ ( a , a ) \Gamma_{\hat{a}}(a,a) Γ a ^ ( a , a ) follows by the triangle inequality for the standard deviation, given τ ^ \hat{\tau} τ ^ and then on average over τ ^ \hat{\tau} τ ^ . The scores of the group are independent and identically distributed with zero mean, so E [ w j 2 ] = ( 1 − 1 m ) v T S v \mathbb{E}[w_j^2] = (1-\frac{1}{m})\mathbf{v}^{\mathsf{T}}S\mathbf{v} E [ w j 2 ] = ( 1 − m 1 ) v T S v . By (36), v T Cov ( g ^ R L B ) v \mathbf{v}^{\mathsf{T}}\operatorname{Cov}(\hat{\mathbf{g}}_{\mathrm{RLB}})\mathbf{v} v T Cov ( g ^ RLB ) v thus exceeds v T Cov ( g ^ s h r ) v \mathbf{v}^{\mathsf{T}}\operatorname{Cov}(\hat{\mathbf{g}}_{\mathrm{shr}})\mathbf{v} v T Cov ( g ^ shr ) v by at most 4 σ i n t e r 2 ( m − 1 ) 2 ∑ j ≥ 2 E [ w j 2 ] = 4 σ i n t e r 2 m v T S v \frac{4\sigma_{\mathrm{inter}}^2}{(m-1)^2}\sum_{j\geq2}\mathbb{E}[w_j^2] = \frac{4\sigma_{\mathrm{inter}}^2}{m}\mathbf{v}^{\mathsf{T}}S\mathbf{v} ( m − 1 ) 2 4 σ inter 2 ∑ j ≥ 2 E [ w j 2 ] = m 4 σ inter 2 v T S v , which is (34) as v \mathbf{v} v is arbitrary.
Hidden noise thus reduces only the correlation between two branches, as the factual and each of its branches are always correlated as if they shared the noise (Lemma 5). It costs at most a multiple of the interaction, as noise values that a factual cannot tell apart give it the same return, so their luck can differ only as much as the effect of its actions does.
We now prove Proposition 9.
Proposition 9. Suppose that counterfactuals are exact. Then, for every group and given x ^ i \hat{x}_i x ^ i ,
Cov ( g ^ R L O O ) − Cov ( g ^ R L B ) ⪰ ( σ l u c k − σ i n t e r ) 2 − ( m + 4 ) σ i n t e r 2 m − 1 E [ z i z i T ] , (39) \operatorname{Cov}(\hat{\mathbf{g}}_{\mathrm{RLOO}})-\operatorname{Cov}(\hat{\mathbf{g}}_{\mathrm{RLB}})\succeq\frac{(\sigma_{\mathrm{luck}}-\sigma_{\mathrm{inter}})^2-(m+4)\sigma_{\mathrm{inter}}^2}{m-1}\mathbb{E}[\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}], \tag*{(39)} Cov ( g ^ RLOO ) − Cov ( g ^ RLB ) ⪰ m − 1 ( σ luck − σ inter ) 2 − ( m + 4 ) σ inter 2 E [ z i z i T ] , (39) with equality if σ i n t e r = 0 \sigma_{\mathrm{inter}}=0 σ inter = 0 , where A ⪰ B A\succeq B A ⪰ B means A − B A-B A − B is PSD. Against REINFORCE with m m m independent trajectories and exact value baseline, the bound holds with 2 Var ( G ) − σ l u c k 2 m ( m − 1 ) E [ z i z i T ] \frac{2\operatorname{Var}(G)-\sigma_{\mathrm{luck}}^2}{m(m-1)}\mathbb{E}[\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}] m ( m − 1 ) 2 Var ( G ) − σ luck 2 E [ z i z i T ] subtracted. Hence RLB has the smaller covariance whenever σ l u c k ≥ ( 1 + m + 4 ) σ i n t e r \sigma_{\mathrm{luck}}\geq(1+\sqrt{m+4})\sigma_{\mathrm{inter}} σ luck ≥ ( 1 + m + 4 ) σ inter against RLOO, and whenever 2 Var ( G ) / ( m + 1 ) \sqrt{2\operatorname{Var}(G)/(m+1)} 2 Var ( G ) / ( m + 1 ) is added to the threshold against REINFORCE.
Proof. We first bound the terms of (33). For every action noise, ∣ Cov u ( V ( u ) , G ~ ) ∣ ≤ σ l u c k σ i n t e r \lvert\operatorname{Cov}_{\mathbf{u}}(V(\mathbf{u}),\widetilde{G})\rvert\leq\sigma_{\mathrm{luck}}\sigma_{\mathrm{inter}} ∣ Cov u ( V ( u ) , G )∣ ≤ σ luck σ inter by the Cauchy–Schwarz inequality, so the second term is ⪰ − 2 m σ l u c k σ i n t e r S \succeq-\frac{2}{m}\sigma_{\mathrm{luck}}\sigma_{\mathrm{inter}}S ⪰ − m 2 σ luck σ inter S , as z i z i T ⪰ 0 \mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}\succeq0 z i z i T ⪰ 0 . For the third term, g ( u ) − g = E [ ( G ~ − E [ G ~ ∣ ϵ ] ) z i ∣ u ] \mathbf{g}(\mathbf{u})-\mathbf{g}=\mathbb{E}[(\widetilde{G}-\mathbb{E}[\widetilde{G}|\epsilon])\mathbf{z}_i|\mathbf{u}] g ( u ) − g = E [( G − E [ G ∣ ϵ ]) z i ∣ u ] , so by the Cauchy–Schwarz inequality ( v T ( g ( u ) − g ) ) 2 ≤ E [ ( G ~ − E [ G ~ ∣ ϵ ] ) 2 ∣ u ] v T S v (\mathbf{v}^{\mathsf{T}}(\mathbf{g}(\mathbf{u})-\mathbf{g}))^2\leq\mathbb{E}[(\widetilde{G}-\mathbb{E}[\widetilde{G}|\epsilon])^2|\mathbf{u}]\,\mathbf{v}^{\mathsf{T}}S\mathbf{v} ( v T ( g ( u ) − g ) ) 2 ≤ E [( G − E [ G ∣ ϵ ] ) 2 ∣ u ] v T S v for every vector v \mathbf{v} v , and taking expectations, Cov ( g ( u ) ) ⪯ σ i n t e r 2 S \operatorname{Cov}(\mathbf{g}(\mathbf{u}))\preceq\sigma_{\mathrm{inter}}^2S Cov ( g ( u )) ⪯ σ inter 2 S . Using 1 m ≤ 1 m − 1 \frac{1}{m}\leq\frac{1}{m-1} m 1 ≤ m − 1 1 and 1 − m − 2 m ( m − 1 ) ≤ 1 1-\frac{m-2}{m(m-1)}\leq1 1 − m ( m − 1 ) m − 2 ≤ 1 , and completing the square,
Cov ( g ^ R L O O ) − Cov ( g ^ s h r ) ⪰ ( σ l u c k − σ i n t e r ) 2 − m σ i n t e r 2 m − 1 S . (40) \operatorname{Cov}(\hat{\mathbf{g}}_{\mathrm{RLOO}})-\operatorname{Cov}(\hat{\mathbf{g}}_{\mathrm{shr}})\succeq\frac{(\sigma_{\mathrm{luck}}-\sigma_{\mathrm{inter}})^2-m\sigma_{\mathrm{inter}}^2}{m-1}S. \tag*{(40)} Cov ( g ^ RLOO ) − Cov ( g ^ shr ) ⪰ m − 1 ( σ luck − σ inter ) 2 − m σ inter 2 S . (40)
Subtracting (34), where 4 m ≤ 4 m − 1 \frac{4}{m}\leq\frac{4}{m-1} m 4 ≤ m − 1 4 , turns m m m into m + 4 m+4 m + 4 in the numerator, which is the bound for RLOO. If σ i n t e r = 0 \sigma_{\mathrm{inter}}=0 σ inter = 0 , then G ~ \widetilde{G} G does not depend on u \mathbf{u} u . The second term of (33) is then zero, and so is the third, because g ( u ) = E [ G ~ z i ] \mathbf{g}(\mathbf{u})=\mathbb{E}[\widetilde{G}\mathbf{z}_i] g ( u ) = E [ G z i ] is constant. Since RLB then has the covariance of shared noise by Lemma 8, (33) is Cov ( g ^ R L O O ) − Cov ( g ^ R L B ) = σ l u c k 2 m − 1 S \operatorname{Cov}(\hat{\mathbf{g}}_{\mathrm{RLOO}})-\operatorname{Cov}(\hat{\mathbf{g}}_{\mathrm{RLB}})=\frac{\sigma_{\mathrm{luck}}^2}{m-1}S Cov ( g ^ RLOO ) − Cov ( g ^ RLB ) = m − 1 σ luck 2 S , which is the bound with equality.
We next compare with REINFORCE with the exact value b = E [ G ] b=\mathbb{E}[G] b = E [ G ] . The m m m terms of g ^ b \hat{\mathbf{g}}_b g ^ b are then independent and identically distributed with mean g \mathbf{g} g , so Cov ( g ^ b ) = 1 m ( E [ ( G − E [ G ] ) 2 z i z i T ] − g g T ) \operatorname{Cov}(\hat{\mathbf{g}}_b)=\frac{1}{m}\left(\mathbb{E}[(G-\mathbb{E}[G])^2\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}]-\mathbf{g}\mathbf{g}^{\mathsf{T}}\right) Cov ( g ^ b ) = m 1 ( E [( G − E [ G ] ) 2 z i z i T ] − g g T ) . Comparing with (32) for RLOO gives
Cov ( g ^ R L O O ) − Cov ( g ^ b ) = Var ( G ) S + g g T m ( m − 1 ) (41) \operatorname{Cov}(\hat{\mathbf{g}}_{\mathrm{RLOO}})-\operatorname{Cov}(\hat{\mathbf{g}}_b)=\frac{\operatorname{Var}(G)S+\mathbf{g}\mathbf{g}^{\mathsf{T}}}{m(m-1)} \tag*{(41)} Cov ( g ^ RLOO ) − Cov ( g ^ b ) = m ( m − 1 ) Var ( G ) S + g g T (41)
for b = E [ G ] b=\mathbb{E}[G] b = E [ G ] . which is what RLOO pays for estimating its baseline from the group. We have g = E [ G ~ z i ] \mathbf{g} = \mathbb{E}[\widetilde{G}\mathbf{z}_i] g = E [ G z i ] , because V ( u ) V(\mathbf{u}) V ( u ) is independent of z i \mathbf{z}_i z i , which has zero mean. By the Cauchy–Schwarz inequality, g g ⊤ ⪯ E [ G ~ 2 ] S = ( Var ( G ) − σ l u c k 2 ) S \mathbf{g}\mathbf{g}^{\top} \preceq\mathbb{E}[\widetilde{G}^{2}]S = (\operatorname{Var}(G)-\sigma_{\mathrm{luck}}^{2})S g g ⊤ ⪯ E [ G 2 ] S = ( Var ( G ) − σ luck 2 ) S . The right side of (38) is therefore ⪯ 2 Var ( G ) − σ l u c k 2 m ( m − 1 ) S \preceq\frac{2\operatorname{Var}(G)-\sigma_{\mathrm{luck}}^{2}}{m(m-1)}S ⪯ m ( m − 1 ) 2 Var ( G ) − σ luck 2 S , and subtracting it from the bound for RLOO gives the bound for REINFORCE.
We finally derive the two conditions. The bound for RLOO is positive semidefinite if ( σ l u c k − σ i n t e r ) 2 ≥ ( m + 4 ) σ i n t e r 2 (\sigma_{\mathrm{luck}}-\sigma_{\mathrm{inter}})^{2} \ge(m+4)\sigma_{\mathrm{inter}}^{2} ( σ luck − σ inter ) 2 ≥ ( m + 4 ) σ inter 2 , that is, if σ l u c k ≥ ( 1 + m + 4 ) σ i n t e r \sigma_{\mathrm{luck}} \ge(1+\sqrt{m+4})\sigma_{\mathrm{inter}} σ luck ≥ ( 1 + m + 4 ) σ inter . In the bound for REINFORCE, m − 1 m-1 m − 1 times the coefficient of S S S is ( σ l u c k − σ i n t e r ) 2 − ( m + 4 ) σ i n t e r 2 + 1 m σ l u c k 2 − 2 m Var ( G ) (\sigma_{\mathrm{luck}}-\sigma_{\mathrm{inter}})^{2}-(m+4)\sigma_{\mathrm{inter}}^{2}+\frac{1}{m}\sigma_{\mathrm{luck}}^{2}-\frac{2}{m}\operatorname{Var}(G) ( σ luck − σ inter ) 2 − ( m + 4 ) σ inter 2 + m 1 σ luck 2 − m 2 Var ( G ) . For σ l u c k = ( 1 + m + 4 ) σ i n t e r + t \sigma_{\mathrm{luck}}=(1+\sqrt{m+4})\sigma_{\mathrm{inter}}+t σ luck = ( 1 + m + 4 ) σ inter + t with t ≥ 0 t\ge0 t ≥ 0 , the terms without Var ( G ) \operatorname{Var}(G) Var ( G ) sum to 2 m + 4 σ i n t e r t + t 2 + 1 m σ l u c k 2 ≥ m + 1 m t 2 2\sqrt{m+4}\sigma_{\mathrm{inter}}t+t^{2}+\frac{1}{m}\sigma_{\mathrm{luck}}^{2}\ge\frac{m+1}{m}t^{2} 2 m + 4 σ inter t + t 2 + m 1 σ luck 2 ≥ m m + 1 t 2 , so the coefficient is nonnegative if t ≥ 2 Var ( G ) / ( m + 1 ) t\ge\sqrt{2\operatorname{Var}(G)/(m+1)} t ≥ 2 Var ( G ) / ( m + 1 ) .
The condition against REINFORCE asks for more luck than that against RLOO, as REINFORCE with the exact value does not have to estimate its baseline. By (38), it is never worse than RLOO.
Tightness of the conditions of Proposition 9
We show that the conditions of Proposition 9 cannot be dropped and are tight up to a constant by constructing an example.
Let no noise be hidden, so that RLB has the covariance of shared noise by Lemma 8. If V ( u ) V(\mathbf{u}) V ( u ) is constant, there is no luck to cancel, and (33) reduces to − ( 1 − m − 2 m ( m − 1 ) ) Cov ( g ( u ) ) ⪯ 0 -\left(1-\frac{m-2}{m(m-1)}\right)\operatorname{Cov}(\mathbf{g}(\mathbf{u}))\preceq0 − ( 1 − m ( m − 1 ) m − 2 ) Cov ( g ( u )) ⪯ 0 . Without luck, RLB thus never has a smaller covariance than RLOO, and it has a larger one whenever the target given the noise varies with the noise. The same holds against REINFORCE with the exact value, whose covariance is at most that of RLOO by (38). An example is G = a u G=au G = a u for an action a a a and a noise u u u that are both uniform on { − 1 , 1 } \{-1,1\} { − 1 , 1 } , where the noise decides which action is better. This is the known limitation of common random numbers [14 ] .
Now we add luck to the example, G = λ w + a u G=\lambda w+au G = λ w + a u with a further independent noise w w w that is uniform on { − 1 , 1 } \{-1,1\} { − 1 , 1 } , so that σ l u c k = λ \sigma_{\mathrm{luck}}=\lambda σ luck = λ and σ i n t e r = 1 \sigma_{\mathrm{inter}}=1 σ inter = 1 . The scores of the two actions sum to zero, so z i = a v \mathbf{z}_i=a\mathbf{v} z i = a v for a vector v \mathbf{v} v , and the target given the noise is u v u\mathbf{v} u v , with covariance v v ⊤ = S \mathbf{v}\mathbf{v}^{\top}=S v v ⊤ = S . The second term of (33) vanishes, so (33) is ( λ 2 m − 1 + m − 2 m ( m − 1 ) ) S \left(\frac{\lambda^{2}}{m}-1+\frac{m-2}{m(m-1)}\right)S ( m λ 2 − 1 + m ( m − 1 ) m − 2 ) S . Hence RLB has the smaller covariance if and only if σ l u c k ≥ m − 2 + 2 / m σ i n t e r \sigma_{\mathrm{luck}}\ge\sqrt{m-2+2/m}\,\sigma_{\mathrm{inter}} σ luck ≥ m − 2 + 2/ m σ inter . For REINFORCE with the exact value, Var ( G ) = λ 2 + 1 \operatorname{Var}(G)=\lambda^{2}+1 Var ( G ) = λ 2 + 1 and g = 0 \mathbf{g}=0 g = 0 in this example, so subtracting (38) leaves ( λ 2 m − 1 + m − 3 m ( m − 1 ) ) S \left(\frac{\lambda^{2}}{m}-1+\frac{m-3}{m(m-1)}\right)S ( m λ 2 − 1 + m ( m − 1 ) m − 3 ) S . Hence RLB has the smaller covariance if and only if σ l u c k ≥ m − 1 + 2 / ( m − 1 ) σ i n t e r \sigma_{\mathrm{luck}}\ge\sqrt{m-1+2/(m-1)}\,\sigma_{\mathrm{inter}} σ luck ≥ m − 1 + 2/ ( m − 1 ) σ inter . Both thresholds have to grow as m \sqrt{m} m : the luck that RLOO and REINFORCE carry is averaged over the m m m trajectories of a group, whereas the dependence of the target on the one noise draw that a group of RLB shares is averaged only over groups. For the choice of m m m , this means that the covariance of a group of RLB does not fall below Cov ( g ( u ) ) \operatorname{Cov}(\mathbf{g}(\mathbf{u})) Cov ( g ( u )) however large m m m is (proof of Lemma 7), a floor that only more factual trajectories reduce, so m m m is worth increasing until the other terms are comparable to this floor.
The term added for REINFORCE is needed as well. If σ i n t e r = 0 \sigma_{\mathrm{inter}}=0 σ inter = 0 and g = 0 \mathbf{g}=0 g = 0 , as when the first action does not affect the return, (33) and (38) give Cov ( g ^ b ) − Cov ( g ^ R L B ) = m σ l u c k 2 − Var ( G ) m ( m − 1 ) S \operatorname{Cov}(\widehat{\mathbf{g}}_{\mathrm{b}})-\operatorname{Cov}(\widehat{\mathbf{g}}_{\mathrm{RLB}})=\frac{m\sigma_{\mathrm{luck}}^{2}-\operatorname{Var}(G)}{m(m-1)}S Cov ( g b ) − Cov ( g RLB ) = m ( m − 1 ) m σ luck 2 − Var ( G ) S for the exact value, which is positive semidefinite if and only if σ l u c k ≥ Var ( G ) / m \sigma_{\mathrm{luck}}\ge\sqrt{\operatorname{Var}(G)/m} σ luck ≥ Var ( G ) / m . This is the condition of Proposition 9 up to a factor of at most 2 \sqrt{2} 2 .
Proof of Proposition 10
We keep the setting and notation of Appendix A.12, that is, we consider one group and condition on its branching state x ^ i \hat{x}_i x ^ i without writing it. We first prove a useful lemma.
Lemma 9. Suppose that counterfactuals are exact. Then, for every group and given x ^ i \hat{x}_i x ^ i , RLB is unchanged if the luck that the factual reveals, E [ V ( u ) ∣ T ^ ] \mathbb{E}[V(\mathbf{u})\mid\hat{\mathbf{T}}] E [ V ( u ) ∣ T ^ ] , is subtracted from every return, whereas RLOO, and REINFORCE with m m m independent trajectories and any state-dependent baseline, have
Cov ( g ^ ) ⪰ ( σ l u c k − σ i n t e r ) 2 m E [ z i z i ⊤ ] \operatorname{Cov}(\hat{\mathbf{g}}) \succeq\frac{(\sigma_{\mathrm{luck}}-\sigma_{\mathrm{inter}})^{2}}{m}\mathbb{E}[\mathbf{z}_i\mathbf{z}_i^{\top}] Cov ( g ^ ) ⪰ m ( σ luck − σ inter ) 2 E [ z i z i ⊤ ]
where ( ⋅ ) + (\cdot)_+ ( ⋅ ) + denotes the positive part.
Proof. By (29), the estimator is unchanged when the same quantity is added to all returns of the group. This applies to E [ V ( u ) ∣ τ ^ ] \mathbb{E}[V(\mathbf{u})\mid\hat{\tau}] E [ V ( u ) ∣ τ ^ ] , which is a function of the factual. By Lemma 5, it is the mean hindsight value, given the factual, of the noise that the factual and each of its branches use. If no noise is hidden, it is the hindsight value V ( u ) V(\mathbf{u}) V ( u ) of the noise that the group shares, and RLB is (29) with G ~ ( j ) \widetilde{G}^{(j)} G ( j ) in place of G ( j ) G^{(j)} G ( j ) .
For RLOO and REINFORCE, every trajectory has its own noise, so its hindsight value is not common to the group and does not cancel. Indeed, the m m m terms of g ^ b \hat{\mathbf{g}}_b g ^ b are independent and identically distributed, so Cov ( g ^ b ) = 1 m Cov ( ( G − b ) z i ) \operatorname{Cov}(\hat{\mathbf{g}}_b)=\frac{1}{m}\operatorname{Cov}((G-b)\mathbf{z}_i) Cov ( g ^ b ) = m 1 Cov (( G − b ) z i ) . Given the action noise of a trajectory, its score z i \mathbf{z}_i z i and the baseline b b b are fixed, so the conditional covariance of ( G − b ) z i (G-b)\mathbf{z}_i ( G − b ) z i is Var u ( G ) z i z i T \operatorname{Var}_{\mathbf{u}}(G)\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}} Var u ( G ) z i z i T . As G = V ( u ) + G ~ G=V(\mathbf{u})+\widetilde{G} G = V ( u ) + G , the standard deviation of G G G over u \mathbf{u} u is at least σ l u c k − σ i n t e r \sigma_{\mathrm{luck}}-\sigma_{\mathrm{inter}} σ luck − σ inter by the triangle inequality. A covariance is at least the expected conditional covariance, so Cov ( g ^ b ) ⪰ ( σ l u c k − σ i n t e r ) 2 m S \operatorname{Cov}(\hat{\mathbf{g}}_b)\succeq\frac{(\sigma_{\mathrm{luck}}-\sigma_{\mathrm{inter}})^2}{m}S Cov ( g ^ b ) ⪰ m ( σ luck − σ inter ) 2 S for every such baseline, and the same holds for RLOO by (38).
We now turn to learned models. The branches of RLB are drawn independently given τ ^ \hat{\tau} τ ^ from the distribution p θ , ω ( ⋅ ∣ x ^ i , τ ^ ) p_{\theta,\omega}(\cdot\mid\hat{x}_i,\hat{\tau}) p θ , ω ( ⋅ ∣ x ^ i , τ ^ ) obtained by replacing the exact counterfactual transitions in p θ ( ⋅ ∣ x ^ i , τ ^ ) p_\theta(\cdot\mid\hat{x}_i,\hat{\tau}) p θ ( ⋅ ∣ x ^ i , τ ^ ) with p ω ( x k + 1 ∣ x k , a k , o k ) p_\omega(x_{k+1}\mid x_k,a_k,o_k) p ω ( x k + 1 ∣ x k , a k , o k ) . We write E ω \mathbb{E}_\omega E ω and Cov ω \operatorname{Cov}_\omega Cov ω when branches are generated by p ω p_\omega p ω , and E \mathbb{E} E when they are exact counterfactuals, and let trajectory 2 be a branch. The error of the model is
η : = E [ ∣ E ω [ G ( 2 ) ∣ τ ^ , a i ( 2 ) ] − E [ G ( 2 ) ∣ τ ^ , a i ( 2 ) ] ∣ ] . (42) \eta:=\mathbb{E}\left[\left|\mathbb{E}_\omega[G^{(2)}\mid\hat{\tau},a_i^{(2)}]-\mathbb{E}[G^{(2)}\mid\hat{\tau},a_i^{(2)}]\right|\right]. \tag*{(42)} η := E [ E ω [ G ( 2 ) ∣ τ ^ , a i ( 2 ) ] − E [ G ( 2 ) ∣ τ ^ , a i ( 2 ) ] ] . (42)
the mean absolute error of its expected return of a branch, given the factual and the first action of the branch. We assume ∥ z i ∥ ≤ z max \lVert\mathbf{z}_i\rVert\le z_{\max} ∥ z i ∥ ≤ z m a x for all trajectories, and take the bias and the mean squared error with respect to the target g \mathbf{g} g of the group.
RLOO with a WM takes the real trajectory τ ^ \hat{\tau} τ ^ as its root and generates the m − 1 m-1 m − 1 branches from x ^ i \hat{x}_i x ^ i with the model and fresh actions, independently of the root (Xiao et al., [55 ] ). REINFORCE uses the real trajectory alone, or m m m independent ones as in Proposition 9, with a baseline that depends on the state only, such as a learned value function. The proposition assumes ∣ G ( j ) − G ( 1 ) ∣ ≤ A \lvert G^{(j)}-G^{(1)}\rvert\le A ∣ G ( j ) − G ( 1 ) ∣ ≤ A for every generated branch j ≥ 2 j\ge2 j ≥ 2 . We treat all models as fixed, that is, learned from data that are independent of the trajectories of the group.
We now prove Proposition 10.
Proposition 10. Let the branches of RLB be generated by a CWM, let η \eta η be the mean absolute error of the model’s expected return of a branch, and let scores be bounded by z max z_{\max} z m a x . Then, for every group and x ^ i \hat{x}_i x ^ i , the bias of RLB is at most z max η z_{\max}\eta z m a x η in norm. If returns of a branch and its factual differ by at most A A A , then
Cov ( g ^ ) − Cov ( g ^ R L B ) ⪰ ( ( σ l u c k − σ i n t e r ) 2 m ( m − 1 ) − A 2 ) E [ z i z i T ] (43) \operatorname{Cov}(\hat{\mathbf{g}})-\operatorname{Cov}(\hat{\mathbf{g}}_{\mathrm{RLB}})\succeq\left(\frac{(\sigma_{\mathrm{luck}}-\sigma_{\mathrm{inter}})^2}{m(m-1)}-A^2\right)\mathbb{E}[\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}] \tag*{(43)} Cov ( g ^ ) − Cov ( g ^ RLB ) ⪰ ( m ( m − 1 ) ( σ luck − σ inter ) 2 − A 2 ) E [ z i z i T ] (43) for g ^ \hat{\mathbf{g}} g ^ either RLOO with any WM or REINFORCE with any state-dependent baseline, where ( ⋅ ) + (\cdot)_+ ( ⋅ ) + is the positive part. Hence RLB has the smaller covariance whenever σ l u c k ≥ σ i n t e r + m A \sigma_{\mathrm{luck}}\ge\sigma_{\mathrm{inter}}+mA σ luck ≥ σ inter + m A , and the smaller mean squared error if also z max η ≤ A ( E [ ∥ z i ∥ 2 ] / m ) 1 / 2 z_{\max}\eta\le A\left(\mathbb{E}[\lVert\mathbf{z}_i\rVert^2]/m\right)^{1/2} z m a x η ≤ A ( E [∥ z i ∥ 2 ] / m ) 1/2 .
Proof. We first bound the bias. We take expectations in (31). The cross terms with the score of a branch vanish as in the proof of Proposition 8, which only used that the first action of a branch is drawn with fresh action noise. The factual contributes E [ G ( 1 ) z i ( 1 ) ] = g \mathbb{E}[G^{(1)}\mathbf{z}_i^{(1)}]=\mathbf{g} E [ G ( 1 ) z i ( 1 ) ] = g , and the m − 1 m-1 m − 1 branches contribute equal terms, so that
E ω [ g ^ R L B ] − g = m − 1 m ( E ω [ G ( 2 ) z i ( 2 ) ] − g ) − 1 m E ω [ G ( 2 ) z i ( 1 ) ] . (44) \mathbb{E}_\omega[\hat{\mathbf{g}}_{\mathrm{RLB}}]-\mathbf{g}
=\frac{m-1}{m}\left(\mathbb{E}_\omega[G^{(2)}\mathbf{z}_i^{(2)}]-\mathbf{g}\right)-\frac{1}{m}\mathbb{E}_\omega[G^{(2)}\mathbf{z}_i^{(1)}]. \tag*{(44)} E ω [ g ^ RLB ] − g = m m − 1 ( E ω [ G ( 2 ) z i ( 2 ) ] − g ) − m 1 E ω [ G ( 2 ) z i ( 1 ) ] . (44)
For an exact branch, E [ G ( 2 ) z i ( 2 ) ] = g \mathbb{E}[G^{(2)}\mathbf{z}_i^{(2)}]=\mathbf{g} E [ G ( 2 ) z i ( 2 ) ] = g and E [ G ( 2 ) z i ( 1 ) ] = 0 \mathbb{E}[G^{(2)}\mathbf{z}_i^{(1)}]=0 E [ G ( 2 ) z i ( 1 ) ] = 0 by the proof of Proposition 8. The bias is therefore the difference, between a generated and an exact branch, of the expectation of G ( 2 ) ( m − 1 m z i ( 2 ) − 1 m z i ( 1 ) ) G^{(2)}\left(\frac{m-1}{m}z_i^{(2)}-\frac{1}{m}z_i^{(1)}\right) G ( 2 ) ( m m − 1 z i ( 2 ) − m 1 z i ( 1 ) ) . The vector in the bracket is determined by τ ^ \hat{\tau} τ ^ and the first action of the branch, which have the same distribution in both cases, and its norm is at most z max z_{\max} z m a x . Taking the expectation of G ( 2 ) G^{(2)} G ( 2 ) given τ ^ \hat{\tau} τ ^ and this action first, the bias is at most z max η z_{\max}\eta z m a x η in norm.
We next bound the covariance of RLB. Let D ( j ) : = G ( j ) − G ( 1 ) D^{(j)}:=G^{(j)}-G^{(1)} D ( j ) := G ( j ) − G ( 1 ) . Subtracting G ( 1 ) G^{(1)} G ( 1 ) from all returns in (31) gives
g ^ R L B = 1 m − 1 ∑ j = 2 m D ( j ) ( z i ( j ) − z ˉ i ) , (45) \hat{\mathbf{g}}_{\mathrm{RLB}}=\frac{1}{m-1}\sum_{j=2}^{m}D^{(j)}\left(\mathbf{z}_i^{(j)}-\bar{\mathbf{z}}_i\right), \tag*{(45)} g ^ RLB = m − 1 1 j = 2 ∑ m D ( j ) ( z i ( j ) − z ˉ i ) , (45)
so that RLB depends on the returns only through their differences from the factual. As ∣ D ( j ) ∣ ≤ A \lvert D^{(j)}\rvert\le A ∣ D ( j ) ∣ ≤ A , the Cauchy–Schwarz inequality gives ( v ⊤ g ^ R L B ) 2 ≤ A 2 m − 1 ∑ j ≥ 2 ( v ⊤ ( z i ( j ) − z ˉ i ) ) 2 \left(\mathbf{v}^{\top}\hat{\mathbf{g}}_{\mathrm{RLB}}\right)^2\le\frac{A^2}{m-1}\sum_{j\ge2}\left(\mathbf{v}^{\top}\left(\mathbf{z}_i^{(j)}-\bar{\mathbf{z}}_i\right)\right)^2 ( v ⊤ g ^ RLB ) 2 ≤ m − 1 A 2 ∑ j ≥ 2 ( v ⊤ ( z i ( j ) − z ˉ i ) ) 2 for every vector v \mathbf{v} v . The scores are independent and identically distributed with zero mean, so E [ ( z i ( j ) − z ˉ i ) ( z i ( j ) − z ˉ i ) ⊤ ] = ( 1 − 1 m ) S \mathbb{E}\left[(\mathbf{z}_i^{(j)}-\bar{\mathbf{z}}_i)(\mathbf{z}_i^{(j)}-\bar{\mathbf{z}}_i)^{\top}\right]=\left(1-\frac{1}{m}\right)S E [ ( z i ( j ) − z ˉ i ) ( z i ( j ) − z ˉ i ) ⊤ ] = ( 1 − m 1 ) S , and therefore E ω [ g ^ R L B g ^ R L B ⊤ ] ⪯ ( 1 − 1 m ) A 2 S \mathbb{E}_{\omega}\left[\hat{\mathbf{g}}_{\mathrm{RLB}}\hat{\mathbf{g}}_{\mathrm{RLB}}^{\top}\right]\preceq\left(1-\frac{1}{m}\right)A^2S E ω [ g ^ RLB g ^ RLB ⊤ ] ⪯ ( 1 − m 1 ) A 2 S . A covariance is at most the second moment, so Cov ω ( g ^ R L B ) ⪯ ( 1 − 1 m ) A 2 S \operatorname{Cov}_{\omega}(\hat{\mathbf{g}}_{\mathrm{RLB}})\preceq\left(1-\frac{1}{m}\right)A^2S Cov ω ( g ^ RLB ) ⪯ ( 1 − m 1 ) A 2 S .
We next bound the covariance of the other estimators from below. For RLOO with a WM, we condition on the action noise of the root and on the branches, of which the environmental noise u \mathbf{u} u of the root is independent. The scores in (31) are then fixed, and only the return G ( ϵ , u ) G(\epsilon,\mathbf{u}) G ( ϵ , u ) of the root is random, through u \mathbf{u} u . Its variance is at least ( σ l u c k − σ i n t e r ) 2 (\sigma_{\mathrm{luck}}-\sigma_{\mathrm{inter}})^2 ( σ luck − σ inter ) 2 as in the proof of Lemma 9, so the conditional covariance of the estimator is at least
( σ l u c k − σ i n t e r ) 2 ( m − 1 ) 2 ( z i ( j ) − z ˉ i ) ( z i ( j ) − z ˉ i ) ⊤ . \frac{(\sigma_{\mathrm{luck}}-\sigma_{\mathrm{inter}})^2}{(m-1)^2}\left(\mathbf{z}_i^{(j)}-\bar{\mathbf{z}}_i\right)\left(\mathbf{z}_i^{(j)}-\bar{\mathbf{z}}_i\right)^{\top}. ( m − 1 ) 2 ( σ luck − σ inter ) 2 ( z i ( j ) − z ˉ i ) ( z i ( j ) − z ˉ i ) ⊤ .
The scores of the group are independent and identically distributed with zero mean, so the last matrix has expectation ( 1 − 1 m ) S \left(1-\frac{1}{m}\right)S ( 1 − m 1 ) S . As a covariance is at least the expected conditional covariance,
Cov ( g ^ ) ⪰ ( σ l u c k − σ i n t e r ) 2 m ( m − 1 ) S . \operatorname{Cov}(\hat{\mathbf{g}})\succeq\frac{(\sigma_{\mathrm{luck}}-\sigma_{\mathrm{inter}})^2}{m(m-1)}S. Cov ( g ^ ) ⪰ m ( m − 1 ) ( σ luck − σ inter ) 2 S .
For REINFORCE, Lemma 9 gives the same with 1 m \frac{1}{m} m 1 in place of 1 m ( m − 1 ) \frac{1}{m(m-1)} m ( m − 1 ) 1 , and its proof with 1 1 1 if only the real trajectory is used.
We finally combine the bounds. Subtracting the upper bound for RLB, where 1 − 1 m ≤ 1 1-\frac{1}{m}\le1 1 − m 1 ≤ 1 , from the lower bound gives the claimed inequality. If σ l u c k ≥ σ i n t e r + m A \sigma_{\mathrm{luck}}\ge\sigma_{\mathrm{inter}}+mA σ luck ≥ σ inter + m A , the lower bound is ⪰ m m − 1 A 2 S \succeq\frac{m}{m-1}A^2S ⪰ m − 1 m A 2 S , so RLB has the smaller covariance. Its mean squared error is the trace of its covariance plus the squared norm of its bias, hence at most ( 1 − 1 m ) A 2 E ∥ z i ∥ 2 + z max 2 η 2 \left(1-\frac{1}{m}\right)A^2\mathbb{E}\lVert\mathbf{z}_i\rVert^2+z_{\max}^2\eta^2 ( 1 − m 1 ) A 2 E ∥ z i ∥ 2 + z m a x 2 η 2 , which is at most A 2 E ∥ z i ∥ 2 A^2\mathbb{E}\lVert\mathbf{z}_i\rVert^2 A 2 E ∥ z i ∥ 2 if z max η ≤ A ( E ∥ z i ∥ 2 / m ) 1 / 2 z_{\max}\eta\le A\left(\mathbb{E}\lVert\mathbf{z}_i\rVert^2/m\right)^{1/2} z m a x η ≤ A ( E ∥ z i ∥ 2 / m ) 1/2 . The mean squared error of the other estimators is at least the trace of their covariance, which is then at least m m − 1 A 2 E ∥ z i ∥ 2 \frac{m}{m-1}A^2\mathbb{E}\lVert\mathbf{z}_i\rVert^2 m − 1 m A 2 E ∥ z i ∥ 2 .
Proof of Proposition 11
We consider a maximum likelihood CWM p ω ^ p_{\hat{\omega}} p ω ^ of Proposition 2, learned from a training set D \mathcal{D} D independent of the trajectories of the policy gradient. Suppose that, for every group and every step k k k , the probability of any set of inputs ( x k , a k , o k ) (x_k,a_k,o_k) ( x k , a k , o k ) of the model, where ( x k , a k ) (x_k,a_k) ( x k , a k ) follows an exact counterfactual branch of τ ^ \hat{\tau} τ ^ , is at most κ \kappa κ times its probability under the training distribution, which is the distribution of ( x i , a i , o i ) (x_i,a_i,o_i) ( x i , a i , o i ) in (9). In particular, the training pairs must include pairs as they occur in a group, whose two states coincide at the branching step. For states drawn independently from a continuous distribution, κ \kappa κ is infinite. For the group at step i i i , η \eta η is the error in (42) given x ^ i \hat{x}_i x ^ i , and A A A bounds the difference between the returns of a branch and its factual as in Proposition 10, for generated and for exact counterfactual branches. The bias is that of the whole estimator (12) .
Proposition 11. In Propositions 2 and 10, suppose that every input of the CWM along the branches is at most κ \kappa κ times as likely as in the training distribution. Then, on average over the training set, every maximum likelihood CWM has E x ^ i [ η ] ≤ 2 A ( n − i ) 2 κ ( 1 + log ∣ Ω ∣ ) / N \mathbb{E}_{\hat{x}_i}[\eta]\le2A(n-i)\sqrt{2\kappa(1+\log\lvert\Omega\rvert)/N} E x ^ i [ η ] ≤ 2 A ( n − i ) 2 κ ( 1 + log ∣ Ω ∣) / N for step i i i . Hence RLB (12) has a bias at most A z max n ( n + 1 ) 2 κ ( 1 + log ∣ Ω ∣ ) / N A z_{\max} n(n+1)\sqrt{2\kappa(1+\log\lvert\Omega\rvert)/N} A z m a x n ( n + 1 ) 2 κ ( 1 + log ∣ Ω ∣) / N in norm.
Proof. We first relate η \eta η to the error of a generated branch in total variation,
η T V : = E τ ^ [ TV ( p ω ( ⋅ ∣ x ^ i , τ ^ ) , p θ ( ⋅ ∣ x ^ i , τ ^ ) ) ] , (46) \eta_{\mathrm{TV}}:=\mathbb{E}_{\hat{\tau}}\left[\operatorname{TV}\left(p_{\omega}(\cdot\mid\hat{x}_i,\hat{\tau}),p_{\theta}(\cdot\mid\hat{x}_i,\hat{\tau})\right)\right], \tag*{(46)} η TV := E τ ^ [ TV ( p ω ( ⋅ ∣ x ^ i , τ ^ ) , p θ ( ⋅ ∣ x ^ i , τ ^ ) ) ] , (46)
where TV ( P , Q ) = sup E ∣ P ( E ) − Q ( E ) ∣ \operatorname{TV}(P,Q)=\sup_{E}\lvert P(E)-Q(E)\rvert TV ( P , Q ) = sup E ∣ P ( E ) − Q ( E )∣ , for which the expectations of any function bounded by B B B differ by at most 2 B TV ( P , Q ) 2B\operatorname{TV}(P,Q) 2 B TV ( P , Q ) . Given τ ^ \hat{\tau} τ ^ , the return of the factual is fixed, so the error in (42) is that of the expected value of G ( 2 ) − G ( 1 ) G^{(2)}-G^{(1)} G ( 2 ) − G ( 1 ) , which is bounded by A A A . Given τ ^ \hat{\tau} τ ^ and the first action of the branch, a generated and an exact branch differ in total variation by an amount whose average over this action is the distance inside (46) . Hence η ≤ 2 A η T V \eta\le2A\eta_{\mathrm{TV}} η ≤ 2 A η TV .
We next show that, for every model p ω p_\omega p ω ,
η T V ≤ ∑ k = i n − 1 E [ TV ( p ω ( ⋅ ∣ x k , a k , o k ) , p ( ⋅ ∣ x k , a k , o k ) ) ] , (47) \eta_{\mathrm{TV}} \le\sum_{k=i}^{n-1}\mathbb{E}\left[\operatorname{TV}\left(p_\omega(\cdot\mid x_k,a_k,o_k),p(\cdot\mid x_k,a_k,o_k)\right)\right], \tag*{(47)} η TV ≤ k = i ∑ n − 1 E [ TV ( p ω ( ⋅ ∣ x k , a k , o k ) , p ( ⋅ ∣ x k , a k , o k ) ) ] , (47)
where ( x k , a k ) (x_k,a_k) ( x k , a k ) follows an exact counterfactual branch of τ ^ \hat{\tau} τ ^ . Fix τ ^ \hat{\tau} τ ^ , and for k = i , … , n k=i,\ldots,n k = i , … , n , let P k P_k P k be the distribution of the branch that uses the exact counterfactual transitions before step k k k and p ω p_\omega p ω from step k k k on, so that P i P_i P i is the generated and P n P_n P n the exact branch. The distributions P k P_k P k and P k + 1 P_{k+1} P k + 1 differ only in the transition at step k k k , taken from a state and action distributed as on the exact branch, and are obtained from the distribution of the trajectory up to x k + 1 x_{k+1} x k + 1 by the same later transitions. Their total variation distance is therefore at most the expected total variation distance of this transition, and (47) follows from the triangle inequality and the expectation over τ ^ \hat{\tau} τ ^ .
We next bound the terms of (47) for p ω = p ω ^ p_\omega=p_{\hat{\omega}} p ω = p ω ^ , averaged over x ^ i \hat{x}_i x ^ i . By coverage assumption, the H² distance between the model and the exact counterfactual, averaged over the inputs of step k k k , is at most κ \kappa κ times its average over the training distribution, whose expectation over D \mathcal{D} D is ≤ ( 1 + log ∣ Ω ∣ ) / N \le(1+\log|\Omega|)/N ≤ ( 1 + log ∣Ω∣ ) / N by (9). The total variation distance of two distributions is at most 2 \sqrt{2} 2 times their Hellinger distance, so by Jensen’s inequality the k k k -th term of (47) has expectation ≤ 2 κ ( 1 + log ∣ Ω ∣ ) / N \le\sqrt{2\kappa(1+\log|\Omega|)/N} ≤ 2 κ ( 1 + log ∣Ω∣ ) / N over x ^ i \hat{x}_i x ^ i and D \mathcal{D} D .
We now prove the claims. By (47) , the expectation of η T V \eta_{\mathrm{TV}} η TV over x ^ i \hat{x}_i x ^ i and D \mathcal{D} D is at most n − i n-i n − i times this bound, and the bound on η \eta η follows as η ≤ 2 A η T V \eta\le2A\eta_{\mathrm{TV}} η ≤ 2 A η TV . As (12) is ∑ i γ i g ^ i \sum_i\gamma^i\hat{g}_i ∑ i γ i g ^ i and ∇ θ J ( θ ) = ∑ i γ i E [ g i ( x ^ i ) ] \nabla_\theta J(\theta)=\sum_i\gamma^i\mathbb{E}[g_i(\hat{x}_i)] ∇ θ J ( θ ) = ∑ i γ i E [ g i ( x ^ i )] , its bias is the sum over i i i of γ i \gamma^i γ i times the mean over x ^ i \hat{x}_i x ^ i of the bias of the group at step i i i , which is ≤ z max η \le z_{\max}\eta ≤ z m a x η in norm by Proposition 10. The bound on the bias follows as γ ≤ 1 \gamma\le1 γ ≤ 1 and ∑ i = 0 n − 1 ( n − i ) = n ( n + 1 ) / 2 \sum_{i=0}^{n-1}(n-i)=n(n+1)/2 ∑ i = 0 n − 1 ( n − i ) = n ( n + 1 ) /2 .
Sparse branching
Branching at every step costs m − 1 m-1 m − 1 model rollouts per step. In practice, it is useful to branch sparsely, where we branch only at the first step and use the same m − 1 m-1 m − 1 branches at every later step:
∇ θ J ( θ ) ≈ 1 m ∑ j = 1 m ∑ i = 0 n − 1 γ i ( G i ( j ) − b i ( j ) ) z i ( j ) , τ ( 1 ) = τ ^ , τ ( 2 ) , … , τ ( m ) ∼ i i d p θ ( ⋅ ∣ x ^ 0 , τ ^ ) , (48) \nabla_\theta J(\theta)\approx\frac{1}{m}\sum_{j=1}^{m}\sum_{i=0}^{n-1}\gamma^i\left(G_i^{(j)}-b_i^{(j)}\right)z_i^{(j)},\qquad\tau^{(1)}=\hat{\tau},\quad\tau^{(2)},\ldots,\tau^{(m)}\mathrel{\overset{\mathrm{iid}}{\sim}}p_\theta(\cdot\mid\hat{x}_0,\hat{\tau}), \tag*{(48)} ∇ θ J ( θ ) ≈ m 1 j = 1 ∑ m i = 0 ∑ n − 1 γ i ( G i ( j ) − b i ( j ) ) z i ( j ) , τ ( 1 ) = τ ^ , τ ( 2 ) , … , τ ( m ) ∼ iid p θ ( ⋅ ∣ x ^ 0 , τ ^ ) , (48)
with b i ( j ) b_i^{(j)} b i ( j ) as in (12) , where z i ( j ) z_i^{(j)} z i ( j ) is the score of trajectory j j j at its own state x i ( j ) x_i^{(j)} x i ( j ) . The trajectories of the group at a step i ≥ 1 i\ge1 i ≥ 1 thus no longer share a state. RLOO with sparse branching uses independent branches instead [24 ] .
Corollary 2. Under the assumptions of Proposition 8, the estimator (48) is unbiased, also with the exact counterfactuals of any other SCM of the form (6) that is consistent with the MDP.
Proof. We expand the baselines as in (33) , at every step i i i . By Lemma 5, every branch is distributed as p θ ( ⋅ ∣ x ^ 0 ) p_\theta(\cdot\mid\hat{x}_0) p θ ( ⋅ ∣ x ^ 0 ) given x ^ 0 \hat{x}_0 x ^ 0 , so E [ ∑ i γ i G i ( j ) z i ( j ) ] = ∇ θ J ( θ ) \mathbb{E}[\sum_i\gamma^iG_i^{(j)}z_i^{(j)}]=\nabla_\theta J(\theta) E [ ∑ i γ i G i ( j ) z i ( j ) ] = ∇ θ J ( θ ) for every j j j by (2). The cross terms E [ G i ( ℓ ) z i ( j ) ] \mathbb{E}[G_i^{(\ell)}z_i^{(j)}] E [ G i ( ℓ ) z i ( j ) ] with ℓ ≠ j \ell\ne j ℓ = j vanish as in the proof of Proposition 8. If j ≥ 2 j\ge2 j ≥ 2 , the action of branch j j j at step i i i is drawn with fresh action noise, which is independent of its state x i ( j ) x_i^{(j)} x i ( j ) and of the other trajectories. If j = 1 j=1 j = 1 , Lemma 5 lets us replace branch ℓ \ell ℓ by the trajectory that uses the noise of the factual fresh action noise, all of which are independent of the action noise of a ^ i \hat{a}_i a ^ i , as is x ^ i \hat{x}_i x ^ i . The second claim follows as in the proof of Corollary 1.
Proposition 12. Let the branches in (48) be generated by a CWM, let scores be bounded by z max z_{\max} z m a x , and let the returns-to-go of a branch, generated or exact, and of its factual differ by ≤ A \le A ≤ A at every step. Then the bias of (48) is ≤ 2 A z max η η T V \le2A z_{\max}\eta\eta_{\mathrm{TV}} ≤ 2 A z m a x η η TV in norm, where η T V \eta_{\mathrm{TV}} η TV is the error (46) of a branch from x ^ 0 \hat{x}_0 x ^ 0 , averaged over x ^ 0 \hat{x}_0 x ^ 0 . For a maximum likelihood CWM as in Proposition 11,
with coverage along the branches from x ^ 0 \hat{\mathbf{x}}_0 x ^ 0 , the bias is ≤ 2 A z max n 2 2 κ ( 1 + log ∣ Ω ∣ ) / N \leq2A z_{\max} n^2 \sqrt{2\kappa(1+\log|\Omega|)/N} ≤ 2 A z m a x n 2 2 κ ( 1 + log ∣Ω∣ ) / N on average over the train set.
Proof. We take expectations as in the proof of Corollary 2. The cross terms with the score of a branch vanish for every model, as they only use that its actions are drawn with fresh action noise. As in (44) , the bias is therefore the difference, between a generated and an exact branch, of the expectation of ∑ i γ i G i ( 2 ) c i \sum_i \gamma^i G_i^{(2)} c_i ∑ i γ i G i ( 2 ) c i with c i : = m − 1 m z i ( 2 ) − 1 m z i ( 1 ) c_i := \frac{m-1}{m}z_i^{(2)}-\frac{1}{m}z_i^{(1)} c i := m m − 1 z i ( 2 ) − m 1 z i ( 1 ) . Unlike in Proposition 10, c i c_i c i depends on the state of the branch at step i i i , whose distribution depends on the model, so we bound the difference in total variation. Given τ ^ \hat{\tau} τ ^ , the score z ( 2 ) z^{(2)} z ( 2 ) has zero mean for both branches, so G i ( 2 ) G_i^{(2)} G i ( 2 ) can be replaced by G i ( 2 ) − G i ( 1 ) G_i^{(2)}-G_i^{(1)} G i ( 2 ) − G i ( 1 ) , and ( G i ( 2 ) − G i ( 1 ) ) c i (G_i^{(2)}-G_i^{(1)})c_i ( G i ( 2 ) − G i ( 1 ) ) c i is bounded by A z max A z_{\max} A z m a x in norm. Every step thus contributes ≤ 2 A z max η T V \leq2A z_{\max}\eta_{\mathrm{TV}} ≤ 2 A z m a x η TV , and the first claim follows as γ ≤ 1 \gamma\leq1 γ ≤ 1 . The second claim follows from (47) for i = 0 i=0 i = 0 and the bound on its terms in the proof of Proposition 11.
Compared to Proposition 11, the bound grows by a factor of at most two, and coverage is needed only along the branches from the first state.
We finally discuss the variance. Let g ^ i \hat{g}_i g ^ i be the term of step i i i in (48) without the factor γ i \gamma^i γ i . For any function v v v of the state, with average v ˉ \bar{v} v ˉ over the states of the group at step i i i , (31) gives
g ^ i = 1 m − 1 ∑ j = 1 m ( G i ( j ) − v ( x i ( j ) ) ) ( z i ( j ) − z ˉ i ) + 1 m − 1 ∑ j = 1 m ( v ( x i ( j ) ) − v ˉ ) z i ( j ) . (49) \hat{g}_i = \frac{1}{m-1}\sum_{j=1}^{m}\left(G_i^{(j)}-v(x_i^{(j)})\right)\left(z_i^{(j)}-\bar{z}_i\right)+\frac{1}{m-1}\sum_{j=1}^{m}\left(v(x_i^{(j)})-\bar{v}\right)z_i^{(j)}. \tag*{(49)} g ^ i = m − 1 1 j = 1 ∑ m ( G i ( j ) − v ( x i ( j ) ) ) ( z i ( j ) − z ˉ i ) + m − 1 1 j = 1 ∑ m ( v ( x i ( j ) ) − v ˉ ) z i ( j ) . (49)
The last sum is a drift term, as the baseline of a trajectory is built from returns at the states of the other trajectories. It vanishes when the group shares a state, as when branching at every step, and it otherwise has zero mean, so it contributes to the variance but not to the bias. It is present for RLOO with sparse branching as well, whose trajectories also differ through their noise.
The comparison of Proposition 10 still holds for the term of every step, with two changes. First, g ^ i \hat{g}_i g ^ i satisfies (45) with the returns-to-go and scores of step i i i , and these scores are uncorrelated with zero mean, so the proof of Proposition 10 gives E ω [ g ^ i g ^ i T ] ⪯ A 2 S ˉ i \mathbb{E}_{\omega}[\hat{g}_i\hat{g}_i^{\mathsf{T}}]\preceq A^2\bar{S}_i E ω [ g ^ i g ^ i T ] ⪯ A 2 S ˉ i , where S ˉ i \bar{S}_i S ˉ i is the average of E [ z i z i T ] \mathbb{E}[z_i z_i^{\mathsf{T}}] E [ z i z i T ] over the m m m trajectories and A A A includes the drift. Second, for RLOO with any WM and sparse branching, and for REINFORCE with any state-dependent baseline, conditioning also on the noise of the real trajectory before step i i i gives Cov ( g ^ i ) ⪰ 1 m 2 E [ ( σ l u c k − σ i n t e r ) 2 z i z i T ] \operatorname{Cov}(\hat{g}_i)\succeq\frac{1}{m^2}\mathbb{E}[(\sigma_{\mathrm{luck}}-\sigma_{\mathrm{inter}})^2 z_i z_i^{\mathsf{T}}] Cov ( g ^ i ) ⪰ m 2 1 E [( σ luck − σ inter ) 2 z i z i T ] , where z i z_i z i is the score of the real trajectory and σ l u c k \sigma_{\mathrm{luck}} σ luck and σ i n t e r \sigma_{\mathrm{inter}} σ inter are those of its state x ^ i \hat{x}_i x ^ i .
Extended related work
In this section, we provide an extended discussion of related work across domains.
Policy gradients with grouped baselines. RLB constructs learning signals by comparing multiple samples associated with a common input. Its parent method, RLOO ([24 , 2 ] ) uses the mean return of other independently sampled trajectories as a leave-one-out baseline. Relatedly, GRPO ([43 ] ) normalizes rewards within groups of responses to the same prompt for clipped policy updates. Yet, sharing a starting state or prompt does not itself couple environmental randomness. We adapt RLOO baseline but generate counterfactual branches conditioned on a factual. Given the close relationship between RLOO and GRPO ([25 ] ), we conjecture that our approach could be extended to GRPO, which we leave as future work.
Policy gradients with shared randomness. Our work is closely related with prior work that leverages common random numbers to reduce the variance of policy gradient estimators. TRPO’s “vine” procedure ([41 ] ) compares actions through rollouts using common random numbers and requires simulator resets to sampled states. Input-dependent baselines ([28 ] ) condition value predictions on observed future exogenous inputs. Hindsight learning ([45 ] ) uses logged exogenous inputs and known dynamics to evaluate actions through hindsight planning. Exogenous-state methods remove exogenous state variables and rewards when the reward decomposes additively ([10 ] ), or learn with a sample complexity that is nearly independent of an unknown exogenous part of the state that does not affect rewards (Efroni et al., 2022). rMC [7 ] estimates policy gradients for finite MDPs from return differences between a root trajectory and coupled true counterfactuals for all alternative actions run until they merge with the root. We employ learned counterfactual dynamics, allowing policy learning without online simulator resets or direct online observation of environmental noise.
Exogenous inputs and states. Among the policy gradient methods above, those that use exogenous inputs or states are the closest to ours. They are given the noise, as inputs [28 , 45 ] or as a part of the state [10 , 11 ] , whereas RLB only needs the factual observations, from which a CWM predicts the counterfactual transitions. The noise thus need not be a separate input or a part of the state, nor behave additively. If the noise is given as an input sequence, the baseline of RLB is a Monte Carlo estimate of the input-dependent baseline of Mao et al. [28 ] . If the reward decomposes additively as in Dietterich et al. [10 ] , RLB removes the exogenous return without discovering the decomposition. In Efroni et al. [11 ] , the exogenous part of the state does not affect rewards and is to be ignored, whereas the noise that we consider affects returns. Hindsight learning Sinclair et al., [45 ] assumes known dynamics and lets a planner see the future inputs, which biases its values towards foresight, whereas the policy of RLB does not see the future noise, so its gradient is unbiased as long as CWM is exact.
Hindsight and counterfactual credit assignment. Prior work has used hindsight and counterfactual predictions to distinguish action effects from luck. HCA Harutyunyan et al., [19 ] assigns credit using action probabilities conditioned on future observations. CCA Mesnard et al., [30 ] learns value baselines from hindsight features, encouraging independence from current action. QCA Mesnard et al., [32 ] compares return distributions at the quantile level and predicts it from future observations. COMA Foerster et al., [12 ] uses a centralized critic to marginalize one agent’s action while fixing the others’, and its baseline follows difference rewards [54 ] . In our multi-agent bandit, where the other agents are the environmental noise of an agent, RLB is a sampled version of this baseline, and the learned CWM computes it from each agent’s own observation without a centralized critic. We build baselines from generated counterfactual trajectories, without a separate critic that predicts returns, coupling transition outcomes through factual observations instead of e.g. return quantiles. We note that an older preprint of CCA [31 ] has theorized a “vine” extension motivated by that of TRPO in Appendix E.§ 2 , and separately theorized a model extension in Appendix E.§ 3 (see also Corollary 1 in the latest version), yet the precise combination of leave-one-out baseline with counterfactual models as in our work has not been considered, and their implemented methods are all model-free and use learned value baselines.
Counterfactual inference for policy search and evaluation. Similar to our CWMs, prior work has used observed experience to improve simulations of alternative decisions. Abbeel et al. (2006) correct approximate dynamics using real trajectories for local policy improvement in nearly deterministic settings. CF-GPS Buesing et al., [8 ] infers scenarios from logged episodes, simulates alternative policies, and improves policies through return-weighted regression. It motivates factual conditioning when scenario distributions are harder to model than causal mechanisms, thereby inspiring our approach. Oberst & Sontag (2019) reuse inferred Gumbel noise under alternative policies for counterfactual off-policy evaluation. Distinguished from these approaches, we employ a grouped policy gradient estimator using learned counterfactual transitions, where both the factual and counterfactual contribute to each update. In addition, CF-GPS is given the mechanisms and infers only the noise of a logged episode, whereas a CWM learns the counterfactual transition itself.
Identifiability of counterfactuals. The transitions of an MDP do not identify its counterfactuals, as SCMs with the same transitions can disagree on them [37 ] . Prior work is therefore given the noise or the mechanisms [28 , 45 , 8 ] , or restricts the mechanisms such that the transitions determine the counterfactuals, e.g., to Gumbel-max mechanisms [37 ] . RLB needs neither, as it uses counterfactuals only as a means to estimate the policy gradient, for which every SCM consistent with the MDP gives an unbiased estimate and the choice among them only affects the variance (Corollary 1).
Learned and generative counterfactual inference. Our approach is related to, and can benefit from, methods for inferring and learning counterfactual dynamics. CoPhy [6 ] predicts physical trajectories under altered initial conditions from factual experience, using paired factual and counterfactual training data similarly to our CWMs. Filtered-CoPhy [22 ] extends this to video prediction without object position or physical property supervision, using paired videos. We study a similar prediction problem in action-conditioned prediction setting, and further study modeling difficulty depending on environmental properties. Diff-SCM [40 ] and DCM [9 ] use diffusion-based latent inference to generate counterfactuals in class-conditional image generation and medical application, respectively. CWMDT [44 ] conditions video diffusion on scene descriptions modified by a language model. Distinctly, we apply diffusion counterfactual inference to an action-conditioned WM trained on interaction data.
Advantage functions. The weight G ( j ) − b ( j ) G^{(j)} - b^{(j)} G ( j ) − b ( j ) that RLB gives to a trajectory estimates G − V ( u ) G - V(\mathbf{u}) G − V ( u ) , the return of the trajectory relative to the expected return of the policy under the same environmental noise. It differs from the usual advantage, which is relative to the expected return over all noise, by the luck V ( u ) − E [ V ( u ) ] V(\mathbf{u}) - \mathbb{E}[V(\mathbf{u})] V ( u ) − E [ V ( u )] , which a state-dependent baseline cannot remove (Lemma 9). This hindsight advantage is targeted by input-dependent baselines [28 ] and future-conditional value functions [30 ] with a learned critic, whereas RLB estimates it in a critic-free manner. If part of the noise is hidden, the baseline estimates E [ V ( u ) ∣ τ ^ ] \mathbb{E}[V(\mathbf{u}) \mid\hat{\tau}] E [ V ( u ) ∣ τ ^ ] instead, which is a posterior value function [36 ] with the noise as the hidden variable.
Experiment details
Contextual bandit
Environment and agents. We adapt the setting of Mesnard et al. [30 ] , using deterministic reward as outlined in § 5.1 . The policy is a linear layer followed by softmax to give 21 action probabilities, and it receives the context c ∈ { − 10 , … , 10 } c \in\{-10, \ldots, 10\} c ∈ { − 10 , … , 10 } which is represented by a 21-dimensional one-hot vector. For REINFORCE with baseline, we use a separate linear function of the context, fitted by squared loss. For CCA, we follow Mesnard et al. [30 ] to reproduce the method and apply it to our setting. All methods use Adam with learning rate 4 × 10 − 4 4 \times10^{-4} 4 × 1 0 − 4 and entropy regularization of 0.004. Each training uses 10 7 10^7 1 0 7 environmental interactions, with batch size 256 per update.
Offline model learning. For WM and CWM training, we use REINFORCE with baseline as the reference policy, with its action probabilities equally mixed with a uniform policy. We create paired data using uniformly sampled contexts and two independent actions, and the same environmental noise. We collect 4,096 training, 1,024 validation, and 2,048 test pairs, keeping both members of every pair in the same split. This costs 14,336 environmental interactions per dataset.
Within next state x = ( c , a + u ) \mathbf{x} = (c, a + \mathbf{u}) x = ( c , a + u ) , both models are trained to predict a + u a + \mathbf{u} a + u since c c c is already provided as input. The models use the same paired dataset, where the ordinary WM treats both pair members as separate examples conditioned on context and action. The counterfactual model trains on both directions, conditioned on one and predicting the other, and the other way around as well.
Each model has two hidden layers of eight SiLU units, Gaussian mean and scale outputs, and a learned linear connection from inputs to the mean. This makes these models slightly smaller than the policy. For both models, we clip the predicted Gaussian standard deviation to have a floor of 0.05, so that maximum likelihood does not explode for a constant prediction target.
Each model is trained with 5,000 Adam updates with 256 examples sampled with replacement per update. We use cosine learning rate scheduler from 3 × 10 − 3 3 \times10^{-3} 3 × 1 0 − 3 to 3 × 10 − 5 3 \times10^{-5} 3 × 1 0 − 5 . After training, we use the final checkpoint and keep it frozen throughout policy learning.
Variance of RLOO and RLB. We evaluate Proposition 9 and Lemma 7 for this problem, which has one step and no hidden noise. For a context c c c and an action a a a with mean a ˉ : = E [ a ∣ π θ ( ⋅ ∣ c ) ] \bar{a} := \mathbb{E}[a \mid\pi_{\theta}(\cdot\mid c)] a ˉ := E [ a ∣ π θ ( ⋅ ∣ c )] , the return is G = σ 2 − ( c − a − u ) 2 G = \sigma^2 - (c - a - \mathbf{u})^2 G = σ 2 − ( c − a − u ) 2 . Its hindsight value and the rest of the return are
V ( u ) = σ 2 − E [ ( c − a ˉ ) 2 ] + 2 ( c − a ˉ ) u − u 2 , G ~ = E [ ( c − a ˉ ) 2 ] − ( c − a ) 2 + 2 ( a ˉ − a ) u , V(\mathbf{u}) = \sigma^2 - \mathbb{E}[(c - \bar{a})^2] + 2(c - \bar{a})\mathbf{u} - \mathbf{u}^2, \qquad\widetilde{G} = \mathbb{E}[(c - \bar{a})^2] - (c - a)^2 + 2(\bar{a} - a)\mathbf{u}, V ( u ) = σ 2 − E [( c − a ˉ ) 2 ] + 2 ( c − a ˉ ) u − u 2 , G = E [( c − a ˉ ) 2 ] − ( c − a ) 2 + 2 ( a ˉ − a ) u ,
so that σ l u c k 2 = 2 σ 4 + 4 ( c − a ˉ ) 2 σ 2 \sigma_{\mathrm{luck}}^2 = 2\sigma^4 + 4(c - \bar{a})^2\sigma^2 σ luck 2 = 2 σ 4 + 4 ( c − a ˉ ) 2 σ 2 and σ i n t e r 2 = 4 σ 2 max a ( a − a ˉ ) 2 \sigma_{\mathrm{inter}}^2 = 4\sigma^2\max_a(a - \bar{a})^2 σ inter 2 = 4 σ 2 max a ( a − a ˉ ) 2 . Hence σ l u c k 2 \sigma_{\mathrm{luck}}^2 σ luck 2 grows as σ 4 \sigma^4 σ 4 and σ i n t e r 2 \sigma_{\mathrm{inter}}^2 σ inter 2 only as σ 2 \sigma^2 σ 2 , and the conclusion of Proposition 9 holds for large noise. For any noise level, with Cov u ( V ( u ) , G ~ ) = 4 ( c − a ˉ ) ( a ˉ − a ) σ 2 \operatorname{Cov}_{u}(V(u),\widetilde{G}) = 4(c-\bar{a})(\bar{a}-a)\sigma^{2} Cov u ( V ( u ) , G ) = 4 ( c − a ˉ ) ( a ˉ − a ) σ 2 , g ( u ) − E [ g ( u ) ] = − 2 u ∇ θ a ˉ \mathbf{g}(u)-\mathbb{E}[\mathbf{g}(u)] = -2u\nabla_{\theta}\bar{a} g ( u ) − E [ g ( u )] = − 2 u ∇ θ a ˉ and the score z 0 z_0 z 0 of the action, (35) gives
Cov ( g ^ R L O O ) − Cov ( g ^ R L B ) = 2 σ 4 + 4 ( c − a ˉ ) 2 σ 2 m − 1 E [ z 0 z 0 ⊤ ] + 8 ( c − a ˉ ) σ 2 m E [ ( a ˉ − a ) z 0 z 0 ⊤ ] − 4 ( 1 − m − 2 m ( m − 1 ) ) σ 2 ∇ θ a ˉ ∇ θ a ˉ ⊤ . \operatorname{Cov}(\widehat{\mathbf{g}}_{\mathrm{RLOO}})-\operatorname{Cov}(\widehat{\mathbf{g}}_{\mathrm{RLB}})=\frac{2\sigma^{4}+4(c-\bar{a})^{2}\sigma^{2}}{m-1}\mathbb{E}\left[\mathbf{z}_0\mathbf{z}_0^{\top}\right]+\frac{8(c-\bar{a})\sigma^{2}}{m}\mathbb{E}\left[(\bar{a}-a)\mathbf{z}_0\mathbf{z}_0^{\top}\right]-4\left(1-\frac{m-2}{m(m-1)}\right)\sigma^{2}\nabla_{\theta}\bar{a}\nabla_{\theta}\bar{a}^{\top}. Cov ( g RLOO ) − Cov ( g RLB ) = m − 1 2 σ 4 + 4 ( c − a ˉ ) 2 σ 2 E [ z 0 z 0 ⊤ ] + m 8 ( c − a ˉ ) σ 2 E [ ( a ˉ − a ) z 0 z 0 ⊤ ] − 4 ( 1 − m ( m − 1 ) m − 2 ) σ 2 ∇ θ a ˉ ∇ θ a ˉ ⊤ .
The first term grows as σ 4 \sigma^{4} σ 4 and the others as σ 2 \sigma^{2} σ 2 . Hence the covariance of RLOO grows as σ 4 \sigma^{4} σ 4 and that of RLB only as σ 2 \sigma^{2} σ 2 , as measured in Table 3 , and the advantage of RLB widens with the noise level, as in Figure 4 (left). The last term is the price of sharing one noise draw in a group (Appendix § 8 .13), which is why a moderate group size is best in Table 5 .
Table 3. Gradient variance and bias of contextual bandit at a uniform policy. - denotes unbiased.
Table 5. Gradient variance in the contextual bandit for different group sizes m m m , averaged over five seeds. Bold marks the lowest RLB variance within sampling error.
Multi-agent bandit
Environment and agents. Based on the contextual bandit problem, we adapt the multi-agent setting of Mesnard et al. [30 ] . Contexts are independent across agents, and actions are sampled independently given the contexts and current policies. Each agent observes only its own context before acting. Each agent has its own policy and baseline with the architecture and optimization settings of Appendix § 10 .§ 1 , and parameters are not shared between agents.
Offline model learning. Similarly as in contextual bandit, we use the agents trained with REINFORCE with baseline as the reference policy, with each agent’s policy mixed equally with uniform actions. We generate data in groups, where each group contains a factual joint episode across the agents and one alternative for each agent with shared environmental randomness (all other agents). Herein, each alternative resamples only that agent’s action while retaining all contexts and other agents’ factual actions. This gives one pair per agent using K + 1 K+1 K + 1 joint environment interactions in total for all agents. We collect 4,096 training, 1,024 validation, and 2,048 test groups per seed, keeping every observation from a group in the same split.
Each agent has its own ordinary and CWM which predicts the scalar terminal cost x i = − r x^{i}=-r x i = − r . The ordinary model takes ( c i , a i ) (c^{i},a^{i}) ( c i , a i ) , and the counterfactual model additionally takes the factual observation o i o^{i} o i defined in § 5.2 . Neither observes other agents’ contexts, actions, or individual costs. Both use two hidden layers of 16 SiLU units and a learned linear connection to the mean, again yielding models slightly smaller than the policy.
The models use Gaussian densities restricted to [ 0 , 400 K ] [0,400K] [ 0 , 400 K ] , the possible joint-cost interval. These are continuous approximations to integer costs and the underlying Gaussian scale has a floor of 0.05 to prevent explosion. As in contextual bandits, ordinary WMs train on both pair elements and counterfactual models are trained on both directions. Each independent model receives 5,000 updates with 256 examples per update and the same Adam schedule as in Appendix § 10 .§ 1 .
The dinosaur game
Environment and agents. Chrome Dino ([15 ] ) is a side-scrolling platform game. The dinosaur remains at a fixed horizontal location while obstacles move from right to left. We use three actions A = { stand , jump , duck } A=\{\text{stand},\text{jump},\text{duck}\} A = { stand , jump , duck } . A policy observes the four most recent decision frames in grayscale at 128 × 64 and selects an action, repeating the action across four frames.
Since jumping is an almost universal solution in the distributed version of the game, we modify the game so that the three actions have distinct consequences. Under our modification, cacti and low birds require a jump, middle birds require a duck, and high birds must be ignored by standing. We additionally increase the frequency of birds and allow them to appear throughout an episode. Game speed starts at 20 pixels per raw frame, increases by one every 20 raw frames, and is capped at 43.
The reward is +1 if an obstacle is passed, −1 upon collision, and zero otherwise. Training rollouts continue after a collision and have a fixed length of 20 decisions, or equivalently 80 raw frames. During testing, evaluation terminates at the first collision or after 375 decisions.
A branching root is a state from which multiple policy rollouts are generated for RLOO and RLB. We branch when the nearest obstacle satisfies 8 < T T C ≤ 12 8 < \mathrm{TTC} \le12 8 < TTC ≤ 12 raw frames, where
T T C = horizontal distance to the nearest obstacle game speed . \mathrm{TTC} = \frac{\text{horizontal distance to the nearest obstacle}}{\text{game speed}}. TTC = game speed horizontal distance to the nearest obstacle .
All methods use the same convolutional policy. Its three convolutional layers have 32, 64, and 64 channels, kernel sizes 8, 4, and 3, and strides 4, 2, and 1. We use orthogonal initialization, Adam with learning rate 10 − 3 10^{-3} 1 0 − 3 , gradient clipping at norm 20, discount γ = 0.99 \gamma= 0.99 γ = 0.99 , and entropy coefficient 0.04. The learned-baseline control uses a separate value network with the same convolutional architecture and a scalar output, optimized with learning rate 3 × 10 − 2 3 \times10^{-2} 3 × 1 0 − 2 .
For all methods, each update contains 32 trajectories. RLB and RLOO arrange these as eight groups of m = 4 m = 4 m = 4 trajectories. Every method is trained for 2,000 updates and fifteen seeds, giving 64,000 trajectories and 1.28 million rollout decisions per seed.
Offline model learning. The diffusion WM, which is also used for counterfactual world modeling, is trained on 1,000 recorded episodes of 150 decisions each, totaling 150,000 observed decisions. Each frame is an RGB image with 320×240 resolution. Training examples contain eight preceding frames, the single causal action, and the next frame. A pretrained VAE maps frames to latent space. We jointly train an action embedding and a 101M-parameter conditional U-Net diffusion model using the velocity prediction objective. Training uses AdamW with learning rate 2 × 10 − 4 2 \times10^{-4} 2 × 1 0 − 4 , gradient clipping at 1, batch size 32, bfloat16 precision, and EMA with warmup and decay 0.9999. We apply classifier-free guidance [20 ] by dropping the action with probability 0.2 during training. All experiments use the EMA checkpoint after 9,000 steps.
We generate each frame with 10 DDIM [46 ] noise inversion steps and with guidance scale 1.0. The generated frame is appended to the context, so a policy rollout is generated autoregressively for 20 decisions. A frozen visual classifier maps each pair of consecutive generated frames to collision, no-event, or obstacle-clear reward. For policy input, generated frames are converted to grayscale and resized to 128 × 64.
For RLB + CWM, at every step, DDIM inversion uses the corresponding factual eight-frame context, factual action, and factual next frame to abduct factual noise. This noise is shared across the m − 1 m - 1 m − 1 imagined group members, while each member conditions on its sampled action and recursively generated context. RLOO + WM instead uses independent fresh Gaussian noise.
Validation and testing. For policy evaluation, we save a checkpoint every 100 policy updates. For each method, every checkpoint is evaluated on 30 validation episodes for each training seed. We select one checkpoint index using its mean validation performance across the fifteen seeds. The selected checkpoint is then evaluated once on 100 test episodes per seed. Validation and test episodes use fixed and different simulator seeds that are shared by all methods. All policies predict action greedily in the real simulator. An episode ends at the first collision or after 375 decisions. We report the fraction of encountered obstacles that cause a collision and the mean number of decisions survived before the first collision. Survival is capped at 375 decisions. The main table reports the mean and sample standard deviation across the fifteen training seeds.
To evaluate model imaginations, we follow the criteria of Melistas et al. [29 ] for assessing counterfactuals. For each root we retain the factual action and uniformly select one of the other two actions as the intervention. CWM and WM therefore receive exactly the same contexts and intervention actions. CWM uses the DDIM-inverted factual noise, and WM uses fresh Gaussian noise. Composition is the mean pixel ℓ 1 \ell_1 ℓ 1 error, on the 0–255 scale, between the recorded next frame and a generation made under the factual action. Effectiveness is the macro-F1 score attained by a trained action predictor, i.e. an inverse dynamics model, applied to the generated counterfactual. Realism is FID against the recorded next frames. Minimality is counterfactual latent divergence (CLD), computed with an independently trained unconditional VAE.
We additionally use a Dino-specific minimality measure for newly entering obstacles. Existing obstacles are visible in the context frames, whereas a newly entering obstacle is not and must be generated by the model. Using only recorded frames, we select transitions where a new obstacle appears in the fixed right-edge region marked by the red dashed boxes. The obstacle-preservation score is the mean pixel ℓ 1 \ell_{1} ℓ 1 error between the generated counterfactual and the recorded next frame within this region, measured on the 0–255 scale.
Supplementary results
We present supplementary results we could not include in the main text due to space limits.
Analysis of bias and variance
We empirically analyze the bias and variance of the policy gradient estimators, in particular RLOO and RLB under the use of learned (counterfactual) world models.
Contextual bandit. We compare all methods in the contextual bandit of § 5.1 in terms of variance and size of the bias relative to that of the gradient. We fix the same uniform policy and use the same budget of 256 transitions per batch across all methods, using five seeds. Because the true policy gradient can be computed exactly in this environment, the bias can be measured directly.
The results are in Table 3 . With almost zero environmental noise (σ = 0.1 \sigma= 0.1 σ = 0.1 ), RLB and RLOO have the same variance, because there is little noise to share. As the noise grows, RLB has the lowest variance of all methods, 12–14× lower than RLOO and REINFORCE at σ = 30 \sigma= 30 σ = 30 , and 45–50× lower at σ = 60 \sigma= 60 σ = 60 . RLB + CWM keeps this reduction, while RLOO + WM does not, presumably due to the difficulty of learning the WM (§ 5.1 ). CCA and RLOO + WM are biased, and their bias grows with the noise, whereas RLB + CWM is empirically nearly unbiased (relative bias ≤0.003).
We further measure the bias of RLB + CWM during CWM training, at the final RLB + CWM policy rather than the uniform policy of Table 3 . At σ = 30 \sigma= 30 σ = 30 , the relative bias is 1.0 at initialization, briefly rises to 1.43 for an intermediate model, and falls to 0.0025 for the fully trained CWM. The result shows that, as CWM becomes more accurate through training, it reduces the bias of policy gradient estimation, consistent with our Propositions 10 and 11.
Dino. In Chrome Dino (§ 5.3 ), the true policy gradient is unknown, so we estimate the bias of RLB + CWM and RLOO + WM by respectively comparing against the simulator RLB and RLOO, both of which are unbiased, using 640 pairs and subtracting the contribution of sampling noise. For comparisons, we take three policies learned with 500, 1,000, and 1,500 updates of REINFORCE with a learned baseline, and use one checkpoint of each learned world model.
The results are in Table 4 . Learned CWM barely changes the direction of the gradient, as its estimated gradient points in nearly the same direction as the unbiased gradient of RLB with simulator (cosine similarity 0.993–0.996). A bias is detectable only at update 500, where the squared bias (1.05) is still below 2% of the squared error of a single batch. At updates 1,000 and 1,500, the confidence intervals of the squared bias include zero, and even their upper limits (0.24 and 0.31) are below 1% of the squared error of a single batch.
Table 4. Gradient variance and bias of Dino game. Brackets are 95% confidence interval.
We find that the learned CWM mainly increases variance. RLB + CWM has around 1.4–2.3× the variance of simulator RLB, which has the lowest variance of the four estimators at every update. It has variance comparable to simulator RLOO at update 500 and lower at updates 1,000 and 1,500, while using only one real trajectory per group instead of four. It also has 37–39% lower variance than RLOO + WM at updates 1,000 and 1,500.
Analysis of the group size
We measure how group size m m m affects gradient variance in the contextual bandit of § 5.1 , at uniform policy and with exact counterfactuals. We fix the budget at 256 trajectories per batch, so a batch contains 256 / m 256/m 256/ m groups, and estimate the variance from 4,000 batches for each of five seeds.
Table 5 shows that the variance of RLB is lowest at m = 4 m=4 m = 4 to 8 and increases for larger groups, whereas that of RLOO keeps decreasing with m m m . This matches the analysis of Appendix § 8 .13. A larger group reduces the terms that decay with m m m , but leaves fewer groups to average the variation of the target with the noise draw that each group shares. RLB has a lower variance than RLOO at every tested m m m , by a factor of 3.4 to 13.0 at σ = 30 \sigma=30 σ = 30 and 12.4 to 48.2 at σ = 60 \sigma=60 σ = 60 .
We also train RLB with exact counterfactuals and RLOO for each group size. Table 6 reports the exact expected reward at the end of training. The group size m = 4 m=4 m = 4 used in our experiments gives RLB the highest final reward at both noise levels. RLOO instead improves steadily with m m m , in line with its variance, but even its best group size remains far behind RLB at every group size. Together, these results support a moderate group size for RLB.
Table 6. Expected reward of RLB and RLOO after 10M interactions in the contextual bandit, across group sizes m m m . Mean and 95% normal confidence interval over six seeds. The optimum is zero.
Multi-agent bandit
We include supplementary results for multi-agent bandit (§ 5.2 ).
Additional baselines. We further compare with difference rewards [54 ] and counterfactual multi-agent (COMA) policy gradients [12 ] , both of which use multi-agent counterfactual baselines (Appendix § 9 ). To account for the simulator use by the simulatorbased estimators, we count every factual and counterfactual reward evaluation as an environment interaction. As a result, with K K K agents in the environment, each episode costs 1 + K 1+K 1 + K interactions for difference rewards and 1 + 20 K 1+20K 1 + 20 K for COMA, whereas each RLB with group size four costs 1 + 3 K 1+3K 1 + 3 K .
The results are in Figure 8 . At 10M environment interactions, RLB outperforms difference rewards for K = 8 K=8 K = 8 and K = 20 K=20 K = 20 and performs competitively for K = 60 K=60 K = 60 . It outperforms COMA across every K K K . When only real environment interactions for policy training are counted, RLB + CWM achieves the highest return among the methods shown across all three settings. When generated samples are also counted, RLB + CWM closely matches the simulator-based RLB.
Figure 8. Policy learning results for the multi-agent bandit problem, with additional baselines difference rewards (Wolpert & Tumer [54 ] ) and COMA (Foerster et al., [12 ] ).
Exogenous-reward removal (Dietterich et al., [10 ] ) is also related. Its discovery procedure uses state transitions to identify exogenous state components and estimate their reward contribution. Our one-step multi-agent bandit does not provide this transition structure, and each agent observes only its own context before acting. Applying the method to the additional post-action feedback would require adapting its discovery criterion. We therefore do not include it as a direct reproduction.
The dinosaur game
We include supplementary results for Chrome Dino (§ 5.3 ).
Qualitative examples. Figure 9 shows eight additional qualitative examples of CWM and WM generations using different factual and intervention actions.
Figure 9. Additional examples. CWM and WM use the same intervention action.
Additional baselines. We add two actor-critic baselines, advantage actor-critic (A2C) (Mnih et al., [34 ] ) and proximal policy optimization (PPO) (Schulman et al., [42 ] ), using the same policy architecture as the other methods in § 5.3 . We train each policy for 2,000 steps over fifteen seeds and select a checkpoint using a separate validation set. We evaluate each policy greedily on 100 episodes shared across methods. As a result, we find that A2C obtains a collision rate (%) of 7.07 ± 4.92 7.07 \pm4.92 7.07 ± 4.92 , whereas PPO obtains 3.27 ± 0.86 3.27 \pm0.86 3.27 ± 0.86 . For comparison, RLB obtains 3.29 ± 0.36 3.29 \pm0.36 3.29 ± 0.36 (Table 2 ). PPO and RLB thus compete in mean collision rate, while RLB exhibits improved stability across seeds.
Impact of diffusion inversion hyperparameters. We evaluate the sensitivity of the diffusion counterfactual inference to the number of DDIM inversion steps and the classifier-free guidance (CFG) scale for action conditioning (Sanchez & Tsaftaris, [40 ] ). We perform evaluation using a fixed set of 100 held-out starting states. From every state, we generate one factual rollout and three counterfactual rollouts over eight policy decisions.
We measure three metrics. Composition and effectiveness are defined as in Table 1 and Appendix § 10 , with composition given as a percentage of the [ 0 , 255 ] [0,255] [ 0 , 255 ] pixel range. Unlike in Table 1 , we evaluate rollouts rather than single transitions, because the CWM generates its branches autoregressively during policy training, so the inversion settings matter through how errors accumulate along a rollout. Composition is therefore averaged over the generated frames of the factual rollout, each generated from the previous generated frames, and its values are higher than for the single transitions of Table 1 . We also report failure, the percentage of generated frames with at least one missing or invented obstacle. We add it because a small obstacle can disappear while changing the average pixel error only slightly.
As shown in Table 7 , increasing from five to ten DDIM steps reduces the composition error from 0.371% to 0.197% and failure from 34.4% to 9.9%. Twenty steps further reduce these errors but require 1.86× the runtime of ten steps. We find that increasing the guidance scale beyond 1.0 provides no meaningful improvement in effectiveness, which is already nearly perfect, and increases both errors. Given the computational cost of running the CWM repeatedly during policy training, we use ten DDIM steps and a guidance scale of 1.0 as the best quality–runtime trade-off.
Table 7. Impact of diffusion inversion steps and guidance scale.
Factual action information in counterfactuals. While exact diffusion inversion would recover latent noise independent of the action underlying the factual (§ 3.1 ), and therefore yield unbiased policy gradient estimate in RLB (Proposition 8), diffusion inversion is not exact in practice, which means the information of the action can leak into the baseline and introduce bias (Proposition 10). To test if this happens in practice, we train a small nonlinear action classifier to predict the factual action from the inverted noise, and also the generated counterfactual. By training an action classifier on the inverted noise using 600 training data, 300 validation data, and 3,000 unseen test data, we find that the factual action is recoverable with 98% test accuracy, whereas the chance level is 33%. Thus, the inverted latent does retain substantial information about the factual action.
While this may appear as inducing substantial bias in RLB, we remark that what matters for the bias is whether this information reaches the counterfactual branches, as Propositions 10 and 11 predict that the bias is bounded by the error of counterfactuals and their returns. Therefore, we additionally train the same classifier to predict the factual action from generated counterfactuals. For the same data, we draw a new action uniformly from three choices and generate the counterfactual from the inverted noise with this action. We then give the classifier the counterfactual, the last context frame, and the new action. Its test accuracy is 53.4 % ± 0.8 % 53.4\% \pm0.8\% 53.4% ± 0.8% over five seeds, no higher than the 54.8 % ± 0.6 % 54.8\% \pm0.6\% 54.8% ± 0.6% of a classifier that sees only the context frame and the new action5 . Thus, the classifier detects no information of factual action in the generated counterfactual beyond the context and new action, consistent with the small overall bias of RLB + CWM measured in Appendix § 11 .§ 1 .
Training cost. We measure end-to-end wall-clock time cost on NVIDIA RTX 3090 GPUs. Policy training times are measured by running each method for 100 updates on one GPU. They include environment simulation, policy optimization, and online WM or CWM inference. In terms of diffusion model evaluations, each policy update of RLOO + WM and RLB + CWM contains eight groups, each with one factual trajectory and three 20-step generated branches. Both methods therefore generate 480 frames per update, which requires 4,800 U-Net evaluations. RLB + CWM additionally uses ten DDIM diffusion inversion steps per frame, and inverts the 160 factual transitions, requiring 6,400 U-Net evaluations per update in total. The diffusion WM is trained once offline for 9,000 optimization steps using eight GPUs, which takes a modest time of 2 hours and 15 minutes. As shown in Table 8 , the simulator-based methods require approximately 7–8 minutes per 100 policy updates, whereas RLOO + WM and RLB + CWM require 58.9 and 75.0 minutes, respectively. As such, the empirical cost overhead of CWM compared to WM due to DDIM inversion is around 27%. We leave faster diffusion based on few-step distillation (Wan et al., [52 ] ) as future work.
Table 8. Wall-clock time cost of Dino model and policy training on RTX 3090 GPUs.
Linear key-to-door & task interleaving
To expand our experiments to more complex sequential environments, we leverage the linear key-to-door and task interleaving environments introduced by Mesnard et al. [30 ] , using the configurations of Meulmans et al. (2023). These environments require credit assignment across multiple intervening decisions and stochastic rewards. In addition to the main methods, we include actor-critic methods A2C and PPO, as well as COCOA-reward (Meulmans et al., [33 ] ), which learns how much each action contributes to each later reward, input-dependent baseline [28 ] which computes a baseline conditioned on future exogenous inputs, and Hindsight Mean Actor Critic (MAC) [45 ] , which computes state-action values conditioned on future exogenous inputs using exact dynamic programming and access to the environment dynamics.
Environments. In linear key-to-door, the agent traverses a sequence containing a key, stochastic distractor rewards, a door, and a terminal treasure. Collecting the treasure requires picking up the key and subsequently opening the door, while unrelated rewards are observed between these two decisions. In task interleaving, the agent makes choices in several contexts whose rewards are delayed and interleaved. In each context, it chooses between a rewarding and a non-rewarding object, but observes the outcome only when that context is revisited. Meanwhile, it may make choices and receive rewards in other contexts. The agent must therefore assign each delayed reward to the decision that produced it. We use the configuration of Meulemans et al. [33 ] with five contexts, two objects per context, at most three simultaneously open contexts, a maximum episode length of 100, and termination probability of 0.05. In both environments, the noise is not additive. In key-to-door, a distractor reward has a random value and is received only if the agent picks it up, and in task interleaving, the random placement of the objects decides which choice is rewarded.
Setup. We run five seeds for each method and report learning as a function of environment interactions. Each policy is evaluated over 512 episodes using stochastic action selection, which is 22,016 transitions in Key-to-Door, where every episode lasts 43 steps, and about 10,200 transitions in Task Interleaving, where episodes last 19.9 steps on average. In task interleaving, REINFORCE, RE-
INFORCE with a learned baseline, RLOO, A2C, PPO, simulator-based RLB, the input-dependent baseline, and Hindsight MAC use 32 factual trajectories per update. COCOA-reward, RLOO + WM, and RLB + CWM use eight factual trajectories per update and therefore perform approximately four times as many policy updates. We compare the methods through approximately 1M interactions. In key-to-door, simulator-based methods use eight factual trajectories per update, whereas RLOO + WM and RLB + CWM use two, each expanded into a group of m = 4 m = 4 m = 4 , and therefore perform about four times as many updates. We compare them through approximately 2M interactions. The task interleaving WM and CWM are trained offline on 39,672 training transitions collected using a separately trained reference policy. The key-to-door paired dataset contains 77,056 transitions, comprising 44,032 training transitions and 33,024 held-out validation and test transitions. Hindsight MAC additionally queries a white-box planner when computing its policy updates, using approximately 12 additional transitions per factual transition in key-to-door and 8.24 in task interleaving.
Results. In task interleaving, as shown in Figure 10 , RLB + CWM obtains 99.99 ± 0.01% success, and simulator-based RLB obtains 99.70 ± 0.36% at approximately 1M interactions. Both outperform the remaining methods. RLOO + WM reaches 93.58 ± 3.14%, compared with 82.01 ± 0.51% for RLOO, showing that policy learning with (counterfactual) world models improve environment interaction efficiency by replacing the branches in the group with imaginations.
Figure 10. Results for the task interleaving environment across five randomized trials.
In key-to-door, as shown in Figure 11 , RLB + CWM obtains the highest mean success 98.16 ± 0.70%, followed closely by PPO at 98.10 ± 1.91%. Simulator-based RLB reaches 95.83 ± 1.20%, while COCOA-reward exhibits considerably greater seed-to-seed variability.
Figure 11. Results for the linear key-to-door environment across five randomized trials.
For the remaining methods, the input-dependent baseline obtains 40.3 ± 18.8% in key-to-door and 82.8 ± 0.6% in task interleaving. Hindsight MAC obtains 12.8 ± 6.0% and 82.5 ± 0.4%, respectively, where we find that the requirement for an online white-box environment access for planning makes the method inefficient in terms of environment interaction efficiency.
Overall, these results show that RLB is effective in sequential credit assignment problems with complexity beyond bandits, and that a learned CWM can reduce the environment interactions required for learning long-term dependencies during policy learning, extending our findings in § 5 .
Sensitivity to the choice of SCMs
Different SCMs can induce the same MDP while coupling counterfactual outcomes differently. By Corollary 1, the choice does not bias RLB, but it can change its variance. We test the extent of this in the RiverSwim benchmark ([47 ] ), which has many compatible SCMs.
RiverSwim has six states in a row, and the agent starts in the leftmost one. It can swim left or right. Swimming left moves it left with probability 0.9 and keeps it in place with probability 0.1. Swimming right moves it right with probability 0.35, keeps it in place with probability 0.6, and moves it left with probability 0.05. Swimming left in the leftmost state gives a reward of 0.005, and swimming right in the rightmost state gives a reward of 1. All other rewards are zero. The agent must therefore give up the small nearby reward and swim against the current to reach the large one. Episodes last 40 steps, and the return is the sum of rewards discounted by γ = 0.99 \gamma= 0.99 γ = 0.99 per step.
We generate each transition from shared noise with two types of SCM. In both, a transition has three possible outcomes (move left, stay, move right), whose probabilities depend on the action. An inverse-CDF SCM draws a uniform number u ∈ [ 0 , 1 ] u \in[0, 1] u ∈ [ 0 , 1 ] , lists the three outcomes in a fixed order, splits [ 0 , 1 ] [0, 1] [ 0 , 1 ] into consecutive intervals whose lengths are their probabilities, and returns the outcome whose interval contains u u u . A Gumbel-max SCM [37 ] draws one Gumbel variable per outcome and returns the outcome with the largest sum of log probability and Gumbel variable.
All of these SCMs give the same transition probabilities, but they couple the outcomes of different actions differently. For example, with the order (left, stay, right), a small u u u gives “left” under both actions, whereas with the order (right, stay, left), a small u u u gives “right” under swimming right but “stay” under swimming left. We test all six orderings of the three outcomes. For inverse-CDF sampling, reversing an ordering gives the same coupling, so the six orderings give three distinct couplings. For Gumbel-max sampling, the Gumbel variables are exchangeable, so all six give the same coupling. We compare all of them with RLOO, which uses independent noise.
At a uniform, an intermediate, and a near-optimal policy, we estimate gradients using 400 batches of 64 groups with m = 4 m = 4 m = 4 , and compare them with the exact gradient. We also train five policy seeds for each ordering.
Figure 12 shows the results. Every estimated mean gradient has cosine similarity above 0.998 with the exact gradient, and the final return is similar (16.0445 for RLOO vs. about 16.0512 for RLB), allowing us to compare their variance in a controlled manner. Compared with RLOO, the shared-noise SCMs give no consistent variance reduction at the uniform policy (ratio 0.89–1.08), a small one at the intermediate policy (1.08–1.22×), and about a twofold one near the optimum (1.96–2.16×). Importantly, RLB remains unbiased under all tested SCMs, and the differences in variance reduction are small, indicating robustness to the choice of SCM.
Figure 12. Sensitivity to the choice of SCMs in RiverSwim.
A regime where RLB is predicted to not help
Appendix § 8 .13 shows that RLB can have a larger gradient variance than RLOO when the noise mostly interacts with the action rather than acting as shared luck. We test this prediction in a minimal one-step bandit with actions a ∈ { − 1 , 1 } a \in\{-1, 1\} a ∈ { − 1 , 1 } and return G = λ w + a ( u + μ ) G = \lambda w + a(u + \mu) G = λ w + a ( u + μ ) , where u u u and w w w are independent and uniform on { − 1 , 1 } \{-1,1\} { − 1 , 1 } . The noise u u u decides which action is better, so σ i n t e r = 1 \sigma_{\mathrm{inter}} = 1 σ inter = 1 . The noise w w w is luck shared by both actions, so σ l u c k = λ \sigma_{\mathrm{luck}} = \lambda σ luck = λ . The offset μ > 0 \mu> 0 μ > 0 makes a = 1 a = 1 a = 1 better on average. The policy is a sigmoid of one logit. We use groups of m = 4 m = 4 m = 4 and exact counterfactuals, which here share both u u u and w w w with the factual. For m = 4 m = 4 m = 4 , Appendix § 8 .13 predicts that RLB has the larger variance whenever σ l u c k < m − 2 + 2 / m σ i n t e r ≈ 1.58 \sigma_{\mathrm{luck}} < \sqrt{m - 2 + 2/m}\,\sigma_{\mathrm{inter}} \approx1.58 σ luck < m − 2 + 2/ m σ inter ≈ 1.58 .
We first estimate the gradient variance at the uniform policy with μ = 0.2 \mu= 0.2 μ = 0.2 , using 2 × 10 6 2 \times10^{6} 2 × 1 0 6 groups per estimator. Table 9 shows that, without luck, RLB has 3.45× the variance of RLOO. The ratio decreases as luck grows, equals 1.00 at λ = 1.58 \lambda= 1.58 λ = 1.58 , and falls to 0.35 at λ = 3 \lambda= 3 λ = 3 . The crossover thus matches the theory.
Table 9. Gradient variance of RLB relative to RLOO on interaction bandit. Values < 1 favor RLB.
We then train both estimators from the uniform policy with μ = 0.05 \mu= 0.05 μ = 0.05 , one group per update, and 2,000 SGD updates with learning rate 0.05 over 200 seeds. Intervals are 95% normal confidence intervals over seeds. Without luck, RLB reaches a probability of 0.835 ± 0.017 0.835 \pm0.017 0.835 ± 0.017 of choosing the better action, compared with 0.855 ± 0.007 0.855 \pm0.007 0.855 ± 0.007 for RLOO. RLB remains unbiased, but it learns slightly more slowly and varies more across seeds. With λ = 3 \lambda= 3 λ = 3 , the order reverses. RLOO drops to 0.790 ± 0.031 0.790 \pm0.031 0.790 ± 0.031 , whereas RLB is unchanged at 0.835 ± 0.017 0.835 \pm0.017 0.835 ± 0.017 , as the shared luck cancels within each group. These results confirm our findings across the main text and in Appendix § 8 .13 that RLB helps in settings where environmental complexity and luck dominate action in a consistent manner.