This is a language model in its simplest form. It has counted which word follows which in Alice's Adventures in Wonderland and continues your text one word at a time.

The interactive demo needs JavaScript.
How it works. The model counted which word follows each word, or each pair of words, in Lewis Carroll's book (1865, public domain, about 30,000 words). It picks the next word at random in proportion to those counts. A low temperature favors the most frequent words, so the text repeats itself. A high temperature makes rare words more likely, so the text becomes more diverse but less coherent.
Large language models. In a slightly simplified picture, they also do the same next token prediction. They use a learned network in place of a count table, far more text and a context of thousands of words. Switch to two words of context and watch how quickly the model starts copying the book. Memorization is an open question for large models too.
