Please enable JavaScript to use CodeHS

AI Visualizations

How LLMs Learn

Type sentences and watch a simple word association graph grow. It is a toy model of how language models notice which words appear together.

LLMs ~12 min Middle / High school
The Big Idea

What is a large language model?

A large language model (LLM) is a program that learns patterns from huge amounts of text. It does not understand language the way people do, but it becomes very good at predicting which words tend to appear together.

The visualization below is a simplified version of that idea. It is not a real LLM, but it shows the same core concept: words that appear near each other build stronger connections.


Interactive

Try it: How LLMs Learn

Type a sentence and click Train Model. The graph will add each word as a circle and draw lines between words that appeared next to each other. Type more sentences to make the connections stronger.


How It Works

What the graph shows

  • Each circle represents a word, also called a token.
  • A line between two words means they appeared next to each other in a sentence.
  • The thicker the line, the more often those two words appeared together.
  • Real LLMs use similar co-occurrence patterns, plus billions of parameters, to generate text.

Check Yourself

Quick quiz

1. In the widget, each circle represents a?

2. Thicker lines mean?

3. Real LLMs learn from?


Keep exploring

Explore more AI and machine learning tutorials.

Part of the AI Visualizations tutorial series.