$\varphi$TD: Distributional Reinforcement Learning using Characteristic Functions

Thomas Mousseau, Tyler Kastner, Davide Baldelli, Amir-massoud Farahmand

TL;DR

In reinforcement learning, knowing the entire probability distribution of future rewards is vastly richer than just knowing the average. However, existing methods have been mathematically handcuffed, forced to approximate these distributions using rigid, simplified histograms or fixed-weight particles. By taking a detour into the frequency domain via Fourier transforms, $\varphi$TD breaks these handcuffs—unifying existing algorithms and letting agents effortlessly learn smooth, continuous mixtures like Gaussians or Gammas.

What Problem Does This Paper Address?

Standard Reinforcement Learning (RL) teaches an agent to predict its expected future reward—a single, average number. Distributional RL upgrades this by modeling the entire probability distribution of returns, capturing uncertainty, multimodality, and risk.

There is, however, a mathematical catch. As an agent learns via the Bellman equation, its target distribution gets shifted (by immediate rewards) and scaled (by a discount factor). When this happens, the new distribution almost always falls outside the parametric family the neural network can represent. To keep learning moving, algorithms must force the target back into a valid shape using a mathematical "projection."

In standard probability space (the spatial domain), closed-form projections are notoriously hard to derive. To keep the math tractable, classic algorithms compromise by freezing one degree of freedom:

  • Categorical methods (like C51) lock atom locations onto a fixed grid and only learn their probability weights.
  • Quantile methods (like QR-DQN) lock probability weights to be uniform and only learn their locations.

Because of this spatial projection bottleneck, we couldn't jointly optimize both locations and weights, nor could we easily model continuous mixtures (like a Mixture of Gaussians).

Methods

When an equation is stubborn in normal space, a classic physicist’s trick is to take its Fourier transform. In probability theory, the Fourier transform of a distribution is called its characteristic function (CF), $\varphi(\omega) = \mathbb{E}[e^{i\omega Z}]$, which uniquely maps any distribution into the frequency domain.

The authors introduce $\varphi$TD, an algorithm that computes temporal-difference (TD) errors directly between characteristic functions rather than spatial distributions.

  • Implicit Cramér Projection: They use a specific distance metric in frequency space weighted by $1/\omega^2$. Crucially, they prove this frequency loss is mathematically identical to the squared Cramér distance (the $L_2$ distance between cumulative distribution functions) in spatial space. Taking a simple gradient step on this loss implicitly projects the target distribution onto whatever parametric family your network outputs—no closed-form spatial projection required!
  • Tractable Sampling: Integrating over all frequencies from $-\infty$ to $\infty$ is impossible in practice. Instead, $\varphi$TD approximates the integral via Monte Carlo sampling. Notably, if you sample frequencies from a $\text{Pareto}(1, x_m)$ distribution, its probability density naturally decays at $1/\omega^2$, effortlessly baking the required mathematical weighting right into the sampling process (they also explore an explicitly weighted Exponential sampling variant).
  • Plug-and-Play Families: Any distribution or mixture with a closed-form CF (Dirac particles with free weights and locations, Gaussians, Gammas, Laplaces, Cauchys) can now be dropped into a deep RL network without changing the loss function.

Datasets

Because RL generally evaluates on interactive environments rather than static datasets, the authors test $\varphi$TD across two setups:

  • Controlled Synthetic Contextual Bandit: A newly constructed offline supervised benchmark where 5D Gaussian states map to four actions, each triggering a distinct ground-truth reward distribution (Gaussian, Cauchy mixture, Gaussian mixture, or skewed Gamma).
  • Deep RL Benchmarks: Four MinAtar games (Asterix, Breakout, Freeway, SpaceInvaders over 10M steps) and Craftax (a complex, Crafter/NetHack-inspired survival environment evaluated over 1 billion steps), built atop the GPU-vectorized Parallel Q-Network (PQN) architecture.

Key Insights and Ideas

  • A Grand Unification: $\varphi$TD doesn't just add new distributions; it unifies old ones. When restricted to fixed-grid or uniform-weight particles, $\varphi$TD’s convergence points match Categorical TD and Quantile TD (QTD).
  • A Smooth Surrogate for Quantiles: Even more surprisingly, the expected gradient updates of $\varphi$TD on quantile families match QTD's trajectory step-for-step. Because standard QTD relies on non-smooth subgradients (which are notoriously tricky to analyze), $\varphi$TD acts as a smooth, differentiable surrogate for quantile learning.
  • The Expressivity Tradeoff: Freeing up both particle locations and weights ($\mathcal{F}_m$) reduces approximation error (the model can fit weirder shapes), as seen in the synthetic tests. However, with finite data, extra degrees of freedom can bump up estimation error (harder to fit reliably), reminding us there is no free lunch in parameterization.

Key Results

In the controlled bandit benchmark, $\varphi$TD variants consistently matched or beat spatial baselines in reconstructing ground-truth distributions:

Quantitative comparison of distributional algorithms in the offline contextual bandit setting.
  • Synthetic Precision: Unconstrained Dirac mixtures ($\varphi$TD-Dirac) achieved the lowest Cramér error on Gaussian ($0.0046$ vs. QTD's $0.0096$) and Gamma ($0.0038$ vs. QTD's $0.0136$) targets, while $\varphi$TD-Qt excelled on Cauchy ($0.0102$) and Gaussian mixtures ($0.0086$). Meanwhile, $\varphi$TD-Cat closely mirrored standard CTD across all metrics, empirically confirming their theoretical equivalence.
  • Scaling to 1B Steps: On MinAtar and Craftax, continuous mixtures like $\varphi$TD-Gaussian and $\varphi$TD-Gamma performed competitively with or outperformed the strong PQN baseline, reaching ~35 mean episodic return on Craftax at 1B steps (matching PQN-RNN and beating categorical/Cauchy variants which hovered between 20–26).

Limitations and Future Work

  • Parameter Allocation Dilemmas: With new freedom comes new hyperparameter headaches. If you have a budget of $2m$ neural network outputs, is it better to use $2m$ fixed-grid categorical bins, or $m$ unconstrained particles with both weights and locations? Systematic guidelines for choosing families don't exist yet.
  • Non-Convexity: Moving beyond simple categorical grids into general mixtures makes the optimization landscape non-convex, complicating formal convergence proofs. Proving under which exact conditions general parametric families converge remains an open theoretical frontier.

Summary updated

Abstract

Distributional Reinforcement Learning methods aim to learn the entire distribution of returns, yet current algorithmic approaches are limited to a narrow class of distributions. We propose $\varphi$TD, a method to overcome this limitation by computing the loss in the frequency domain. We demonstrate that this further unifies quantile and categorical approaches to distributional RL, and enables the learning of distributions that were previously impossible to capture, such as mixtures of continuous distributions. We empirically study $\varphi$TD across synthetic benchmarks and large-scale deep RL environments and demonstrate that the flexibility obtained from wider parametric families can lead to improved performance.
BibTeX
@inproceedings{mousseau2026varphi,
  author = {Thomas Mousseau and Tyler Kastner and Davide Baldelli and Amir-massoud Farahmand},
  title = {{$\textbackslash\{\}varphi$TD: Distributional Reinforcement Learning using Characteristic Functions}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=BJHnl3nENy},
}
Figure