LLM Fundamentals Questions with Answers

8 practice questions on LLM Fundamentals (Generative AI & LLMs) with answers and step-by-step solutions. Try 8 samples below, then practise all 8 free in the AptiNest app.

Sample questions

Question 1Easy

What is the "context window" of an LLM?

  1. The maximum number of tokens the model can consider in one request
  2. The number of users who can query the model simultaneously
  3. The total size of the dataset used to pre-train the model
  4. The number of separate conversations the model can remember across different days

Answer: A. The maximum number of tokens the model can consider in one request

Explanation

Anything beyond the context window cannot be attended to in a single call, so long documents must be truncated, summarised or retrieved selectively.

Step-by-step solution

  1. The context window is measured in tokens.
  2. It covers everything in one request: instructions, history, documents and the reply being generated.
  3. Anything beyond it cannot be seen by the model in that call.

Why the other options are wrong

  • B. That is about server capacity, not the model's context.
  • C. Training data size is separate; the window is per request.
  • D. Models do not remember across separate calls unless the app re-sends past text.

Tip: Context window = the model's working memory for one request, counted in tokens.

Question 2Easy

What is a "token" in the context of LLMs?

  1. A complete sentence, always split exactly at full stops and question marks
  2. Always exactly one complete word, never less
  3. Always exactly one character of the input text
  4. A chunk of text such as a word, subword or punctuation mark

Answer: D. A chunk of text such as a word, subword or punctuation mark

Explanation

Tokenizers (e.g. byte-pair encoding) split text into subword units; common words may be one token while rare words are split into several.

Step-by-step solution

  1. A tokenizer cuts text into pieces before the model sees it.
  2. Common words are often one token; rare words split into several subword pieces.
  3. Punctuation and spaces can be tokens too, so a token is a chunk of text of varying size.

Why the other options are wrong

  • A. Sentences are far too large; one sentence is usually many tokens.
  • B. Rare or long words are split into several tokens, so a token is often less than a word.
  • C. Character-level splitting is possible but standard LLM tokenizers use subwords.

Tip: Rough rule for English: one token is about three-quarters of a word.

Question 3Easy

At its core, what is a large language model trained to do during pre-training?

  1. Translate text between exactly two languages
  2. Look up answers in a fixed database of questions
  3. Classify whole documents into a fixed set of categories
  4. Predict the next token given the preceding tokens

Answer: D. Predict the next token given the preceding tokens

Explanation

Autoregressive LLMs learn a probability distribution over the next token from vast text corpora; generation repeats this prediction token by token.

Step-by-step solution

  1. Pre-training uses huge amounts of ordinary text with no labels.
  2. The training signal is simply: given the tokens so far, predict the next one.
  3. Generation repeats that prediction one token at a time.

Why the other options are wrong

  • A. Translation is one task an LLM can do, but it is not the pre-training objective.
  • B. LLMs do not look up stored answers; they generate text from learned probabilities.
  • C. Document classification is a separate task, usually added by fine-tuning or prompting.

Tip: Pre-training = next-token prediction; everything else (chat, instructions) is added later.

Question 4Easy

What is the typical effect of lowering the sampling temperature towards 0?

  1. Output becomes more random, varied and creative in its wording
  2. Output becomes more deterministic and focused on the most likely tokens
  3. The model's context window grows to fit longer prompts
  4. The model runs with less memory and fewer parameters

Answer: B. Output becomes more deterministic and focused on the most likely tokens

Explanation

Temperature divides the logits before softmax. Low values sharpen the distribution; high values flatten it, increasing diversity.

Step-by-step solution

  1. Temperature divides the logits before softmax.
  2. A small temperature makes big logits relatively bigger, so the top token dominates.
  3. Near 0 the model almost always picks the most likely token, giving focused, repeatable output.

Why the other options are wrong

  • A. That is what a high temperature does.
  • C. Temperature only changes sampling; the context window is fixed by the model.
  • D. Temperature has no effect on model size or memory use.

Tip: Low temperature for facts and code, higher for brainstorming.

Question 5Medium

