Large Language Models
From tokens, attention and the Transformer to prompting, retrieval, tools, agents, the Model Context Protocol and running a model on your own hardware, large language models as told through the free samples of the Leanpub books about them.
Created from the free samples of 15 Leanpub books and the descriptions and tables of contents of 17 more books and courses, with every source cited.
A large language model (LLM) is a neural network trained on very large amounts of text to predict the next token, a word or a piece of one, from the tokens before it. From that one ability come programs that answer questions, summarise, translate and write code. A non-technical guide on this shelf offers a picture of the result, a genius in the basement who has read everything, will take any role and is sometimes convincingly wrong,[6] while a textbook insists that a language model is at its core a mathematical function.[5] A third book draws the consequence: such a system never aims at the correct result, only at the most probable one, and what is called a hallucination is the system working as designed.[7]
The literature has moved quickly from the model to what surrounds it. One architecture book treats the model as a single probabilistic component, to be enclosed in retrieval, validation, permissions and control loops.[4] One engineering book holds that the scarce skill is no longer building things with models but knowing which things are worth building, and ends several of its chapters by advising against the technique they describe.[1] Other books teach prompting to people who will never write a program,[21] or show how to run a model on a computer the reader already owns.[2]
This article covers where to begin, the history, how a language model works, prompting, the building of applications with retrieval, tools and agents, running and adapting models, and evaluation and operation. Its sources are the free samples of the Leanpub books listed at the end, with the descriptions and tables of contents of the books and courses whose samples were not available, and every claim that rests on a source is cited to it.
Where to start
A reader who wants to understand and use the technology without programming has several books. Generative AI in a Nutshell explains what generative AI is, how it works and where its limits lie, and asks for no background.[6] Generative AI For The Rest Of US (2024) covers similar ground and adds the economics and regulation,[20] and ChatGPT - Using the AI Appliance (2024) treats a chat assistant as an appliance to be judged by what goes in and what comes out.[21] Generative AI Professional Prompt Engineering Guide is a large collection of prompt templates,[15] and Reliable Generative AI is written for professionals who design repeatable workflows around a model without writing code.[23]
A developer can begin in a familiar language. OpenAI GPT For Python Developers (2024) is for Python programmers with no machine learning background;[25] Spring AI for Your Organization is for Java developers who use the Spring framework;[9] PHP AND LLMs is for PHP developers;[27] and Building AI Agents with C# and .NET 10 asks for intermediate C# and no experience of AI.[12] Running Local LLMs on Your Own Hardware needs comfort at the command line and nothing more,[2] and The Model Context Protocol (MCP) in Practice assumes a reader who knows web interfaces and JSON.[3]
Those who want to know what happens inside a model can build one. Build Your First LLM starts from a first Python program and assumes neither programming nor advanced mathematics;[14] The Hundred-Page Language Models Book asks for Python and writes a Transformer from scratch;[5] Under The Hood is a long workshop for readers prepared to do sustained work.[19] Experienced engineers are addressed directly by LLM Engineering, from Component to Production, which says that it is not an introduction and assumes a reader who has shipped software and knows what an embedding is,[1] and by Systems Thinking for Agentic AI, for backend engineers and architects with no machine learning background.[4]
History
Statistical models of language are older than neural ones: counting which words follow which was a working method in speech recognition and translation for decades. Neural language models appeared in the 2000s, word embeddings in the early 2010s, and in 2017 the Transformer, an architecture built on a mechanism called attention, which could be trained on far more text than its predecessors. Models of the GPT family followed, and the release of a public chat interface at the end of 2022 brought them to a general audience. Open-weight models, protocols for connecting models to tools and systems described as agents have followed in quick succession.
The books mark the same points. The foreword to The Hundred-Page Language Models Book, by a researcher who took up language modelling two decades ago, remembers the counting of word sequences as a very simple concept that was hard to beat.[5] Generative AI in a Nutshell dates the Transformer to a paper of 2017 and records that the chat assistant released in November 2022 had a million users within five days.[6] Running Local LLMs on Your Own Hardware tells the next chapter: the first widely known models could be reached only through their makers' services, until capable models were published with their weights; then quantization, which stores each weight in about four bits where sixteen had been used, cut the memory needed to roughly a quarter, and inference engines written for ordinary processors did the rest.[2] Spring AI for Your Organization gives the history from the side of one programming language, listing the Java tools for chatbots and language processing from 1995 onwards and the shift of the field to Python in the 2010s.[9] How fast the details date is visible in Get SH*T Done with Prompt Engineering and LangChain (2023), whose table of context limits runs from 512 tokens to a hundred thousand.[8]
How a language model works
The vocabulary comes first, because the terms are often used as if they meant the same thing. Systems Thinking for Agentic AI lays them out as layers: artificial intelligence is the broad field, not one technology; machine learning is the part of it in which a system learns patterns from data instead of following rules written by hand; deep learning uses neural networks to learn from very large datasets; and generative models, of which large language models are one kind, produce new content.[4] Generative AI in a Nutshell gives the same map in a sentence or two for readers who do not program: generative AI creates original content where earlier systems found or classified existing content, and a large language model is the kind that communicates in ordinary human language.[6]
A model reads and writes tokens. A token, in one guide's words, can be thought of as a word, a character or a part of a word, and every model has a limit on how many it can take in at once; text beyond the limit must be cut, with a loss of context.[8] Given the tokens so far, the model computes which token is likely to come next, adds it, and repeats.[6] The books that teach the internals differ in how they get there. The Hundred-Page Language Models Book starts with models that count and with recurrent networks before the Transformer, on the view that the earlier approaches are overlooked and make the later one intelligible, and its contents go on to fine-tuning, sampling, prompt engineering and hallucinations.[5] A course version adds quizzes, exercises and recorded interviews.[18]
Under The Hood builds a model through thirty-six projects, from a single differentiable number to serving, and has the reader break each piece on purpose and measure what is lost, to show why it is there.[19] Build Your First LLM does the same as one continuous project for complete beginners.[14] The Wizard's Lens: Learn to Think Like AI takes a different route, explaining attention and context through physical analogies inside a book that is as much about expert judgement as about models; it opens by asking the reader to bring a stubborn problem to an AI assistant and to require three clarifying questions before any answer.[10]
What a model is determines how it fails. The AI Coverup: Are We Really Hallucinating? begins with an assistant that misread the title of the author's own book by taking the commonest meaning of one word, and builds its argument on the contrast with a spreadsheet: forty years of personal computing taught people to expect the same result from the same inputs, and a language model does not work that way.[7] Systems Thinking for Agentic AI puts it in an engineer's terms. Once behaviour is learned from data a system is partly statistical, and that has consequences for testing, evaluation, reliability and debugging.[4]
Prompting
A prompt is the text given to a model, and prompt engineering is the practice of writing it to get the result wanted. Generative AI in a Nutshell separates that skill from what it calls prompt imagination, the ability to think of useful things to ask for at all, and considers both as basic as reading and writing.[6] Get SH*T Done with Prompt Engineering and LangChain is practical about form: it shows plain text, lists, JSON and tables being passed to a model, prefers a Markdown table for large amounts of structured data because it uses fewer tokens, and asks for JSON back when a program will read the answer.[8]
Opinions divide over how much engineering a prompt needs. Generative AI Professional Prompt Engineering Guide organises the subject into more than twenty named templates with a framework for assembling them,[15] and LLM Prompt Engineering For Developers (2024) treats prompts as artefacts to be tested and scored, covering few-shot examples, step-by-step reasoning and the tools that compare one wording with another.[24] Organic Prompting argues the other way, for the simplest prompt that works, refined in conversation,[22] and ChatGPT - Using the AI Appliance recommends the same habit to non-technical readers before any formal method.[21] An adjacent book shows prompting used to teach: ChatGPT: Your Python Coach (2023) is an introduction to Python organised around the hundred prompts with which its author drafted it. Its preface makes an observation that recurs across the shelf, that programming is a favourable case for these models, because what they produce is code and code can be checked by running it.[16]
Building applications
A model on its own, The Model Context Protocol (MCP) in Practice observes, can only talk: it cannot read the file being discussed or query the database that holds the answer.[3] An application supplies what is missing, and the simplest applications call a hosted model through its interface. OpenAI GPT For Python Developers builds a series of small programs this way, using chat, embeddings, semantic search and speech,[25] and a short course, ChatGPT-to-Speech: Build an AI-Powered Podcast With Python (2023), chains a model to a text-to-speech service to turn news headlines into a podcast.[26] Spring AI for Your Organization and PHP AND LLMs do the equivalent for Java and PHP, the second with a driver that hides which vendor's model is in use.[9][27] The Java book explains its purpose by a gap: the field's tools had moved to Python, and a framework was needed that keeps conversation history, retrieval and the calling of functions inside the ecosystem its readers already use.[9] LLM Engineering, from Component to Production is wary of leaning on any such layer, and teaches frameworks as a thin covering over ideas that will outlive them.[1]
Retrieval and tools
Retrieval-augmented generation (RAG) gives a model passages fetched from the application's own documents, so that its answer rests on them instead of on memory. LLM Engineering, from Component to Production builds a retrieval system as its spine and is strict about the order of work: a strong baseline first, then more elaborate techniques only where measurement justifies their cost. It lists the failures that make no noise, such as an index built with the wrong embedding model or a pipeline that seems to work while returning weak evidence.[1]
Tool use lets a model act. In Systems Thinking for Agentic AI's account the model proposes a structured request and the application decides whether the request is valid and carries it out: the model interprets intent, and the application controls execution.[4] The engineering book states the same principle as a division of labour, inference for judgement and ordinary deterministic code for loops, conditions, validation and orchestration.[1] Until recently every tool had to be described separately for every vendor's model. The Model Context Protocol (MCP) in Practice calls this the N-by-M problem, one small function redefined once for each client, and presents the Model Context Protocol as the remedy, a client and server arrangement in which a capability is written once, so that the number of integrations grows with the sum of clients and capabilities and not with their product. A server is made of three kinds of thing, tools, resources and prompts. The book covers the server side only, builds its first server twice, in Python and in TypeScript, to show what belongs to the protocol and what to one library, and notes that separate server processes bring questions of security and versioning with them.[3]
Agents
The word agent is used loosely, and Systems Thinking for Agentic AI narrows it: not any application built round a model, but a system in which a model takes part in a control loop, deciding what should happen next, calling outside capabilities, observing the results and continuing until the task is done or a stopping condition applies.[4] The preface of Agent Engineering with Gemini, an early-access book, sets agent engineering in a line of changes of abstraction, from machine instructions to languages and from servers to cloud platforms, and warns that without context, controlled tools, deterministic workflows and evidence of reliability an impressive demonstration remains a demonstration. Its first chapter is headed by the principle that a model is a capability and not a system, and has the reader define success before building anything.[11] Building AI Agents with C# and .NET 10 grows one question-answering agent across twenty chapters on Microsoft's agent framework, with maps for readers migrating from two earlier libraries.[12] The Agentic AI book runs from the foundations of language models to systems of several agents,[28] and System Design for the LLM Era applies the conventional system design case study to four products built on models, among them a coding environment and a support agent.[29] Two adjacent books come from neighbouring practices: AI Appliances documents a framework in which an agent is a declared workflow of model calls, queries and scripts, and begins from what it calls the prototype problem, that a prototype is built for the demonstration and not for the working day, so that the questions about validating inputs start only when someone asks for it in production,[17] and The Augmented Developer (2024) surveys coding assistants before building custom ones.[32]
Running and adapting models
A model can be run without anyone's service. Running Local LLMs on Your Own Hardware reduces a local setup to three parts, a file of weights, a program that reads it and a way of talking to that program, and then maps ten layers that may be added above, from the tokenizer and the inference engine to an interface for applications, retrieval, evaluation and operations. Privacy is the reason it gives first for doing so: a prompt sent to a hosted service may contain source code, customer records or medical notes, and a provider's policy about them is a promise, not a physical fact. The others are cost that does not rise with use, speed and availability without a network, control and reproducibility, and the understanding that comes from doing it. The book's working model is that memory, its capacity and the rate at which it can be read, decides what will run and how fast, more than the speed of the processor. The book warns that the particular models it names will be superseded while the structure that made them runnable will not.[2] Local AI Engineering with Ollama covers similar ground for developers with one tool, proceeding from tokens and quantization to a small agent with memory.[30]
Fine-tuning adapts a trained model to a task by training it further on examples. A Hands-On Guide to Fine-Tuning Large Language Models with PyTorch and Hugging Face is devoted to it, with attention to the configuration settings that decide whether the work fits on a consumer graphics card and a chapter on troubleshooting.[13] Get SH*T Done with Prompt Engineering and LangChain sets fine-tuning beside prompt engineering as the two ways to better results,[8] and the contents of The Hundred-Page Language Models Book include a method of adapting a model by training only a small number of added parameters.[5]
Evaluation and operation
A system that does not give the same answer twice cannot be tested like other software, and the newer books give this as much room as the building. LLM Engineering, from Component to Production asks for a set of questions and expected answers written by hand, treats deterministic measures of retrieval as gates in the build, and regards the scores that one model gives another's output as noisy signals for monitoring; it asks the reader to record figures before and after every change so that claims about the architecture remain falsifiable. Its later chapters deal with tracing, cost per query, injection tests and serving.[1] Rethinking Performance Engineering for Agentic AI addresses the engineers who keep such systems running, for whom an agent that decides at run time how many calls to make breaks the usual service targets; it proposes latency budgets and a limit on tokens per trace.[31] Reliable Generative AI makes the corresponding case to non-programmers, that dependable results come from structured and grounded workflows and not from clever prompts.[23]
Questions about Large Language Models
Which book about large language models should I start with?
A reader who does not program can begin with Generative AI in a Nutshell, which explains what generative AI is, how it works and where its limits lie, and asks for no background.[6] A developer can begin in a familiar language: OpenAI GPT For Python Developers (2024) is for Python programmers with no machine learning background, and Spring AI for Your Organization is for Java developers who use the Spring framework.[25][9] Those who want to know what happens inside a model can build one with The Hundred-Page Language Models Book, which asks for Python and writes a Transformer from scratch.[5]
What is a large language model?
A large language model is a neural network trained on very large amounts of text to predict the next token, a word or a piece of one, from the tokens before it. Given the tokens so far, the model computes which token is likely to come next, adds it, and repeats.[6] The Hundred-Page Language Models Book insists that a language model is at its core a mathematical function.[5]
Why do language models hallucinate?
The AI Coverup: Are We Really Hallucinating? draws the consequence of how a model works: such a system never aims at the correct result, only at the most probable one, and what is called a hallucination is the system working as designed.[7] The book builds its argument on the contrast with a spreadsheet: forty years of personal computing taught people to expect the same result from the same inputs, and a language model does not work that way.[7]
What is the Model Context Protocol?
Until recently every tool had to be described separately for every vendor's model, which The Model Context Protocol (MCP) in Practice calls the N-by-M problem.[3] The Model Context Protocol is the remedy it presents, a client and server arrangement in which a capability is written once, so that the number of integrations grows with the sum of clients and capabilities and not with their product.[3] A server is made of three kinds of thing, tools, resources and prompts.[3]
Can I run a large language model on my own computer?
Running Local LLMs on Your Own Hardware reduces a local setup to three parts, a file of weights, a program that reads it and a way of talking to that program.[2] Quantization, which stores each weight in about four bits where sixteen had been used, cut the memory needed to roughly a quarter, and memory decides what will run and how fast, more than the speed of the processor.[2] Privacy is the reason the book gives first for running a model locally: a provider's policy about the prompts sent to it is a promise, not a physical fact.[2]
What is the difference between an AI agent and an LLM application?
Systems Thinking for Agentic AI narrows the word agent: not any application built round a model, but a system in which a model takes part in a control loop, deciding what should happen next, calling outside capabilities, observing the results and continuing until the task is done or a stopping condition applies.[4] In tool use, by the same account, the model proposes a structured request and the application decides whether the request is valid and carries it out.[4]
Sources
Every source is a Leanpub book or course. The note after each says which part of it was read; where no sample was available, only the public description and table of contents were used.
- 1.LLM Engineering, from Component to Production, Ali Aouf Free sample: the summary of the book's sections, the reader's guide and the outline of its chapters. 2026. Free sample: PDF · EPUB
- 2.Running Local LLMs on Your Own Hardware, Yohan J. Rodríguez: A Practical Guide to Private, Offline, and Self-Hosted Large Language Models Free sample: the preface and the opening of chapter one, on what a local setup consists of, how local models became practical and why to run them. 2026. Free sample: PDF
- 3.The Model Context Protocol (MCP) in Practice, Yohan J. Rodríguez: Building, Integrating, and Scaling Custom Tool Servers for AI Agents Free sample: the preface and the opening of chapter one, on the integration problem the protocol addresses. 2026. Free sample: PDF
- 4.Systems Thinking for Agentic AI, Ediz Najim: A Software Architect’s Guide to Building Reliable LLM and Agent Systems Free sample: chapter one, a map from artificial intelligence through language models to retrieval, tools and agents. 2026. Free sample: PDF · EPUB
- 5.The Hundred-Page Language Models Book, Andriy Burkov: hands-on with PyTorch Free sample: the contents, the foreword, the preface and the opening of chapter one. 2025. Free sample: PDF
- 6.Generative AI in a Nutshell, Henrik Kniberg: How to Survive and Thrive in the Age of AI Free sample: the opening chapters, on why generative AI matters, a mental model for it, and its terminology. A course of the same name covers the same ground. 2025. Free sample: PDF · EPUB
- 7.The AI Coverup: Are We Really Hallucinating?, Edward W. Barnard: HPC Tradecraft Apprenticeship, Volume 1 Free sample: chapter one, on hallucination as expected behaviour. 2026. Free sample: PDF · EPUB
- 8.Get SH*T Done with Prompt Engineering and LangChain, Venelin Valkov: Build AI Applications with ChatGPT in Python Free sample: the introduction to prompts, input and output formats, and tokens and their limits. 2023. Free sample: PDF · EPUB
- 9.Spring AI for Your Organization, Muthukumaran Navaneethakrishnan: GCP Vertex AI Edition Free sample: the preface and chapter one, on AI frameworks in Java and setting up a first project. 2025. Free sample: PDF · EPUB
- 10.The Wizard's Lens: Learn to Think Like AI, Edward W. Barnard: HPC Tradecraft Apprenticeship, Volume 3 Free sample: the introduction and the opening exercise of chapter one. 2026. Free sample: PDF · EPUB
- 11.Agent Engineering with Gemini, Venkatesh Tadinada: Book 1: Build an Inspectable Agent MVP with Gemini, ADK, and Antigravity Free sample: the note on the sample edition and the preface. 2026. Free sample: PDF · EPUB
- 12.Building AI Agents with C# and .NET 10, Rachid DAHIR: A Developer’s First Guide to the Microsoft Agent Framework Free sample: the preface, on readers and prerequisites, and the overview of the parts. 2026. Free sample: PDF
- 13.A Hands-On Guide to Fine-Tuning Large Language Models with PyTorch and Hugging Face, Daniel Voigt Godoy Free sample: front matter and the table of contents only. 2025. Free sample: PDF
- 14.Build Your First LLM, Hasan Degismez: A Hands-On Guide to Language Models The free sample is a table of contents only: from that and the description. 2026. Free sample: PDF
- 15.Generative AI Professional Prompt Engineering Guide, George Tome: Prompt Engineering Excellence: Unlock the Full Potential of Generative AI The free sample is a table of contents only: from that and the description. 2026. Free sample: PDF
- 16.ChatGPT: Your Python Coach, Sergio Rojas-Galeano: Mastering the Essentials in 100 Prompts Free sample: the preface, on the prompt-based approach, and the table of contents. 2023. Free sample: PDF
- 17.AI Appliances, Joel Bryan Juliano: Build & Deploy Autonomous AI Agents and Agencies in YAML Free sample: the contents and the opening of chapter one, on the gap between a prototype and production. 2026. Free sample: PDF · EPUB
- 18.The Hundred-Page Language Models CourseCourse, Andriy Burkov No sample: from the description; the course version of the language models book. 2025.
- 19.Under The Hood, Ramchand Kumaresan: Build Every Layer of a Large Language Model from Scratch No sample: from the description and table of contents. 2026.
- 20.Generative AI For The Rest Of US, Aymen El Amri: Your Future, Decoded No sample: from the description and table of contents. 2024.
- 21.ChatGPT - Using the AI Appliance, Adam Russell: Start Simply - Skip the AI Hype - Get Results Easily No sample: from the description and table of contents. 2024.
- 22.Organic Prompting, Adam Russell: The natural approach to Prompt & Response Engineering No sample: from a description and a table of contents that differ somewhat. 2025.
- 23.Reliable Generative AI, George Tome: A Practical Guide to Prompt Design, RAG, Agents, and Safer AI Workflows No sample: from the description and table of contents. 2026.
- 24.LLM Prompt Engineering For Developers, Aymen El Amri: The Art and Science of Unlocking LLMs' True Potential No sample: from the description and table of contents. 2024.
- 25.OpenAI GPT For Python Developers, Aymen El Amri: The art and science of building AI-powered apps with GPT-4, Whisper, Weaviate, and beyond No sample: from the description and table of contents. 2024.
- 26.ChatGPT-to-Speech: Build an AI-Powered Podcast With PythonCourse, Daniel Davis: Learn how to automatically convert news headlines to audio podcast files using the ChatGPT and ElevenLabs APIs. No sample: from the description of a short course. 2023.
- 27.PHP AND LLMs, Alfred Nutile: Practical Integrations using Laravel No sample: from the description and table of contents. 2025.
- 28.The Agentic AI book, Dr. Ryan Rad: From Language Models to Multi-Agent Systems No sample: from the description and table of contents. 2026.
- 29.System Design for the LLM Era, Sampriti Mitra: Patterns and Principles for Production-Grade AI Architecture No sample: from the description alone. 2026.
- 30.Local AI Engineering with Ollama, Aymen El Amri: Run, understand, customize, fine-tune, and build agentic apps on your own hardware No sample: from the description and table of contents. 2026.
- 31.Rethinking Performance Engineering for Agentic AI, Kandasamy Selvaraj: A Practitioner's Guide to Performance, Latency Budgets, and Production-Grade Observability for Scalable Enterprise Agentic AI No sample: from the description and table of contents. 2026.
- 32.The Augmented Developer, Aymen El Amri: Code Smarter, Not Harder No sample: from the description and table of contents. 2024.
Further reading
Other books in the library on neighbouring ground, not cited above. Most are about working with one coding agent.
- Claude Code: Building Production Agents That Actually Scale, Thomas De Vos: Build, Evaluate, Secure, and Operate Production AI Agents with Claude Code, MCP, Hooks, and the Claude Agent SDK Taking agents built on one coding tool into production: the agent loop, context, tools, permissions, evaluation and cost. 2026.
- Claude Code, Maurizio Pelizzone: A practical guide for those who want to start using Claude Code professionally A practical guide to professional use of a command-line coding agent, from installation to memory, permissions and subagents. 2026.
- Claude Code Safety: Stop Your AI Agent from Destroying Your Work, yurukusa: The Claude Code hooks that stop a destructive rm, a force push, a dropped database and a discarded working tree — and the data loss runbook for when one gets through. A field guide to the irreversible accidents an unattended coding agent can cause, with a guard for each. 2026. Free sample: PDF · EPUB
- Clarity Engineer : Code Is the Side Effect, Volodymyr Pavlyshyn: Building AI-Driven Systems Where Engineering Judgment Is the Real Work For experienced engineers working with coding agents, arguing that clarity, not code, is the engineer's main product. 2026.
- The OpenClaw Playbook, Dennis Steinberg: A Prompt-First Guide to Making Your Agent Useful A guide without code to turning an agent into a personal assistant that knows its owner's calendar and habits. 2026. Free sample: PDF · EPUB
- Claude Code for Legacy Modernization, Thomas De Vos: Recover Hidden Business Rules, Build a Verification Harness, and Modernize Critical Systems Without Breaking Production Changing a critical legacy system safely with a coding agent's help, following one slice from discovery to retirement. 2026.