TensorTonic/llm-interview-questions
Über uns
LLM and transformer interview questions with explanations and practice problems for each one
Lernen und BildungGemessener Sternzuwachs
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- +3
- in 1 month
- Verlauf wird gesammelt
Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.
README.md
OriginalLLM and Transformer Interview Questions
This is a list of the transformer and large language model questions that come up most often in ML engineer and research interviews. It has 39 questions across four stages, from tokens and attention to serving, evaluation and system design.
Every question links to an explanation that covers the answer and to practice problems where you implement the idea in Python and check it against tests. Having built attention or a KV cache yourself is the most reliable way to answer follow-up questions about them.
Table of Contents
- Who this is for
- How to use this roadmap
- Stage 1: Transformer Foundations
- Stage 2: Training and Alignment
- Stage 3: Inference and Serving
- Stage 4: Evaluation, RAG and System Design
- What's next
Who this is for
This list is for anyone preparing for an interview where transformers or LLMs are likely to come up.
- If you are preparing for an ML engineer role, focus on stages 1 and 3, since attention, the KV cache and serving questions are the most common.
- If you are interviewing for research or post-training roles, spend extra time on stage 2, where training dynamics and alignment methods are covered.
- If you already work with LLMs, use the tables as a self-test and read the explanations only for the questions you cannot answer out loud.
You need basic Python and some familiarity with neural networks. The questions build on each other, so earlier stages make later answers easier.
How to use this roadmap
Read each question and try to answer it out loud in two minutes before opening the explanation. Interviewers usually follow up with a trade-off or a number, so check that your answer covers why the idea exists and what it costs.
After reading, solve one of the practice problems for that question. When you have finished a stage, the interview assessments let you test yourself under time pressure, including the LLM Internals, Training and Decoding Primitives and Post-Training and Alignment sets.
Stage 1: Transformer Foundations
Almost every LLM interview starts with how a transformer turns text into predictions. These questions cover tokens, positions, attention and the block that repeats through the whole model. Expect to explain each one from scratch and to say how modern models changed the original design.
| Question | Read | Practice |
|---|---|---|
| What is tokenization, and how is a BPE tokenizer trained and applied? | Tokenization in the Transformer | Train a BPE Tokenizer From Scratch, Apply Ranked BPE Merges |
| Why do transformers need positional information, and how does RoPE encode it? | RoPE: Rotary Position Embedding Explained | RoPE: Rotary Query and Key Embeddings, Sinusoidal Positional Encoding |
| How does self-attention work, and why are the scores scaled by the square root of the key dimension? | Attention in LLMs: Queries, Keys and Values Explained | Named-Dimension Batched Attention Scores, Numerically Stable Softmax |
| What is the causal mask, and where in attention is it applied? | Attention in LLMs: Queries, Keys and Values Explained | Causal Masking for Attention |
| Why use multiple attention heads, and what do MQA and GQA change? | Multi-head attention in the Transformer | Causal Grouped-Query Attention |
| Walk through a decoder block. Where do the residual connections and normalization go? | Encoder block in the Transformer | Transformer Decoder Block |
| Why do transformers use LayerNorm instead of BatchNorm, and what does RMSNorm remove? | Layer Normalization in the Transformer | RMSNorm Forward Pass |
| What does the feed-forward layer do, and why does a SwiGLU block use a smaller hidden size? | Feed-forward network in the Transformer | Parameter-Matched SwiGLU Block |
| What is the difference between encoder-only, decoder-only and encoder-decoder models, and why did decoder-only win for LLMs? | GPT Pretraining: How Next-Token Prediction Works | |
| What is a Mixture of Experts model, and what goes wrong when you train one? | Mixture of Experts (MoE) in LLMs Explained | Top-k MoE Router with Load Statistics |
Stage 2: Training and Alignment
Once the architecture is clear, interviewers move on to how the model is trained and how a base model becomes an assistant. These questions cover the pretraining objective, optimization, memory and scale, and the fine-tuning and preference methods used after pretraining.
Stage 3: Inference and Serving
Serving questions are now common even for roles that do not focus on infrastructure, because cost and latency decide whether a model ships. These questions cover how tokens are generated, why decoding is slow, and the techniques that make it faster and cheaper.
Stage 4: Evaluation, RAG and System Design
Later rounds ask whether you can judge a model and build a product around it. These questions cover evaluation, retrieval-augmented generation, the live coding round and open-ended design prompts.
| Question | Read | Practice |
|---|---|---|
| How do you evaluate an LLM when there is no single correct answer? | Evaluating generated answers | Fit Elo Ratings from Pairwise Votes |
| How would you measure agreement between human or LLM judges? | Machine Learning Evaluation Metrics | Cohen's Kappa |
| What is benchmark contamination, and how would you detect it? | Build Deterministic MinHash Signatures | |
| What is RAG, and what happens between the user's question and the model's answer? | Retrieval-Augmented Generation (RAG) Explained | Text Chunking for RAG |
| What is the difference between dense and sparse retrieval, and when would you combine them? | Retrieval-Augmented Generation (RAG) Explained | BM25 Ranking |
| How do you evaluate a RAG system, and how do you tell a retrieval failure from a generation failure? | LLM serving and RAG | Precision and Recall at K |
| In a coding round, how would you implement multi-head attention from scratch? | ML Coding Interview Questions: 20 to Implement | Multi-Head Attention (MHA) |
| How would you design a support chatbot that answers from company documentation? | ML System Design Interview Framework | |
| How would you serve a large open model to thousands of concurrent users within a latency target? | LLM serving and RAG | Optimize Throughput and Cost Under a Latency SLO |
What's next
To go deeper than single questions, the Build LLM from Scratch study plan walks through a full language model piece by piece, and the Inference Engineering plan covers serving in the same way. The LLM Internals pages have visual explanations of most topics above, and the Transformer research track rebuilds the original paper step by step.
If you want to build the model yourself instead of studying it one question at a time, the How to Build an LLM from Scratch guide walks through the stages in order, from tokens and embeddings to generation, and lists the mistakes people make when joining the pieces.
For a written walkthrough of how to prepare, the LLM Interview Questions guide explains how to answer the questions interviewers ask most often about large language models.
If you are interviewing for a research engineer role, the Research Engineer Interview Preparation guide explains how to prepare for those interviews, and the NLP Interview Questions guide covers the language processing questions that are often asked alongside the LLM ones.
If you are interviewing for an AI engineer role, the AI Engineer Interview Questions guide covers the questions asked about building applications on top of language models.
License
MIT
Ähnliche Projekte entdecken
Wird geladen…