Back to blog
Oct 16, 2026
2 min read

How LLMs work: inside the next token

“ A six-part series that follows one sentence through tokenization, embeddings, attention, the transformer stack, and next-token prediction — with an interactive overview you can click through first. ”
Contents

This series opens a large language model along one running sentence — The cat sat on the — and shows what has to happen before the next token appears. Start with the interactive overview below, then read each guide in order.

THE LLMs KNOW-HOW · CONCEPT PREVIEW
Inside the next token
RUNNING SENTENCEThe cat sat on the ▏
Text → model → next token → text

A model you can open

GPT-2 structure from the guides · schematic activations

The six guides

  1. Neural networks: a function with knobs — neurons, forward passes, and backpropagation.
  2. Tokenization: how text becomes numbers — tokens, vocabularies, and GPT-2’s tokenizer.
  3. Embeddings: giving every token a vector — lookup tables and position vectors.
  4. Attention: letting tokens look at each other — weighted context and the causal mask.
  5. The transformer: blocks, stacks and a model that works — assembling the stack and counting parameters.
  6. Next-token prediction: from probabilities to text — logits, softmax, temperature, top-k and top-p.

Read them in order: each guide assumes the ones before it.

How LLMs work: inside the next token
https://www.vinaygautam.com/blog/how-llms-work
Author: Vinay Gautam
Published: Oct 16, 2026
© 2026 Vinay Gautam. All rights reserved.

Enjoyed this post?

Get notified when I publish new articles. No spam, unsubscribe anytime.

Subscribe

Comments & reactions

Share a thought or react. Sign in with GitHub to join the discussion.