Multimodal Models·Question 37 of 67Advanced

You are self-hosting a VLM for a document pipeline and throughput is a third of what you projected from the LLM's specs. Why, and what do you do?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Because a VLM document workload is prefill-bound and your intuition is calibrated on decode-bound text serving. A page image is on the order of ~1-2k visual tokens in, and the output is maybe 200 tokens of JSON. So you pay a large compute-bound prefill for a tiny memory-bound decode. Every trick that makes text serving fast - continuous batching, speculative decoding, generous KV cache - targets decode and buys you almost nothing here.

Full worked answer with diagram

Because a VLM document workload is prefill-bound and your intuition is calibrated on decode-bound text serving. A page image is on the order of ~1-2k visual tokens in, and the output is maybe 200 tokens of JSON. So you pay a large compute-bound prefill for a tiny memory-bound decode. Every trick that makes text serving fast - continuous batching, speculative decoding, generous KV cache - targets decode and buys you almost nothing here.

What to look at, in order:

1. The vision encoder is a separate compute stage. It is a ViT running over N tiles, and at high resolution it is not a rounding error. In naive implementations it runs synchronously in the request path, serialised with LLM prefill on the same GPU, so neither batches well. Fix: batch encoder work across requests, or disaggregate encoder and decoder into separate pools so each is sized and batched independently. Same principle as prefill/decode disaggregation, applied one stage earlier.

2. Cut visual tokens before cutting anything else. Lower the pixel budget (Qwen-style processors expose min_pixels / max_pixels); most pipelines are configured far above what their task needs, and nobody ever measured. Patch merging in the projector (2x2 pixel-unshuffle, a 4x reduction) is standard in modern VLMs and already applied. Inference-time token pruning and merging works better on natural images than on documents, because documents are information-dense - that is the entire point of a document. The measurement to run: sweep token budget against per-field accuracy and find the knee. Teams routinely discover they are paying 4x for zero accuracy.

3. Cache the prefix. If you ask several questions about the same page, put the image first and the question last so the encoded and prefilled prefix is shared across calls. That is a straight multiple on throughput for multi-question workloads and costs you a prompt reordering.

4. Right-size the model. A 7B-class VLM at high resolution frequently beats a much larger one at low resolution on document tasks, because the binding constraint is perception, not reasoning. Test it rather than assuming bigger is better.

5. Then the usual. Quantization (less of the story here than for decode-bound serving), tensor-parallel sizing, and honest measurement: GPU utilisation percentage lies, so track tokens/s/GPU against a roofline estimate.

Worth sketching. It shows the interviewer you know exactly where the bottleneck sits, and that the encoder is a compute stage of its own rather than part of prefill.

flowchart LR
    A["Page image"] --> B["ViT over N tiles"]
    B --> C["LLM prefill,<br/>~1-2k visual tokens"]
    C --> D["Decode ~200 JSON tokens"]
    D --> E["Continuous batching and<br/>speculative decoding help only here"]
    B --> F["Encoder and prefill serialised<br/>on one GPU, neither batches"]
    F --> G["Fix: separate encoder and decoder<br/>pools, cut the pixel budget"]

What a good answer covers

  • Because a VLM document workload is prefill-bound and your intuition is calibrated on decode-bound text…
  • A page image is on the order of ~1-2k visual tokens in, and the output is maybe 200 tokens of JSON
  • So you pay a large compute-bound prefill for a tiny memory-bound decode
  • Every trick that makes text serving fast - continuous batching, speculative decoding, generous KV cache…
  • The vision encoder is a separate compute stage

Key terms: 3. Cache the prefix · 4. Right-size the model · 5. Then the usual

Interviewer follow-ups to expect

  1. How would you decide the pixel budget per document class rather than globally?

  2. Walk me through what changes if the workload shifts to one question per image with no reuse.

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep