Adapter tokens or one shared vocabulary for images

L2WorkingTrade-off12 minSystem designML breadth

RolesLLM Product EngineeringCustomer AI Deployment

The question

A product needs a model that reads screenshots and answers questions today, and might need to draw diagrams later. Two designs are on the table: an adapter model, where a vision encoder feeds projected tokens into a text-only decoder, and a model that turns images into discrete codes in the same vocabulary as text and trains one next-token loss over interleaved sequences. Compare them and pick for this product.

Answer it first, aloud or on paper. Then open the answer.

The answer

Show short answer

The adapter design is late fusion: images enter as projected continuous tokens or through cross-attention, the decoder reuses all its text pretraining, and the output is text only. The shared-vocabulary design is early fusion: a quantizer maps an image to discrete codes, the transformer trains one loss over text and image codes, and it can emit image codes, so it generates pictures. For a product that must read screenshots now, pick the adapter: it reuses more pretrained compute, has no quantizer ceiling for understanding, and is cheaper to serve; add the early-fusion model only when drawing becomes a real requirement, because its image quality is capped by the quantizer and each generated image costs a decoder pass over a thousand or more codes.

Show full answer

Two paths into the model

Late fusion, adapterEarly fusion, shared vocabulary
Image inputencoder features projected into the embedding space, or read through cross-attentiondiscrete codes from a learned quantizer, looked up like text tokens
Losslanguage-modeling loss on texta single next-token loss on text and image codes together
Outputtext onlytext and images, interleaved as the model chooses
Reuse of the pretrained LLMfullthe model trains on the mixed stream from the start
Ceiling for understandingthe encoderthe quantizer's reconstruction
Serving cost per answerone decoder step per generated text tokenone decoder step per generated text token, plus 1024 sequential decoding steps per generated image, one per code, then a decoder pass for the pixels

What early fusion buys

One sequence, one loss, and mixed-modality output. The reference model's quantizer maps a 512 by 512 image to 1024 codes from a codebook of 8192, inside a single vocabulary of 65,536 entries that also holds the text tokens and the separators. When the model emits the image-start separator, the next 1024 codes go to the decoder for pixels.

What it costs

  • A quality ceiling. The quantizer is lossy; at that codebook and code count the reconstruction peaks around 26 to 28 dB, below the 32 and more of continuous latent diffusion. A better quantizer lifts the ceiling, but the ceiling is the quantizer.
  • Training stability. Early-fusion training at scale diverged without normalization of the attention queries and keys, dropout after every residual, and an extra normalization on the last block.
  • Compute. Every generated image is a decoder pass over its codes.

What late fusion buys

It bolts onto any pretrained decoder, keeps the text stream clean so that text ability survives, and computes the image once; with cross-attention the image keys and values are cached across decode steps. It cannot emit images.

The pick

Reading screenshots is understanding, and the adapter is the simpler and stronger tool for it today. When drawing arrives, measure whether a separate generation model behind a tool call meets the need before you move the whole stack to early fusion.

Follow-ups

  1. L2WorkingWhy can the adapter model not generate an image?

    Show expected answer

    its output head covers the text vocabulary only; images enter as embeddings and never exist as tokens it could predict.

  2. L2WorkingWhat is the shared vocabulary made of?

    Show expected answer

    text tokens, image codes and modality separators in one id space, so one embedding table and one output projection cover all of them.

  3. L3SeniorWhere does the quality ceiling of the early-fusion model come from, and what moves it?

    Show expected answer

    the quantizer's reconstruction; a larger codebook and more codes per image raise it, as the next generation of tokenizers showed.

  4. L3SeniorA hybrid keeps images continuous and trains a diffusion loss on patches next to the text loss. What does it trade?

    Show expected answer

    no quantizer and higher image fidelity, against two losses on different scales to balance and a diffusion sampling loop at generation time.

Wrong answers

Show the wrong answers that interviewers hear
  • “Early fusion is the future, so start there.”

    For understanding alone it reuses less pretrained compute and caps quality at the quantizer; the adapter is the simpler, stronger choice until generation is required.

  • “The adapter can draw if you add a decoder head.”

    Its images never exist as predictable tokens; drawing needs either image codes in the vocabulary or a separate generation model.

  • “The quantizer is a detail; the transformer does the work.”

    In the early-fusion family the quantizer sets the ceiling on every image the model produces.

Taught in

The Chameleon lesson sets out the early-fusion thesis and its costs, the cross-attention fusion capstone builds the late-fusion path, and the Emu3 lesson shows what a better quantizer changes.