Interviews & offers

LLM Interview Questions: What AI Teams Ask and Good Answers

By the AIJobDesk team · Updated

LLM interviews test how transformers work, how models are pretrained and fine-tuned, how to build and evaluate retrieval-augmented generation, and how to serve models cheaply and safely. Strong answers connect each concept to a practical decision, such as when to fine-tune instead of prompting or how to measure hallucinations.

LLM interview questions cover how transformers work, how models are trained and adapted, how to build retrieval-augmented systems, how to evaluate outputs and how to serve models efficiently and safely. Interviewers want more than definitions. They want to hear when you'd fine-tune versus prompt, how you'd measure hallucinations and what you'd do when costs spike. Below are real-style questions by topic with what a good answer covers.

Who gets LLM interview questions?

These questions show up for LLM engineer, generative AI engineer, AI engineer, NLP engineer and research engineer roles, and increasingly for ML engineers and product-minded data scientists. Application-focused roles lean on RAG, evaluation and serving. Research and training roles lean on architecture, pretraining and optimization.

Transformer and architecture questions

1. Explain self-attention. Cover queries, keys and values as linear projections of token embeddings; attention scores as scaled dot products of queries and keys; softmax to get weights; and a weighted sum of values. Explain the scaling by the square root of the key dimension (to keep softmax from saturating).

2. Why multi-head attention? Several heads let the model attend to different relationships in parallel, such as syntax in one head and coreference in another, at roughly the same cost as one big head.

3. How do transformers know token order? Through positional information: learned or sinusoidal embeddings in early models, and rotary position embeddings (RoPE) in many current ones. Bonus: how RoPE scaling helps extend context length.

4. What's the computational cost of attention, and how is it reduced? Quadratic in sequence length for compute and memory. Mention FlashAttention (an exact, memory-efficient kernel), grouped-query attention to shrink the KV cache, and sparse or sliding-window attention.

5. Decoder-only versus encoder-decoder models? Decoder-only models predict the next token with causal masking and dominate chat models. Encoder-decoders suit tasks with a clear input-output split such as translation. Encoder-only models like BERT are strong for classification and embeddings.

6. What is tokenization and why does it matter? Subword schemes like BPE balance vocabulary size and sequence length. Tokenization affects cost (you pay per token), multilingual performance and odd failures such as poor arithmetic or character counting.

Training and fine-tuning questions

7. Walk through the stages of training a chat model. Pretraining on large text corpora with next-token prediction; supervised fine-tuning on instruction-response pairs; then preference tuning with RLHF or direct preference optimization (DPO). A good answer says what each stage adds.

8. RLHF versus DPO? RLHF trains a reward model from human preferences and optimizes the policy against it with reinforcement learning (often PPO). DPO skips the explicit reward model and optimizes directly on preference pairs, which is simpler and more stable but less flexible.

9. What is LoRA and why use it? Low-rank adaptation freezes base weights and trains small low-rank matrices added to certain layers. It cuts memory and storage, lets you keep many adapters per base model and usually gets close to full fine-tuning quality for narrow tasks. QLoRA adds a quantized base model to fit larger models on smaller GPUs.

10. When would you fine-tune instead of using prompting or RAG? This is a judgment question interviewers love. Strong answer: use RAG when the model needs facts that change or that it never saw; fine-tune when you need a consistent format, style or narrow skill, or to make a smaller, cheaper model match a larger one on a specific task. Start with prompting and an eval set, and only fine-tune if the eval shows a gap prompting can't close.

11. What is catastrophic forgetting? Fine-tuning on a narrow dataset can degrade general abilities. Mitigations include LoRA, mixing in general data, lower learning rates and evaluating on general benchmarks after tuning.

RAG and retrieval questions

12. Design a RAG system over company documents. Cover ingestion and chunking (size and overlap tradeoffs), embedding model choice, a vector index, hybrid search (dense plus keyword such as BM25), reranking with a cross-encoder, prompt construction with citations, and evaluation. Mention access control so users only retrieve documents they're allowed to see.

13. Retrieval quality is poor. How do you debug it? Separate retrieval from generation. Build a set of questions with known relevant chunks, measure recall@k, then try better chunking, hybrid search, query rewriting or a reranker. If retrieval is good but answers are bad, the problem is the prompt or the model.

14. How do you reduce hallucinations? Ground answers in retrieved context, instruct the model to say when it doesn't know, require citations, lower temperature for factual tasks, and verify claims against sources with a second pass. Then measure it, since you can't reduce what you don't track.

Evaluation questions

15. How do you evaluate an LLM application? Build a task-specific eval set from real user queries, with reference answers or grading rubrics. Use automated metrics where possible (exact match, unit tests for code, retrieval recall), LLM-as-judge with a calibrated rubric for open-ended output, and human review on a sample. Track results across every prompt and model change.

16. What are the risks of LLM-as-judge? Position bias, verbosity bias, self-preference for outputs from the same model family, and drift when the judge model changes. Calibrate against human labels and randomize answer order.

17. Why aren't public benchmarks enough? They may not match your task, can be contaminated in training data and saturate quickly. Your own eval set is what predicts production quality.

Inference and cost questions

