Module 2 — Under the hood

How AI works:
from prompt to output.

Your text is broken into pieces, converted into numbers, processed through many neural-network layers, and generated back one piece at a time. No AI/ML background required — just the same mindset you'd use to trace any engineering pipeline.

The complete pipeline

One prompt, start to finish

Every stage below happens, in this order, for every AI response — illustrated with one running example: an engineer asking AI to diagnose a bearing-vibration problem.

Prompt

User types a question

"Predict the likely cause of high bearing vibration."

↓
1 · Tokenization

Text → tokens

["Predict"," the"," likely"," cause"," of"," high"," bearing"," vibration","."]

↓
2 · Token IDs

Tokens → vocabulary integers

[4521, 262, 4900, 3286, 286, 1029, 15329, 22289, 13]

↓
3 · Embedding

Integers → meaning-carrying vectors

"bearing" → [0.21, -0.73, 0.15, 0.44, …]

↓
4 · Positional Encoding

+ position in the sequence

So token order changes meaning, not just token identity.

↓
5 · Transformer Layers (× N, stacked)

Self-Attention + Feed-Forward

Each token "looks at" every other token to weigh what's relevant, then a feed-forward step refines its representation. Repeated across many stacked layers.

↓
6 · Output Probabilities

A score for every possible next token

"misalignment" 0.34 · "imbalance" 0.21 · "wear" 0.18 · …

↓
7 · Sampling / Decoding

One token is chosen

Greedy, top-k, top-p, or temperature-based selection picks the next token.

↻ chosen token is appended to the sequence — steps 5–7 repeat until a stop token or length limit
↓
8 · Detokenization

Output tokens → readable text

The full generated token sequence is converted back into text.

↓
Output

Final response

"High bearing vibration is most often caused by misalignment, imbalance, or bearing wear."

Want to see the token-by-token prediction actually run on real statistics? Try the Predict Game →

01 — The reference

All 21 questions, in order

Grouped into six parts, matching the pipeline above. Click any question to expand its answer.

02 — Self-assessment

Test what you've learned

Ten random questions pulled from a bank of 13 each round. Runs entirely in this page — your best score is remembered on this device.

Next Ready to practice? Module 4 — Prompt Lab has 50 hands-on exercises, or try the Predict Game to see tokenization and prediction running on real statistics.