Pixel-space conditional DiT that predicts the flow-matching velocity
v(z_t, t | c) on MNIST. Trained as the amortized posterior estimator for
CoDiff (Bayesian Experimental
Design via Contrastive Diffusions,
arXiv:2410.11826).
Shared trunk of 5 blocks + 3-block velocity head, hidden size 256, 4 heads,
patch size 4. In-context conditioning (learnable time tokens, no AdaLN), 2D RoPE
on patch tokens, QK RMSNorm, SwiGLU MLP, bias-free linears. The network predicts
x and the velocity follows from
v = (z - x_pred) / max(t, 0.05).
Architecture after
pMF, single-head.
1from flax import nnx, serialization
2from huggingface_hub import hf_hub_download
3from models.pixel_dit import PixelDiT # from the CoDiff repo
4
5net = PixelDiT(rngs=nnx.Rngs(0))
6graphdef, state = nnx.split(net)
7with open(hf_hub_download("jcopo/mnist", "model.msgpack"), "rb") as f:
8 state.replace_by_pure_dict(serialization.from_bytes(state.to_pure_dict(), f.read()))
9nnx.update(net, state)
10
11v = net(x, cond=c, t=t) # x: (B,28,28,1) in [-1,1], c: (B,28,28,2)
1@article{iollo2024bayesian,
2 title={Bayesian Experimental Design via Contrastive Diffusions},
3 author={Iollo, Jacopo and Heinkel{\'e}, Christophe and Alliez, Pierre and Forbes, Florence},
4 journal={arXiv preprint arXiv:2410.11826},
5 year={2024}
6}