AIInterviewTraining logoAIInterview/Training

inference

AI, ML & GenAI interview questions tagged inference, across every topic.

46 questions · 8 unlocked for you

Concepts behind "inference"

The curriculum that explains the ideas these questions test.

Foundational
🖥️ ML Infrastructure & Serving
GPU Memory and the Serving StackServing an LLM is largely a memory problem: the GPU has to hold the model weights along with a KV cache that scales with sequence length and batch size, and inference divides into a compute-bound prefill and a memory-bandwidth-bound decode. Understanding the memory math (weights plus KV cache), why decode is bandwidth-bound, and the levers (quantization, batching, paged attention) is the bedrock of LLM serving. AI, ML, and GenAI engineer interviews probe it because 'will this model fit and how fast will it run?' is a recurring production question.
Core
🧠 Foundations of LLMs & GenAISign in
Attention Variants: MHA, MQA, and GQAMulti-head attention gives every query head its own key and value heads, which is expressive but leaves the KV cache large and memory-bandwidth hungry at decode time. Multi-query attention shares one key-value head across all query heads to shrink the cache sharply, and grouped-query attention sits between them by sharing key-value heads across small groups. AI, ML, and GenAI engineer interviews probe this because it is the cleanest example of trading model quality against serving memory and throughput, and it explains why frontier models standardized on GQA.
Core
🧠 Foundations of LLMs & GenAISign in
The KV CacheIn autoregressive decoding a model would recompute attention over the whole history at every step; the KV cache keeps each token's key and value vectors so a new token only attends and never recomputes. Compute is saved, but the cost shifts to memory: the cache grows with sequence length times batch size and usually turns into the binding constraint in serving. AI, ML, and GenAI interviews probe it because it explains why long contexts are costly to serve, why throughput (not model speed) is often the limit, and why MQA/GQA and PagedAttention exist.
Core
🧠 Foundations of LLMs & GenAISign in
Inference-Time Compute and Reasoning ModelsInference-time (test-time) compute is the idea that spending more computation at generation, longer chains of thought, sampling multiple attempts, or search, reliably improves answers on hard problems, a scaling axis distinct from making the model bigger. Reasoning models (o1/R1-style) are trained, often via RL on verifiable rewards, to produce long internal reasoning and use this. AI, ML, and GenAI interviews probe it because it changed how hard problems get solved and introduced a real latency/cost trade-off: route easy queries to fast models, reserve reasoning models for genuinely hard ones.
Core
🖥️ ML Infrastructure & ServingSign in
Quantization and Low PrecisionQuantization holds and runs model weights (and activations) at fewer bits, FP16/BF16, FP8, INT8, INT4, rather than FP32, shrinking memory and accelerating inference for some accuracy cost. It is the primary way to fit a large model onto a given GPU and serve it cheaply, and it sits behind QLoRA fine-tuning and KV-cache compression. AI, ML, and GenAI engineer interviews probe it because 'how do you serve a 70B model affordably?' typically opens with quantization, so the precision ladder and its trade-offs are must-know material.
Core
🖥️ ML Infrastructure & ServingSign in
Continuous BatchingGPUs run efficiently on batches, but LLM requests show up at different times and complete after different numbers of tokens, so static batching wastes the GPU while it waits on the slowest request. Continuous (in-flight) batching inserts and evicts requests from the running batch at each decoding step, holding the GPU full and sharply lifting throughput. AI, ML, and GenAI engineer interviews probe it because it is the single biggest throughput lever in LLM serving and explains why one replica can serve many concurrent users.