AI-901 lesson 3: how generative models work

Lesson 3 of 12 · 7 min read · Updated October 16, 2026

A generative language model works by predicting the next token over and over: it reads the tokens of a prompt, scores every possible next token, picks one, adds it to the text and repeats until the response is complete. Tokens are chunks of text, often a whole short word, a part of a longer word or a punctuation mark, and each model can handle only a fixed number of them per request, called its context window. Almost every concept in this lesson follows from those two facts.

Tokens and the context window

A model does not see words or letters; it sees tokens. A common word may be one token, while a rare or long word is split into several pieces. Because of this, costs and limits are counted in tokens, not words or characters.

The context window is the maximum number of tokens the model can consider in one request. It has to hold the system prompt, the conversation so far, any supplied documents and the response itself. If the input is too long, the request fails or older material must be removed. A larger window allows longer documents and conversations, but it does not make the model smarter, and the limit differs from model to model.

Training versus inference

Two phases are easy to blur.

  • Training is when the model learns patterns from very large amounts of data. It is done once (and sometimes refined later) by the model’s creator, and it fixes what the model “knows” up to a knowledge cutoff.
  • Inference is using the finished model to answer a request. Everything an app does, including every prompt sent from the Foundry portal, is inference. Prompting does not retrain the model.

Two consequences matter for the exam. A model cannot know facts that appeared after its training, so current or private information must be supplied in the prompt. And a model can produce confident text that is wrong, because it predicts plausible text rather than looking facts up.

From prompt to response

From prompt to responseA system prompt, a user prompt and optional grounding data are turned into tokens, processed by a deployed model whose parameters such as temperature shape the output, and returned as a response.System promptUser promptGrounding dataoptionalTokenstext split into piecesDeployed modeltemperature and otherparameters applyResponsenew tokens
A system prompt, a user prompt and optional grounding data are turned into tokens, processed by a deployed model with its parameters, and returned as generated tokens that form the response.

The figure above shows the path. The system prompt sets standing behaviour such as role, tone and limits. The user prompt is the request of the moment. Grounding data is optional text from your own sources placed into the request so the answer can rely on it. All of this becomes tokens, the deployed model generates new tokens under the configured parameters, and those tokens are turned back into the response, often called the completion.

Parameters that shape the output

Parameters are settings sent with a request, not changes to the model.

ParameterEffect
TemperatureLower values give more focused, repeatable answers; higher values give more varied, creative ones
Top-pRestricts choices to the most likely tokens whose combined probability reaches the value; lower means more conservative
Maximum output lengthCaps how many tokens the response may use

Temperature and top-p both influence randomness, so the usual advice is to adjust one and leave the other alone. Some reasoning models do not accept these settings, so a model’s documentation is worth checking. Even at the lowest temperature, identical output is not guaranteed in every case.

Choosing a model and a deployment

Choose a model by capability and constraint, then the cheapest option that meets them.

  • A large language model suits open-ended reasoning and long, complex tasks.
  • A smaller model suits simple, high-volume tasks where cost and speed matter most.
  • A multimodal model accepts more than text, such as images or audio, as input.
  • An image-generation model creates pictures from text and is the wrong choice for chat.

In Microsoft Foundry a model becomes usable once it is deployed, and the deployment type decides where data is processed and how it is billed. At fundamentals level, know the pattern: Global Standard is the usual starting point, pay per token with the broadest model availability; Data Zone types keep processing within the US, EU or Asia Pacific zone; Standard keeps processing in the chosen Azure geography; Provisioned types reserve capacity for steady, predictable throughput; Batch types handle large asynchronous jobs at lower cost. Availability varies by model.

A 60-person law firm builds an assistant that answers questions about its own policy documents. Staff need consistent, cautious answers, so the team uses a low temperature. Policy documents are long, so the team checks that the context window covers the system prompt, the supplied extract and the answer. A smaller model would be cheaper, but the questions need careful reading, so a more capable one is chosen. The firm must keep client data within the EU, which points toward a Data Zone deployment type rather than a global one. If the same firm also wanted to summarise ten thousand archived memos overnight, a batch type would suit that job better than live requests.

Easy to confuse

Often mixed upThe difference
Training vs inferenceLearning from data vs answering requests with the finished model
Model vs deploymentThe model is the capability; the deployment is the usable endpoint with a type and settings
Temperature vs top-pBoth control randomness; temperature scales it, top-p limits the candidate pool
System vs user promptStanding instructions vs the current request
Token vs wordA token is a text piece the model counts; one word can be several tokens

The topic page on prompt engineering basics goes further into writing prompts.

Key points

  • Generative models predict the next token repeatedly; the context window limits how many tokens one request can hold.
  • Training builds the model once; inference is every later request, and prompts do not retrain it.
  • Lower temperature gives more predictable output, higher gives more varied output; top-p is a related randomness control.
  • Pick the smallest model that meets the requirement; multimodal models take images or audio as input.
  • The deployment type governs data processing location and billing; Global Standard is the common default.

Check yourself

Question 1. A team wants an assistant to give the same, predictable wording when employees ask routine HR questions. Which change is most likely to help?

  • A. Raise the temperature
  • B. Use an image-generation model
  • C. Lower the temperature
  • D. Enlarge the context window only
Show answer

Answer: C

Lowering temperature makes output more focused and repeatable. Raising it increases variety, enlarging the context window changes how much text fits rather than how random the output is, and retraining is not something done by changing a prompt.

Want more questions like this? Full AI-901 practice tests →

Question 2. A request fails because the system prompt, a long attached report and the expected answer together exceed what the model can handle at once. Which limit has been reached?

  • A. The temperature setting
  • B. The context window
  • C. The training cutoff
  • D. The deployment type
Show answer

Answer: B

The context window is the token budget for one request, covering prompt, supplied data and response. Temperature controls randomness, training cutoff describes what the model learned, and the deployment type governs location and billing.

Want more questions like this? Full AI-901 practice tests →

Question 3. A hospital group must keep prompts and responses processed inside the European Union and expects variable, pay-per-use traffic. Which deployment approach fits best?

  • A. Global Standard
  • B. Global Batch
  • C. A provisioned type chosen for steady traffic
  • D. Data Zone Standard
Show answer

Answer: D

A Data Zone Standard type keeps processing within the EU zone and bills per token, which suits variable traffic. A Global type may process data in any region, Provisioned reserves paid capacity for steady load, and Batch is for delayed large jobs rather than live requests.

Want more questions like this? Full AI-901 practice tests →

This lesson sits in the first exam domain, Identify AI concepts and capabilities, which carries 40 to 45% of AI-901, and the recap page AI concepts explained summarises model choice and configuration for revision.