Interview questions

LLM Interview Questions (2026): The Ones Interviewers Really Ask

Most lists of llm interview questions read like a glossary someone memorised the night before. That's not how the good interviews go. A strong interviewer isn't checking whether you can recite a definition of a transformer — they're checking whether the thing feels like machinery to you or magic. Do you know why the model miscounts letters? Do you know what temperature actually changes? Can you explain a hallucination without hand-waving?

So I've written these the way you'd want to answer them at a whiteboard — first person, plain language, no textbook voice. I've grouped them from "do you get the core idea" up to "have you actually used one of these in anger." Say the answers out loud a few times and they stop being facts you recall and start being things you just know.

How LLMs actually work

What is a large language model, in one sentence?

It's a next-token predictor. You give it some text, and it outputs a probability distribution over what the next chunk of text is most likely to be, picks one, appends it, and repeats. That's it. Everything else — answering questions, writing code, sounding thoughtful — is an emergent side effect of getting really good at "what word comes next" over a huge amount of text. The magic isn't a reasoning engine hiding inside; it's that predicting the next token well turns out to require a shocking amount of implicit knowledge.

What they're testing: do you understand the model as prediction, not as a database or a mind.
What's a token, and why do models "miscount" letters?

Models don't see letters or words — they see tokens, which are sub-word chunks. "Strawberry" might be three tokens like straw + ber + ry. So when you ask "how many r's are in strawberry," the model never had the individual letters as separate units to count; it's reasoning over chunks that don't line up with characters. Same reason it fumbles reversing a string or doing tight character math. It's not dumb, it's just that its atoms aren't your atoms.

What they're testing: whether you know tokenization exists and can connect it to a real failure mode.
What's an embedding?

An embedding is a list of numbers that places a piece of text at a point in a high-dimensional space, arranged so things with similar meaning land near each other. "Dog" and "puppy" sit close; "dog" and "spreadsheet" sit far. Inside an LLM, every token gets embedded first — that's how text becomes something math can operate on. And it's the same trick that powers retrieval: to find relevant documents, you embed the query and the docs and look for the nearest points. I go deeper on that in the what is RAG piece.

What they're testing: do embeddings feel like geometry to you, or like a mystery.
Explain attention without the math.

When the model processes a word, attention lets it look back at every other word in the input and decide which ones matter for this one. In "the trophy didn't fit in the suitcase because it was too big," attention is what lets the model connect "it" to "trophy" rather than "suitcase." Each token essentially asks "who here is relevant to me?" and pulls in a weighted blend of the others. Stack that many times and the model builds a rich, context-aware sense of every word. That mechanism is the whole reason transformers beat what came before.

What they're testing: can you explain the core innovation in plain terms, not just name-drop it.

Training, tuning & prompting

What's the difference between training and inference?

Training is the expensive, one-time-ish process where the model reads a mountain of text and adjusts its billions of weights so its predictions get better — that's where the knowledge gets baked in. Inference is what happens every time you actually use the model: weights are frozen, you feed in a prompt, and it predicts tokens out. Training costs millions and happens rarely; inference is the per-request cost you pay forever. As an engineer you live almost entirely in inference-land.

What they're testing: do you know the model isn't learning from your prompts at runtime.
Does the model learn from my prompt during a conversation?

No — and this trips people up. The weights don't change when you chat. What looks like "remembering" earlier in a conversation is just that the whole conversation so far gets re-fed into the model as context on every turn. It's in-context, not in-weights. The moment that text falls out of the context window, it's gone. This is exactly why people confuse "give it examples in the prompt" with "fine-tuning" — one is temporary context, the other permanently changes the weights.

What they're testing: the context-vs-weights distinction, which underpins prompting, RAG, and fine-tuning.
When do you reach for fine-tuning vs prompting vs RAG?

Prompting first, always — it's free and instant, so exhaust it before anything else. Reach for RAG when the problem is knowledge: facts the model doesn't have or that change often, like your company's docs. You retrieve the right text at question time and hand it over as context. Reach for fine-tuning when the problem is behaviour: a consistent format, tone, or a narrow task where you can't fit enough examples in the prompt. The classic mistake is fine-tuning to add facts — that's fragile and expensive; RAG is the tool for facts. I break the retrieval side down in the RAG interview questions post.

What they're testing: can you match the technique to the problem, or do you reach for one reflexively.

Generation & its quirks

What does temperature actually change?

Remember the model outputs a probability distribution over next tokens. Temperature reshapes that distribution before it samples. Low temperature (near 0) makes it sharp — the model almost always grabs the single most likely token, so output is focused and repeatable. High temperature flattens it, so less likely tokens get a real shot, giving you variety and surprise. I use low temperature for extraction, classification, or anything where I want the same answer twice, and higher for brainstorming or copy. It does not make the model "more creative" in a smart way — it just widens the dice.

What they're testing: do you know temperature acts on sampling, not on the model's intelligence.
What's top-p (nucleus sampling), and how's it different from temperature?

