What if you could understand how ChatGPT actually works, with nothing more than high-school algebra and a working laptop?
Inside Large Language Models, Volume I is the book the field has been missing: a plain-English, math-light, code-first introduction to the technology behind every modern AI assistant. No prior machine learning experience is assumed. No graduate-level mathematics is required. Every concept is walked through with simple arithmetic that a motivated high-school student can follow on paper.
Volume I takes you from the very first question, "what is a large language model, really?" to building and training a complete GPT-style model from scratch in Python. Along the way you will:
- See every step worked out by hand. When the book introduces attention, you compute attention scores between three actual tokens with three-dimensional vectors and a calculator. When it introduces softmax, you apply softmax to a tiny list of numbers and watch the probabilities come out correctly. There is no hand-waving, no "it can be shown that," no skipping the math.
- Build the transformer block, piece by piece. Single-head attention. Multi-head attention. Residual connections. Layer normalisation. Feed-forward networks. The language modeling head. Every component gets a chapter that explains the problem it solves, the math behind it, and a working PyTorch implementation you can run on your laptop.
- Learn the math the way it should be taught. The dot product is presented as a similarity score with a worked example. Softmax is presented as a soft winner-take-all rule with a four-row computation. Backpropagation is walked through a tiny one-weight network with arithmetic at every step before scaling to a 96-layer transformer. If you can multiply two numbers, you can follow this book.
- Train your own GPT. The final chapter assembles everything into a complete, runnable Python implementation that trains on a small text corpus and generates new text. You will run it. You will modify it. You will understand exactly what every line does.
Who this book is for:
- Software engineers who want to move beyond calling APIs and actually understand the systems they ship.
- Students who are tired of textbooks that hide the math behind notation and want to see every step.
- Curious readers with a high-school background who have heard about transformers and want a real, technical understanding without a PhD-level prerequisite.
- Practitioners moving into AI roles who need a foundation that goes deeper than online tutorials.
What makes this book different:
Most LLM books fall into one of two camps: the popular-science books that explain the ideas without ever showing the math, and the academic textbooks that bury the ideas under a wall of notation. Inside Large Language Models takes a third path. It treats the reader as a serious adult who wants the real machinery, but it refuses to require any background the reader does not already have. Every formula is preceded by a plain-English paragraph that explains what the formula is doing. Every code listing is followed by a line-by-line table that explains what each line is doing. Every concept is paired with a concrete numerical example you can verify on paper.
Volume I is the foundation: tokenisation, embeddings, positional encoding, attention in all its forms, the complete transformer block, training, and a from-scratch GPT. Volume II takes those foundations into production: inference, alignment, fine-tuning, and four end-to-end fine-tuning projects.
By the end of Volume I, you will not just know how a transformer works. You will have built one yourself, trained it, and watched it generate text. The mystery will be gone. What is left is mastery.
Companion code: every listing in the book is available as a runnable Python file at https://github.com/ritesh-modi/inside-llm. Clone it, run it, modify it, break it, fix it.