How the trained model turns its shares into new text one character at a time, how the dice and the temperature setting change what comes out, and what's missing compared with big chat models.
The big picture
Training (Step 3) only ever asked the model for one thing: a share for each of the 65 characters, saying how likely each one is to come next. There's no "write a paragraph" button inside it. Writing is a loop wrapped around that one ability: get the shares, pick a character, add it to the end, and ask again.
My model is built on Andrej Karpathy's nanoGPT, open source under the MIT license, and trained on his Tiny Shakespeare text from char-rnn. The writing loop on this page is nanoGPT's own. All the text on this page was written by the step-5,000 model I trained, and anything drawn rather than measured is labelled as an illustration.
Words to know
Prompt
The starting text you give the model. Mine: "To be, or not to be:"
Generation
Writing new text by repeating the guess-pick-append loop.
Top choice
Always picking the character with the biggest share. Its textbook name is greedy decoding.
Sampling
Rolling weighted dice: each character's chance of being picked equals its share.
Temperature
A dial that makes the shares more lopsided (below 1) or more even (above 1) before the dice roll.
Top 40
Only the 40 characters with the biggest shares are allowed into the dice roll. My run's samples used it.
Seed
A starting number for the dice. Same seed, same rolls, same text.
The writing loop
These shares are after the run's settings (temperature 0.8, top 40), so they differ a little from the model's own shares in Step 1: the line break's 56.12% there is 57.7% here.
These are real first steps. At each row, the model reads everything so far, gives its shares, and one character gets picked and added. The picks spell a line break, then "The one cau…". Most picks were the top choice. Three were not: the 'o' had only 5.4%, the 'c' only 0.6%, and the 'u' 6.3%. That's the dice at work, and it's why the line went "The one cause" instead of something more predictable.
Two things that surprise people. First, the model writes exactly one character per pass. To write 200 characters it runs the full model 200 times. Second, it never goes back. Once a character is added, it stays, even if it was a poor pick, and every later guess has to work with it.
The sliding window
Step 2 explained that the model can see at most 256 characters. When writing, that limit becomes a sliding window. My prompt is 20 characters, so after 236 new characters the window is full. From new character 238 on, the opening 'T' of the prompt has slid out of view, and the model can no longer see it at all. The writing loop just keeps the last 256 characters and drops the oldest one each time.
That's why long output from my model drifts. It can't remember a character's name from 300 characters ago unless the name shows up again inside the window.
Picking: top choice or dice
There are two ways to pick. Always take the top choice, or roll weighted dice where each character's chance equals its share. I wrote 1,500 characters from four prompts both ways and measured repetition: the share of 20-character stretches that show up more than once. Always taking the top choice repeated far more, up to 24% of the text. With dice, it was 6.1% at most and usually close to zero.
Here's what that looks like. With no randomness, the same situation always leads to the same pick. Once the text drifts into a pattern, such as two speakers trading short lines, the model's top choice keeps steering it back. The same line came back word for word, and over 1,500 characters "YORK:" appeared 8 times and "EXETER:" 6 times. It didn't lock into an endless loop in my test, but it kept circling. The dice break that up by sometimes taking the second or tenth choice.
My run's samples also used "top 40": before rolling, every character outside the 40 biggest shares is ruled out, so a 1-in-10,000 oddball can never be picked.
Temperature
Real shares for the first letter of ROMEO's line ("ROMEO:" then a line break), captured at the end of training. At temperature 1.0, the model's own shares, I leads with 15%, but A, T, and W are close behind. Turn the temperature down to 0.2 and I jumps to 56.5% while the long tail almost vanishes. Turn it up to 1.5 and the shares flatten, with I down to 10.7%. Temperature doesn't add knowledge or remove it. It only changes how lopsided the shares are before the dice roll. Turned all the way down, it ends up as "always take the top choice".
Real output: the first lines of 400 characters at each temperature, with the same model, prompt, and seed.
The chart shows the share of words in each 400-character sample that exist anywhere in the Shakespeare file. At low temperature, nearly every word is real. At 2.0, one word in five is made up: "gawning", "cosfishers", "yondering". These come from one sample per temperature, so the exact numbers would move with a different seed, but the direction is clear.
The seed
The dice aren't truly random. A computer makes "random" numbers from a starting number called the seed. Same seed, same sequence of rolls. So with the same model, prompt, settings, and seed, you get the same text every time. On one computer, two runs with seed 1337 matched character for character, and seed 42 wrote something completely different.
The fourth card is a surprise. The computer that ran the training also used seed 1337, the step-5,000 model, and the same settings, yet it wrote different text from the very first word. Same seed on the same computer gives identical text; on a different computer it can differ, likely from tiny rounding differences in the math (untested).
Sounds like Shakespeare, means nothing
This ties back to the samples in Step 3, written during training at each saved step. The chart shows the share of words in each sample that exist in the Shakespeare file. It went from 4% at step 0 to 94% by step 1,000. Each sample is only about 40 words, so small ups and downs, like the dip at step 5,000, don't mean much.
Real words aren't the same as meaning. Take the step-5,000 sample: "Your hand, whort is it in the wars? MENENIUS: Sirrah, the gods May be the public rebukes of that ever". The layout is right, the names are real Shakespeare characters, the rhythm sounds right, and most words are real. But nobody is saying anything. The model learned which characters tend to follow which, at every scale from letters to line layout. It never learned that words refer to things, because nothing in its training ever asked it to.
What big chat models add
My model
Large chat models
Text it learned from
1.1 million characters of Shakespeare
Trillions of word pieces from many sources
What one token is
1 character, 65 in total
A word piece, roughly 50,000–200,000 in total
Learned numbers
10.65 million
Billions to hundreds of billions
Window
256 characters
Many thousands of word pieces
Extra training after that
None
Example conversations, plus people rating which answers are better
The core is the same: a big chat model is still a next-token guesser wrapped in this same writing loop, with dice and a temperature setting. The differences are scale and finishing. Far more text and far more numbers let it pick up much more than spelling and style. Word pieces let each step carry part of a word instead of a letter. Then a second round of training on example conversations, with people rating which answers are better, teaches it to follow instructions and answer questions instead of just continuing text. My model has none of that second round, so it can only continue text in the style it was trained on. The figures for large models are typical published ranges, not one specific product.
The whole pipeline
That's the whole machine. Text becomes IDs and rows of numbers (Step 1). Attention lets each character pull in what came before, 6 heads at a time and 6 layers deep (Step 2). Out come 65 shares. One character gets picked, added, and the loop goes again (Step 4). Every number involved was set beforehand by the training loop (Step 3); while writing, nothing gets nudged and nothing is learned.
My model can
Write endless new text in Shakespeare's layout and style.
Be steered from predictable to wild with one dial.
Repeat the exact same text on demand with a seed, on the same computer.
My model can't
Mean anything, follow instructions, or answer questions.
Remember more than the last 256 characters.
Learn while it writes; every number is fixed after training.