Temporal Difference Flows
Abstract
Predictive models of the future are fundamental for an agent's ability to reason and plan. A common strategy learns a world model and unrolls it step-by-step at inference, where small errors can rapidly compound. Geometric Horizon Models (GHMs) offer a compelling alternative by directly making predictions of future states, avoiding cumulative inference errors. While GHMs can be conveniently learned by a generative analog to temporal difference (TD) learning, existing methods are negatively affected by bootstrapping predictions at train time and struggle to generate high-quality predictions at long horizons. This paper introduces Temporal Difference Flows (TD-Flow), which leverages the structure of a novel Bellman equation on probability paths alongside flow-matching techniques to learn accurate GHMs at over 5× the horizon length of prior methods. Theoretically, we establish a new convergence result and primarily attribute TD-Flow's efficacy to reduced gradient variance during training. We further show that similar arguments can be extended to diffusion-based methods. Empirically, we validate TD-Flow across a diverse set of domains on both generative metrics and downstream tasks including policy evaluation. Moreover, integrating TD-Flow with recent behavior foundation models for planning over pre-trained policies demonstrates substantial performance gains, underscoring its promise for long-horizon decision-making.
Motivation
World models enable agents to reason and plan by simulating future states, but standard one-step dynamics models must be unrolled sequentially at inference time—causing small single-step inaccuracies to compound rapidly over long horizons.
Geometric Horizon Models (GHMs), or -models, sidestep inference-time compounding error by directly learning a generative model of a policy’s normalized successor measure , the -discounted distribution of future states visited by :
Because satisfies the off-policy Bellman equation and maps any reward function to action-values via , GHMs can be trained off-policy with temporal-difference (TD) bootstrapping. In practice, however, naive generative TD methods (GANs, VAEs, and standard flow or diffusion models) suffer from bootstrapping instability and high gradient variance, breaking down beyond horizons of 20–50 steps.
Method
Flow Matching constructs a time-dependent probability path for transporting a simple prior to the target distribution via a neural ODE . To learn off-policy from one-step transitions , we introduce three progressively more structured TD-Flow algorithms:
- TD-CFM: Draws a bootstrapped endpoint and constructs a fresh conditional path . Re-sampling independent noise discards the ODE correspondence and creates crossing paths.
- Coupled TD-CFM (): Preserves the natural endpoint coupling between the initial noise and its bootstrapped ODE sample , interpolating directly along to align conditional paths and lower transport cost.
- -CFM: Exploits the linearity of the Bellman operator to decompose the target probability path into two separate flows—a standard conditional flow-matching term on one-step transitions and a bootstrapped velocity term that integrates the target ODE only up to time () and regresses directly onto the target velocity field :

Figure 1. Visual depiction of TD-Flow variants. Dashed lines show the neural ODE trajectory and solid lines show conditional probability paths. TD-CFM creates crossing paths by resampling noise; Coupled TD-CFM aligns the endpoints (X₀, X₁); TD²-CFM solves the ODE up to time t to regress directly onto the target velocity field.
Extension to Denoising Diffusion (-DD). Using the Fokker-Planck equation for mixtures of diffusion processes, the same principle extends directly to score-based diffusion models: one-step transitions use the standard denoising score-matching target, while bootstrapped transitions regress directly onto the target network’s score (or noise) prediction along the reverse SDE trajectory.
Convergence and Variance Reduction
Theoretical analysis explains both why TD-Flow converges and why -CFM dramatically outperforms naive bootstrapping at long horizons:
- Bellman operator on probability paths: At every flow time , TD-CFM, TD-CFM(C), and -CFM all implement the update , where . is a -contraction in -Wasserstein distance whose unique fixed point matches the Monte-Carlo Conditional Flow Matching path.
- Reduced gradient variance: Comparing unbiased sample-based gradient estimators shows that TD-CFM and TD-CFM(C) incur an additional computational variance term proportional to relative to -CFM—growing sharply as . With non-intersecting straight conditional paths, TD-CFM(C) matches -CFM’s variance, whereas on curved paths TD-CFM(C) incurs extra variance while -CFM remains unaffected.
Key Results
We benchmark TD-Flow and TD-Diffusion variants against modern relativistic GAN and -VAE baselines on 10M off-policy ExoRL transitions spanning 22 tasks across four DeepMind Control Suite domains (Pointmass Maze, Walker, Cheetah, and Quadruped).
Horizon Scaling and Single-Policy Evaluation
Evaluating effective horizons on the Pointmass Loop task confirms our variance analysis: while TD-VAE, TD-GAN, TD-DD, and vanilla TD-CFM deteriorate rapidly as the horizon grows, -CFM and -DD remain stable—improving value-function MSE by nearly four orders of magnitude at horizon 100.

Figure 2. Scaling effective horizon on Pointmass Loop. Value-function prediction MSE across effective horizons from 5 to 100 (γ from 0.8 to 0.99). Both TD²-CFM and TD²-DD stay robust out to effective horizon 100, outperforming naive baselines by nearly four orders of magnitude.
Across all four domains at (horizon 100), -CFM achieves a reduction in value-function MSE, reduction in Earth Mover’s Distance, and improvement in normalized negative log-likelihood relative to TD-CFM. Consistent with theory, TD-CFM(C) performs comparably with straight linear paths but degrades substantially when switched to curved sinusoidal paths, whereas -CFM preserves—and slightly improves—its accuracy.
Planning via Generalized Policy Improvement
To test downstream long-horizon decision-making, we train policy-conditioned GHMs over reward embeddings learned by a pre-trained Forward-Backward (FB) behavior foundation model. At test time, we perform Generalized Policy Improvement (GPI) by evaluating 256 candidate policies with samples from :

Figure 3. Planning via Generalized Policy Improvement (22 tasks, 4 domains). Coupled TD-CFM and TD²-CFM consistently improve zero-shot FB policies by +29% to +36% across all policy-sampling distributions, whereas FB’s own value-function GPI degrades performance on average.
Across all three embedding-sampling distributions (Random, Train Distribution, and Local Perturbation), flow-based GPI with Coupled TD-CFM and -CFM delivers to return improvements over zero-shot FB policies with minimal sensitivity to the sampling distribution—whereas FB-GPI degrades performance (-57%, -59%, -38%) due to value-estimation errors over out-of-distribution policies.
Citing
To cite this paper, please use the following reference:
@inproceedings{farebrother25tdflow,
title = {Temporal Difference Flows},
author = {
Farebrother, Jesse and Pirotta, Matteo and Tirinzoni, Andrea
and Munos, Rémi and Lazaric, Alessandro and Touati, Ahmed
},
year = 2025,
booktitle = {International Conference on Machine Learning (ICML)},
}