← Questions

Vision encoders and LLM bottlenecks

0
AppleAI/ML designLast asked Nov 2025

An AI/ML design interview question asked in Apple's technical phone screen, last asked Nov 2025. It tests vision, llm and inference performance.

A machine learning fundamentals conversation in two halves: vision encoders, then what limits large language model inference and how to speed it up.

Questions

  1. What is a vision encoder, and what does it do in a computer vision or multimodal model?
  2. How is a vision encoder usually trained?
  3. What are the main bottlenecks of LLM inference?
  4. How would you reduce LLM inference memory and latency?

What a strong answer covers

  • Vision encoders: CNNs and Vision Transformers that turn an image (as patches) into embeddings; in multimodal models a projection or cross-attention connects those embeddings to the language model.
  • Training: supervised classification on labeled images, contrastive image-text training (CLIP-style), self-supervised methods (masked image modeling, DINO-style distillation), and then fine-tuning or alignment with the language model.
  • LLM bottlenecks: the prefill phase is compute-bound; decoding one token at a time is memory-bandwidth-bound; the KV cache grows with batch size and context length and limits how many requests fit; attention cost grows with sequence length.
  • Memory and latency fixes: quantization of weights and KV cache, grouped-query or multi-query attention, paged KV cache memory, continuous batching, FlashAttention-style kernels, speculative decoding, tensor and pipeline parallelism, prefix caching, distillation into a smaller model.
  • For each fix, what it costs (quality, complexity, hardware support).

Follow-ups

  • Estimate the KV cache size for a given model, batch size and context length.
  • Time to first token is fine but tokens per second is poor. Where do you look?
  • How would you cut the cost of the image tokens in a multimodal model?

Where it's asked

  • Apple · Technical phone screen · Last asked Nov 2025

What it tests

vision · llm · inference performance

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing