data
TVMConfig
extends
GenerativeModelConfigTVMConfig(sample_size: int | tuple[int, int] = 32, in_channels: int = 4, out_channels: int = 4, act_fn: GenerativeActivation = 'silu', patch_size: int = 2, hidden_size: int = 1152, depth: int = 28, num_heads: int = 18, mlp_ratio: float = 4.0, frequency_embedding_size: int = 256, num_classes: int = 1000, class_dropout: float = 0.1, qk_norm: bool = True, modulation_norm: bool = True, time_embedding_init: TimeEmbeddingInit = 'spectral', guidance_scale: float = 2.0, guidance_range: tuple[float, float] | None = None, scaled_parameterization: bool = True, time_sampler: TimeSampler = 'gap', gap_mean: float = -0.8, gap_std: float = 1.0, t_mean: float = 1.0, t_std: float = 1.0, s_mean: float = -0.4, s_std: float = 1.0, separate_flow_matching_time: bool = True, ratio_t_equals_s: float = 0.0, target_ema_decay: float = 0.99, eval_ema_decay: float | None = 0.9999, detach_jvp: bool = False, latent_mean: tuple[float, ...] = (0.86488, -0.27787343, 0.21616915, 0.3738409), latent_std: tuple[float, ...] = (4.85503674, 5.31922414, 3.93725398, 3.9870003))Configuration for the Terminal Velocity Matching family.
Parameters
sample_ sizeint= 32Side of the latent the network operates on —
32 for
256-pixel ImageNet, 64 for 512-pixel, after the Stable
Diffusion VAE's factor of eight.in_ channelsint= 4, 4Latent channels. The network predicts a velocity in the latent's
own space, which the loss and the sampler add to the input, so
the two must be equal.
out_ channelsint= 4, 4Latent channels. The network predicts a velocity in the latent's
own space, which the loss and the sampler add to the input, so
the two must be equal.
patch_ sizeint= 2Side of the square patch each token covers.
hidden_ sizeint= 1152Transformer width.
depthint= 28Number of transformer blocks.
num_ headsint= 18Attention heads per block. DiT-XL uses 16; the paper uses 18 so
the head dimension is 64, which its attention kernel runs 1.25x
faster at, and reports the two train to the same FID.
mlp_ ratiofloat= 4.0Feed-forward expansion inside each block.
frequency_ embedding_ sizeint= 256Width of the sinusoid each scalar condition is expanded into
before its MLP.
num_ classesint= 1000Label vocabulary. Index
num_classes is the null label the
guidance dropout substitutes.class_ dropoutfloat= 0.1Probability of training a sample unconditionally — its label is
replaced by the null token and its guidance scale by one.
qk_ normbool= TrueRMS-normalise queries and keys (with a learnable scale) before
attention. Part of the semi-Lipschitz control.
modulation_ normbool= TrueRMS-normalise each adaLN shift, scale and gate vector (Eq. 16 and
Appendix B.2). Without it the modulation's magnitude, and with it
the layer's Lipschitz constant, can grow unbounded — the
activation blow-up of Figure 4.
time_ embedding_ init(spectral, normal)= "spectral"How the time and guidance MLPs start. Every other linear layer
is initialised to unit spectral norm regardless.
guidance_ scalefloat= 2.0The classifier-free guidance weight trained at, and the
default a sampler uses for labelled draws. The paper's best
one-step 256-pixel model trains at
2.0.guidance_ rangetuple of float or None= None(w_min, w_max) to train with a random guidance weight instead
of a constant one: is drawn uniformly from
. Constant guidance wins in every
comparison the paper makes (Table 4a), which is why None.scaled_ parameterizationbool= TruePredict with the guidance weight factored out, so the
model's velocity is (Table 4c).
time_ sampler(gap, trunc, clamp)= "gap"Joint distribution of
(t, s).gap_ meanfloat= -0.8, 1.0Logit-normal parameters of
t - s under "gap".gap_ stdfloat= -0.8, 1.0Logit-normal parameters of
t - s under "gap".t_ meanfloat= 1.0, 1.0Logit-normal parameters of
t under "trunc" and "clamp"
— Table 3's best setting for both.t_ stdfloat= 1.0, 1.0Logit-normal parameters of
t under "trunc" and "clamp"
— Table 3's best setting for both.s_ meanfloat= -0.4, 1.0Logit-normal parameters of
s, and of the Flow Matching time
when that is drawn separately.s_ stdfloat= -0.4, 1.0Logit-normal parameters of
s, and of the Flow Matching time
when that is drawn separately.separate_ flow_ matching_ timebool= TrueDraw the Flow Matching term's time independently of the pair
instead of reusing
s — the sampler the paper names gap*,
which lets the Flow Matching term keep the time distribution that
works for Flow Matching on its own (Figure 9).ratio_ t_ equals_ sfloat= 0.0Fraction of the batch trained with
s = t, where the terminal
term vanishes and only Flow Matching remains. The paper finds any
non-zero share hurts one-step quality (Table 4d).target_ ema_ decayfloat= 0.99, the EMA rate of the network that supplies the
terminal and unconditional targets.
0 uses the live weights
under a stop-gradient; 0.99 is the paper's sweet spot
(Table 4b).eval_ ema_ decayfloat or None= 0.9999, the rate of Algorithm 1's second average, the
one that is evaluated and released (Table 6, "Eval EMA rate").
None keeps no such copy, saving a network's worth of memory.detach_ jvpbool= FalseStop the gradient at . Faster and
lighter, but biases the gradient — the paper's runtime study
offers it as a trade, not a default (Figure 10).
latent_ meantuple of float= (0.86488, -0.27787343, 0.21616915, 0.3738409)Per-channel statistics the VAE latent is whitened with before the
network sees it, — IMM's setting,
which the paper follows (Appendix F.1), in place of the usual
single factor 0.18215. The defaults are the 256-pixel ones; the
512-pixel latent has its own.
latent_ stdtuple of float= (0.86488, -0.27787343, 0.21616915, 0.3738409)Per-channel statistics the VAE latent is whitened with before the
network sees it, — IMM's setting,
which the paper follows (Appendix F.1), in place of the usual
single factor 0.18215. The defaults are the 256-pixel ones; the
512-pixel latent has its own.
Notes
Reference: Zhou, Parger, Haque, and Song, "Terminal Velocity Matching", ICLR 2026 (arXiv:2511.19797). Training settings are Table 6; the defaults here are its first column, the 256-pixel model at behind the 3.29 one-step FID.
The released code agrees with the paper on every setting above, with one exception it does not exercise: its random-guidance path draws rather than uniformly. The paper's description is followed here.
Examples
>>> from lucid.models.generative.tvm import TVMConfig
>>> config = TVMConfig()
>>> config.hidden_size, config.depth, config.num_heads
(1152, 28, 18)
>>> config.num_patches
256
The 512-pixel model is the same network over a wider latent:
>>> TVMConfig(sample_size=64).num_patches
1024