Safe Flow Q-Learning: Offline Safe Reinforcement Learning with Reachability-Based Flow Policies and Conformal Prediction

Mumuksh Tayal, Manan Tayal, Ravi Prakash

In the world of robotics and autonomous systems, "learning from experience" is often too dangerous to do in the real world. This has led to the rise of Offline Reinforcement Learning (RL), where agents learn from pre-collected, static datasets. However, two major hurdles remain: ensuring the agent never violates "hard" safety constraints (like crashing) and making sure the resulting policy is fast enough to run on real-time hardware.

A new paper from researchers at the Indian Institute of Science (IISc) introduces Safe Flow Q-Learning (SafeFQL), a framework designed to tackle both problems at once.

TL;DR

SafeFQL is an offline RL framework that achieves state-of-the-art safety by combining reachability-based safety critics with expressive flow-matching policies. By distilling complex generative models into a one-step actor and using conformal prediction to calibrate safety margins, it delivers high-performance control that is 2.5x faster than diffusion-based alternatives.

What Problem Does This Paper Address?

Most "safe" RL methods use soft constraints, often via Lagrangian multipliers. This approach treats safety like a budget: it’s okay to fail occasionally as long as the average cost is low. In safety-critical applications—like a boat navigating a rocky river—a single failure is unacceptable.

Furthermore, recent high-performance offline RL methods use generative models (like diffusion) to represent complex behaviors. While these models are great at capturing the nuances of a dataset, they are computationally expensive. They require multiple "denoising" steps to produce a single action, which creates too much latency for high-frequency control loops.

Methods

SafeFQL introduces a multi-stage pipeline to bridge the gap between safety, expressivity, and speed:

  1. Reachability-Based Critics: Instead of measuring "expected cumulative cost," SafeFQL uses Hamilton-Jacobi (HJ) reachability. It learns a safety value function that represents the worst-case safety margin along a future trajectory. If the value is negative, the state is predicted to be safe for the foreseeable future.
  2. Flow Matching & Distillation: The researchers use a "Flow Matching" teacher to model the complex distribution of actions in the dataset. To solve the latency issue, they distill this teacher into a "one-step" student actor. This student can output an action in a single forward pass, eliminating the need for iterative sampling at deployment.
  3. Feasibility-Gated Objective: Rather than balancing reward and safety with a weighted sum (which can lead to a "tug-of-war" during training), SafeFQL uses a binary gate. If an action is predicted to be unsafe, the optimizer ignores rewards entirely and focuses solely on returning to the safe region.
  4. Conformal Prediction Calibration: Because neural networks aren't perfect, the learned safety boundary might be slightly off. SafeFQL uses Conformal Prediction—a statistical tool—to calculate a safety "buffer" ($\delta$) based on a held-out calibration set. This provides a probabilistic guarantee that the agent will remain safe even with finite data errors.

Datasets

The authors evaluated SafeFQL on two main benchmarks:

  • Safe Boat Navigation: A custom 2D environment where a point-mass boat must navigate a river with variable drift and avoid circular obstacles.
  • Safety Gymnasium (MuJoCo): A standard suite of high-dimensional tasks (HalfCheetah, Hopper, Ant, Walker2D, and Swimmer) where the agent must maximize reward while keeping its velocity below a strict threshold.

Key Insights and Ideas

  • The Power of the Gate: The "exclusive-gate" mechanism is a major departure from standard Lagrangian methods. By prioritizing safety as a hard switch rather than a penalty term, the authors found the training process much more stable and less sensitive to hyperparameter tuning.
  • Expressivity without Latency: The paper proves that you don't have to choose between a "smart" policy (generative) and a "fast" policy (one-step). Distillation allows the agent to retain the multimodal modeling capabilities of flow matching while running at the speed of a standard MLP.
  • Uncertainty is a Feature: By incorporating Conformal Prediction, the authors acknowledge that "safe" is a relative term when learning from limited data. This calibration step makes the safety boundary explicitly uncertainty-aware.

Key Results

  • Superior Safety: In the Boat Navigation task, SafeFQL achieved zero collisions, whereas many baselines (like BEAR-Lag or CPQ) struggled to maintain safety while moving toward the goal.
  • Efficiency: SafeFQL achieved a 2.5x inference speedup over diffusion-based baselines (like FISOR).
  • Sampling Efficiency: Unlike other generative methods that require "rejection sampling" (generating 16+ actions and picking the best one), SafeFQL works optimally with just one action sample ($N=1$).
  • Performance: Across MuJoCo tasks, SafeFQL matched or exceeded the rewards of the best-performing baselines while consistently maintaining the lowest violation rates.

Limitations and Future Work

The authors note that they currently use a hard indicator mask in their loss function. While effective, this can create a "non-smooth" loss landscape that might make training tricky in some environments. They suggest that future work could explore continuous masking functions or "soft" relaxations to improve stability without sacrificing the strict priority of safety.

Additionally, while the conformal prediction provides probabilistic guarantees, these are currently "marginal" guarantees. Moving toward "conditional" guarantees (safety for specific, difficult states) remains an open research direction.

Summary updated

BibTeX
@inproceedings{tayal2026safe,
  author = {Mumuksh Tayal and Manan Tayal and Ravi Prakash},
  title = {{Safe Flow Q-Learning: Offline Safe Reinforcement Learning with Reachability-Based Flow Policies and Conformal Prediction}},
  booktitle = {AIWILD @ ICML},
  year = {2026},
  url = {https://openreview.net/forum?id=glZK5wks9X},
}
Figure