Book cover: Do Zero ao LLM com Delphi
Delphi and Artificial Intelligence

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.

Buy the print bookBuy on Kindle★ Review this book

This book is currently available in Brazilian Portuguese.

Edition1st edition2026Length224 pages16 × 23 cmBook languagePortugueseBrazilFormatsPrint and KindleTwo editionsISBN978-65-02-32159-1Print edition
About the book

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.

The challenge

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.

The book’s approach

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.”
By the end of the book, you will be able to:
Turn text into tokens, vectors, and tensors
Implement linear layers and a neural network
Understand loss, gradients, and optimization
Build multi-head causal attention
Assemble and train a small Transformer
Save checkpoints and generate text token by token
Questions that guide the reading

Answers begin with the right questions.

Questions explored through context, criteria, and examples.

01

How is text transformed into tokens and numbers?

02

What does a neural network adjust when it learns?

03

How does attention decide which positions to observe?

04

How does a causal Transformer generate text token by token?

Inside the book

A structured journey that helps you move forward.

Concepts and applications presented in a coherent sequence.

01

Corpus and tokenization

Prepare a corpus and build the vocabulary that turns text into numerical sequences.

02

Vectors, matrices, and tensors

Implement the mathematical structures underlying model operations.

03

Neural networks and loss

Build layers, activations, and a loss function capable of measuring error.

04

Gradients and optimization

Calculate derivatives, propagate gradients, and adjust parameters during learning.

05

Attention and Transformers

Build causal attention, multiple heads, and the central Transformer block.

06

Training and generation

Train the model, save checkpoints, and generate tokens while examining results and limitations.

What makes this book different

Depth to understand. Clarity to keep moving forward.

01

A language model built from start to finish in Delphi 13

02

Mathematics explained with small numbers before code

03

An implementation using only Object Pascal and the RTL

04

Testable code with honest discussion of laboratory limits

Who this book is for

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.

✓ Delphi and Object Pascal developers✓ Programmers without prior AI training✓ Architects and technical leaders✓ Professionals who want to move beyond APIs
Before you begin

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

An informed choice

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

Why this author, on this subject

Experience that gives the reading context.

An Embarcadero MVP and Delphi developer for more than 20 years, Régys connects the Object Pascal ecosystem to language-model foundations without relying on Python or external services.

Book readers

Experiences from readers.

The first reviews will appear here after moderation.

Have you read it?

Share your reading experience.

After confirming your email, your review will be moderated before publication. Your email will never be displayed.

Your rating
Continue the conversation

Receive resources and updates about Do Zero ao LLM com Delphi.

Sign up for content, samples, and new resources related to the book.

Choose your edition

Continue your journey with the complete book.

Build, train, and run your own language model

Print edition ISBN: 978-65-02-32159-1