---
title: "How LLMs learn and generate text"
description: "The pipeline from prompt to answer: tokenize text into subword IDs, embed them, run them through stacked transformer layers, and read a probability distrib"
canonical_url: "https://fanout.sh/ai-engineering/lessons/how-llms-work"
md_url: "https://fanout.sh/ai-engineering/lessons/how-llms-work.md"
access: "public"
---

# How LLMs learn and generate text

The pipeline from prompt to answer: tokenize text into subword IDs, embed them, run them through stacked transformer layers, and read a probability distrib

## Public overview

The pipeline from prompt to answer: tokenize text into subword IDs, embed them, run them through stacked transformer layers, and read a probability distribution off the top. Everything an LLM does — chat, code, reasoning — is this loop applied one token at a time.

---
This representation contains public Fanout content only. Protected Pro lessons, account data, billing, checkout, and pricing are not included.

Browse the public content map: https://fanout.sh/sitemap.md
