Interview prep
Generative AI & LLMs interview questions
33 of the most common Generative AI & LLMs questions for data and AI interviews — each with a worked answer, the trap to avoid, and a link to learn it properly. Serving, RAG, evaluation, guardrails, cost, and the failure modes that bite in production.
Filter by role
- Which parts of an LLM application would you implement synchronously, and which would use queues or asynchronous workers? Explain how you would handle backpressure, cancellation, timeouts, retries, ordering, and progress updates for both interactive chat and long-running agent jobs. Medium
- A model must return output conforming to a JSON Schema, but occasionally emits syntactically valid JSON with an invalid enum or missing field. When would you use constrained decoding, schema validation with retries, or both, and what are the latency and availability trade-offs? Medium
- You need to migrate a production semantic-search system to a new embedding model. What compatibility, normalization, distance-metric, indexing, recall, and rollout issues would you check before replacing the existing vectors? Medium
- A product team wants the model to answer questions about frequently changing internal policies while also adopting a consistent response style. Which parts would you solve with RAG, which with fine-tuning, and what evidence would change your decision? Medium
- Your service meets average latency targets but users complain about sluggish streaming. Which TTFT, inter-token latency, end-to-end latency, throughput, utilization, and goodput measurements would you collect, and how would you tie them to separate interactive and batch SLOs? Medium
- Take one chat request through the autoregressive loop. What is computed once, what is recomputed for each token, how do the KV cache and chat template affect latency and token budget, and why can streaming improve time-to-first-byte without reducing total generation time? Medium
- You need to run an open model locally on commodity hardware. How would you choose a quantization level and a GGUF runtime, estimate memory for weights and KV cache, measure quality loss, and decide whether self-hosting is better than using an API? Medium
- Your RAG system retrieves the right document but the answer misses a qualification contained in a table, code block, or heading several paragraphs away. How would you redesign chunking and parent-child retrieval without causing the prompt to grow uncontrollably? Medium
- The same prompt sometimes produces materially different answers in production even though temperature is set to zero. What would you investigate across sampling parameters, model versions, batching, seeds, tool results, chat templates, and provider infrastructure? Medium
- For a large collection of structured reports with reliable headings, page numbers, and tables, when would you choose vectorless retrieval such as PageIndex over embeddings, and what failure modes would you expect from each approach? Medium
- Design a RAG pipeline for questions that require joining facts from several documents, handling freshness, and producing citations. How would you decide between query decomposition, hybrid retrieval, reranking, iterative retrieval, and a retrieve-more-than-top-k strategy? Hard
- An autonomous coding agent can modify production systems and has learned to optimize its task score by hiding failures. What controls would you add around permissions, sandboxes, monitoring, tripwires, human escalation, and shutdown, and what evidence would make you revise your threat model for deceptive alignment? Hard
- Design an AI gateway that fronts several model providers. How would it handle authentication, policy enforcement, routing, retries, provider outages, circuit breaking, fallback models, streaming failures, and the risk that retries multiply cost or duplicate tool actions? Hard
- An inference server has high GPU utilization but poor p99 latency for short requests. How would continuous batching, sequence scheduling, prompt length, output length, and KV-cache memory explain the behavior, and which scheduler changes would you try first? Hard
- You need to replace an expensive frontier model with a small on-device model for a narrow workflow. How would you design the distillation data, choose between logits and teacher-generated traces, and prove that the smaller model has retained the behaviors that matter? Hard
- Where would you place input filters, output filters, tool-call checks, and a model such as Llama Guard in an agentic system? How would you manage false positives, latency, adversarial adaptation, and unequal refusal rates across user groups? Hard
- Your RAG agent reads web pages and emails, then uses their contents to decide which tools to call. How would you defend against indirect prompt injection when the malicious instructions are inside retrieved content, and how would you test that the defense survives realistic composition attacks? Hard
- Why might round-robin load balancing produce uneven latency across identical LLM replicas? Compare routing by queue length, estimated remaining tokens, KV-cache locality, and least-connections, and explain how you would prevent a single long request from starving short ones. Hard
- A safety team reports that the model passes a fixed set of refusal prompts. How would you build a jailbreak taxonomy and red-team plan that covers multi-turn attacks, role-play, encoding, multilingual prompts, tool use, and attacks that manipulate the surrounding application rather than the model? Hard
- Build the unit economics for an LLM feature. Which variables dominate cost and latency, and how would you decide among prompt reduction, output limits, caching, batching, quantization, model routing, and self-hosting while preserving the product's quality and reliability targets? Hard
- A vendor claims its model supports a 200k-token context, but your evaluation shows that it misses evidence placed in the middle of long documents. How would you diagnose the failure, and when would you use retrieval or summarization instead of simply increasing the context window? Hard
- You have a 70B model, limited GPU memory, and a few hundred thousand high-quality examples. How would you choose between full fine-tuning, LoRA, QLoRA, and another PEFT method, and how would you detect that the adapter is memorizing or degrading general capabilities? Hard
- Design a model cascade for a customer-support workload with strict cost and quality targets. What signals would you use to route requests, how would you avoid routing errors caused by overconfident small models, and how would you evaluate the cascade rather than each model in isolation? Hard
- An MoE model advertises much lower active-parameter cost than its total parameter count. What does that mean operationally, and how would expert imbalance, routing overhead, expert parallelism, and a hot expert affect throughput and tail latency? Hard
- You are adding image and audio inputs to a support agent. How would you handle modality-specific preprocessing, OCR and transcription errors, cross-modal grounding, prompt injection embedded in an image, privacy, and the different latency and cost profiles of each modality? Hard
- Your SFT model follows instructions but has poor long-horizon behavior, and you have pairwise preferences plus automatically verifiable rewards. How would you choose among more SFT, RLHF, DPO, Constitutional AI or RLAIF, and verifiable-reward training, and how would you detect reward hacking? Hard
- For a workload with very long prompts and long streamed responses, when would you split prefill and decode onto different worker pools? How would KV-cache transfer, network bandwidth, scheduling, and KV offloading affect whether disaggregated serving actually improves goodput? Hard
- You are reviewing a pretraining corpus assembled from web, code, and licensed data. How would you handle deduplication, quality filtering, benchmark contamination, licensing, personally identifiable information, and the trade-off between differential privacy and model utility? Hard
- How would you evaluate a RAG system so that you can tell whether a bad answer came from retrieval, context assembly, or generation? Which offline and online metrics would you trust, and how would you use an LLM judge without letting it hide regressions? Hard
- How would you protect a multi-tenant LLM API from both denial of service and denial of wallet? Design limits and admission controls for requests, input tokens, output tokens, concurrency, retries, and expensive tools without making legitimate long-context users unusable. Hard
- Design a tool-calling interface for an agent that can search internal systems and create payments. How would you validate arguments, enforce authorization, make retries safe, prevent SSRF and prompt injection, and handle a tool that times out after performing the side effect? Hard
- You enabled speculative decoding but throughput got worse for some requests. How would you reason about draft-model quality, acceptance rate, verification cost, memory bandwidth, sequence length, and batching before deciding whether to keep or remove it? Hard
- A team wants to generate most of its next training set with an existing model. What signals would tell you that the data is becoming low-diversity or causing model collapse, and how would you preserve useful synthetic data without recursively amplifying errors? Hard
No questions tagged for that role yet.