All 214 LLMs & GenAI interview questions
Large language models: pretraining, fine-tuning, RAG, hallucinations, and evaluation.
Every question below opens on its own page, with a full answer, the formulas written out and a multiple-choice check. Free to read, no account needed.
Fundamentals
- What is a large language model, in one paragraph?easy
- Walk through how one training step of an autoregressive LLM works.easy
- How does Byte-Pair Encoding (BPE) tokenization work?medium
- Why don't LLMs simply use character-level tokenization?medium
- What does 'emergence' mean in LLM capabilities and is it real?hard
- Why do modern LLMs use decoder-only architectures?medium
- What is SwiGLU and why do LLMs use it in the MLP block?hard
- What is in-context learning (ICL) and how does it work?medium
Tokenization & embeddings
- What are text embeddings and how are they used?easy
- How does SentencePiece differ from BPE?medium
- Name three practical failure modes caused by tokenization.medium
- How does vocabulary construction affect multilingual quality?medium
- How do you pick an embedding model for a new RAG project?medium
- What's the trade-off between embedding dimension and retrieval quality?medium
- What is Matryoshka Representation Learning (MRL)?hard
- How is ColBERT different from a standard bi-encoder?hard
- What are 'contextual embeddings' and why are they useful?hard
- How does multimodal retrieval (image + text) work?hard
- When and how do you fine-tune an embedding model?hard
- What are 'hard negatives' in embedding training?hard
- How does CLIP enable multimodal capability?medium
- What breaks when you change the embedding model in a live RAG system?hard
Pretraining & scaling
- What data goes into modern LLM pretraining?medium
- Why is data deduplication critical for LLM pretraining?medium
- Summarize Kaplan et al. (2020) scaling laws in one sentence.hard
- State the Chinchilla scaling insight and its practical impact.hard
- How do you prevent MoE routing collapse?hard
- How do you train an LLM to a long context length?hard
- Is data curriculum used in LLM pretraining?hard
- How much does it cost to pretrain a modern LLM?hard
- Why is the softmax + cross-entropy at the LM head a training bottleneck?hard
- What is continual pretraining and when does it beat fine-tuning?hard
- What parallelism strategies are combined to train a 70B model?hard
- What is embedding tying and when do LLMs use it?medium
- What's the practical minimum tokens-per-parameter for a competitive LLM?hard
- Can you repeat data across epochs in LLM pretraining?hard
- What is benchmark contamination and how do you detect it?hard
- How is high-quality instruction-tuning data constructed?medium
Architecture & attention variants
- What is the context window and what tricks extend it?medium
- What is a Mixture-of-Experts (MoE) LLM?hard
- Why did RoPE replace learned positional embeddings in modern LLMs?hard
- What is Grouped-Query Attention (GQA) and why does it matter?hard
- How does Mixtral 8x7B differ from a dense LLM?hard
- How does YaRN extend an LLM's context beyond training length?hard
- How does Flash Attention 2 speed up training?hard
- How is a modern vision-language model (LLaVA, GPT-4V, Claude 3) built?hard
Fine-tuning & adaptation
- Fine-tuning vs RAG — which do you use when?medium
- What is LoRA and why is it popular for fine-tuning LLMs?hard
- What is supervised fine-tuning (SFT) and where does it fit in the alignment pipeline?easy
- How are 'reasoning models' like o1 / R1 trained?hard
- Should you fine-tune the LLM for RAG or improve retrieval first?medium
- How do you serve many LoRA adapters efficiently?hard
- A stakeholder wants the model to 'know our internal docs'. Do you fine-tune or build RAG?medium
Alignment: SFT, RLHF, DPO
- Describe the full RLHF pipeline in three stages.hard
- Why does the reward model use a Bradley-Terry / log-sigmoid loss?hard
- How is PPO adapted for RLHF and what are the main pitfalls?hard
- How does DPO simplify RLHF?hard
- When does RLHF beat DPO and vice versa?hard
- What is KTO and when is it useful?hard
- What is ORPO?hard
- What is RLAIF and where is it useful?hard
- What is Constitutional AI?hard
- Give an example of reward hacking in RLHF.medium
- What is sycophancy in LLMs and how do you reduce it?medium
- How is 'refusal' behavior trained into LLMs?medium
- What is the 'alignment tax' and how do you minimize it?medium
- What is 'honesty' as an alignment target and how do you train for it?medium
- How do you balance helpfulness vs harmlessness in RLHF?hard
- Why is PPO used in RLHF instead of vanilla REINFORCE?hard
- What is GRPO?hard
- What is iterative DPO / online DPO?hard
- What is an instruction hierarchy in modern LLMs?hard
- How well-calibrated are LLM confidences and how do you fix them?hard
Prompting techniques
- What are the pillars of good prompt engineering?easy
- Few-shot vs zero-shot — when do you use each?easy
- What is chain-of-thought (CoT) prompting?medium
- How does self-consistency improve CoT?medium
- What is Tree of Thoughts (ToT) and when does it help?hard
- Does role-play prompting ('You are a senior lawyer...') actually help?easy
- How is the system prompt different from the user prompt?easy
- How do you force structured output (JSON) from an LLM?medium
- How does function calling / tool use work in modern LLMs?medium
- Does position in the context matter for what the LLM 'sees'?medium
- Do 'negative prompts' ('do not X') work in LLMs?easy
- What is prompt chaining and why prefer it over one big prompt?medium
- How do you use one prompt to extract multiple fields at once vs many separate prompts?medium
- What is Chain-of-Density (CoD) prompting?hard
- How do you get reliable table output from an LLM?medium
- When does chain-of-thought HURT performance?hard
- How should you write tool descriptions for reliable agent tool selection?medium
- Do agents plan explicitly or should we let them just react?hard
Decoding & sampling
- What do temperature and top-p do at generation time?easy
- How does JSON mode actually work?hard
- Greedy decoding vs sampling — when do you pick each?easy
- How does top-k differ from top-p sampling?easy
- What is min-p sampling?hard
- What is repetition penalty and its trade-off?medium
- What are stop sequences and why do they matter in production?easy
- What is logit bias and when do you use it?medium
- How should max_tokens be set in production?easy
- Why is streaming output important in production LLM apps?easy
- What is speculative decoding?hard
- Why don't chat LLMs use beam search?medium
- Structured Outputs (OpenAI) / Constrained decoding — how do they differ from JSON mode?hard
- How do Medusa and EAGLE differ from vanilla speculative decoding?hard
- How do you make an LLM reliably return valid JSON?medium
- Does temperature 0 make an LLM deterministic?hard
Retrieval-augmented generation
- How does Retrieval-Augmented Generation (RAG) work?medium
- How should you chunk documents for RAG?medium
- What is indirect prompt injection?hard
- Walk through the components of a production RAG pipeline.medium
- What chunking strategies exist beyond fixed-size?hard
- How do vector databases differ from traditional databases?medium
- How does HNSW work in one paragraph?hard
- What is IVF-PQ and when do you use it?hard
- Why combine dense (vector) and sparse (BM25) retrieval?medium
- How does Reciprocal Rank Fusion (RRF) work?medium
- What is a cross-encoder reranker and when do you need one?medium
- Why rewrite the user's query before retrieval?medium
- What is HyDE and how does it help retrieval?hard
- How do metadata filters interact with vector search?hard
- How do you evaluate a RAG pipeline end-to-end?hard
- What is faithfulness in RAG and how do you measure it?medium
- What is Graph RAG and when does it beat plain RAG?hard
- What is parent-document (small-to-big) retrieval?medium
- How do you make an LLM cite its sources reliably?medium
- What is 'agentic RAG' or self-RAG?hard
- What can you cache in a RAG pipeline?medium
- How do you counter 'lost in the middle' in RAG?medium
- What are RAG-specific safety concerns?hard
- How do you handle the freshness problem in RAG (docs change constantly)?medium
- How do you scale to hundreds of tools without overwhelming the LLM?hard
- How do you choose a chunking strategy for RAG?medium
- Your RAG system gives a wrong answer. How do you find out which stage failed?hard
- Why does stuffing more context into a long-context model sometimes make answers worse?hard
- Why does hybrid search usually beat pure vector search?medium
Vector databases & hybrid search
Inference: caching, batching, serving
- What is quantization and what tradeoffs come with it?medium
- What is the KV cache and why does it matter for LLM inference?hard
- What is prompt caching and when does it help?hard
- What's the difference between prefill and decode in LLM inference?medium
- What is continuous / dynamic batching in LLM serving?hard
- How does Paged Attention work?hard
- What is chunked prefill and why is it useful?hard
- How do you trade off throughput vs latency in LLM serving?medium
- How does INT8 weight quantization work in practice?medium
- Compare GPTQ, AWQ, and NF4 quantization.hard
- What is FP8 inference and where does it help?hard
- How do you quantize the KV cache and why?hard
- When do you distill an LLM for serving?medium
- vLLM vs TensorRT-LLM vs TGI vs SGLang — how do you pick?medium
- What does 'automatic prefix caching' do in vLLM?hard
- What role does NVIDIA Triton play in LLM serving?medium
- How do you pick a GPU for serving a 70B LLM?hard
- What are typical tokens/sec numbers for popular LLMs on H100?medium
- How do you autoscale LLM serving?hard
- What SLIs / SLOs are typical for LLM serving?medium
- Why is cold-starting an LLM slow and how do you fix it?hard
- What LLM observability tools do you deploy?medium
- How do you canary-deploy a new LLM version?medium
- What is a 'model router' and when is it worth it?hard
- Your LLM feature costs too much per request. What levers do you pull, in order?medium
- How do you make an LLM feature feel fast when generation is inherently slow?medium
Long context
Evaluation & benchmarks
- How do you evaluate an LLM system?medium
- What is red-teaming in LLM safety?medium
- What does MMLU actually measure and its limitations?medium
- GSM8K vs MATH vs AIME — what do they measure?medium
- HumanEval / MBPP / SWE-bench — how do they test code?medium
- What is Chatbot Arena and why is it important?easy
- What is Arena-Hard-Auto?medium
- What is MT-Bench and how does it differ from Chatbot Arena?medium
- How reliable is LLM-as-a-judge and how do you validate it?hard
- What is LiveBench and why does it exist?medium
- What is EleutherAI's lm-evaluation-harness?medium
- How do you evaluate an agent (tool-using LLM)?hard
- How do you detect hallucinations in production?hard
- What does TruthfulQA measure?medium
- How do you test an LLM for social bias?medium
- How do you evaluate LLM apps cheaply at scale?medium
- How do you build a good golden eval set?medium
- How do you measure jailbreak robustness?hard
- How do you evaluate an agent's tool-use accuracy?medium
- How do you evaluate multimodal LLMs?medium
- What biases affect LLM-as-a-judge evaluation, and how do you control them?hard
- You have no evaluation set for a new LLM feature. How do you build one quickly?medium
Hallucinations & reliability
Safety, guardrails, red-teaming
- What are the main LLM safety and alignment concerns?medium
- Name three types of LLM jailbreak.medium
- How do content moderation filters complement alignment?medium
- How do you protect an LLM API from abuse / cost spikes?medium
- What defenses actually work against jailbreaks?hard
- What does Llama Guard do?medium
- How do you handle PII in an LLM pipeline?medium
- What security concerns are specific to agents with tool use?hard
- How do you defend a RAG or agent system against prompt injection?hard
Agents & tool use
- Describe a basic ReAct / agent loop.medium
- How is 'memory' typically implemented in agents?medium
- When do multi-agent systems beat single-agent?hard
- How does a coding agent (SWE-agent, Aider, Cursor) actually work?hard
- What's hard about web-navigation agents?hard
- What does an ideal function-calling schema look like?medium
- How do parallel tool calls work?medium
- What is the Model Context Protocol (MCP)?medium
- How do you keep agent costs bounded?medium
- When should you not build an agent?medium