Transys← More applications
Interactive AI explainers

See how AI actually works

Four hands-on demos of the ideas behind ChatGPT and other modern AI. Type, click, drag the sliders and watch what happens. Everything runs in your browser.

Tokenization: how AI reads text

Language models never see letters or whole words. They see tokens: common words stay whole, rare words get chopped into pieces. Type below and watch your text split up.

0characters
0words
0tokens
0chars / token

What to notice

  • Common words like the and is are one token each.
  • unbelievable becomes un + believ + able, so the model learns word parts.
  • Rare names like Karachi split into many small pieces.
  • A space usually belongs to the next token (shown as a faint dot).

Why it matters

AI pricing and context limits are counted in tokens. English averages about 4 characters per token; Urdu and other languages often need more tokens for the same meaning. Hover a token to see its ID number, which is what the model really receives.

This is a simplified tokenizer with a small vocabulary, built to show the idea. Real ones learn ~50,000–200,000 pieces from data.

Word embeddings: meaning as location

AI turns each word into a list of numbers, a point in space. Words with similar meanings end up close together. Real models use hundreds of dimensions; here we squash it to 2 so you can see it. Click any two words to compare them.

Click a word to select it.

Word arithmetic

Directions in the space carry meaning. The step from man to woman is the same as from king to queen.

−+

Try these

  • king − man + woman
  • Karachi − Pakistan + England
  • puppy − dog + cat

Where it's used

Search engines, recommendation systems and RAG chatbots all use embeddings to find text with similar meaning, not just matching keywords.

Neural network: learning a boundary

A neural network learns by adjusting its weights a tiny bit at a time to reduce its error. Pick a dataset, press Train, and watch it learn to separate the teal points from the purple ones.

class Aclass Bbackground = network's guess
0steps
–loss
–accuracy

Experiments

  • XOR with 1 neuron can't succeed: one neuron draws only a straight line.
  • Raise neurons to 4+ and it bends the boundary to solve XOR.
  • Set the learning rate very high and watch the loss jump around.
  • The spiral needs many neurons and patience. Deep learning stacks many layers for problems like this.

Temperature & sampling: how AI picks the next word

A chatbot writes one token at a time. For each step it gives every possible next word a probability, then picks one. Temperature controls how adventurous that pick is.

What to notice

  • Low temperature (0.1): almost always the top word. Safe and predictable, good for facts and code.
  • High temperature (2.0): odd words like "banana" get a real chance. More creative, but riskier.
  • Top-k = 1 is "greedy" decoding: no randomness at all.

This is also why the same question can get different answers from a chatbot: the model is sampling, not looking up a fixed reply.