A base (pre-trained only) model often continues a question with more questions instead of answering. Which additional training mainly fixes this?

  1. Instruction tuning and preference-based alignment (e.g. RLHF)
  2. Using a higher sampling temperature during generation
  3. Switching to a smaller tokenizer with fewer tokens
  4. Increasing the context window so the model can see more of the question at once

Answer: A. Instruction tuning and preference-based alignment (e.g. RLHF)

Explanation

Supervised instruction tuning on prompt-response pairs, followed by learning from human (or AI) preference feedback, makes models follow instructions helpfully.

Step-by-step solution

  1. A base model only continues text in the style of its training data.
  2. Instruction tuning trains it on prompt and good-response pairs.
  3. Preference-based alignment (e.g. RLHF) further rewards helpful answers, so it answers instead of continuing.

Why the other options are wrong

  • B. Temperature changes randomness, not whether the model follows instructions.
  • C. Tokenizer size does not teach the model to answer questions.
  • D. The model already sees the question; the issue is its behaviour, not visibility.

Tip: Base model = autocomplete; instruction-tuned model = assistant.

Question 6Medium

What does top-p (nucleus) sampling do?

  1. Samples only from the smallest set of tokens whose cumulative probability reaches p
  2. Returns the top p complete responses to the user
  3. Always picks the single most likely token at every step
  4. Samples uniformly at random from every token in the vocabulary, ignoring probabilities

Answer: A. Samples only from the smallest set of tokens whose cumulative probability reaches p

Explanation

With p = 0.9, low-probability tail tokens are excluded, while the candidate set adapts to how confident the model is.

Step-by-step solution

  1. Sort tokens by probability, highest first.
  2. Add probabilities until the running total reaches p (e.g. 0.9).
  3. Sample only from that set; the low-probability tail is dropped.

Why the other options are wrong

  • B. Top-p works token by token, not on whole responses.
  • C. Always taking the top token is greedy decoding.
  • D. Uniform sampling ignores the model's probabilities; top-p uses them.

Tip: Top-k fixes the number of candidates; top-p fixes their total probability.

Question 7Medium

Why does an LLM's API usage cost and latency usually grow with prompt length?

  1. Longer prompts are stored permanently on the provider's servers and billed for storage
  2. Every input token must be processed, and each output token is a further step
  3. Prompt length has no effect on computation
  4. The model retrains itself on every prompt it receives

Answer: B. Every input token must be processed, and each output token is a further step

Explanation

Computation scales with the number of input and output tokens; generation is sequential, one token per step.

Step-by-step solution

  1. Every input token passes through the model before generation starts.
  2. Each output token then needs another forward pass, one after another.
  3. More tokens means more computation, so more time and more cost.

Why the other options are wrong

  • A. Providers bill for processing tokens, not for storing prompts.
  • C. Computation grows with the number of tokens processed.
  • D. Models do not retrain on each prompt; weights stay fixed during use.

Tip: Shorter prompts and capped outputs are the simplest cost and latency savings.

Question 8Hard

Two candidate tokens have logits 2.0 and 1.0. With temperature 1 the first token's probability is about 0.73. What is it with temperature 0.5?

  1. About 0.62
  2. About 0.88
  3. About 0.73
  4. About 0.50

Answer: B. About 0.88

Explanation

Divide logits by T = 0.5: 4.0 and 2.0.
softmax gives e^4 / (e^4 + e^2)
= 1 / (1 + e^-2)
= 0.88. Lower temperature makes the likely token even more likely.

Step-by-step solution

  1. Divide each logit by T = 0.5: 2.0 becomes 4.0, 1.0 becomes 2.0.
  2. Softmax: p = e^4 / (e^4 + e^2).
  3. Divide top and bottom by e^4: p = 1 / (1 + e^-2) = 1 / 1.135.
  4. p is about 0.88.

Why the other options are wrong

  • A. Lower temperature sharpens the distribution, so the top probability must rise above 0.73, not fall.
  • C. That is the T = 1 value; changing temperature changes the probabilities.
  • D. 0.5 would mean equal logits or infinite temperature.

Tip: Two-way softmax: p = 1 / (1 + e^-(difference / T)).

Practise all 8 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all Generative AI & LLMs topics · All topics