TVM
8 memberslucid.models.generative.tvmTerminal Velocity Matching — one- and few-step generation from scratch.
Zhou, Parger, Haque and Song, ICLR 2026 (arXiv:2511.19797). MeanFlow's dual: where MeanFlow differentiates the learned displacement at the interval's start, TVM differentiates it at the terminal time and matches it to the velocity where the jump lands — an objective that bounds the 2-Wasserstein distance once the network is made Lipschitz, which is what its RMS-normalised DiT is for.
Zhou, Linqi, Mathias Parger, Ayaan Haque, and Jiaming Song. "Terminal Velocity Matching." International Conference on Learning Representations (ICLR), 2026. [arXiv:2511.19797](https://arxiv.org/abs/2511.19797).
Write the ground-truth flow map from time to time as and its net displacement as . The displacement satisfies two conditions: it is the integral, and its derivative at is the instantaneous velocity. One two-time network parameterises both,
and the scaling makes hold by construction.
The integral condition cannot be trained directly — it would need an ODE solve per sample. Differentiating it with respect to the terminal time instead gives a condition with no integral in it,
and the squared error in that condition, integrated over , upper-bounds the displacement error. The unknowns on the right are replaced by the model itself — the jump lands at and the velocity there is — which is only sound if is right, so Flow Matching is trained jointly. It is the same condition at zero displacement:
is an exponential moving average of the weights, held under a stop-gradient, and the derivative expands to — one Jacobian-vector product along , whose result is itself back-propagated through. A weighted integral of this objective over bounds between the data and the model's push-forward when is Lipschitz (Theorem 1).
MeanFlow's dual. MeanFlow enforces , differentiating at the start; the tangent of that derivative contains the sampled velocity , whose magnitude under guidance varies widely. TVM's tangent is a unit step in , independent of and , which is why it trains stably even with random guidance.
Guidance is learned, not applied. The class-conditional field is the guided one, , with the unconditional half supplied by the EMA network. Its magnitude grows linearly in , so the loss is weighted by and the network optionally predicts with the factor pulled out — the scaled parameterisation.
Semi-Lipschitz control. Every LayerNorm becomes a parameter-free RMSNorm, queries and keys are RMS-normalised, every adaLN modulation vector is itself RMS-normalised so its scale cannot grow without bound, and linear layers start at unit spectral norm.
Where Lucid departs from the authors' release, on purpose. The model matches the authors' code to float32 rounding (forward pass, terminal derivative, loss, every gradient and the sampler), but three choices differ, and they matter to anyone reproducing a released run from scratch:
- The patch embedding starts at unit spectral norm. Lucid divides
the patch-embedding weight by its largest singular value, as the
paper prescribes for linear layers. The release's initialiser
divides a rebound alias of the weight (
w.data = w.data / s[0]) rather than the parameter, so its patch embedding keeps the Xavier-normal draw, at full size. - Precision. The release trains under bf16 autocast, and its Jacobian-vector product runs attention in bf16 even when autocast is off. Lucid computes in the model's own dtype throughout — float32 unless the model is cast — including the terminal derivative. A converted checkpoint sampled in Lucid is therefore not rounded where the authors' bf16 sampler is.
- No NaN masking. The release replaces a NaN loss with zero before the backward pass; Lucid returns the loss as computed, so a diverging step is seen instead of trained through.
Classes
Functions
tvm_imagenet256→ TVMModel678MThe 256-pixel ImageNet network — one step to 3.29 FID.
tvm_imagenet256_gen→ TVMForImageGeneration678Mtvm_imagenet256 with its objective and sampler.
tvm_imagenet512→ TVMModel678MThe 512-pixel ImageNet network — one step to 4.32 FID.
tvm_imagenet512_gen→ TVMForImageGeneration678Mtvm_imagenet512 with its objective and sampler.