
You have used a language model. Now discover how it learns.
Do Zero ao LLM com Delphi
Build, train, and run your own language model
Open the black box of language models by building, training, and running a small educational LLM in Delphi 13.
This book is currently available in Brazilian Portuguese.
A complete view of the book.
From Zero to an LLM with Delphi opens the black box of language models by building a small educational laboratory from beginning to end. Readers follow the path that turns text into tokens, vectors, and tensors, measures error, calculates gradients, and adjusts parameters until a network can generate new sequences.
The mathematics begins with small examples before becoming Object Pascal and Delphi 13 code. Without relying on Python or external services, the book implements linear layers, causal attention, multiple heads, and Transformer blocks, followed by training, checkpoints, and token-by-token generation. The goal is to understand the mechanism, its limits, and the decisions hidden behind a ready-made API.
Does this situation sound familiar?
Language models usually arrive as ready-made services: a request goes in, a response comes out, and almost the entire mechanism remains hidden. Calling an API does not reveal how text becomes numbers, how patterns are learned, or how each new token is selected.
A path from intention to practice.
Build the entire path in Delphi 13—from corpus and tokenizer to tensors, neural networks, gradients, causal attention, and Transformer blocks. The mathematics begins with small examples, and every concept receives a testable Object Pascal implementation.
“Understanding a language model begins when its operations stop being invisible.”
Answers begin with the right questions.
Questions explored through context, criteria, and examples.
What does a neural network adjust when it learns?
How does attention decide which positions to observe?
How does a causal Transformer generate text token by token?
A structured journey that helps you move forward.
Concepts and applications presented in a coherent sequence.
Corpus and tokenization
Prepare a corpus and build the vocabulary that turns text into numerical sequences.
Vectors, matrices, and tensors
Implement the mathematical structures underlying model operations.
Neural networks and loss
Build layers, activations, and a loss function capable of measuring error.
Gradients and optimization
Calculate derivatives, propagate gradients, and adjust parameters during learning.
Attention and Transformers
Build causal attention, multiple heads, and the central Transformer block.
Training and generation
Train the model, save checkpoints, and generate tokens while examining results and limitations.
Depth to understand. Clarity to keep moving forward.
A language model built from start to finish in Delphi 13
Mathematics explained with small numbers before code
An implementation using only Object Pascal and the RTL
Testable code with honest discussion of laboratory limits
Knowledge that becomes action.
Delphi developers, architects, and professionals who want to understand language models from the inside will find a direct approach connected to concrete problems.
What you need to benefit from the book
✓Intermediate experience with Delphi or Object Pascal
✓No prior data science or machine learning background is required
This may not be the right book if…
—Readers interested only in consuming commercial model APIs
—Readers expecting to build a ChatGPT competitor in a few pages
Experiences from readers.
The first reviews will appear here after moderation.
Share your reading experience.
After confirming your email, your review will be moderated before publication. Your email will never be displayed.
Receive resources and updates about Do Zero ao LLM com Delphi.
Sign up for content, samples, and new resources related to the book.

Continue your journey with the complete book.
Build, train, and run your own language model
Print edition ISBN: 978-65-02-32159-1

