Large Language Models interview questions

29 questions from the Large Language Models course, each with the correct answer and an explanation. Try to answer before you open the answer.

What an LLM Is

1. What is the basic task an LLM is trained for?

  1. Run SQL queries
  2. Look up answers in a fact database
  3. Predict the next token given the previous ones
  4. Compress images
Show answer

Answer: Predict the next token given the previous ones

Everything an LLM produces is built by repeated next-token prediction.

Lesson: What Is a Large Language Model

2. Which stage is usually the most expensive?

  1. Pretraining
  2. Writing the prompt
  3. Rendering the UI
  4. Spell checking
Show answer

Answer: Pretraining

Pretraining consumes most of the compute because of the data and model size.

Lesson: The Life of a Model: Pretraining to Chat

3. What does BPE repeatedly do?

  1. Sort the alphabet
  2. Delete rare letters
  3. Translate words
  4. Merge the most frequent adjacent pair into a new token
Show answer

Answer: Merge the most frequent adjacent pair into a new token

Merging frequent pairs builds a vocabulary of useful chunks.

Lesson: Tokens and Byte-Pair Encoding

4. What is hallucination?

  1. A GPU overheating
  2. Confident output that is false or invented
  3. A slow network
  4. Compressing a prompt
Show answer

Answer: Confident output that is false or invented

The model generates plausible text, not verified facts.

Lesson: What LLMs Are Good and Bad At

From Text to Probabilities

5. What does a cosine similarity near 1 indicate?

  1. The vectors are unrelated
  2. The vectors point in nearly the same direction
  3. The text is long
  4. The model is large
Show answer

Answer: The vectors point in nearly the same direction

Similar meaning gives similar direction in embedding space.

Lesson: Embeddings and Similarity

6. What does raising the temperature do?

  1. Deletes tokens
  2. Makes the model larger
  3. Guarantees correct answers
  4. Flattens the distribution, making output more varied
Show answer

Answer: Flattens the distribution, making output more varied

Higher temperature spreads probability across more tokens.

Lesson: Logits, Softmax and Temperature

7. What does top-p sampling keep?

  1. The smallest set of tokens whose probabilities sum to at least p
  2. Exactly p tokens
  3. Only the last token
  4. Every token
Show answer

Answer: The smallest set of tokens whose probabilities sum to at least p

The size of the kept set adapts to how confident the model is.

Lesson: Sampling: Greedy, Top-k and Top-p

8. What does a bigram model use to predict the next word?

  1. Images
  2. A database of facts
  3. Counts of which word followed the previous word
  4. A compiler
Show answer

Answer: Counts of which word followed the previous word

It estimates probabilities from word-pair frequencies.

Lesson: A Tiny Language Model You Can Run

9. A perplexity of 1 means…

  1. The text has one token
  2. The model knows nothing
  3. The model predicts the text perfectly
  4. The model is biased
Show answer

Answer: The model predicts the text perfectly

Perplexity 1 corresponds to assigning probability 1 to every true next token.

Lesson: Loss and Perplexity

The Transformer

10. In attention, what do the softmax weights multiply?

  1. The value vectors
  2. The tokenizer
  3. The GPU
  4. The prompt
Show answer

Answer: The value vectors

The output is a weighted sum of values, with weights from query-key scores.

Lesson: Self-Attention: Queries, Keys, Values

11. What does the causal mask prevent?

  1. Embedding
  2. Tokenisation
  3. Softmax
  4. A token attending to later tokens
Show answer

Answer: A token attending to later tokens

The model must predict the next token without seeing it.

Lesson: Causal Masking and Generation

12. Why are positions added to a transformer?

  1. To reduce the vocabulary
  2. Attention alone does not know word order
  3. To compress images
  4. To encrypt text
Show answer

Answer: Attention alone does not know word order

Without positional information the same words in any order look identical.

Lesson: Layers, Feed-Forward Blocks and Positions

13. What does a KV cache store?

  1. The user's password
  2. Keys and values of earlier tokens, to avoid recomputing them
  3. The training data
  4. The tokenizer rules
Show answer

Answer: Keys and values of earlier tokens, to avoid recomputing them

Caching earlier keys and values makes each new token cheaper to generate.

Lesson: Context Window and the KV Cache

Training and Adapting Models

14. What did scaling-law research suggest for a fixed compute budget?

  1. Neither matters
  2. Only add parameters
  3. Only add data
  4. Grow parameters and training data together
Show answer

Answer: Grow parameters and training data together

Balanced growth of model size and data gives better loss for the same compute.

Lesson: Scaling Laws and Data

15. Which problem is best solved with retrieval rather than fine-tuning?

  1. Answering from documents that change daily and must be cited
  2. Always replying in a fixed brand tone
  3. Learning a fixed output format
  4. Making the model smaller
Show answer

Answer: Answering from documents that change daily and must be cited

Retrieval brings current, citable facts into the prompt at question time.

