MeanFlow
14 memberslucid.models.generative.mean_flowMeanFlow — one-step generation by modelling the average velocity.
Geng, Deng, Bai, Kolter and He, arXiv:2505.13447, 2025. The fifth step of the flow lineage and the one that removes the integral: where Flow Matching learns the instantaneous velocity and integrates it at sampling time, MeanFlow learns the average velocity over an interval, which is that integral, and reads a sample off a single evaluation.
Geng, Zhengyang, Mingyang Deng, Xingjian Bai, J. Zico Kolter, and Kaiming He. "Mean Flows for One-step Generative Modeling." arXiv preprint [arXiv:2505.13447](https://arxiv.org/abs/2505.13447), 2025.
Flow Matching models the instantaneous velocity — the tangent of the path at one instant — and recovers a sample by integrating it. MeanFlow models the average velocity over an interval, defined as that integral divided by its width:
The two coincide only in the limit . Away from it the average velocity points along the displacement between the two times rather than along the curve, which is exactly what a one-step sampler needs: with in hand the whole path is , and generation from noise is a single evaluation at .
Training on that definition directly would require the integral. The way through is to multiply it out and differentiate with respect to , holding fixed, which turns the integral into the MeanFlow Identity:
Every term on the right is available. The instantaneous velocity is the closed-form conditional velocity Flow Matching already regresses onto, and the total derivative expands by the chain rule into
which is one Jacobian-vector product of along the tangent — a single extra forward-mode pass, not a second-order solve. The identity becomes a regression target,
and the loss is . The stop-gradient is what keeps the cost at one extra pass: without it the Jacobian-vector product would itself need to be differentiated.
Setting collapses the second term and recovers Flow Matching exactly, so the method is Flow Matching with a modified target rather than a different framework. The paper draws for only a quarter of samples; at 0% it is Flow Matching and one-step generation fails outright (FID 328.91 against 61.06).
Classes
Functions
mean_flow_base_2→ MeanFlowModel131MBase width, patch 2 — the smallest reported model.
mean_flow_base_2_gen→ MeanFlowForImageGeneration131Mmean_flow_base_2 posed as a sampler.
mean_flow_base_4→ MeanFlowModel131MThe ablation backbone — Base width, patch 4.
mean_flow_base_4_gen→ MeanFlowForImageGeneration131Mmean_flow_base_4 posed as a sampler.
mean_flow_large_2→ MeanFlowModel459MLarge width, patch 2.
mean_flow_large_2_gen→ MeanFlowForImageGeneration459Mmean_flow_large_2 posed as a sampler.
mean_flow_medium_2→ MeanFlowModel308MMedium width, patch 2.
mean_flow_medium_2_gen→ MeanFlowForImageGeneration308Mmean_flow_medium_2 posed as a sampler.
mean_flow_xlarge_2→ MeanFlowModel676MExtra-large width, patch 2 — the paper's headline model.
mean_flow_xlarge_2_gen→ MeanFlowForImageGeneration676Mmean_flow_xlarge_2 posed as a sampler.