How is AI made?
A teaching (a word ) that looks only at the previous word to pick the next. It has no or , and it does not learn facts. The word splitter is for teaching too, not a real .
- Data prep
- ① Tokenization
- ② IDs and one-hot vectors
- ③ Training
- ④ Generation
Data prep
Collect a few short example sentences. Repeating a sentence raises its counts, but helps when it fits your purpose, not just when there is more of it. Each time a sentence ends, one ‘sentence end’ is counted too.
① Tokenization
This demo splits sentences into word-like pieces. Real LLM can be words, parts of words, characters or . Text is split into tokens so it can be handled as numbers, not because it is too long.
② IDs and one-hot vectors
An is a number used as a name tag. A has 1 in its own position and 0 everywhere else. Neither tells us which words have similar meanings. That is held by a different , a learned embedding, which this demo does not train.
③ Training
Count which word came after the previous word, and how often (sentence ends count too). A candidate's is its count divided by the total count after the previous word. Neural learn instead of storing a small table like this.
④ Generation
Compare choice, which always picks the most likely word, with , which draws by probability. Drawing ‘sentence end’ stops generation. Sampling can give the same sentence again. Generated text has not been checked for truth.
| Word | Number | Number vector (one-hot) |
|---|---|---|
Pick a word to see what the learned about which word is likely to come next:
Percentages are rounded; their displayed total may differ slightly from 100%.
This word only appears at the end of a sentence, so there's no next word. Try another word.
The percentages in the table are at 1. Temperature only changes how likely each word is to be drawn — not the counts or whether anything is true.
Preparing the Python runtime…
My Code
Output
Press [Run] and the result will appear here.
Loading…
Choose a pending booking to cancel. Each cancellation requires confirmation.
Your :