AI-901 for Beginners: Tokens, Vectors, Embeddings, and Attention
Welcome to my series on studying for the Microsoft AI-901: Azure AI Fundamentals exam.
Throughout these posts, I’m going to approach the material from a beginner’s point of view, especially when it comes to some of the terminology. Words like tokens, vectors, embeddings, and attention can make the subject sound much more intimidating than it really is.
This is not going to be a deep math lesson on vectors or Transformer architecture. My goal is to break down the concepts into simpler explanations that are easier to understand, remember, and hopefully recognize on the AI-901 exam.
The terminology can be daunting at first, but once you understand what the words actually mean and how the pieces fit together, things start making a lot more sense.
Large Language Models: Start With Predictive Text
By now, there’s a good chance you’ve heard the term large language model, or LLM, but what does an LLM actually do?
At a very basic level, an LLM is similar to predictive text on your cellphone. If you're typing a message to a friend and write:
Can you go to the store and pick up _____
your phone might suggest:
fruit
coffee
milk
An LLM is doing something similar, but on a much more sophisticated level. It has learned patterns and relationships from very large amounts of text. When you give an LLM an input, also known as a prompt, it uses the text it has so far to predict what should come next.
For example:
When my cat was a _____
A likely prediction might be:
kitten
The response generated by the model is called a completion. Technically, though, an LLM isn't predicting the next word. It predicts the next token.
That brings us to our first AI term.
Tokens and Tokenization
A token is essentially a chunk of text.
A token can be:
an entire word
part of a word
punctuation
another commonly used sequence of characters
For example, the word: unbelievable
might be broken into something roughly like:
un + believable
And the sentence:
I heard a dog bark loudly.
might become tokens resembling:
I | heard | a | dog | bark | loudly | .
The process of breaking text into these smaller pieces is called tokenization. Each distinct token in the model's vocabulary is assigned a unique token ID.
For example, imagine the sentence:
I listened to a musician playing music softly at a cafe.
The tokens could have identifiers such as:
| Token | Token ID |
|---|---|
| I | 1 |
| listened | 2 |
| to | 3 |
| a | 4 |
| musician | 5 |
| playing | 6 |
| music | 7 |
| softly | 8 |
| at | 9 |
| a | 4 |
| cafe | 10 |
Notice that the second occurrence of a still has token ID 4 because it is the same token.
One important thing to understand is that these IDs do not contain the meaning of the token. Musician does not have some special mathematical meaning because its ID happens to be 5.
Think of a token ID more like a barcode:
Token #5 = musician
It's an identifier.
But an ID alone isn't enough for the model to understand that musician is related to music, or that banana is more related to eat than to car
For that, we need numbers the model can actually work with.
Vectors: Giving the Model Numbers to Work With
A computer can't work directly with words and meanings the way humans do. It needs numerical representations.
That's where vectors come in.
For our purposes, a vector is simply:
A list, or array, of numbers.
A token such as musician could be represented by something that looks like:
musician → [2.1, -0.7, 4.2, 1.3, ...]
Real LLM vectors can contain hundreds or even thousands of values. For AI-901, you don't need to understand what every individual number means.
The important part is this:
A vector gives the model a mathematical representation it can work with.
The individual values in a vector are often called dimensions. These dimensions work together to represent features and relationships learned by the model.
That leads us to embeddings.
Embeddings: Vectors With Learned Meaning
So far:
Vector = a list of numbers
An embedding is a learned vector representation that captures features and relationships.
A simple way I remember it is:
Embedding = a learned vector representation
During training, the model adjusts these numerical representations as it learns patterns in language. Concepts that are related can develop mathematically related representations.
For example, consider:
banana
eat
car
The concepts banana and eat have a stronger relationship than banana and car.
Or consider:
dog
puppy
skateboard
A dog and a puppy are much more closely related concepts than a dog and a skateboard.
The exact numbers aren't important to us. What matters is that the numerical representations now contain useful learned relationships.
So when someone talks about:
"the embedding for banana"
they're basically talking about:
A numerical representation of banana that captures learned features and relationships.
But there's still another problem. Knowing which tokens appear isn't enough. Their order matters too.
Positional Encoding: Where Did the Token Appear?
Consider these two sentences:
Dog bites man.
and:
Man bites dog.
They contain the same three important tokens:
dog
bites
man
But they have very different meanings.
The model therefore needs to know not only:
WHAT token is this?
but also:
WHERE did it appear?
That's where positional encoding comes in. Positional information gives the model a way to recognize where each token appears in the sequence, kind of like a map.
For example:
Dog — position 1
bites — position 2
man — position 3
Using our earlier sentence, we might have something like:
| Token | Token ID | Position |
|---|---|---|
| I | 1 | 1 |
| listened | 2 | 2 |
| to | 3 | 3 |
| a | 4 | 4 |
| musician | 5 | 5 |
| playing | 6 | 6 |
| music | 7 | 7 |
| softly | 8 | 8 |
| at | 9 | 9 |
| a | 4 | 10 |
| cafe | 10 | 11 |
Notice something important.
The second a still has token ID 4, because it's the same token. But it appears in a different position.
A simple way to remember the distinction is:
Token ID tells me WHAT it is.
Position tells me WHERE it is.
Now we have tokens, vectors, embeddings, and positional information. The next question is: What actually processes all of this information?
That's where the Transformer comes in.
The Transformer: Where the Real Processing Happens
A Transformer is the architecture that processes token representations and learns how the tokens in a sequence relate to one another. This is where the model starts using context to create richer representations.
Consider the word:
bank
Now look at these two sentences:
I sat by the bank and watched the river.
and:
I went to the bank to deposit money.
The token bank appears in both sentences, but its meaning is different. In the first sentence, words such as river help indicate that bank refers to a riverbank. In the second sentence, words such as deposit and money help indicate that bank refers to a financial institution.
The Transformer uses the surrounding context to help build a representation of the token that reflects how it is being used in that particular sequence.
Several important concepts live inside the Transformer discussion:
attention
multi-head attention
encoder and decoder blocks
feed-forward processing
Let's break those down one at a time.
Attention: What Matters Right Now?
One of the biggest concepts behind Transformers is attention. Attention helps the model determine which other tokens are important when processing a particular token.
A simple way I remember it is:
Which other tokens matter when I'm processing this token?
Take the sentence:
The dog barked loudly at the cat.
When processing barked, some tokens may have a stronger relationship to it than others.
For example:
dog
loudly
cat
may provide more useful context than a word such as:
the
The model assigns different attention weights that influence how much information from other tokens contributes to the current token's representation.
It's important not to think of attention as a permanent importance score attached to a word. The importance changes depending on context.
For example:
The dog's bark was loud.
compared with:
The bark on the tree was rough.
The surrounding tokens help the model understand that bark is being used differently in each sentence. The model isn't literally thinking: "Oh, this bark belongs to a dog." It's all math.
But for a beginner's mental model:
Attention determines how strongly different tokens should influence one another in context.
Multi-Head Attention: Looking at Multiple Relationships at Once
Multi-head attention sounds much scarier than the basic idea behind it. Think of it like several people examining the same sentence at the same time. One person might notice one relationship. Another might notice something different. Another might connect words that are farther apart in the sentence.
Take:
The dog that chased the cat was tired.
One person might capture a relationship such as:
dog ↔ chased
Another might capture:
chased ↔ cat
Another might capture:
dog ↔ was tired
Different attention heads (people) can learn to focus on different types of patterns and relationships, and their results are combined.
For AI-901, the main idea to remember is:
Multi-head attention = multiple attention mechanisms examining different relationships in parallel.
Encoder and Decoder
The original Transformer architecture contains two major types of blocks:
an encoder
a decoder
Modern Transformer models don't all use the exact same configuration. For example, GPT-style LLMs are generally decoder-only Transformers. For AI-901, however, understanding the basic roles of the encoder and decoder helps explain how Transformer models process and generate language.
Encoder
Think:
UNDERSTAND / REPRESENT the input
The encoder examines tokens and their relationships using attention and builds contextual representations. In simple terms, it helps create a representation that reflects not just the token itself, but also the context surrounding it.
So instead of simply representing:
bank
it can represent something closer to:
bank being used in the context of a river
or:
bank being used in the context of money
Decoder
Think:
GENERATE / PREDICT the output
The decoder uses the information available so far to predict the next token. Then it does it again. And again.
For example:
When my dog was a _____
The model may determine that:
puppy
is more probable than:
cat
or:
skateboard
Once puppy is generated, it becomes part of the sequence:
When my dog was a puppy _____
The model then predicts the next token. A simple way to remember the difference is:
Encoder = builds contextual representations
Decoder = predicts and generates tokens
A Quick Note About Masked Attention
When the decoder is predicting the next token, it shouldn't be allowed to cheat by looking ahead at future tokens. That's the idea behind masked attention. During training, the complete sentence may already be known.
For example:
When my dog was a puppy, he loved to play.
But if the model is learning to predict puppy, it shouldn't be able to look ahead and see the answer.
It can use:
When + my + dog + was + a
but the future tokens are masked.
So:
Masked attention prevents the decoder from using future tokens when predicting the next token.
Think:
No cheating. You can only use what came before.
Feed-Forward Processing
Attention helps gather useful contextual information. The feed-forward neural network then further processes and refines that information. For AI-901, I don't think we need to go much deeper than that.
My beginner version is:
Attention helps determine what information matters. The feed-forward network further processes that information.
The result is a richer representation of the token that reflects both the token itself and the context around it. Also keep in mind that feed-forward processing happens inside Transformer layers. It isn't a completely separate step that happens only after the encoder and decoder.
Putting It All Together
Now that we've covered all these terms individually, let's connect them.
Suppose our prompt is:
When my dog was a...
Step 1: Tokenization
The text is broken into tokens.
Conceptually:
When | my | dog | was | a
Step 2: Token IDs
Each token is mapped to its unique identifier in the model's vocabulary.
Remember:
Token ID = label
Through training, these representations capture learned features and relationships.
Embedding = learned vector representation
Step 4: Positional Information
The model also needs to know where the tokens occur.
When — position 1
my — position 2
dog — position 3
was — position 4
a — position 5
This allows the model to take word order into account.
Step 5: Transformer Processing
Now the Transformer processes those representations. Attention helps determine which previous tokens are important.
For our sentence, the relationship between:
dog + was + a
may be particularly useful.
Multi-head attention allows different relationships to be examined in parallel. Feed-forward processing further processes and refines the contextual information.
Step 6: Next-Token Prediction
The decoder uses the information available so far to calculate probabilities for possible next tokens.
Conceptually, it might look something like:
puppy = likely
cat = unlikely
skateboard = extremely unlikely
Those aren't real probabilities, but they illustrate the idea.
The model generates:
puppy
Now our sequence becomes:
When my dog was a puppy
And the process repeats.
The model now predicts the next token based on:
When my dog was a puppy _____
Then the next. Then the next. That's essentially how an LLM builds a response one token at a time.
The Big Picture
If you remember only one flow from this section of AI-901, it's this:
Text → Tokens → Token IDs → Vectors/Embeddings + Position → Transformer → Context → Next-token probabilities → Generate token → Repeat
The individual terms sounded confusing when I first started reading about them because they were introduced separately. Once I started thinking of them as pieces of one process, they became much easier to understand.
AI-901 Beginner Cheat Sheet
| Term | Beginner-Friendly Definition |
|---|---|
| Large Language Model (LLM) | A model trained on large amounts of text that can understand and generate language by predicting tokens. |
| Prompt | The input given to the model. |
| Completion | The response or continuation generated by the model. |
| Token | A chunk of text. |
| Tokenization | Breaking text into tokens. |
| Token ID | A unique identifier assigned to a token. |
| Vector | An array or list of numbers. |
| Embedding | A learned vector representation that captures features and relationships. |
| Positional encoding | Gives the model information about where a token occurs in a sequence. |
| Transformer | The architecture that processes token representations and relationships using attention and neural-network layers. |
| Attention | Helps determine which tokens should influence one another in context. |
| Multi-head attention | Multiple attention mechanisms examine different relationships in parallel. |
| Encoder | Builds contextual representations of input. |
| Decoder | Predicts and generates tokens. |
| Masked attention | Prevents the decoder from using future tokens when predicting the next token. |
| Feed-forward network | Further processes and refines information produced within a Transformer layer. |
| Next-token prediction | Calculating which token is likely to come next based on the sequence so far. |
If some of these terms still feel confusing, that's okay. The most useful thing I've found while studying AI-901 is to understand the role each piece plays before worrying about exactly how all the underlying math works.
For me, the simplest mental model is:
Tokens are the pieces.
Vectors and embeddings turn those pieces into numbers with learned relationships.
Positional encoding tells the model where the pieces are.
The Transformer uses attention to understand how those pieces relate in context.
The decoder uses that context to predict what comes next.
Once those pieces connect, the terminology starts sounding a lot less intimidating.
Download the LLM Beginner Study Guide
If you’re studying for AI-901 or just trying to make sense of how LLMs actually work I put together a one-page visual study guide that connects the concepts from this post.
It covers the basic flow from tokens and embeddings to attention, Transformers, and next-token prediction, so you can keep the big picture handy while you study.
[Download the free LLM Beginner Study Guide PDF]
Next up: I’ll keep building on these concepts as I work through more of the AI-901 material

