data
DriftingConfig
extends
GenerativeModelConfigDriftingConfig(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 = 768, depth: int = 12, num_heads: int = 12, mlp_ratio: float = 4.0, cond_dim: int = 768, num_classes: int = 1000, noise_classes: int = 64, noise_coords: int = 32, n_cls_tokens: int = 16, use_qknorm: bool = True, use_swiglu: bool = True, use_rope: bool = True, use_rmsnorm: bool = True, attn_fp32: bool = True, use_remat: bool = False, frequency_embedding_size: int = 256, temperatures: tuple[float, ...] = (0.2, 0.05, 0.02), gen_per_label: int = 64, cfg_min: float = 1.0, cfg_max: float = 4.0, neg_cfg_pw: float = 5.0, no_cfg_frac: float = 0.0, patch_mean_size: tuple[int, ...] = (2, 4), patch_std_size: tuple[int, ...] = (2, 4), use_mean: bool = True, use_std: bool = True, every_k_block: int | None = 2, pos_per_sample: int = 64, neg_per_sample: int = 32, positive_bank_size: int = 128, negative_bank_size: int = 1000, use_mae: bool = True, use_convnext: bool = False, mae_base_channels: int = 640, mae_layers: tuple[int, int, int, int] = (3, 4, 6, 3), mae_input_patch_size: int = 1)Configuration for the Drifting Model family.
Parameters
sample_ sizeint= 32Side of the generated field — the official
input_size. 32
for the SD-VAE latent models, 256 for the pixel models.in_ channelsint= 4, 4Channels of the noise and of the output. The generator maps a
noise field to a sample of the same shape, so they must match.
out_ channelsint= 4, 4Channels of the noise and of the output. The generator maps a
noise field to a sample of the same shape, so they must match.
patch_ sizeint= 2Tokenisation patch —
2 for B/2 / L/2, 16 for
B/16 / L/16. Both give 256 tokens.hidden_ sizeint= 768Transformer width.
depthint= 12Number of blocks.
num_ headsint= 12Attention heads.
mlp_ ratiofloat= 4.0Feed-forward expansion before the SwiGLU two-thirds rule.
cond_ dimint= 768Width of the conditioning vector that drives adaLN and the
in-context tokens. Every released model sets it equal to
hidden_size.num_ classesint= 1000Class vocabulary. There is no null class: guidance is trained in
by conditioning on , not by label dropout.
noise_ classesint= 64Codebook size of the random style embeddings — the discrete half
of the noise.
0 disables them.noise_ coordsint= 32How many style indices are drawn per sample; their embeddings are
summed into the conditioning vector.
n_ cls_ tokensint= 16In-context conditioning tokens prepended to the sequence.
use_ qknormbool= TrueThe LightningDiT modernisations the paper adopts (A.2).
use_ swiglubool= TrueThe LightningDiT modernisations the paper adopts (A.2).
use_ ropebool= TrueThe LightningDiT modernisations the paper adopts (A.2).
use_ rmsnormbool= TrueThe LightningDiT modernisations the paper adopts (A.2).
attn_ fp32bool= TrueRun attention in float32 when the model is in a narrower dtype.
False for the released latent B/2 and L/2.use_ rematbool= FalseRecompute each block on the backward pass instead of storing its
activations.
True for the released pixel models.frequency_ embedding_ sizeint= 256Width of the sinusoid the guidance scale is embedded through.
temperaturestuple of float= (0.2, 0.05, 0.02)Kernel temperatures (the release's
R_list). One
normalised drift per temperature, summed.gen_ per_ labelint= 64Generated samples per class label, .
cfg_ minfloat= 1.0, 4.0Range of the training-time guidance scale .
cfg_ maxfloat= 1.0, 4.0Range of the training-time guidance scale .
neg_ cfg_ pwfloat= 5.0Exponent of the power law the
scale is drawn from.
no_ cfg_ fracfloat= 0.0Probability of replacing the drawn scale by
1 (no guidance).
0.5 for the released L/2.patch_ mean_ sizetuple of int= (2, 4)Patch sides over which local feature means / stds are pooled (A.5).
patch_ std_ sizetuple of int= (2, 4)Patch sides over which local feature means / stds are pooled (A.5).
use_ meanbool= TrueWhether each feature map also contributes its global mean / std.
use_ stdbool= TrueWhether each feature map also contributes its global mean / std.
every_ k_ blockint or None= 2Also take features from every
k-th residual block of each
stage. None keeps only the stage outputs.pos_ per_ sampleint= 64Positive (same-class) samples drawn per label, .
neg_ per_ sampleint= 32Unconditional real samples drawn per label, .
0 trains without guidance negatives.positive_ bank_ sizeint= 128Per-class sample-queue length.
negative_ bank_ sizeint= 1000Global unconditional queue length.
use_ maebool= TrueCompute the loss in the latent- / pixel-MAE feature space. No trained
encoder is published, so see
DriftingForImageGeneration.load_feature_encoder.use_ convnextbool= FalseAlso use ConvNeXt-V2-Base (ImageNet-22k) features. Pixel models only.
mae_ base_ channelsint= 640MAE ResNet base width ; stages are .
mae_ layerstuple of int= (3, 4, 6, 3)Basic blocks per MAE stage — ResNet-34's.
mae_ input_ patch_ sizeint= 1Space-to-depth patch applied before the MAE ResNet:
1 for the
32x32x4 latent, 8 for 256x256x3 pixels (giving 32x32x192).Notes
Reference: Deng, Li, Li, Du, and He, "Generative Modeling via Drifting", arXiv:2602.04770, 2026. Architecture: Appendix A.2 and Table 8. Loss: Alg. 2 and Appendices A.5–A.7.
Where Table 8 and the released configs/gen/*.yaml disagree, the
release wins, because the authors' checkpoints were trained by it: the
latent B/2 uses 64 positives per label (Table 8 says 128).
Examples
>>> from lucid.models.generative.drifting import DriftingConfig
>>> config = DriftingConfig()
>>> config.hidden_size, config.depth, config.patch_size
(768, 12, 2)
>>> config.num_patches, config.swiglu_hidden_size
(256, 2048)Used by 4
Properties
4Tokens per side of the patch grid.
Per-head width.
Image tokens — (sample_size / patch_size)^2, 256 for every release.
SwiGLU inner width: two thirds of hidden * mlp_ratio, rounded up to 32.
The release computes int(2/3 * int(hidden * mlp_ratio)) and then
rounds up to a multiple of 32 — 2048 for B, 2752 for L.