How models actually work

Tokens, embeddings, attention and next-token prediction - the minimum mental model that makes everything else on the exam make sense.

  • Models & configuration
  • 15 minutes

After this lesson you can

  • Explain what a token and an embedding are
  • Say what self-attention buys you over older sequential models
  • Explain why models hallucinate - and why that motivates RAG

From prompt to answer, in five steps

The generation loop

  1. Tokenize

    Your text is split into tokens - roughly 4 characters or ¾ of a word in English. "Understanding" might become "Under" + "standing". Tokens are the unit models read, generate and bill in.

  2. Embed

    Each token becomes a dense vector of numbers. Position in that vector space encodes meaning, so semantically similar text lands close together - the property that makes vector search work.

  3. Attend

    Self-attention scores how much every token should attend to every other token, all at once. This is what captures long-range context: a pronoun near the end can still be linked to a name near the start.

  4. Predict

    The model outputs a probability distribution over its entire vocabulary for the single next token. Not an answer - a distribution.

  5. Sample and repeat

    One token is chosen (temperature and top_p decide how adventurously), appended to the sequence, and the whole thing runs again. This loop is what "autoregressive" means.

Try itType something and watch it split into tokens.
Microsoft␣Foundry␣makes␣deploying␣generative␣AI␣models␣straightforward.
Characters
71
Words
8
≈ Tokens
17
Chars / token
4.2

Approximate, for intuition. The exam-relevant facts: a token is roughly 4 characters or ¾ of a word in English, long words split into several tokens, and tokens are the unit models read, generate and bill in.

Check your understanding

Models & configuration

What is a token, in the context of a language model?

Embeddings: meaning as coordinates

An embedding is a numeric vector that represents meaning. "Annual leave" and "holiday allowance" share no words but sit close together in vector space - which is exactly why retrieval for RAG uses embeddings rather than keyword matching alone.

Know this: Know this

Embedding models (for example text-embedding-3-small and text-embedding-3-large) are a separate model type in the catalog. They produce vectors, not text. If a question needs semantic search, clustering or a RAG index, the answer involves an embedding model.

Check your understanding

Models & configuration

What does an embedding represent?

Why transformers won

Self-attention plus parallelism is the whole story.
Older recurrent networks (RNNs)Transformers
ProcessingOne token at a time, in orderWhole sequence in parallel
Long-range contextFades over distanceAttention links any two tokens directly
Training on large hardwareHard to paralleliseScales across GPU clusters

Encoder-style transformers (BERT-like) are good at understanding and embeddings. Decoder-style transformers (GPT-like) generate text autoregressively. You do not need the internals - you need to know that self-attention weighs all tokens against each other simultaneously.

Check your understanding

Models & configuration

What does the transformer architecture's self-attention mechanism make possible?

The classical ML vocabulary you still need

AI-901 dropped most of AI-900's classical machine learning content, but a handful of terms still appear as background vocabulary.

  • Features are the inputs; the label is what you are predicting.
  • Training fits the model to data; inferencing is using the trained model on new input.
  • Supervised learning uses labelled data - regression predicts a number, classification predicts a category.
  • Unsupervised learning finds structure in unlabelled data - clustering groups similar items.
  • Deep learning uses neural networks with many layers; transformers are a deep learning architecture.

Exam trap: Do not over-study this

AI-900 tested AutoML, the ML designer, and evaluation metrics in depth. AI-901 does not. If your notes have a long section on regression metrics or Azure ML Studio, that time is better spent on Foundry, agents and Content Understanding.

Why models make things up

A language model predicts the most plausible next token, learned from patterns in training data. Plausible is not the same as true, and the model has no fact lookup. That is hallucination - and understanding its cause explains the entire rationale for retrieval.

Know this: The chain to remember

Models predict plausibility → plausible ≠ true → so give the model real source text in the prompt (RAG) → and cite it so a human can check (transparency). Three exam topics, one causal chain.

Check your understanding

Models & configuration

Why can a language model state something false with complete confidence?