Step 4 of 5
GenAI Interview Concepts
Thirty-five topics in three tiers - core, common, and senior - with crisp answers you can say out loud.
18 min read
GenAI interviews cluster around a surprisingly stable set of topics. This guide organizes 35 of them into three tiers - what every candidate must know, what most interviews probe, and what separates senior candidates - with a crisp answer for each that you could say out loud in about 30 seconds.
35 topics in 3 tiers#
Core - must know
Asked in almost every GenAI interview
- RAG design
- Debugging RAG
- Chunking
- Embeddings
- Hybrid search
- Reranking
- Hallucinations
- RAG evals
- Prompt design
- Structured output
- Context management
- Decoding settings
Common - usually probed
Expected for most engineering roles
- KV cache
- BPE tokenization
- LoRA / QLoRA
- RLHF vs DPO
- ReAct
- Tool-calling reliability
- Prompt injection
- Guardrails
- Quantization
- Fine-tune vs RAG
- LLM-as-judge
- LLM caching
Senior - differentiators
System-level judgment and operations
- Multi-tenancy
- LLMOps
- CI regression gating
- vLLM / PagedAttention
- HyDE
- Multimodal RAG
- Cost optimization
- Latency optimization
- Agent evaluation
- PII & privacy
- Model routing
Core#
1. Walk me through designing a RAG system.
Ingest documents (parse, clean, chunk with metadata), embed and index them (vector index plus keyword index), and at query time: rewrite the query if needed, retrieve candidates with hybrid search, rerank to the top few, and generate an answer that's instructed to use only the provided context and cite it. Around it: access control at retrieval, evals, caching, and observability.
2. A RAG system gives wrong answers. How do you debug it?
First separate retrieval from generation. Check whether the right chunk was retrieved at all (context recall). If not, it's a retrieval problem: chunking, embeddings, query phrasing, filters, or top-k. If it was retrieved but the answer is still wrong, it's generation: prompt, context order, too much noise, or the model ignoring context. Build a small labeled eval set so you can measure fixes.
3. How do you choose a chunking strategy?
Chunks must be small enough to be specific and large enough to be self-contained. Start around 300-800 tokens with some overlap, split on structure (headings, paragraphs) rather than fixed character counts, and attach metadata like title and section. Tune on your eval set. Advanced options: parent-child (retrieve small, return the larger parent) and semantic chunking.
4. How do embeddings work, and how do you pick a model?
An embedding model maps text to a vector so similar meanings are close together (by cosine similarity). Pick by quality on your own retrieval eval (not just leaderboards), language and domain coverage, dimension (storage and speed), max input length, cost, and whether you can self-host. Changing embedding models means re-indexing everything.
5. What is hybrid search and why use it?
Combining keyword search (BM25) with vector search, then merging the results (e.g., reciprocal rank fusion). Vectors capture meaning but miss exact terms like product codes, names, and acronyms; keywords catch those but miss paraphrases. Together they're more robust than either alone.
6. What does a reranker do?
A cross-encoder that scores each (query, document) pair jointly - slower but much more accurate than comparing precomputed embeddings. Retrieve 20-50 candidates cheaply, rerank, and keep the best 3-8. It typically improves answer quality more than any other single change to a RAG pipeline.
7. How do you reduce hallucinations?
Ground the model in retrieved sources and instruct it to answer only from them; require citations; allow and encourage 'I don't know'; lower temperature for factual tasks; use structured output; add a verification step (check claims against sources); and measure faithfulness with evals. No method gets it to zero, so design the UX for verification.
8. How do you evaluate a RAG system?
Separate metrics for retrieval (context recall and precision, hit rate, MRR) and generation (faithfulness to context, answer relevance, correctness against references). Use a labeled test set built from real questions, automated metrics (e.g., Ragas) plus LLM-as-judge with rubrics, spot-checked by humans, and run it on every change.
9. What makes a good prompt?
Clear role and goal, all necessary context, explicit constraints and output format, a few representative examples for tricky formats, and instructions to reason before answering when the task is complex. Put stable content first (for caching) and the variable question last. Then iterate against a test set rather than by feel.
10. How do you get reliable structured output?
Use the provider's structured-output or tool-calling features with a JSON schema, validate the result (e.g., with Pydantic) and retry with the validation error on failure, keep schemas simple with enums where possible, and give an example. Never parse free text with regex when a schema is available.
11. How do you manage a long conversation's context?
Keep the system prompt and key facts pinned, summarize or trim older turns, retrieve relevant past information instead of carrying everything, and put the most important instructions at the start and end (models use the middle of long contexts least). Track token counts so you never silently overflow.
12. What do temperature and top-p do, and how do you set them?
Temperature scales the logits before softmax: low values make output more deterministic, high values more diverse. Top-p samples only from the smallest set of tokens whose probabilities sum to p. Use low temperature for extraction, code, and factual answers; higher for brainstorming. Tune one of them, not both.
Common#
13. What is the KV cache?
During generation, keys and values for past tokens don't change, so they're stored rather than recomputed at every step. That makes each new token cheap, but the cache grows linearly with context length and batch size, and it's often the main GPU-memory constraint in serving.
14. How does BPE tokenization work, and why does it matter?
Byte-Pair Encoding starts from bytes and repeatedly merges the most frequent adjacent pair into a new token until the vocabulary reaches a target size. It matters because cost, context limits, and latency are counted in tokens, and tokenization explains quirks like poor letter counting and higher token costs for code and non-English text.
15. Explain LoRA and QLoRA.
LoRA freezes the base model and trains a low-rank update (two thin matrices) for selected weight matrices - often under 1% of parameters - so fine-tuning needs far less memory and produces small adapter files. QLoRA does the same on top of a 4-bit quantized base model, making 7-8B-parameter fine-tuning possible on a single consumer GPU.
16. RLHF vs DPO?
RLHF trains a reward model on human preference comparisons, then optimizes the model against it with reinforcement learning (classically PPO) - powerful but complex and unstable. DPO trains directly on (chosen, rejected) pairs with a simple loss, no reward model or RL loop - simpler, cheaper, and stable, which is why it's popular for open models.
17. What is ReAct?
A prompting pattern where the model interleaves reasoning ('Thought') with actions (tool calls) and observations (tool results) in a loop until it can answer. Reasoning makes actions deliberate; observations ground reasoning in real data. It's the basis of most tool-using agents.
18. How do you make tool calling reliable?
Fewer, well-named tools with precise descriptions and typed arguments (enums where possible); validate arguments before executing; return concise, informative errors so the model can recover; cap iterations; log every call; and evaluate tool selection on a test set of tasks.
19. What is prompt injection and how do you defend against it?
Untrusted text (from a user or retrieved content) that makes the model follow unintended instructions. No filter catches it all, so defend architecturally: least-privilege tools, human approval for sensitive actions, separating untrusted content from secrets and exfiltration paths, treating model output as untrusted, plus classifiers as one extra layer.
20. What are guardrails?
Checks around the model. Input guardrails: injection and jailbreak detection, PII detection, topic filters. Output guardrails: policy and toxicity checks, grounding/faithfulness checks, format validation. They can block, rewrite, or escalate to a human, and they should fail closed for high-risk actions.
21. What is quantization and what are the trade-offs?
Storing weights (and sometimes activations or the KV cache) in fewer bits - 8-bit, 4-bit - to cut memory and speed up memory-bound decoding. The cost is some accuracy loss, usually small at 8-bit and modest at good 4-bit formats (GPTQ, AWQ, GGUF Q4_K_M). Always re-run your evals after quantizing.
22. When would you fine-tune instead of using RAG?
RAG for knowledge - facts that change, need citations, or are too many to memorize. Fine-tuning for behavior - format, tone, style, domain-specific task skills, or moving a task to a smaller, cheaper model. They combine well: fine-tune for behavior, retrieve for facts. Try prompting first; it often closes most of the gap.
23. What is LLM-as-a-judge, and what are its pitfalls?
Using a strong model to grade outputs against a rubric or compare two answers - it scales evaluation cheaply. Known biases: preference for the first-presented answer, for longer answers, and for its own style. Mitigate with clear rubrics, swapping answer order, reference answers, and calibration against human labels.
24. How do you cache LLM calls?
Exact caching for identical requests; semantic caching (embed the query, reuse answers above a similarity threshold - carefully tuned); and provider prompt caching, which reuses processed long prefixes like system prompts and documents to cut cost and time-to-first-token. Invalidate when prompts, models, or sources change.
Senior#
25. How do you design a multi-tenant LLM application?
Isolate data per tenant at every layer: tenant filters enforced in retrieval (not in prompts), separate or partitioned indexes, per-tenant encryption keys where required. Add per-tenant rate limits, quotas, and cost attribution; per-tenant configuration (models, prompts); and audit logs. Guard against cross-tenant leakage via caches - include the tenant in cache keys.
26. What does LLMOps involve beyond MLOps?
Versioning prompts, models, retrieval indexes, and configs together; eval suites that run on every change; tracing every call with tokens, cost, and latency; monitoring quality in production with sampling, feedback, and judges; managing provider models that change underneath you; and cost controls. The core difference: outputs are open-ended, so quality evaluation is continuous.
27. How would you gate releases on quality in CI?
Maintain a versioned eval set of representative and previously failed cases. On every change to prompts, models, or retrieval, run it and compare to the production baseline with thresholds (e.g., faithfulness can't drop more than 1 point; no regressions on critical cases; latency and cost within budget). Block the merge on failure and store the results with the release.
28. How do vLLM and PagedAttention improve serving?
PagedAttention stores the KV cache in fixed-size blocks allocated on demand, like virtual-memory pages, eliminating most of the memory wasted by pre-allocating for maximum length. Combined with continuous batching - adding and removing requests at every decoding step - it serves many more concurrent requests on the same GPU.
29. What is HyDE?
Hypothetical Document Embeddings: ask the model to write a plausible answer to the query, embed that hypothetical answer, and use it to search. A fake answer often looks more like real relevant documents than a short question does, improving recall. Costs an extra generation; can mislead when the model's guess is wrong.
30. How would you build RAG over images, tables, and PDFs?
Either convert everything to text (OCR, table extraction, captions from a vision model) and use a standard text pipeline, or use multimodal embeddings to index images directly and pass retrieved images to a vision-capable model. Preserve layout and table structure, keep page references for citations, and evaluate per modality.
31. How do you reduce LLM costs?
Route each request to the smallest model that passes evals; retrieve and send fewer, better tokens; use prompt caching with stable prefixes; cache responses; batch offline work; cap output length; distill or fine-tune a small model for high-volume tasks; and attribute spend per feature so you know where it goes.
32. How do you reduce latency?
Stream tokens (users feel time-to-first-token most); run independent steps in parallel; use smaller or faster models for simple steps; shorten prompts and use prompt caching; cache retrieval and responses; co-locate services; and consider speculative decoding or dedicated serving for self-hosted models. Measure p95, not averages.
33. How do you evaluate an agent?
Beyond final-answer correctness: task success rate on realistic scenarios, trajectory quality (right tools, right order, no pointless steps), number of steps, cost and latency per task, safety (no forbidden actions), and robustness to tool failures. Use sandboxed environments with checkable end states, and replay real traces as regression tests.
34. How do you handle PII and privacy?
Minimize what enters prompts; detect and redact or tokenize PII before calls; choose providers and regions that meet data-residency and retention requirements (zero-retention agreements where needed); keep PII out of logs; enforce access control at retrieval; and support deletion requests across indexes, caches, and logs.
35. How would you route between models?
Classify each request (task type, difficulty, required capabilities, risk) with a cheap router, send it to the cheapest model that meets the quality bar for that class, escalate on low confidence or failed validation, and fall back to another provider on errors. Evaluate routing accuracy and track quality and cost per route.
Papers behind this guide
RAG: Retrieval-Augmented Generation
Combining retrieval systems with generative models - the architecture behind most enterprise AI apps today.
Meta AI, 2020
HyDE: Hypothetical Document Embeddings
Generate a fake answer, embed it, and retrieve real documents near it.
CMU / Waterloo, 2022
LoRA: Low-Rank Adaptation
Fine-tune huge models by training tiny low-rank adapter matrices instead of all weights.
Microsoft, 2021
Direct Preference Optimization (DPO)
Align a model on preference pairs directly - no separate reward model or RL loop.
Stanford, 2023
vLLM: PagedAttention
Manage the KV cache like virtual memory pages - the core idea behind vLLM's throughput.
UC Berkeley, 2023
Ragas: Automated RAG Evaluation
Reference-free metrics for faithfulness, answer relevance, and context relevance.
2023