Flow Matching for Offline Reinforcement Learning with Discrete Actions

Fairoz Nower Khan, Nabuat Zaman Nahim, Ruiquan Huang, Haibo Yang, Peizhong Ju

TL;DR

Generative models like flow matching have revolutionized offline reinforcement learning, but only when actions are smooth and continuous—like applying torque to a robot joint. This paper introduces Q-weighted Discrete Flow Matching (QDFM), swapping out smooth differential equations for discrete probability "jumps" so agents can master distinct, categorical decisions. Better yet, a single QDFM policy can preserve multiple winning strategies at once, adapt on the fly to shifting user preferences, and coordinate entire teams of agents without choking on combinatorial math.

What Problem Does This Paper Address?

In offline reinforcement learning (RL), an agent has to learn a winning strategy purely from a static dataset of past experiences—no trial-and-error in the real world allowed. Recently, researchers started using generative models (specifically diffusion and flow matching) to model policies, allowing agents to capture complex, diverse behaviors from messy datasets.

Here’s the catch: standard flow matching relies on ordinary differential equations (ODEs) that smoothly push probability mass through continuous Euclidean space using action gradients. When your action space is discrete—go left, go right, cast a spell, pick a token—derivatives with respect to actions simply do not exist, and the math breaks down. Worse, if you try to force a continuous model onto discrete choices, it tends to average or interpolate between distinct good strategies. Imagine standing in front of a pit of lava where going sharp left or sharp right both lead to treasure; averaging those two paths walks you straight into the trap.

Continuous interpolation between two valid discrete paths can cause catastrophic mode collapse straight into an unobserved trap.

Methods

To bring flow matching into the discrete world, the authors replace continuous ODE velocity fields with a Continuous-Time Markov Chain (CTMC)—building on recent Discrete Flow Matching techniques. Instead of smoothly sliding through space via derivatives, probability mass moves across discrete actions via sudden "jumps." The neural network learns a time-dependent transition rate matrix (governed by the Kolmogorov forward equation) that dictates how likely an action is to jump to another action as virtual time ticks from $t=0$ to $t=1$.

What’s new here is how the authors steer these jumps toward high rewards, creating QDFM:

  • Three-Phase Q-Weighted Training: First, the model warms up by learning to mimic the raw dataset's behavior. Second, a critic network learns the expected reward ($Q$-value) of actions. Third, the flow model iteratively improves by generating candidate endpoint actions and reweighting its training loss by $\exp(\hat{\beta} Q)$, effectively pulling probability jumps toward high-value actions without needing auxiliary classifier networks.
  • Preference Conditioning: The framework is built natively for multi-objective RL. By feeding random preference vectors (weights over competing goals) into the network during training, a single trained model can shift strategies at test time just by turning a preference dial.
  • Multi-Agent Factorization: In multi-agent games, joint action spaces explode exponentially. QDFM tames this using a factorized path where transitions happen as asynchronous single-agent updates (paired with QMIX value mixing), scaling linearly with the sum of agent actions rather than their product.

At inference time, picking an action just means sampling a starting guess and running a fast, discrete-time Euler simulation of these Markov jumps from $t=0$ to $1$.

Datasets

The authors evaluate QDFM across four distinct benchmark suites (no new benchmarks are introduced, though continuous benchmarks are adapted via quantization):

  • 4-Goal Multimodal Gridworld: A synthetic discrete navigation task with four equally rewarding goals to test mode coverage.
  • Discretized MuJoCo (from Minari): Standard continuous locomotion tasks (HalfCheetah, Hopper, Walker2d across Expert and Medium datasets) where continuous actions are quantized into $K_{\text{act}} = 256$ discrete bins.
  • Multi-Objective Benchmarks: Discrete Deep Sea Treasure (2 objectives) and Resource Gathering (3 objectives), plus MO-Hopper from the D4MORL suite.
  • StarCraft Multi-Agent Challenge (SMAC): Offline multi-agent micromanagement battles (2s3z and 5m_vs_6m across expert, medium, medium-replay, and poor datasets).

