Theoretical Foundations of LLMs

A conceptual introduction to Large Language Models

Preface

Edition 2. This is a living book: it is updated continuously, and new editions incorporate corrections, new examples, and emerging industry topics.

This book is a conceptual introduction to Large Language Models (LLMs). The goal is not to teach programming or framework usage, but to build a solid understanding of the mechanisms that make these models work: from how text becomes a number to how a modern AI system operates end to end.

The material is aimed at any qualified technical professional and at undergraduate and graduate students with a foundation in calculus and basic algebra. No prior coding experience is assumed: concepts are presented through intuition first and formalism second.

The book is available in Portuguese, Spanish, and English; use the language selector in the navigation bar to switch at any time without losing your current page.

As a foundations work, it favors what tends to endure: the principles that underpin the models, rather than their versions, price points, or the tools specific to a given moment, which appear only as examples. The intent is that readers who close the book can understand any new AI system by its logic, not through the circumstantial solutions of a particular technological stage.

How to read this book

Each chapter starts from a concrete question and moves from intuition to formalism, in that order. Throughout the text, three features recur to aid reading: figures in an academic style that synthesize mechanisms too long to describe in prose; callout boxes that isolate key ideas and common pitfalls; and technical terms collected in the Glossary at the end, with cross-language correspondences. All works cited in the text are consolidated on the References page.

You do not need to read in order to benefit: readers in a hurry can jump straight to the module of interest and return to earlier ones when a concept calls for background. That said, the sequence was designed as a progression, and reading it in full is the surest way to avoid gaps.

How the book is organized

Fourteen modules arranged as a pedagogical progression, from the concept of artificial intelligence to the architecture of a modern AI product, followed by a glossary and consolidated references. Each module follows the same section structure, from introduction to references, to make reading and lookup easier.