Lesson: Fine-Tuning, LoRA and When Not to Fine-Tune

16. What data does preference tuning use?

  1. Only images
  2. Only raw web pages
  3. Comparisons showing which answer is better
  4. Server logs
Show answer

Answer: Comparisons showing which answer is better

Preference pairs teach the model which behaviours people favour.

Lesson: Alignment: RLHF and Preference Optimisation

Building with LLMs

17. What does a system prompt do?

  1. Replaces the tokenizer
  2. Trains the model
  3. Sets durable role and rules for the conversation
  4. Increases context length
Show answer

Answer: Sets durable role and rules for the conversation

It carries standing instructions that apply across the user's messages.

Lesson: Prompting Basics

18. What is the main idea of RAG?

  1. Retrieve relevant text and put it in the prompt before answering
  2. Retrain the model for each question
  3. Delete the context
  4. Use a larger tokenizer
Show answer

Answer: Retrieve relevant text and put it in the prompt before answering

Grounding in retrieved text improves accuracy and allows citations.

Lesson: Retrieval-Augmented Generation (RAG)

19. Who actually executes a tool call?

  1. The user's browser only
  2. The model itself
  3. The tokenizer
  4. Your application code
Show answer

Answer: Your application code

The model only proposes the call; your code decides whether and how to run it.

Lesson: Tool Use and Structured Output

20. Which change usually lowers cost the most for easy classification tasks?

  1. Using the largest model with a long prompt
  2. Using a smaller model with a short prompt
  3. Raising the temperature
  4. Adding more examples to every call
Show answer

Answer: Using a smaller model with a short prompt

Match model size and prompt length to the difficulty of the task.

Lesson: Cost, Latency and Caching

Evaluation and Safety

21. Why keep a fixed evaluation set?

  1. To train the base model
  2. To compare changes to prompts or models objectively
  3. To reduce token cost
  4. To avoid testing
Show answer

Answer: To compare changes to prompts or models objectively

The same test inputs let you see whether a change really helped.

Lesson: Evaluating LLM Output

22. Which measure helps catch a hallucinated citation?

  1. Removing the system prompt
  2. Raising the temperature
  3. Using shorter words
  4. Checking in code that the cited passage contains the claim
Show answer

Answer: Checking in code that the cited passage contains the claim

Automated verification against the source catches unsupported claims.

Lesson: Reducing Hallucination

23. Which design best limits damage from prompt injection?

  1. Least-privilege tools plus human approval for risky actions
  2. Giving the model admin access
  3. Hiding the system prompt only
  4. Using a higher temperature
Show answer

Answer: Least-privilege tools plus human approval for risky actions

Limiting what a compromised model can do bounds the harm.

Lesson: Prompt Injection, Privacy and Bias

Running Models in Production

24. What does 4-bit quantization mainly reduce?

  1. The vocabulary
  2. The number of users
  3. Memory used by the weights
  4. The training data
Show answer

Answer: Memory used by the weights

Fewer bits per weight means a smaller memory footprint.

Lesson: Model Size and Quantization

25. What is a benefit of streaming tokens?

  1. Answers become more accurate
  2. The model becomes smaller
  3. Users see output start sooner, improving perceived latency
  4. Tokens become free
Show answer

Answer: Users see output start sooner, improving perceived latency

Streaming shows partial output immediately instead of waiting for the full answer.

Lesson: Serving, Batching and Choosing a Model

Putting It Together

26. Why does the assistant verify citations in code?

  1. Models can invent citations, so they must be checked against retrieved text
  2. To make responses longer
  3. To train the model
  4. Citations are never wrong
Show answer

Answer: Models can invent citations, so they must be checked against retrieved text

Programmatic verification catches unsupported claims before users see them.

Lesson: Case Study: A Policy Question-Answering Assistant

27. A model gives wrong answers about last week's policy change. Which fix fits best?

  1. Shorten the vocabulary
  2. Raise the temperature
  3. Fine-tune on one example
  4. Add retrieval so current policy text is placed in the prompt
Show answer

Answer: Add retrieval so current policy text is placed in the prompt

Fresh, citable facts belong in the prompt via retrieval, not in the weights.

Lesson: Revision: Cheat Sheet and Self-Check

28. Why does softmax with a very low temperature give nearly the same token every time?

  1. It deletes other tokens from the vocabulary
  2. It makes the distribution very sharp around the top logit
  3. It trains the model again
  4. It adds more layers
Show answer

Answer: It makes the distribution very sharp around the top logit

Dividing logits by a small number magnifies differences, concentrating the probability.

Lesson: Revision: Cheat Sheet and Self-Check

29. What does a causal mask guarantee?

  1. The output is always true
  2. A position cannot use information from later positions
  3. The prompt is shorter
  4. The model is quantized
Show answer

Answer: A position cannot use information from later positions

Future scores are set to minus infinity so their attention weights are 0.

Lesson: Revision: Cheat Sheet and Self-Check

← Back to the course