How Language Models Work (in Plain English) › How Language Models Work (in Plain English)

Michael BrenndoerferJune 5, 20252 min read
AI Agent HandbookAll chapters
Part 2 of 15Language Models - The Brain of the Agent
Chapter 4How Language Models Work (in Plain English) › How Language Models Work (in Plain English)
Reading section 1 of 12 · How Language Models Work (in Plain English) · 2 minSection 1 of 12 · 2 min

Book contents

Section 1 of 12 · 2 min read

How Language Models Work (in Plain English) › How Language Models Work (in Plain English)One section · Sections in this chapter1 / 12 ↓

If you've ever used autocomplete on your phone, you've experienced a tiny glimpse of what language models do. You start typing "I'm going to the..." and your phone suggests "store," "park," or "movies." It's predicting what word comes next based on what you've typed so far.

Language models (the AI brain powering our agent) work on this same principle, just at a vastly more sophisticated scale. They're trained to predict the next word (or more precisely, the next "token") in a sequence of text. That might sound simple, but this one ability turns out to be remarkably powerful. It's what allows our AI agent to understand questions, generate coherent answers, and even appear to reason about problems.

When you ask ChatGPT a question or tell Claude to write an email, you're really just giving these models a starting point. They then predict what should come next, token by token, drawing on patterns learned from billions of pages of text. The magic isn't in some hidden understanding of meaning or consciousness. It's in the sheer scale and sophistication of pattern matching.

In this chapter, we'll demystify how these models work. No advanced math required: just some intuition about patterns, predictions, and a whole lot of text.