Skip to content

Drag or use arrow keys to rotate

The No Nonsense Guide

Machine Learning Inference and Kernels

Building High Performance AI Systems

LAXMEN MURALI · FIRST EDITION, 2026

What actually happens between a prompt arriving at a server and tokens streaming back, and how an engineer makes that whole path fast.

chapters
54
parts
11
pages
675
updates
Free

₹3,499

₹5,999 42% off, save ₹2,500

  • eBook
  • Delivered in about a minute
  • Every future edition free, for life

Free trial

Read a chapter before you decide

A 34-page excerpt: the full table of contents and complete chapters exactly as they appear in the book. No email, no signup.

The book

Why it exists

You type a prompt and press enter. Before the first word of the answer appears, a lot has already happened. The text is split into tokens, the request waits in a queue and gets batched with other people's, then it runs through one phase that keeps the GPU flat out and another that leaves it mostly waiting, and the answer comes back one token at a time. Most of that time is lost in places nobody really decided on.

This book follows that whole path. It is usually taught in pieces: serving in one place, scheduling in another, attention, kernels, memory and GPU hardware somewhere else again. In a real system they are one thing, and a choice in any one of them turns up as a problem in another. Batch more requests together and each one gets slower. Quantise the model and the kernels have to change. You can only reason about performance properly once you can see all of it at the same time.

So the book reads as one continuous story: how inference actually runs, then GPU architecture, kernel engineering, CUDA and Triton, attention and the KV cache, quantisation, profiling, scheduling, and serving across many GPUs. The numbers are worked out in the open, using the same models from start to finish, so you can check every performance claim yourself instead of taking it on trust.

Along the way you build a working inference engine of your own, piece by piece, and most of it runs without a GPU. The goal is simple and practical: be able to look at an AI system, work out where its time and memory are really going, and know what to do about it.

Inside

What makes it different

01

One request, traced end to end

The book opens by following a single prompt from start to finish and accounting for every millisecond, so you see where a slow request actually loses its time.

02

Arithmetic, not folklore

The same models are used from the first chapter to the last, so every claim is a calculation you can redo rather than a number you have to trust.

03

Prefill and decode are different machines

Arithmetic intensity, why decode is memory bound, where batching stops helping, and why throughput and latency are separate questions with separate answers.

04

Attention is where the halves weld

Six chapters on the one operator that decides everything: FlashAttention 1, 2 and 3, decode attention and GQA, paged KV cache and PagedAttention, prefix caching and radix trees.

05

You build an inference engine

One project grows with the book, from a simple model to a complete engine, and almost all of it runs without a GPU.

06

Metrics you can defend

Four clocks, Little's law, why the mean is the wrong statistic, and how two honest benchmarks of the same system can disagree. Then the runtimes themselves: vLLM, SGLang, TensorRT-LLM and FlashInfer, compared on what they actually do.

Who it's for

Written for

  • ML engineers who want to know what their serving stack is doing, not just how to configure it
  • Kernel and CUDA engineers who need the serving context their kernels land in
  • Systems engineers accountable for inference latency, throughput and cost per token
  • Students who want ML systems as one subject rather than six unconnected courses
  • Anyone preparing for inference, CUDA, kernel, or performance-engineering interviews

What you need first

You should be able to write a program in any language and know roughly how a GPU differs from a CPU. CUDA, Triton, the numerics and the queueing theory are all taught where the book needs them. Most of the code runs without a GPU.

Table of contents

11 parts, 54 chapters

Every chapter listed. Nothing hidden.

PART I Understanding LLM Inference 4 ch

What a request actually does: tokens, queues, prefill, decode, and the memory arithmetic of the KV cache.

  1. 1 What Happens Between a Prompt and a GPU
  2. 2 The Transformer as an Inference Workload
  3. 3 Prefill and Decode: Two Different Machines
  4. 4 The KV Cache and the Memory Math of Decoding
PART II GPU Architecture for AI Engineers 7 ch

The hardware model everything later leans on. SMs, memory hierarchy, Tensor Cores, roofline, and your first CUDA kernels.

  1. 5 Latency, Throughput, and Metrics You Can Defend
  2. 6 The Shape of a GPU
  3. 7 The Memory Hierarchy
  4. 8 Tensor Cores and the Arithmetic of AI
  5. 9 Roofline, Arithmetic Intensity, and Bottleneck Reasoning
  6. 10 Reading a Spec Sheet Without Being Lied To
  7. 11 Your First CUDA Kernels
PART III CUDA and GPU Kernel Engineering 7 ch

Access patterns, shared memory, warps, occupancy, launch overhead, and GEMM built up from naive to Tensor Core.

  1. 12 Global Memory Access Patterns
  2. 13 Shared Memory, Tiling, and Bank Conflicts
  3. 14 Warp-Level Programming
  4. 15 Occupancy, Registers, and Latency Hiding
  5. 16 Synchronization, Streams, Graphs, and Launch Overhead
  6. 17 GEMM I: From Naive to Tiled
  7. 18 GEMM II: Register Blocking, Double Buffering, and Tensor Cores
PART IV Writing High-Performance LLM Kernels 4 ch

Reductions and online softmax, memory-bound kernels, fusion, and profiling with Nsight.

  1. 19 Reductions and the Online Softmax
  2. 20 Memory-Bound Kernels: RMSNorm, RoPE, and Activations
  3. 21 Kernel Fusion
  4. 22 Profiling: Nsight Systems, Nsight Compute, and Compute Sanitizer
