5. Language Models

Positional Encoding (வரிசை எண் / Queue Numbers)

Let's stand in line at the Ration Shop! (ரேஷன் கடையில வரிசையில நிப்போமா!)

Technical Meaning: நிலை குறியாக்கம் (Nilai Kuriyaakkam) - Adding mathematical signals to words so the AI knows their exact order in a sentence.

The Core Idea

Because Transformers read an entire sentence simultaneously in parallel (unlike RNNs which read word-by-word), they actually have no idea what order the words are in! To fix this, Positional Encoding injects a unique mathematical "stamp" into every word, telling the model exactly where that word sits in the sequence.

The Origin Story

If an AI reads "Dog bites man" and "Man bites dog" exactly at the same time, it sees the exact same three words. Without positional encoding, it would treat both sentences as identical. The inventors of the Transformer used complex sine and cosine waves to create unique positional stamps that can scale to sentences of any length, ensuring the AI never loses track of grammar.

The Tamil Analogy

Positional Encoding

Imagine a massive crowd standing at a Ration Shop (ரேஷன் கடை) in Chennai.

If 100 people just stand in a random cluster, the shopkeeper has no idea who came first. It's chaos.

To fix this, the shopkeeper hands out Token Numbers (1, 2, 3...) as soon as someone arrives. Now, even if the 100 people are standing completely randomly (parallel processing), the shopkeeper knows exactly what order to serve them in.

Positional Encoding is simply the AI handing out a digital token number to every word in a sentence before processing them all at once!

Try It Yourself

Positional Encoding

How does the AI know who bit who if it reads all words at the same time?

1. Choose a Scenario:
2. Assign Queue Numbers:
Transformer Reading Memory
Man
bites
dog
"Man bites dog" and "Dog bites man" look like a random soup of the exact same words! Who is the victim?!