Use X when#
- Chameleon family: you need image generation and mixed-modality output from one decoder.
- Adapter VLM (LLaVA family): you need understanding only. It reuses more pretrained compute.
- Emu3: you want image gen, perception and video from one checkpoint with prompt templates.
- Transfusion: quality comes first and you can afford the two-loss plumbing.
- Show-o: you want T2I, inpainting and VQA in one open model with reasonable speed.
- Janus-Pro: you need both understanding and generation. Pick SD3 or Flux for generation only.
- VAR: you want class-conditional images in about 10 passes, against 28-50 for DiT.
- MIO: you need speech in and speech out from one model, under 500ms TTFAB.
Show-o masked sampling loop#
Residual multi-scale tokenizer (VAR)#
SCALES = (1, 2, 4, 8)4 scales over an 8x8 image
CODEBOOK = 16entries per scale
residual = img.copy()
for scale, book in zip(SCALES, codebooks):
coarse = downsample(residual, scale)pool to scale x scale
tok = encode(coarse, book)nearest code index
recon = book[tok]
residual = residual - upsample(recon, IMG)what is still missed
tokens.append(tok)
out = out + upsample(book[tok], IMG)decoder sums every scale
Tasks in code#
| Task | Code |
|---|
| Residual VQ tokens per scale | tokenize_multiscale(img, codebooks) |
|---|
| 8x8 image to 4 token ids | image_to_tokens(img) |
|---|
| Count image tokens | TokCost("image 512x512", 512, 8).tokens() |
|---|
| Mix guided logits | cfg_mix(cond_logits, uncond_logits, gamma) |
|---|
| Sample with CFG at temp 0.8 | sample_tokens(cond, uncond, gamma=3.0) |
|---|
| Pick understand or generate | route(prompt) |
|---|
| Lay out a 4-modality vocab | build_vocab() |
|---|
| Trace the TTFAB budget | streaming_decode_latency(model_size_b=8) |
|---|
Abbreviations#
- VAR
- Visual AutoRegressive. Next-scale prediction over a pyramid of VQ grids.
- VQ-VAE
- vector-quantized variational autoencoder. Maps features to codebook indices.
- NTP
- next-token prediction. Predict token i+1 from tokens 0 to i.
- CFG
- classifier-free guidance. Mixes conditional and unconditional logits.
- IBQ
- Inverse Bottleneck Quantizer. Emu3 tokenizer class, codebook 32768+.
- MMDiT
- Multimodal DiT. SD3 backbone with joint attention.
- TTFAB
- time-to-first-audio-byte. User voice to first audio output.
- Residual-VQ
- stacked codebooks. Base layer is content, later layers add prosody.
Questions#
- Why does one visual encoder fail?
- VQ codes have weak semantics. SigLIP features do not reconstruct well.
- Why is inpainting free in Show-o?
- Training predicts masked tokens. Mask a region and predict it.
- Why is VAR fast?
- One transformer pass predicts a whole scale in parallel.
- What does Transfusion text attend to?
- Earlier text and previous images. Images see preceding text.
- Why did Janus-Pro beat Janus?
- 7B against 1.3B params and 72M stage 2 pairs against 26M.
- How does MIO keep IDs apart?
- Each modality gets a disjoint ID range in one vocabulary.