I built an app that gives a gut feel for how LLMs work
For a while now, I’ve had a nagging sense that explaining LLMs to students just doesn’t land.
Lining up terms like “large language model,” “Transformer,” “Attention” doesn’t form a clear picture in most people’s heads. But ignoring the substance entirely and settling for “amazing AI” feels uncomfortable too.
So maybe what’s needed is teaching material with some motion to it.
With that in mind, I built a small teaching app that runs entirely in the browser.
https://kuzlab.github.io/llm-how-it-works/
It’s a completely static site, no server, no API key. It’s published on GitHub Pages, so anyone can open the URL and try it. The aim comes down to a single point: making the sentence “an LLM is just predicting the next word by probability, over and over, at tremendous speed” click through the hands, not the head.
The content is split into four tabs. Here they are in order, following the flow of the screen.
Tab 1: Guess the Next Word
This is the main event.
It uses a pre-prepared sample sentence as material. The screen shows the sentence up to a certain point, and candidates for “the word likely to come next” line up with probability bars. For example, after “Today the weather is,” you’d see candidates like “nice (55%),” “bad (20%),” “good, and (12%),” and so on.
Pressing “Next word ▶” advances one word at a time, following the sample. Switch on “Autoplay” and you can watch the sentence grow word by word on its own. “The LLM is just doing this on the human’s behalf, at ferocious speed” — that felt sense is what lands first.
And here’s the heart of this tab: you can click to choose the candidates yourself. Pick the word that matches the sample and it proceeds as expected, but click a different candidate and the sentence branches off onto a side path. It enters a pre-prepared branch and builds up a different sentence. For example, the sample continuation of “Today the weather is” is “nice,” but clicking “good, and” instead sends it veering off onto a different path: “Today the weather is good, and I feel like…” This lets you trace by hand how, even with the same opening, the ending changes depending on which word you pick.
Once a sentence is complete, the message changes depending on how it ended. If it matches the sample, you get “Complete.” If it closes naturally after going down a different branch, you get “Complete via a different path — this is how an LLM sometimes takes a low-probability branch too. That’s why the output is different every time.” If you reach the end of a branch, you get “Cut off here — the real thing would keep inventing a continuation on its own, but this demo is limited to the paths prepared in advance.”
Temperature (randomness) slider
Tab 1 has a “temperature” slider.
It doesn’t change the sentence construction itself, only the “shape” of the probability bars at each step, in real time, according to temperature. Lower the temperature and the bars sharpen, with probability concentrating heavily on the single most likely word (confident, safe). Raise it and the bars flatten out, giving low-probability words a turn too (hesitant, free, unexpected).
“Why do ChatGPT and Claude give slightly different answers each time, even to the same question?” This slider gives a tangible answer. Press “Roll the dice 🎲” and it randomly draws one word according to the current temperature’s distribution and highlights it. At low temperature you draw nearly the same word every time; at high temperature you sometimes draw something surprising — something you can feel in your gut.
Tab 2: Breaking Down Words
The second tab shows an entered sentence split into color-coded blocks (tokens).
What’s effective here is the contrast between Japanese and English. Even sentences of roughly the same length split up completely differently. Place “今日はいい天気ですね” next to “It is a nice day” and, despite meaning almost the same thing, both the number of tokens and where they’re cut diverge. Each token also gets a pseudo ID number.
The point to convey here in one line: an LLM sees the world not in characters or words, but in units called “tokens.” Seeing with your own eyes that your own sense of language and the machine’s way of cutting it up don’t match quietly makes an impression.
Tab 3: A Map of Meaning
The third tab places words on a two-dimensional map.
Words color-coded by category — animals, foods, emotions, colors — are scattered according to closeness of meaning. Tap a word and lines connect it to the three nearest words on the map. Next to “dog” you’ll find “cat,” for instance. You get a feel for meaning having “distance.”
What’s interesting comes next: add context, and the map moves. Add one word to the context, and words in the same category get pulled toward that context, while words in other categories get pushed outward. For example, add “dog” to the context, and the animals cluster tightly around “dog,” while foods and colors scatter to the outside. “The arrangement of meaning shifts with context” — obvious once you say it, but hard to feel without seeing it — plays out through the movement of points.
(Originally I intended to show vector arithmetic like “king − man + woman ≈ queen,” but partway through implementation I judged that this “the map moves with context” experience would land better, and swapped it in.)
Tab 4: Thinking from Both Sides
The last tab has a slightly different character.
The model in Tab 1 predicts the next word left to right (an autoregressive model like GPT). A model like BERT, on the other hand, looks at both sides of a sentence at once and guesses the word that fills a gap in the middle.
This tab shows, side by side in two columns, “the prediction when looking only at the left” and “the prediction when looking at both sides” for the same fill-in-the-blank sentence. Take the sentence “Today the weather is ○○ so let’s go for a walk.” Looking only at the left side, “Today the weather is,” “nice” sits at just 30%, tied roughly with “bad” and others. But the moment you reveal the right side, “so let’s go for a walk,” “nice” jumps to 78% and the hesitation disappears. Below, a comment is generated automatically: “Looking left only, ◯◯ was N%; looking at both sides, the same ◯◯ shot up to M%.” Even for the same word, the broader the visible context, the sharper the prediction.
What Order to Let People Try It In
When showing this to people, I generally have them go through it in this order.
First, in Tab 1, run the “today’s weather” example all the way through, showing the probability bars switching as the sentence grows word by word. Next, switch the sample to one that makes the temperature difference clear and move the temperature slider back and forth. At low temperature it converges on the same safe continuation every time; at high temperature the candidates scatter and the sentence runs wild. Finally, with the “unexpected choice / rainy day” sample, deliberately click a low-probability candidate to branch off onto a side path. Once you’ve experienced “my choice changes the ending” firsthand, the rest of the explanation goes quickly.
From there, move to Tab 2 and compare how Japanese and English get cut up differently. In Tab 3, tap a few words to check closeness of meaning, then add context and watch the map move. Finish with Tab 4, comparing the same fill-in-the-blank sentence “left only” versus “both sides.” All together, this takes less than 10 minutes.
What’s Inside Is Not a Neural Network
Here’s one thing I should state honestly.
Neither the prediction in Tab 1 nor the left-right comparison in Tab 4 runs on an actual neural network under the hood. Both just show a pre-prepared probability table and branching paths. None of that massive computation is in there anywhere. It’s a lightweight model that runs entirely within the browser.
That said, as a model for showing the principle, this is sufficient. The mechanism of “looking at context and choosing the next word by probability” is the same as the real thing. What differs is precision and scale, not the principle. The only way this would become dishonest is if I passed it off as an actual neural network. That’s why the bottom of the screen always displays: “This is a simplified demo for building intuition about the mechanism. Real LLMs use neural networks and are far larger in scale.” That turns it into an honest simplification rather than a falsehood.
Technically, I could use transformers.js to run a real, tiny model in the browser. But that triggers a download of several hundred megabytes, which chokes underpowered PCs and phones. It’s not suited for handing out in a classroom. It’s a good example of how showing “the real thing” doesn’t necessarily mean communicating well.
For good measure, so it can be shown anywhere, I also prepared three display themes: the default dark neon style, a bright paper-like palette suited to classrooms, and a high-contrast one for projector screens. Even with the same content, how it “looks” can change depending on where it’s shown.
Touch It, and It Probably Clicks
Something that wouldn’t form a picture no matter how many terms you piled up can suddenly click into place the moment you watch a sentence grow with a single click.
Let people touch it rather than explain it to them. That’s my own answer to the nagging sense that explanations of LLMs don’t land.
A demo you can actually try: https://kuzlab.github.io/llm-how-it-works/
Reference Links
- A working demo: https://kuzlab.github.io/llm-how-it-works/
- Source code (GitHub): https://github.com/kuzlab/llm-how-it-works
- Transformers.js (a library for running models in the browser): https://huggingface.co/docs/transformers.js
- Word vectors (words with similar meaning cluster nearby) — word2vec / Mikolov et al., 2013: https://arxiv.org/abs/1301.3781
- A model that looks at both sides — BERT / Devlin et al., 2018: https://arxiv.org/abs/1810.04805
Original concept and direction: Yuichiro Kuzuryu. Writing: AI.
Originally published in Japanese at https://clazytech.com/2026/06/1625/. Translated with LLM assistance and reviewed before publication.