Cutting the number of vision tokens a VLM sends to the LLM without wrecking accuracy
Image-heavy serving is dominated by vision-token prefill. Explain the main techniques for reducing how many vision tokens reach the LLM, and the tradeoff each one makes.
Shrink the patch-token set before the LLM: pooling (cheap, blunt), token merging (adaptive, keeps busy regions), or a learned resampler (fixed small count). All trade fine detail for latency and cost.
Imagine summarizing a detailed painting for someone over the phone. You cannot describe every brushstroke, so you compress. The crude way is to split the painting into a grid and give one average color per cell — fast, but you lose the tiny signature in the corner. A smarter way is to spend more words on the busy, interesting areas and barely mention the plain sky. A third way is to decide in advance you will use exactly twenty sentences no matter how complex the painting, and pick the twenty most useful things to say. Each method gets the gist across cheaply, but all of them risk dropping the small print — the fine details only a full description would carry.
Detailed answer & concept explanation~6 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Spend about 5 minutes: establish that vision tokens are the prefill cost and compression sits in the connector, then walk the three techniques in rising fidelity, ending on the task-driven tradeoff.
Real products, models, and research that use this idea.
- Q-Former in BLIP-2 — a learned resampler that compresses any image's patch tokens to a small fixed set of query tokens before the LLM.
- Token merging (ToMe) — adaptively merges similar ViT tokens to cut sequence length while preserving accuracy on busy regions.
- LLaVA-style pixel-shuffle or pooling — strides over patch tokens to shrink the grid cheaply when fine reading is not required.
What an interviewer would ask next. Try answering before peeking at the approach.
QYour VLM does great on natural photos but fails on document OCR after enabling compression. What is happening and how do you fix it?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Thinking compression happens inside the LLM. It happens on the patch tokens between the vision encoder and the LLM — shrink the set there, before prefill, or you save nothing.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.