Both control randomness but from different angles. Temperature rescales the whole distribution. Top-p instead says "only consider the smallest set of tokens whose probabilities add up to p, and sample from those" — so it dynamically cuts off the long tail of unlikely garbage. With top-p at 0.9 you keep the plausible options and drop the nonsense, no matter how many tokens that turns out to be. In practice I usually tune one, not both, and top-p is a nice guardrail against the model wandering into weird low-probability tokens.

What they're testing: whether you actually understand sampling knobs or just know the word "temperature."
Why do LLMs hallucinate?

Because the model was trained to always produce a plausible next token, not to know when to stop. It has no built-in sense of "I don't actually know this" — so when it lacks the fact, it generates something that sounds right, because sounding right is literally what it was optimised for. There's no lookup step where it checks a source unless you add one. So hallucination isn't a bug you patch out; it's the flip side of the model's whole design. You reduce it — ground it with retrieval, tell it to say "I don't know," show citations, verify — but honest engineers say "reduce and detect," not "eliminate."

What they're testing: do you understand the cause, or do you think it's a fixable defect.
What's a context window, and what's "context rot"?

The context window is the maximum amount of text — prompt plus the model's own output — the model can consider at once, measured in tokens. Everything the model "knows" in that moment has to fit inside it. Context rot is what happens as you cram it full: models get noticeably worse at using information buried in the middle of a long context, and stuffing in more marginally-relevant text can actively hurt answers rather than help. Bigger windows are great, but "just paste everything in" is a trap. Curating fewer, more relevant tokens usually beats dumping in more.

What they're testing: do you know a big context window isn't free real estate.
Why is the same prompt giving me different answers?

Two reasons. First, sampling: if temperature or top-p allow randomness, the model rolls the dice on which token to pick, so runs differ by design — set temperature to 0 for near-determinism. Second, even at temperature 0 you can see tiny variation from floating-point and hardware nondeterminism, or because the provider quietly updated the model behind the same name. If your app needs reproducibility, pin what you can, log inputs and outputs, and don't assume "same prompt" guarantees "same output."

What they're testing: do you understand determinism well enough to debug flaky output.

Using LLMs well

How would you reduce cost and latency for an LLM feature?

A stack of levers, cheapest first. Use a smaller, faster model for easy requests and escalate to a big one only when needed — routing beats one-size-fits-all. Trim the prompt: shorter context is faster and cheaper, and it dodges context rot. Cache aggressively — identical or near-identical requests shouldn't hit the model twice, and providers offer prompt caching for the static parts. Stream tokens so the user sees output immediately even if the full answer takes a beat. And always measure cost-per-request; a feature that's brilliant but negative-margin doesn't ship.

What they're testing: production maturity — do you think about the bill and the clock.
How do you evaluate whether an LLM feature is any good?

"It looked fine in the demo" is where things go to die. Build a small evaluation set — real inputs paired with what a good output looks like — and score against it every time you change the prompt or model, so you can see a number move instead of trusting vibes. For open-ended tasks, an LLM-as-judge with a clear rubric works surprisingly well. The point is the same as tests in normal code: without evals, every change is a guess and every regression is a surprise your users find first.

What they're testing: this is a big senior signal — do you engineer, or do you eyeball.
What's an LLM agent, in plain terms?

An agent is an LLM in a loop that can call tools. Instead of just answering, it decides "to do this, I need to search the web / run this code / hit this API," calls the tool, reads the result, and keeps going until it's done. The model provides the reasoning and the tool use provides the hands. The hard parts aren't the idea — they're keeping it from looping forever, handling tool failures gracefully, and stopping it from confidently doing the wrong thing. Great for multi-step tasks; overkill for a one-shot answer.

What they're testing: do you grasp tool-use and the reasoning loop, not just the buzzword.

FAQ

How many LLM interview questions should I actually prepare?
Focus on understanding a dozen core ideas rather than memorising a hundred flashcards. If you truly get next-token prediction, tokens, embeddings, attention, training vs inference, temperature and top-p, context windows, hallucinations, and RAG vs fine-tuning, you can reason your way through almost any question they throw at you. Depth beats breadth every time.
What's the question candidates fumble most?
Why LLMs hallucinate. Weaker answers treat it as a bug that better models will fix. The strong answer explains that the model is trained to always produce a plausible next token and has no built-in sense of not knowing, so hallucination is a design consequence you reduce and detect rather than eliminate.
Do I need to know the transformer math to pass?
For most AI engineer and applied roles, no. You need to explain attention, tokenization, embeddings, and sampling clearly in plain language and connect them to real behaviour and failures. Deep matrix math matters mainly for research roles. Being able to teach the idea out loud is what interviewers are listening for.
How is an LLM different from RAG in an interview answer?
An LLM is the model itself — a next-token predictor. RAG is a technique you wrap around it: retrieve relevant text at question time and feed it in as context so the model answers from real sources instead of memory. Use RAG when the problem is knowledge that changes; the LLM is the engine underneath either way.
What separates a junior answer from a senior one?
Juniors define things; seniors talk about trade-offs and failures. Anyone can say what temperature is. The senior signal is knowing when to turn it down, why retrieval fixes some problems but not behaviour problems, how you'd evaluate the thing, and what it costs per request. Talk about what breaks and what you'd do about it.

Open-source companion: Awesome AI Engineer Interview Questions — 105 curated questions on GitHub, free.