18. How do you reduce LLM inference latency and cost? Options: a smaller or distilled model, quantization (8-bit or 4-bit), batching with continuous batching in servers like vLLM, KV-cache reuse and prompt caching, speculative decoding, shorter prompts and routing easy requests to cheaper models.

19. What is the KV cache? During generation, keys and values for past tokens are cached so each new token doesn't recompute them. It speeds up decoding but uses memory that grows with sequence length and batch size, which is why techniques like paged attention matter.

20. What do temperature and top-p do? Temperature scales logits before softmax: lower is more deterministic, higher more varied. Top-p samples from the smallest set of tokens whose probabilities sum to p.

Safety and reliability questions

21. What is prompt injection and how do you defend against it? Malicious instructions inside user input or retrieved content that try to override the system prompt. Defenses are layered: separate trusted and untrusted content, limit tool permissions, validate outputs, require confirmation for risky actions and red-team regularly. No single defense is complete.

22. How do you get reliable structured output? Use the model provider's structured output or JSON schema features where available, validate against a schema, retry on failure and keep schemas simple.

Agent and tool-use questions

23. How does tool calling work? You describe tools to the model with names, descriptions and parameter schemas. The model returns a structured call, your code executes it and feeds the result back, and the loop continues until the model produces a final answer. Strong answers mention validating arguments and capping the number of steps.

24. Your agent works in demos but fails in production. Why? Common causes: errors compound over many steps, tool outputs are longer or messier than in testing, ambiguous tool descriptions, missing retries and no evaluation on realistic multi-step tasks. Good fixes are fewer, clearer tools, smaller steps, logging every trajectory and building an eval set of end-to-end tasks with pass or fail checks.

25. How would you evaluate an agent? Measure task success rate on a fixed set of realistic tasks, plus cost, latency and number of steps per task. Review failed trajectories by hand to find patterns, and rerun the full set after every prompt, tool or model change.

How to answer LLM interview questions well

  1. Define the concept in a sentence.
  2. Explain the mechanism or tradeoff.
  3. Tie it to a decision you'd make in a real system.
  4. Add a number from your own work if you have one: "Hybrid search raised recall@5 from 71% to 84% on our eval set."

Mistakes to avoid

  • Name-dropping tools without understanding them. If you mention vLLM, be ready to explain continuous batching.
  • Skipping evaluation. Interviewers see "I tried prompts until it looked good" as a red flag.
  • Treating fine-tuning as the default. It's usually not the first step.
  • Ignoring cost. Know roughly how token counts drive spend.

A two-week prep plan

  • Days 1 to 4: Transformer fundamentals and training stages. Implement attention in NumPy once.
  • Days 5 to 9: Build a small RAG app with an eval set of 50 questions, and improve it measurably.
  • Days 10 to 12: Inference and serving. Run an open-weight model locally and measure latency.
  • Days 13 to 14: Mock interviews and system design practice from our ML system design interview guide.

Next step

If you're still building the skills, start with our guide to learning generative AI or the full path to becoming an LLM engineer. For broader ML fundamentals, review our machine learning interview questions. When you're ready, browse LLM engineer jobs. Right now we list new roles every week.

Ready to apply? Browse LLM Engineer jobs

Frequently asked questions

Are LLM interviews hard?
They can be, mainly because the field moves fast and interviewers mix theory with practical judgment. The fundamentals are stable, though: attention, tokenization, training stages, retrieval and evaluation. If you can explain those clearly and have built at least one real LLM application with an evaluation set, you'll handle most questions well.
What LLM interview questions do freshers get?
Freshers usually get conceptual questions: what is a transformer, how does self-attention work, what is tokenization, what's the difference between pretraining and fine-tuning, what is RAG and what causes hallucinations. Expect a coding task such as calling a model API, building a small retrieval pipeline or implementing attention in NumPy.
What do experienced candidates get asked in LLM interviews?
Experienced candidates get design and tradeoff questions: build an assistant over a million documents, cut inference cost by half, decide between fine-tuning and retrieval, design an evaluation pipeline, or handle prompt injection. Interviewers expect real numbers from your past work, such as latency, cost per request and eval scores before and after changes.
Which LLM should I say is the best in an interview?
Avoid naming one best model. A better answer explains that the right model depends on the task, latency, cost, privacy needs and whether you can self-host. Describe how you'd compare candidates: build a task-specific eval set, measure quality, latency and cost per request, and pick the cheapest model that meets the quality bar.
Do LLM interviews include coding?
Usually. Common tasks include writing a prompt pipeline with structured output, building a minimal RAG system, writing an evaluation script that scores model outputs, implementing scaled dot-product attention, or debugging a slow inference setup. Research roles may ask you to implement parts of a transformer or a training loop in PyTorch.
How should I prepare for an LLM engineer interview?
Review transformer fundamentals, build one end-to-end project with retrieval and a proper evaluation set, and practice explaining tradeoffs out loud. Read the documentation of popular serving and fine-tuning tools so you can discuss them concretely. Prepare two stories about LLM failures you debugged, since those come up often.

Sign in to AIJobDesk

Save jobs, track applications and get new matches by email. Free.

or

No password. We email you a 6-digit code.