Why did the guesses change?
Both prompts end with The bass was. Switch from Music to Fishing. The word “bass” stays the same, but the band and the fishing trip give the model different clues about what it means.
The model works with numbers instead of letters. Think of a table with one row for each token. During training, the model learns the numbers in each row. That list of numbers is called an embedding. “Bass” starts with the same list in both prompts. The list is a starting point, not a dictionary definition.
The model also gets a clue about where each token goes. “The dog chased the cat” uses the same words as “The cat chased the dog,” but their order changes who’s chasing whom.
The model uses the earlier pieces of text to update those numbers. By the time it gets to “was,” the numbers reflect the setup, so it makes different guesses about what could come next.
Pick what comes next
The four green ribbons are the model’s four most likely guesses. Thicker ribbons mean bigger chances. The gray ribbon combines the chances of all the other tokens.
Pick a ribbon to add its token to the sentence. That longer sentence is what the model sees when it makes its next set of guesses. A token can be a whole word, part of a word, a mark like a period, or even a space.
Your path shows what you picked in order. The percentage beside each pick is its chance at that step, not the chance of the whole path. Pick an earlier stop to go back. Switch contexts to try the other setup without losing your place.
Roll a token lets chance pick for you among the four green ribbons. A thicker ribbon has a better chance of winning. The gray ribbon is never picked. If you see [end of text], that’s a token the model uses to mark a stopping point.
Is it searching a database?
The model’s table is part of the model itself. It gives each token its starting numbers. That is different from an embedding database, which can store number lists for things like passages of text so a search tool can find related passages. Some chatbots use that kind of search to pull in extra reading before they answer. This demo doesn’t.
Try the ingredient search walk to see what comparing number lists looks like. It finds related ingredients instead of guessing what comes next in a sentence.
For more, see AI in plain language.
Where the guesses come from
These are real guesses from GPT-2 Small, recorded ahead of time using this version of the model. Your browser just shows the recordings. After four picks, you can see what the model would guess next, but there are no more recorded branches to follow.