Skip to main content

Exercises — Language model overview

Comprehension questions and practice

← Back to the lesson: Language model overview

Exercises and practice.

  1. Does fine-tuning necessarily change the architecture? No: it primarily updates parameters. Some methods also add modules, so distinguish the model family from the full structure of the adapted system.

  2. Documentation changes every day: RAG or fine-tuning? RAG can retrieve new documents at inference time without changing the weights. It does not guarantee that retrieved documents are relevant or that the answer is faithful to them.

  3. A model returns a structured request to call lookup_order(order_id=42). Has the order system been queried yet? No. The model has produced a request; the surrounding application must validate the arguments and permissions, execute the tool, and return its result to the model. Generating a tool call is not the same as executing it.

  4. A chat transcript labels messages system, user, and assistant. Are these three Transformer layers? No. They are roles in the message format used by the application/API. The model’s architecture is a separate question, and a role label alone does not enforce a policy.

  5. A pretrained model must classify reviews as positive or negative. It receives an instruction and three labeled examples in the prompt; no additional training is run. Which mechanism is being used? What would change if the weights were updated on a set of examples? And what if external reviews or documentation were retrieved and added to the context?

Show the answer and reasoning

The first case is few-shot / in-context learning: the examples condition the response during inference, without updating the parameters. Updating the weights on examples would be fine-tuning. Retrieving external documents and adding them to the context would be a RAG system. These mechanisms can complement one another, but they are not interchangeable. Pretraining may have exposed the model to related language patterns and task-like examples; “not specifically trained for this classification” does not mean “learned nothing relevant”. To evaluate the classifier, compare predictions with labels from reviews held out from the prompt and tuning decisions.

  1. Reconstruct the generation loop. An assistant receives a prompt and must produce three tokens. Put these operations in order: (a) append the selected token to the context; (b) convert the text into tokens; (c) check whether the three-new-token limit has been reached; (d) compute the next-token distribution; (e) select a token using the decoding rule; (f) process the initial context. Do the model parameters change at each iteration?
Show the answer and reasoning

The initial prompt processing (f) starts with tokenizing the text (b), then the model computes the distribution (d). The decoding rule selects a token (e), which is appended to the context (a). The stopping condition is then checked (c); if the limit has not been reached, a new distribution is computed from the extended context and selection repeats. The parameters remain fixed throughout inference: only the context changes. The three-token limit is an external stopping condition, not a model update. Newly generated tokens depend on previous selections, so an autoregressive continuation cannot be produced in parallel, even though the computation within one model step can use the model’s internal parallelism.

  1. A possible continuation receives probability 0.6. Does this establish that it is true?
Show the answer and reasoning

No. The value 0.6 is a conditional probability assigned by the model to a continuation in a given context. It is not a factual verification or a guarantee of truth. A highly probable answer can still be false.

  1. Are generating, scoring an observed target, and learning three names for the same operation?
Show the answer and reasoning

No. Generation selects a token and extends the context; scoring evaluates the probability of an observed token or sequence; learning uses a loss and its gradients to update parameters. Generation and scoring can be performed with fixed parameters; learning changes the parameters.

  1. Is every large language model (LLM) necessarily a GPT?
Show the answer and reasoning

No. LLM describes a category of language models trained at scale. GPT describes a family based on a decoder-only Transformer architecture and an autoregressive objective. Other language-model configurations exist, including encoder-only and encoder-decoder models.

Language: Français · English