Standard classifier-free guidance (CFG) mixes a class-conditional and an unconditional prediction at every sampling step, which doubles the number of network evaluations. The Mean Flows paper moves the mixing into the training target, so that the trained network already outputs the guided average velocity and one evaluation is enough at sampling time.
For a pair (data , noise ), a class and times , with and , the paper's target (in its general form with a mixing scale ) is
is the network with the class and without it. Both are evaluated at . In the second line the derivatives are those of the class-conditional network at , and takes the place of in the tangent.
Here the network is linear, so every derivative is available by hand:
model is a dict with "A" of shape (D, D), "b_r" and "b_t" of shape (D,), "E" of shape (K, D) (one row per class) and "E_null" of shape (D,).
cfg_meanflow_target(model, x, eps, r, t, labels, omega, kappa=0.0)
x, eps: arrays (B, D). r, t: arrays (B,). labels: integer array (B,).{"v_tilde": (B, D), "dudt": (B, D), "u_tgt": (B, D)}, where dudt is the total derivative in the bracket above.effective_scale(omega, kappa=0.0)
ValueError if .kappa_for(omega, effective)
effective for a given : .