Zenaique

Cutting the number of vision tokens a VLM sends to the LLM without wrecking accuracy

Short answer·Medium·4.0 · 0·~3 min·Asked atMphasisPineconeRazorpay
Attempt it

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.

Free · 2 AI evals / day
TL;DR

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.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

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.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

Ask any team running a vision-language model at scale where the bill comes from and the answer is vision tokens. A single image can turn into hundreds or thousands of patch tokens, and the LLM has to run prefill attention over every one before it generates a word. Stack a few images per request and the visual tokens dwarf the text.

That is why vision-token compression is one of the highest-leverage knobs in a production VLM. Cutting the patch-token set in half roughly halves prefill cost and latency, which at scale is real money. The catch is that those tokens carry the image's detail, so naive compression quietly destroys the model's ability to read small text or count objects.

This deep dive establishes where compression happens and why it is possible, then walks the three techniques from blunt to clever — pooling, token merging, learned resampler — and closes on the tradeoff that ties them together, with concrete token numbers so the savings and the losses are both visible.

Why vision tokens are the bottleneck and why they compress

A VLM encodes an image by splitting it into a grid of patches and running each through a vision transformer, producing one token per patch. A 336-pixel image at a 14-pixel patch size yields a 24×24 grid — about 576 patch tokens for one ordinary image, and high-resolution tiling multiplies that several-fold.

The LLM then processes all of those tokens during prefill, and attention cost grows with sequence length. So a handful of images can cost more than a long text prompt, and prefill — not generation — becomes the dominant latency.

The reason this is fixable is redundancy. Adjacent patches of a blank wall, a clear sky, or a document margin produce nearly identical features. The patch grid carries far less information than its token count suggests. Compression exploits that: it removes or fuses redundant tokens so the LLM processes a smaller, denser set. Crucially this happens in the connector, the bridge between the vision encoder and the LLM, before any tokens enter prefill. Compress there and every downstream cost shrinks; try to do it inside the LLM and you have already paid for the tokens.

Pooling: the blunt, free downsample
Token merging: spend the budget where the image is busy
Learned resamplers: a constant token count by design
Choosing a method, and how compression stacks with resolution
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.

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.
Sign in to see more production examples.

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?
A

Tie OCR failure to small-text tokens being merged or pooled away; propose a higher token budget or resolution-aware policy for document inputs specifically.

1 more follow-up an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

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.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • Why vision-token prefill dominates image-heavy serving cost

  • Where compression happens: the connector, before the LLM

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Which factor most directly…
MCQ·Medium