The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
This book is the summary of everything you are going to need to learn how to deploy LLM to production. All the tips and tricks, and some interview questions.
With Membership
Free!
$5.00
About the Book
LLM Engineering, from Component to Production is a practical, measurement-first guide to building a local-first agentic retrieval-augmented generation system. Across sixteen chapters, one evolving codebase, and a sequence of hands-on labs, it treats the language model as a fallible software component rather than a magical application layer. The central promise is not that the reader will memorize a framework, but that they will finish with a system they have built, measured, secured, observed, and prepared to deploy.
The book begins at the component level. It explains tokenization, sampling, constrained decoding, tool calling, and context management from first principles. The reader writes the tool-calling loop by hand before using an orchestration framework, making the runtime contract explicit: the model proposes a structured action, ordinary code validates and executes it, and the result is returned to the model. This foundation supports a broader engineering principle repeated throughout the manuscript: inference should be used for judgment, while loops, conditionals, data transformation, validation, and orchestration belong in deterministic code.
The retrieval section builds a strong baseline before introducing more elaborate techniques. It covers layout-aware document parsing, structural chunking, provenance, idempotent ingestion, dense and lexical retrieval, reciprocal rank fusion, cross-encoder reranking, and contextual retrieval. Particular emphasis is placed on silent failure modes: indexes built with the wrong embedding model, BM25 constructed over an empty store, lost page metadata, duplicated model calls, and retrieval pipelines that appear to work while returning weak evidence. GraphRAG and query expansion are assessed against measured costs rather than adopted as defaults.
The agency section explains when an agent is justified and when a fixed pipeline is the better design. It covers current LangChain and LangGraph patterns, middleware, durable state, human-in-the-loop interrupts, Model Context Protocol, protocol alternatives, and tool-surface security. The recurring design constraint is containment: read-only tools should remain simple, privileged actions require narrow interfaces and validation, and untrusted model output must never be dispatched through unrestricted reflection or unchecked arguments.
Evaluation, security, observability, and cost form the rigor layer. The book advocates a hand-written golden set, deterministic retrieval metrics such as recall at k and mean reciprocal rank as CI gates, and judged generation metrics as noisy monitoring signals rather than binary tests. It includes prompt pinning, embedding-index skew checks, injection regression tests, OpenTelemetry tracing, latency decomposition, token accounting, and cost-per-query measurement. The reader is repeatedly asked to record before-and-after numbers so that architectural claims remain falsifiable.
The production chapters move from local development to serving and deployment. They cover vLLM, continuous batching, PagedAttention, KV-cache sizing, quantization, concurrency testing, blue-green index releases, canaries, rollback, on-premises and cloud options, data residency versus sovereignty, and EU AI Act implications. The final chapters turn the completed system into a capstone, a defensible CV project, and a set of technically precise interview explanations. Two appendices reinforce the book’s deeper lesson: audit confident technical advice critically, and prefer architectures whose behavior can be inspected, measured, and explained.
The intended outcome is a working system and an evidence trail: a corpus chosen by the reader, a golden set written by hand, retrieval and generation metrics, trace data, security tests, deployment artifacts, and a concise record of which changes improved the system and which were not worth their cost.
About the Author
As a dedicated PhD Researcher at SCK CEN, my work on 3D reconstruction of complex soil materials is pivotal for advancing nuclear isolation strategies. Currently enrolled at Université catholique de Louvain, I am honing my expertise in Artificial Intelligence, particularly within generative AI applications. Previously, I led a team at Smart Drilling Operations, where I developed strong analytical skills and a keen attention to detail. My background in Smart Computational Systems from Université des Sciences et de la Technologie 'Houari Boumediène' underpins my technical competencies, enabling me to contribute effectively to complex multidisciplinary projects.
You can get the free Community Edition in PDF or EPUB just by sharing your name and email address with the author, or you can just click this link to read a shorter sample online...
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.
Learn more about writing on Leanpub
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.