Skip to content
StackDecode
LLM Library
FoundationsAnimated

What is a Large Language Model?

A neural network trained to predict the next piece of text.

The idea

An LLM reads a sequence of tokens and outputs a probability for every possible next token. Trained on huge amounts of text, predicting the next token well forces it to learn grammar, facts and patterns of reasoning.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

Prompt: "The cat sat on the ___"mat4.2sofa3.4floor3.0roof1.6moon0.8table0.5dog-0.3idea-1.4
  • candidates kept
  • chosen

The model produces a raw score (logit) for every word in its vocabulary. Only eight are shown here.

1/4

Temperature reshapes the probabilities; top-k and top-p cut the tail.

Step by step

  1. 1Text is split into tokens
  2. 2The model scores every possible next token
  3. 3One token is chosen and appended
  4. 4The process repeats to build a whole answer

Where it is used

Chat assistants, coding tools, search, translation, summarising.

Watch out for

It predicts plausible text, not guaranteed truth, so it can be confidently wrong.