The average-velocity field .
Parameters
configMeanFlowConfigThe variant to build.
Attributes
patch_embedlucid.nn.Conv2dPatchifying projection — stride equals kernel, so patches do not
overlap.
pos_embedTensorFrozen two-dimensional sine-cosine table, added to the tokens.
blockslucid.nn.ModuleListThe DiT blocks.
final_FinalLayerModulated norm and projection back to patch space.
Notes
Reference: Geng, Deng, Bai, Kolter, and He, "Mean Flows for One-step Generative Modeling", arXiv:2505.13447, 2025. Backbone configurations are Table 4.
The forward takes both times. Which of them reach the embedding is
MeanFlowConfig.time_conditioning; the signature does not
change with it, because the Jacobian-vector product the objective
needs is always taken with respect to no matter how
the network chooses to encode them.
Examples
>>> import lucid
>>> from lucid.models.generative.mean_flow import (
... MeanFlowConfig, MeanFlowModel)
>>> config = MeanFlowConfig(sample_size=8, patch_size=2, hidden_size=32,
... depth=2, num_heads=4, num_classes=10)
>>> model = MeanFlowModel(config).eval()
>>> z = lucid.randn((1, 4, 8, 8))
>>> t = lucid.tensor([1.0])
>>> r = lucid.tensor([0.0])
>>> model(z, r, t).shape
(1, 4, 8, 8)