Learn AI Math

Positional Encoding

Also called: Positional Embedding

What is Positional Encoding?

In one sentence: Positional encoding adds information about word order, so the model knows which word came first, second, and so on.

Attention by itself treats a sentence like a bag of words with no order. But "dog bites man" and "man bites dog" mean very different things. Positional encoding adds a position signal to each token so order is not lost.

What does Positional Encoding look like?

Without positional encoding, a model could not tell "I ate the cake" from "the cake ate I."

Why does Positional Encoding matter?

Word order carries meaning, so every Transformer needs some form of positional information.

Last updated · Fact-checked by The AI Math

Linking to this page from a lesson or article?

Like this explanation? Get one every week.

The AI Math newsletter turns confusing AI news into plain English. No hype, no jargon walls.