Walking Through a Vision-Language Model Build, Start to Finish
Machine LearningModel answerLast updated
Present a vision-language model you built, covering scope, architecture, data, training, modularity, serving latency, and failure modes, with consistent numbers and clear trade-offs.
An interviewer asks you to present, in depth, a vision-language model (VLM) project you worked on. Treat it as a technical conversation in which each claim may be probed further, so your numbers must be concrete and agree with one another.
Cover these seven areas:
-
Task and success measures
- Which task did the model handle (captioning, visual question answering, retrieval, grounding, OCR plus reasoning, or something else)?
- How did you define success, both offline and in the product?
-
Architecture
- Describe the vision encoder, the language model, and the way the two are connected.
- Say where the modalities are fused (input-level, cross-attention, adapters, projection layers).
- State which components were frozen and which were trained.
-
Data
- Which public and internal sources did you use, and what label types did they carry (pairs, dialogs, preferences, boxes, masks)?
- What was the distribution, and what biases did it have (domains, languages, image styles, long tail)?
- How did you split data and prevent leakage?
-
Training
- Which objectives did you use (contrastive, next-token, instruction tuning, preference optimization)?
- How were the stages organized, and what were the key hyperparameters and infrastructure?
- Which benchmarks, ablations, and error analyses did you run?
-
End-to-end versus modular
- Was the system trained jointly? If not, which parts were fixed, and why?
- What were the trade-offs in stability, compute, data needs, and adaptability?
-
Inference cost
- Where does time go (vision encoder, prefill, decoding)?
- What latency and throughput did you measure, and how?
- Which optimizations did you try?
-
Limitations and next steps
- What failure modes remain?
- What would you change in data, architecture, training, evaluation, or serving?
Aim for a concise, technical answer with specific examples and figures.
Hints
Hint 1
Use the seven areas as a fixed outline and open each one with a decision plus a supporting number, instead of narrating chronologically.
Hint 2
Make sure your numbers connect: image resolution and patch size determine visual token count, which determines prefill cost, KV-cache memory, and sequence length budget.
Hint 3
For latency, separate vision encoding, prefill, and decoding, and note that decoding is usually memory-bandwidth bound; justify it with weight size divided by memory bandwidth.
Hint 4
For data splits, think about what could leak: near-duplicate frames or images from the same source, creator, or time window. Name the specific safeguard for each.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
What a strong answer demonstrates
Interviewers use this format to test four things: ownership (which decisions were yours and why), numerical consistency (token counts, latency, and dataset sizes that fit together), trade-off reasoning (why freeze this, why that objective), and honest failure analysis. Every figure you quote invites a follow-up, so only state numbers you can defend.
Structure the answer along the seven areas, roughly 60 to 90 seconds each, and open each with a decision and a number. The numbers below are illustrative; substitute your own.
1. Problem and scope
Example task: a VLM for short-video product understanding. From 1 to 4 keyframes plus a caption it extracts structured attributes (category, brand, on-screen price), answers moderation questions, and writes a one-line description for search.
- Offline: attribute exact-match F1 above 0.85 (OCR plus rules baseline: 0.71), moderation recall at a fixed 2% false-positive rate, hallucination rate under 5% on a human-audited set.
- Online: higher click-through on product search, lower manual review load.
2. Architecture
LLaVA-style design: a SigLIP-class encoder at 384 px with patch size 14 gives 27 x 27 = 729 tokens per image. A 2-layer MLP projects them into a 7B decoder LLM's embedding space.
- Fusion: early, at the input. Visual tokens are placed alongside text tokens and share full self-attention. No cross-attention. This reuses the pretrained LLM unchanged and works with standard KV-cache serving.
- Token budget: 2x2 average pooling cuts 729 to about 182 tokens per frame, so four frames cost roughly 730 tokens instead of 2,900, at about a 1-point OCR cost.
- Frozen vs trainable: Stage 1 trains only the projector. Stage 2 trains the projector and the LLM, and unfreezes the top few encoder blocks at a lower learning rate (for example 0.1x) because fine-grained text reading needs some encoder adaptation.
3. Data
- Alignment: hundreds of thousands of public image-caption pairs.
- Instruction tuning (about 1M samples): public VQA, document and scene-text QA, and grounding sets; internal human-labeled frames; filtered synthetic dialogs from a stronger teacher model.
- Preferences: a small set (about 20K) of pairs contrasting a grounded answer with a hallucinated one.
- Biases: language skew with a long tail of low-resource languages, category over-representation, and domain shift (vertical frames with stylized overlay text versus the square natural images of public data). Mitigate with temperature-based language sampling and category upsampling.
- Splits and leakage: split by video and creator, not by frame, because near-identical frames leak. Run perceptual-hash dedup between train and test, and keep a most-recent-weeks time holdout to measure drift.
4. Training recipe
| Stage | Objective | Trainable | Notes |
|---|---|---|---|
| 1. Alignment | Next-token on captions | Projector | High LR (about 1e-3), 1 epoch, hours on a few dozen GPUs |
| 2. Instruction tuning | Next-token on assistant tokens only | Projector, LLM, top encoder blocks | LR about 2e-5, cosine, warmup, global batch about 256, 2K sequence with packing, bf16, ZeRO-3, gradient checkpointing |
| 3. Preference tuning | DPO, beta about 0.1 | LLM | LR about 5e-7; chosen over PPO-RLHF for stability and no reward model |
Evaluation: public benchmarks (TextVQA, DocVQA, POPE, MMBench) plus internal per-category and per-language F1.
Ablations worth citing: unfreezing top encoder blocks (OCR gain), pooling (tokens versus accuracy), DPO (hallucination drop), unfiltered synthetic data (hurt).
Error analysis: bucket several hundred failures, for example OCR misreads, hallucinated attributes, wrong object among many, counting and spatial errors. The buckets drive the roadmap.
5. End-to-end versus modular
Training was staged and only partly end-to-end. The encoder stayed mostly frozen because full unfreezing on noisy internal data caused feature drift and loss spikes, raised memory by roughly 1.4x, and a pretrained encoder generalizes better than about a million samples can teach.
- Modular: stable, cheap, and swapping the LLM mostly means retraining the projector.
- End-to-end: better fine-grained perception, but needs more data, careful per-module learning rates, and more compute.
For dense text, an optional external OCR tool was cheaper than raising resolution.
6. Latency
Measure on fixed hardware (for example one A100 80GB with a serving engine like vLLM), over thousands of real requests, reporting p50 and p95 with warm caches.
| Component | Approx. time | Comment |
|---|---|---|
| Vision encoder | 30 ms | 4 frames batched |
| Prefill | 70 ms | about 900 tokens |
| Decode | 520 ms | about 13 ms/token x 40 tokens |
Decode dominates and is memory-bandwidth bound: 14 GB of bf16 weights at about 2 TB/s gives a floor near 7 ms/token. This is a good consistency check to show.
Optimizations:
- Int4 weight quantization: about 2x faster per token, with a small accuracy loss.
- Continuous batching: large throughput gain at acceptable p95.
- Vision-embedding cache keyed by frame hash: helps when popular content is re-queried.
- Constrained JSON decoding: fewer output tokens, no parse failures.
- Speculative decoding with a small draft model: strong at batch size 1, weak at high batch, so use it only for the latency-critical path.
7. Limitations and improvements
Failure modes: small or stylized text, hallucinated brands inferred from context, counting beyond a handful of items, left/right and other spatial relations, weaker low-resource-language quality, and prompt injection through overlay text.
Proposals, tied to failure buckets:
- Data: targeted collection and hard-negative mining for OCR and counting; more low-resource-language data.
- Architecture: dynamic or tiled resolution so text-heavy regions get more tokens without paying for it everywhere.
- Training: more preference data focused on grounding; region-level supervision for spatial tasks.
- Evaluation: language-sliced and drift-aware test sets, plus an adversarial overlay-text suite.
- Serving: safety filtering of text inside images, and routing easy requests to a smaller model.
Common mistakes
- Quoting numbers that contradict each other (token count versus latency versus memory).
- Splitting by frame and then reporting inflated test scores.
- Claiming end-to-end training without being able to explain stability and learning-rate choices.
- Reporting only average latency instead of p95, or ignoring prefill versus decode.
- Presenting no failure analysis, or fixes that do not map to observed errors.