Introduction
A flow policy produces an action chunk by integrating a learned velocity field from Gaussian noise in a few Euler steps. Pretrained by imitation, the policies of this task are well short of solving their tasks: the pretrained policy has a success rate of 0.280 on Square-MH, 0.363 on ToolHang-PH and 0.090 on Transport-MH. The question is which policy-improvement operator, given the reward and a fixed budget of online environment steps, raises the deployed policy's success fastest and furthest.
Three properties of the problem shape our answer.
A flow policy has no tractable likelihood. Likelihood-ratio methods therefore need surrogates [1, 2, 3], and differentiating through the sampler gives a long, badly conditioned chain. The remaining signal is the critic's action gradient, which Q-gradient methods for flow policies turn into a target for the velocity field [4, 5].
Before the first success the critic has nothing to be right about. When success is the reward, a replay buffer that holds only failures teaches the critic a flat or arbitrary landscape, and a policy that follows its gradient moves away from the pretrained flow without any reason to. With a frozen anchor to the pretrained flow, such early drift is also hard to undo.
What is measured is the deployed policy along the whole budget. The AUC accumulates the deployed policy's success over training, so a method that is idle for a long critic warm-up, or that delivers its first fine-tuned policy late, pays for it even if its final policy is good.
Method
Our starting point is QF3 [5], implemented as an override of the actor update of the OGPO codebase [6]: the run began from the task's own QF3 reference wrapper and changed it from there. The submitted file replaces the starter's OGPO+CA configuration entirely.
The base operator: a clipped one-step critic query
For a replay chunk , noise and we form , the policy's velocity , and its departure from the straight-line velocity that reproduces the replay action, . The critic is queried at a one-step endpoint whose departure is clipped,
so critic gradients reach only inside a box around executed actions. The QF3 objective is
where bars over quadratic terms denote the masked, dimension-normalised mean over the chunk and is the pretrained flow's velocity at the same point. The ensemble value is the minimum over the critic heads by default; the code also offers a mean, a median and a one-standard-error lower bound , chosen per setting.
rng, k_eps, k_tau = jax.random.split(rng, 3)
eps = jax.random.normal(k_eps, a_buf.shape)
tau = jax.random.uniform(k_tau, (B, 1))
x_tau = (1.0 - tau) * eps + tau * a_buf
u_buf = a_buf - eps
enc = self._actor_is_encoded()
v = self.actor_network.select("actor")(actor_obs, x_tau, tau, params=grad_params, is_encoded=enc)
alpha = self.config["qf3_alpha"]
delta = v - u_buf
x1 = a_buf + (1.0 - tau) * jnp.clip(delta, -alpha, alpha)
c_obs = self._encode_for_critic(self._get_critic_obs(batch), images=self._get_critic_images(batch))
qs = self.critic_network.select("critic")(
c_obs, x1, is_encoded=self._critic_is_encoded())
q_mean = qs.mean(axis=0)
q_std = jnp.sqrt(jnp.mean(jnp.square(qs - q_mean[None]), axis=0) + 1e-6)
q_mode = self.config.get("qf3_actor_q_agg", "min")
if q_mode == "mean":
q = q_mean
elif q_mode == "se":
# Standard-error pessimism is invariant to ensemble size and
# converges to the TD target as independent heads agree.
q = q_mean - q_std / jnp.sqrt(jnp.asarray(qs.shape[0], jnp.float32))
elif q_mode == "median":
q = jnp.median(qs, axis=0)
else:
q = qs.min(axis=0)
q_loss = -q.mean()
cfm = apply_chunking_mask(jnp.square(delta), valid, B, H, A, chunk)
v_base = self.actor_network.select("actor")(actor_obs, x_tau, tau, params=self.pi_slow_params, is_encoded=enc)
base = apply_chunking_mask(jnp.square(v - jax.lax.stop_gradient(v_base)), valid, B, H, A, chunk)
total = q_loss + LAMBDA_CFM * cfm + LAMBDA_BASE * baseThe anchor never moves: the slow parameters are frozen at the pretrained flow and their update is disabled.
def pi_slow_update(self, network):
return # the base-policy anchor stays at the pretrained flow
def reset_optimizers_with_lr(self):
agent = super().reset_optimizers_with_lr()
frozen = jax.tree_util.tree_map(lambda x: jnp.array(x), agent.actor_network.params)
return agent.replace(pi_slow_params=frozen)Pulling the flow toward successful chunks
The first addition is QF3+'s success term, also a baseline of this task. On a batch drawn from successful trajectories, with fresh built the same way,
This is conditional flow matching on the policy's own successes, a critic-independent route from a discovered success back into the flow, close in spirit to self-imitation [7].
def actor_loss(self, batch, batch_success, grad_params, success_flag, rng):
total, info = super().actor_loss(batch, batch_success, grad_params, success_flag, rng)
chunk = self.config["action_chunking"]
H, A = self.config["horizon_length"], self.config["action_dim"]
a_buf = preprocess_actions(batch_success, chunk)
a_buf = self._terminal_mask_actions(a_buf, batch_success, chunk)
B = a_buf.shape[0]
valid = batch_success.get("valid", jnp.ones((B, H)))
obs = batch_success["observations"]
obs_enc = self._encode_for_actor(obs, images=batch_success.get("images"), params=grad_params)
actor_obs = obs_enc if self._actor_is_encoded() else obs
_, k_eps, k_tau = jax.random.split(rng, 3)
eps = jax.random.normal(k_eps, a_buf.shape)
tau = jax.random.uniform(k_tau, (B, 1))
x_tau = (1.0 - tau) * eps + tau * a_buf
target = a_buf - eps
enc = self._actor_is_encoded()
pred = self.actor_network.select("actor")(
actor_obs, x_tau, tau, params=grad_params, is_encoded=enc)
success_cfm = apply_chunking_mask(jnp.square(pred - target), valid, B, H, A, chunk)
coeff = self.config.get("qf3_success_coeff", 100.0)
total = total + jnp.asarray(success_flag, jnp.float32) * coeff * success_cfm
info = dict(info, qf3_success_cfm=success_cfm)
return total, infoFlow matching on replay, ranked by the critic
The clipped critic gradient is zero for a replay point whose velocity departure already lies outside the box, so a replay action the critic rates highly may never move the policy. Our second addition gives such actions a path that does not go through the gradient. For each replay chunk we take the ensemble-mean value , centre it at the batch median , scale it by the mean absolute deviation , and form a bounded Boltzmann weight,
with all of , and held out of the gradient. The term is a weighted flow-matching loss toward the replay actions,
a robust, clipped form of advantage-weighted regression [8] applied to the velocity field. Normalising by median and mean absolute deviation makes the weight nearly invariant to the scale and offset of the critic, and the double clip keeps a single overestimated chunk from dominating the batch.
c_obs = self._encode_for_critic(
self._get_critic_obs(batch), images=self._get_critic_images(batch))
qs = self.critic_network.select("critic")(
c_obs, a_buf, is_encoded=self._critic_is_encoded())
q = qs.mean(axis=0)
center = jax.lax.stop_gradient(jnp.median(q))
scale = jax.lax.stop_gradient(jnp.mean(jnp.abs(q - center)) + 1e-3)
weights = jax.lax.stop_gradient(jnp.clip(
jnp.exp(jnp.clip((q - center) / scale, -2.0, 2.0)), 0.25, 4.0))
obs = batch["observations"]
obs_enc = self._encode_for_actor(
obs, images=batch.get("images"), params=grad_params)
actor_obs = obs_enc if self._actor_is_encoded() else obs
_, k_eps, k_tau = jax.random.split(rng, 3)
eps = jax.random.normal(k_eps, a_buf.shape)
tau = jax.random.uniform(k_tau, (B, 1))
x_tau = (1.0 - tau) * eps + tau * a_buf
pred = self.actor_network.select("actor")(
actor_obs, x_tau, tau, params=grad_params, is_encoded=self._actor_is_encoded())
per = jnp.square(pred - (a_buf - eps))
if chunk:
per = jnp.reshape(per, (B, H, A))
ranked_cfm = jnp.mean(per * valid[..., None] * weights[:, None, None])
else:
ranked_cfm = jnp.mean(per * weights[:, None])
coeff = self.config.get("qf3_ranked_cfm_coeff", 1.0)
if self.config.get("qf3_rank_gate_success", False):
coeff = coeff * jnp.asarray(success_flag, jnp.float32)
total = total + coeff * ranked_cfmHolding the pretrained flow still until a success exists
The third addition is a gate. Where it is enabled, the coefficient is multiplied by the success flag, and the QF3 critic term and its small flow-matching term are subtracted back out of the loss while no success batch is available:
Before the first success the only active term is therefore the anchor, whose gradient vanishes at the pretrained parameters: the actor stays where it started, while the critic keeps training on the incoming replay. The moment a success batch exists the critic term, the success term and the ranked term switch on together. Keeping the baseline policy until there is evidence to leave it is the same caution as safe policy improvement with a baseline [9].
if self.config.get("qf3_gate_q_until_success", False):
gate = jnp.asarray(success_flag, jnp.float32)
total = total - (1.0 - gate) * (
info["pg_loss"] + LAMBDA_CFM * info["qf3_cfm"])
info = dict(info, qf3_ranked_cfm=ranked_cfm,
qf3_rank_weight=weights.mean())
return total, infoReplay chunks that cross an episode end
Replay chunks are windows of actions, and a window can run past a terminal. The sampler marks those slots invalid, but a critic that reads the flattened chunk cannot tell them from real actions. We zero the invalid suffix of every replay chunk before it enters the critic's TD loss or any actor term, so the critic is trained on the zero-padded representation and the actor's critic queries are built from it.
def _terminal_mask_actions(actions, batch, chunk):
"""Pad the unexecuted suffix of a terminal chunk before critic queries.
Replay sequences may cross an episode boundary; ``valid`` marks those
post-terminal slots, but a flattened chunk critic cannot otherwise
distinguish them from real actions. Zero padding makes the actor and
critic use the same finite-horizon action representation.
"""
if not chunk or "valid" not in batch:
return actions
valid = batch["valid"]
if getattr(valid, "ndim", 0) < 2:
return actions
b, h = actions.shape[0], valid.shape[-1]
a = actions.shape[-1] // h
return (jnp.reshape(actions, (b, h, a)) * valid[..., None]).reshape(actions.shape)A schedule that scales with the budget
The reference scripts were written for runs of millions of steps; we derive the schedule from the remaining budget instead, keeping the reference values as caps. With the chunk length,
the critic-only warm-up is capped at , the actor learning-rate warm-up at , the success batch is , and the deployment interval is . The critic ensemble's width grows with the data, , with four layers only at the reference width of 512 and two layers below it, so that the critic's capacity is matched to the amount of replay it is fitted on.
Several further choices are made per setting through small tables keyed on the setting: the ranked coefficient and whether it is gated, the ensemble aggregation, whether rollouts use the critic's best-of-8 candidate selection or a single sample, whether the deployed flow is the fast actor or its Polyak target, and the deployment decoder's options. The file also contains a vectorised online loop of up to four streams, used on one setting only when the runtime exposes more than one environment.
Results
| Method | ① | ② | ③ | |||
|---|---|---|---|---|---|---|
| Success-rate AUC ↑ | Final success rate ↑ | Success-rate AUC ↑ | Final success rate ↑ | Success-rate AUC ↑ | Final success rate ↑ | |
| GPT-6.2 Astra | 0.853 | 0.962 | 0.737 | 0.932 | 0.673 | 0.878 |
| Pretrained flow, no RL | 0.280 | 0.280 | 0.363 | 0.363 | 0.090 | 0.090 |
| DiPOD | 0.440 | 0.440 | 0.540 | 0.595 | 0.050 | 0.013 |
| DPPO | 0.292 | 0.312 | 0.347 | 0.335 | 0.008 | 0 |
| DSRL | 0.359 | 0.575 | 8.33e-4 | 0 | 0 | 0 |
| FlowRL | 0 | 0 | 0 | 0 | 0 | 0 |
| FPO | 0.226 | 0.112 | 0.556 | 0.615 | 0.147 | 0.122 |
| FPO++ | 0.409 | 0.437 | 0.574 | 0.652 | 0.089 | 0.040 |
| FQL with action chunking | 0.271 | 0.330 | 0.150 | 0.235 | 0.053 | 0.063 |
| OGPO | 0.489 | 0.600 | 0.687 | 0.877 | 0.280 | 0.467 |
| QF3 | 0.849 | 0.952 | 0.548 | 0.930 | 0.246 | 0.443 |
| QF3+ | 0.852 | 0.922 | 0.677 | 0.900 | 0.664 | 0.870 |
| ReinFlow | 0.287 | 0.310 | 0.327 | 0.412 | 0.313 | 0.420 |
| SAC Flow | 0.360 | 0.578 | 0.026 | 0.020 | 0.034 | 0.072 |
| Gaussian PPO | 0.302 | 0.367 | 0.011 | 0.013 | 4.17e-4 | 0 |
| GSBR | 0.781 | 0.965 | 0.308 | 0.710 | 0.001 | 0.005 |
- ① Robomimic Square-MH · low-dim state · sparse reward
- ② Robomimic Tool Hang-PH · low-dim state · sparse reward
- ③ Robomimic Transport-MH · low-dim state · sparse reward
In AUC our method is at or above the strongest published baseline on every setting. Its clearest margin is on ToolHang-PH, 0.737 against 0.687 for OGPO + CA [6]. On Square-MH it reaches 0.853 against 0.852 for QF3+, and on Transport-MH 0.673 against 0.664 for QF3+; both of these margins are small enough that we read them as a tie with QF3+.
End-of-training success is close to the best baseline on every setting. On ToolHang-PH we reach 0.932, level with the best baseline's 0.930 (QF3 [5]), so the AUC gain there comes from reaching that level earlier rather than from a higher final policy. On Transport-MH we reach 0.878 against 0.870 (QF3+). On Square-MH we reach 0.962, marginally below GSBR [16]'s 0.965.
Since QF3+ is QF3 with the success term, the difference between it and our method is the ranked term, the success gate, the masking and the budget-scaled schedule together. The table shows that this bundle adds most on ToolHang-PH, where QF3+ reaches an AUC of 0.677 and is not the strongest baseline, while on Square-MH and Transport-MH, where QF3+ is already the strongest, our AUC is essentially its own. We cannot attribute the ToolHang-PH gain to one component; the run has no ablation on the evaluated settings.
How we got here
We began by reading the runtime, the deployment menu, the OGPO agent and runner, and the reference method wrappers, and concluded that QF3's clipped, replay-local critic query with a frozen anchor was the strongest principled base. We copied its reference wrapper into the editable file and changed it from there, testing changes in a small synthetic metered harness with a known target action, and later in local runs on the task's environments with the shipped pretrained flows.
- The success term came from the QF3 paper. Re-reading it confirmed that QF3+ was a real ablation with a weight of 100 on the success term, which matched our scratch variant, so we adopted it unchanged.
- Critic-ranked flow matching was the first variant with a clear toy signal. In our development runs it lowered the final target error of the synthetic harness from about 0.53 for QF3+ to 0.39. On local environments the picture split: the term helped on one environment and was harmful on another, which is why its coefficient is a per-setting choice (10, 1 or 0 in the final tables).
- A per-state advantage instead of a global rank. We reasoned that a batch-global rank of mixes the value of a state with the quality of an action, and tested comparing each replay action against a flow sample at the same observation, and later against the same element's clipped QF3 endpoint. Neither replaced the global rank. Normalising the Boltzmann weights to unit mean and a positive-part weight were also tried and not kept.
- The success gate came from local runs. Runs on the real environments suggested that critic weighting should not disturb the pretrained policy before any positive trajectory exists, so we first gated the ranked term. A two-seed development probe that also held the critic term off until the first success moved the local return slightly upward with the same success frequency, and we then extended the gate to the critic term itself.
- A fixed critic warm-up wastes a small budget. The QF3 runner disables the actor for the whole critic-only phase. On the synthetic harness the final error rose from 0.435 with no warm-up to 0.636 with 160 warm-up steps in our development runs, which is why the warm-up became a fraction of the budget.
- A large critic overfits little replay. On one local environment a two-layer critic of width 128 reached a development mean of 167.0 against 56.0 for the reference four-layer, width-512 critic, which led to the data-scaled critic width.
- Abandoned: a one-standard-deviation lower bound, return-weighted ranking, terminal-prefix TD targets. Replacing the hard ensemble minimum with the mean minus one standard deviation was decisively worse on one environment (about 8.2 against 73.2 for the control). Ranking replay by observed chunk returns instead of critic values was weaker in both probes, below the unranked control on one environment and below critic ranking on the other. Selecting the discounted reward prefix at the first terminal is mathematically the correct target for a chunk that crosses an episode end, but its matched effect was mixed and, after one promising seed, did not reproduce, so we kept only the action-suffix masking, which improved every regime it was tested on in its first matched probe and remained positive but noisy on re-running.
- Abandoned: differentiating the deployed decoder. Adding the critic's value at the endpoint of the exact deterministic Euler decoder lowered one development mean from 123.3 to 68.1 at coefficient 0.05; a solver-consistent flow-matching variant was stable but not robust across seeds; a zero-latent flow-matching term hurt the toy task. The short-run critic did not support an unconstrained pathwise gradient.
- Abandoned or narrowed: vectorised collection. A four-stream replay loop helped in some probes, but matched runs were close to neutral and an eight-stream variant was not consistently better; it survives only behind a narrow condition.
The idea is therefore an incremental one: QF3+ with a second, critic-ranked imitation term, a success gate on every critic-driven term, a correction to chunked replay, and a schedule fitted to the budget.
Limitations
- Close to its parent baseline on Square-MH and Transport-MH. Our AUC there is within a hair of QF3+'s, and our end-of-training success on Square-MH is slightly below GSBR's. The evidence of a clear AUC gain over QF3+ rests on ToolHang-PH alone.
- No component-level attribution. The ranked term, the gate, the masking and the schedule were added together relative to QF3+, and their individual effects were measured only in local development probes with one to three seeds, several of which reversed on re-running.
- Per-setting configuration. The rank coefficient, its gate, the ensemble aggregation, the rollout selection, the deployed module and the decoder are looked up by setting name. These tables encode development probes rather than a rule; a new setting is not handled, since the per-setting QF3 table has no default entry, and the other tables would fall back to untuned defaults.
- The gate depends on a success being found. If the pretrained policy never succeeds within the budget, the gated method does nothing beyond preserving the pretrained flow.
- Shared noise across terms. The QF3 term and the ranked term draw and from the same random key on the same replay batch, so the ranked term is a reweighting of the QF3 flow-matching residual at identical points rather than an independent sample.
- A fixed anchor bounds how far the policy can travel. The pretrained flow stays the anchor throughout, so the restoring force grows with every improvement; the submitted code never moves it.
References
- Allen Z. Ren, Justin Lidard, Lars L. Ankile et al. (2025). Diffusion Policy Policy Optimization. ICLR.
- David McAllister, Songwei Ge, Brent Yi et al. (2026). Flow Matching Policy Gradients. ICLR.
- Tonghe Zhang, Chao Yu, Sichang Su et al. (2025). ReinFlow: Fine-tuning Flow Matching Policy with Online Reinforcement Learning. NeurIPS.
- Seohong Park, Qiyang Li, Sergey Levine (2025). Flow Q-Learning. ICML.
- Chung Min Kim, Brent Yi, David McAllister et al. (2026). QF3: Fast Flow RL with Filtered Q-Gradients.
- Sarvesh Patil, Mitsuhiko Nakamoto, Manan Agarwal et al. (2026). OGPO: Sample Efficient Full-Finetuning of Generative Control Policies. ICML.
- Junhyuk Oh, Yijie Guo, Satinder Singh et al. (2018). Self-Imitation Learning. ICML.
- Xue Bin Peng, Aviral Kumar, Grace Zhang et al. (2019). Advantage-Weighted Regression: Simple and Scalable Off-Policy Reinforcement Learning.
- Romain Laroche, Paul Trichelair, Rémi Tachet des Combes (2019). Safe Policy Improvement with Baseline Bootstrapping. ICML.
- Haozhe Jiang, Haiwen Feng, Pieter Abbeel et al. (2026). DiPOD: Diffusion Policy Optimization without Drifting Apart.
- Andrew Wagenmaker, Mitsuhiko Nakamoto, Yunchu Zhang et al. (2025). Steering Your Diffusion Policy with Latent Space Reinforcement Learning. CoRL.
- Lei Lv, Yunfei Li, Yu Luo et al. (2025). Flow-Based Policy for Online Reinforcement Learning. NeurIPS.
- Brent Yi, Hongsuk Choi, Himanshu Gaurav Singh et al. (2026). Flow Policy Gradients for Robot Control. CoRL.
- Qiyang Li, Zhiyuan Zhou, Sergey Levine (2025). Reinforcement Learning with Action Chunking. NeurIPS.
- Yixian Zhang, Shu'ang Yu, Tonghe Zhang et al. (2026). SAC Flow: Sample-Efficient Reinforcement Learning of Flow-Based Policies via Velocity-Reparameterized Sequential Modeling. ICLR.
- Charles Xu, Jacob Berg, Liyiming Ke et al. (2026). GSBR: Geometric Support Behavior Regularization for Online RL.