Concept · filed under How generative AI models work
Tokens, embeddings and transformers, explained for AI-901
A token is the chunk of text a language model actually processes, often a piece of a word. An embedding is a list of numbers that places text by meaning. A transformer is the model design that uses attention to work out which tokens matter to each other. All three sit under the objective on how generative AI models work in the AI-901 study guide, which names the objective and leaves the vocabulary to you.
- ExamAI-901 (replaced AI-900 on June 30, 2026)
- Questions here6
- UpdatedOct 19, 2026
One pipeline, three stages
The three terms describe the same pipeline at different stages. That is why answer options borrow from each other. Text is cut into tokens. Each token becomes a vector. Attention layers in the transformer relate the tokens to one another, and the model predicts the next token, then the one after, until the reply is finished.
No math is needed for the exam. You need what each term is, what it is not, and the practical fact that hangs on tokens: usage and limits are counted in them.
Fig. 1
Tokens are the meter
For software sold on how well it understands language, a model is oddly uninterested in words. Common words often stay whole; rarer words split into pieces, and punctuation gets its own token. Text in many languages other than English tends to need more tokens for the same meaning.
Two practical facts follow. Generative model usage is metered in tokens, so a longer exchange costs more. And every model has a context window, a maximum number of tokens it can work with at once, shared between what goes in and what comes out. Exam options that measure a model in words, pages or characters are describing something else.
Fig. 2
Embeddings: close means similar
Embeddings and attention, in words
An embedding turns a word, sentence or passage into a vector so that similar meanings sit close together, whatever the wording. That is what lets a search for “getting my money back” find a page titled “Refunds” with no words in common. Embedding models produce these vectors for search and comparison. They do not write replies, which makes them a frequent wrong option when a scenario needs a chat model.
Attention is how a transformer reads in context. For each token, it weighs the other tokens it can see and draws information from the ones that matter. In “The trophy did not fit in the suitcase because it was too big,” attention is what ties “it” to the trophy. Many attention layers stacked together build up a picture of the whole passage before the next token is chosen.
The transformer is the architecture; GPT-style language models are built on it. AI-900 listed “features of the Transformer architecture” under machine learning (AI-900 study guide, exam retired June 30, 2026), so older courses teach it there. To see where prompts, retrieved passages and fine-tuning fit on top of all this, read prompt engineering vs RAG vs fine-tuning.
Table 1
Side by side
| Point | Token | Embedding | Attention |
|---|---|---|---|
| What it is | The unit a model reads and writes | A vector that encodes meaning | A weighting between tokens inside the model |
| Looks like | A word piece with an ID number | A long list of numbers | Scores computed during processing |
| Where you meet it | Usage, context window, max tokens | Semantic search, retrieval, recommendations | Explanations of how transformers work |
| Do you set it? | You control how many you send and allow back | You choose an embedding model | No, it is learned in training |
| Clue words in a question | cost, length, limit | similar, related, by meaning | context, which words relate |
The rule
Max tokens caps how long the reply may get; it does not make the model plan a shorter answer. Hit the cap and the text simply stops. If you want brevity, ask for it in the prompt.
Worksheet
Check the three ideas
A few questions go a layer below this page, into how a transformer keeps track of word order and what it can see while it writes. Evaluate the batch for the reasoning.
Questions come in batches of five. Pick an answer for each, then evaluate the batch: notes on all four options open under every question.
Accuracy by batch
0 evaluated · 0 right · 6 to go
Batch 1 questions 1–5
01
In the context of language models, what is a token?
Your label —The notes on all four options open when this batch is evaluated.
Answer: D
- Many tokens are pieces of words or punctuation, so token counts and word counts differ.
- An API key or other credential authenticates calls; in language modeling a token is a piece of text.
- Sentences are split into many tokens, and the model works through them token by token.
- Correct: tokens include whole words, sub-words and punctuation, so one long word can become several tokens.
02
A team embeds three sentences: "The flight was delayed", "Our plane left late" and "The soup was too salty". What should they expect from the embedding vectors?
Your label —The notes on all four options open when this batch is evaluated.
Answer: C
- Shared words aren't required; the two travel sentences mean nearly the same thing, so their vectors are close.
- Close isn't identical: different wording still produces slightly different vectors.
- Correct: embeddings capture meaning, so the two delay sentences land close together despite sharing no words.
- Distance between embeddings reflects meaning, not how many words a sentence has.
03
In a transformer, what does the attention mechanism do?
Your label —The notes on all four options open when this batch is evaluated.
Answer: C
- Harm filtering is done by content filters around the model, not by attention layers.
- Transformers keep no memory across requests; the app resends earlier messages instead.
- Correct: attention assigns weights to the other tokens based on how strongly they shape the meaning of the current one.
- Splitting text into tokens is tokenization, a step that happens before the transformer works on them.
04
A support bot sends a long system message, the full chat history and several retrieved documents with every request. Why does this raise the cost of running it?
Your label —The notes on all four options open when this batch is evaluated.
Answer: B
- Standard deployments are metered by tokens; a long prompt is still one request, just a more expensive one.
- Correct: every token in the request counts toward usage, not just the tokens in the reply.
- Sending a prompt never retrains the model; fine-tuning is a separate training job you run on purpose.
- Retrieved text simply becomes more input tokens; it doesn't create extra deployments.
05
A transformer looks at all the tokens in a sequence together rather than reading them strictly one at a time. How does it still keep track of word order?
Your label —The notes on all four options open when this batch is evaluated.
Answer: A
- Correct: positional encoding records where each token sits, so order shapes the result even though tokens are processed together.
- Token IDs identify vocabulary entries; a repeated word reuses its ID, so IDs can't encode position.
- Order clearly matters to meaning, and transformers capture it through positional encoding.
- Apps don't number sentences for the model; position is handled inside the model, token by token.
0 of 5 labeled
Batch 2 question 6
06
While a transformer's decoder predicts the next token of a completion, which tokens can its attention take into account?
Your label —The notes on all four options open when this batch is evaluated.
Answer: D
- Later tokens don't exist yet at prediction time, and in training they're masked so the model can't peek at the answer.
- Attention weighs all preceding tokens, not just the last one; that wider view is what makes it useful.
- Attention works over the whole preceding sequence, whichever message the text came from.
- Correct: the decoder uses masked attention, so it can only look at tokens earlier in the sequence than the one it's predicting.
0 of 1 labeled
Asked about transformers
What does GPT stand for?
Generative pre-trained transformer: a model trained in advance on large amounts of text, built on the transformer architecture, that generates output one token at a time.
How deep does AI-901 go into attention?
Not to the math. The outline asks you to describe how generative AI models work and to pick a model by its capabilities (AI-901 study guide, skills measured as of April 15, 2026). Tokens, vectors and attention at the depth of this page cover it.
Is a token always the same length?
No. A tokenizer keeps frequent words whole and breaks rare ones into pieces, and different model families split the same text differently.
Is there a quick way to drill these terms?
The AI-901 flashcards include token, embedding and attention alongside the prompt and deployment vocabulary.