PART V Triton and GPU Code Generation 5 ch

Triton end to end, plus PTX and SASS so you can read what the GPU actually runs.

  1. 23 The Triton Programming Model
  2. 24 Writing LLM Kernels in Triton
  3. 25 Autotuning and the Triton Compiler Pipeline
  4. 26 PTX and SASS: Reading What the GPU Actually Runs
  5. 27 torch.compile, TorchInductor, and Graph Capture
PART VI Attention, FlashAttention, and KV Cache 6 ch

Where the two halves of the book weld together. FlashAttention, decode attention, paged and prefix-cached KV.

  1. 28 Attention as a Memory Problem
  2. 29 FlashAttention: Tiling and Online Softmax in a Kernel
  3. 30 FlashAttention-2 and FlashAttention-3
  4. 31 Decode Attention: GQA, FlashDecoding, and the Batch-of-One Problem
  5. 32 Paged KV Cache and PagedAttention
  6. 33 Prefix Caching, Radix Trees, and Cache Reuse
PART VII Quantization and Advanced Inference 5 ch

Number formats, weight and activation quantization, quantized kernels, and speculative decoding.

  1. 34 Number Formats and Numerical Behaviour
  2. 35 Weight-Only Quantization: INT8, INT4, GPTQ, and AWQ
  3. 36 Activation Quantization, SmoothQuant, and FP8
  4. 37 Quantized Kernels, and Why Low Precision Is Not Automatically Fast
  5. 38 Speculative Decoding
PART VIII Inference Runtimes and Serving 5 ch

Runtime anatomy, continuous batching, chunked prefill, and the serving engines compared.

  1. 39 Anatomy of an Inference Runtime
  2. 40 Batching, Continuous Batching, and the Scheduler Loop
  3. 41 Chunked Prefill, Preemption, and Fairness
  4. 42 Runtime Architectures Compared: vLLM, SGLang, TensorRT-LLM, FlashInfer
  5. 43 Serving, SLOs, and Benchmarking You Can Defend
PART IX Distributed Inference 4 ch

Collectives and interconnects, tensor and pipeline parallelism, prefill and decode disaggregation, MoE.

  1. 44 Collectives, NCCL, and Interconnects
  2. 45 Tensor Parallelism
  3. 46 Pipeline Parallelism and Prefill/Decode Disaggregation
  4. 47 Sequence Parallelism, Expert Parallelism, and MoE Inference
PART X End-to-End Performance Engineering 3 ch

The diagnostic loop, when a faster kernel makes a slower system, and capacity and cost models.

  1. 48 The Diagnostic Loop and Full-Stack Timeline Analysis
  2. 49 When a Faster Kernel Makes a Slower System
  3. 50 Capacity Planning, Cost Models, and Regression Engineering
PART XI Building InferEngine 4 ch

Assembling the engine: the executor, the paged cache manager, the scheduler, and the final optimisation pass.

  1. 51 InferEngine: Architecture and Codebase Review
  2. 52 The Executor, the Kernel Layer, and the Paged KV Cache Manager
  3. 53 The Scheduler and the Continuous Batching Loop
  4. 54 Quantization, Speculation, Multi-GPU, and the Final Optimization Pass

Questions

Before you buy

Can I see some of it before buying?

Yes. There is a free excerpt on this page: the complete table of contents plus full chapters exactly as they appear in the book, with no email address and no signup required.

Do I need a GPU to follow along?

Mostly no. The project you build is designed to run without one, and the book sets out exactly what needs a GPU and what does not.

Do I need to read Machine Learning Compilers first?

No. They cover different halves of the same problem and each stands alone. Read together they run from a transistor to a served token.

What exactly do I get after paying?

Within a minute of payment, you receive an email at the address you entered at checkout with access to everything you bought in Google Drive. Access is granted to that specific email address, is yours permanently, and includes every future edition of each book you bought.

Can I download the book?

No. The books are read online through the Google Drive viewer, on any device with a browser. Downloading, printing and copying are disabled. This keeps independently published books from being redistributed, and it also means every correction reaches you automatically without you having to fetch anything.

Do I need a Google account?

Yes. The book is delivered through Google Drive, so you'll need to be signed in to a Google account using the same email address you gave at checkout. If you use a non-Google address, write to us right after purchase and we'll sort out access for you.

Are purchases refundable?

All purchases are final. Because each book is delivered in full immediately after payment, orders cannot be cancelled or refunded once access has been granted. The sole exception is a delivery failure that cannot be resolved, in which case a full refund is issued.

Can I share or resell it?

No. The book is copyrighted, and sharing, reselling, uploading or redistributing it in any form is prohibited. Your access is tied to your email address and is licensed to you alone.

I didn't receive the email. What now?

Check spam and promotions first. If it still isn't there after 10 minutes, email us with your Razorpay payment ID and we'll re-issue access immediately. Every payment is recorded on our side, so nothing is ever lost.

Is there a paperback?

Not yet. Everything sold here today is an eBook, read online. A paperback edition is being worked on, and if you have already bought the eBook you will hear about it first.

Do I get future updates and new editions?

Yes, all of them, for life. Corrections and revisions arrive automatically: the file is updated in place, so the link you already have always shows the current version. And when a new edition of a book you own is published, that is free too. You never re-download or re-purchase anything.

What can I do with the code in the book?

Use it freely, including in commercial work. The code examples exist to be run and built upon. It is the text, diagrams and the book itself that are copyrighted.