Key Insights and Ideas

  • Why generative discrete policies matter: Standard RL baselines pick actions deterministically, meaning if a dataset has four equally great ways to solve a puzzle, they collapse onto just one. QDFM preserves the entire landscape of good ideas, which is vital for tasks like multi-route planning.
  • Exact theoretical grounding without gradients: Even without continuous action derivatives, the authors prove that their tractable Q-weighted conditional loss has the exact same gradient as an intractable guided marginal objective. Under idealized single-step oracle conditions, it provably recovers the optimal KL-regularized Boltzmann policy.
  • One model, whole Pareto front: Instead of training a dozen separate RL agents for different trade-offs (e.g., speed vs. fuel), conditioning the CTMC jump rates on preference vectors lets one model smoothly span diverse Pareto-optimal behaviors.

Key Results

  • Perfect Mode Coverage: On the 4-goal gridworld, strong offline RL baselines (CQL, AWAC, BCQ) achieve similar average returns to QDFM, but suffer from mode collapse (mode coverage of 0.00 to 0.25). QDFM captures all four strategies (1.00 mode coverage).
On a 4-goal gridworld, standard offline RL baselines collapse onto a single route, whereas QDFM preserves all four optimal modes.
  • Competitive Quantized Control & Speed: On 256-bin MuJoCo, QDFM matches or beats top discrete baselines on Hopper (37.79 Medium, 17.74 Expert) and Walker2d (14.01 Medium, 4.85 Expert), though it trails on HalfCheetah (6.02 Medium vs. IQL's 22.83). Generating an action takes 6.32ms—slower than a single forward pass, but substantially faster than reported continuous diffusion (55.86ms–75.05ms) and optimal-transport (27.26ms) policies.
  • Multi-Objective Diversity: On Deep Sea Treasure, scalarized CQL collapses to 1 solution, while a single QDFM model recovers 15 distinct non-dominated solutions (0.90 hypervolume ratio). On MO-Hopper, QDFM reaches 98.88% of the dataset's Pareto upper bound, beating MODULI (96.02%).
  • Multi-Agent Scale: On SMAC, QDFM achieves competitive or top returns, including 17.06 on 2s3z (medium-replay) and 6.94 on 5m_vs_6m (medium-replay).

Limitations and Future Work

  • Inference Overhead: Because selecting an action requires simulating a Markov jump process over multiple Euler steps, QDFM is noticeably slower at test time than standard single-pass categorical policies.
  • Theory-Practice Gap: The exact Boltzmann policy recovery guarantee applies to an idealized single step from a fixed behavior policy. The actual algorithm iteratively resamples endpoints from its own evolving policy, meaning global convergence for the multi-step loop isn't theoretically guaranteed.
  • Quantization Quirks: Discretizing continuous MuJoCo tasks introduces high variance (tiny policy shifts can flip bins abruptly), and the authors note that QDFM's weaker showing on HalfCheetah hasn't been causally isolated yet.
  • Next Steps: The authors point toward validating multimodal advantages on much larger, complex domains and scaling QDFM up to massive discrete action spaces—most notably language model token selection.

Summary updated

Abstract

Generative policies based on diffusion models and flow matching have shown strong promise for offline reinforcement learning (RL), but their applicability remains largely confined to continuous action spaces. To address a broader range of offline RL settings, we extend flow matching to a general framework that supports discrete action spaces with multiple objectives. Specifically, we replace continuous flows with continuous-time Markov chains, trained using a Q-weighted flow matching objective. We then extend our design to multi-agent settings, mitigating the exponential growth of joint action spaces via a factorized conditional path. For an oracle single policy-improvement step from the behavior distribution, we theoretically show that, under idealized conditions, the Q-weighted objective recovers the KL-regularized Boltzmann policy. Extensive experiments demonstrate that our method performs robustly across diverse settings and benchmarks, including high-dimensional control, multi-agent games, and dynamically changing preferences over multiple objectives, while achieving competitive performance and demonstrating advantages in multimodal decision-making and preference-conditioned policy representation. Our discrete framework can also be applied to continuous-control problems through action quantization, providing a flexible trade-off between representational complexity and performance.
BibTeX
@inproceedings{khan2026flow,
  author = {Fairoz Nower Khan and Nabuat Zaman Nahim and Ruiquan Huang and Haibo Yang and Peizhong Ju},
  title = {{Flow Matching for Offline Reinforcement Learning with Discrete Actions}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=ImlV9V1zY1},
}
Figure