Leanpub Header

Skip to main content

Practical LLM Inference

Quantization, GGUF and Local Models

Practical LLM Inference
This book is 100% completeLast updated on 2026-08-20

Running LLMs locally is easy. Running them well is an engineering problem. Practical LLM Inference gets into the details that matter, from quantization and GGUF internals to GPU offloading, benchmarking and production deployment. Learn how to size hardware, find bottlenecks and build fast, reliable inference systems without the AI hand-waving.

Minimum price

$19.00

$29.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
169
Pages
About

About

About the Book

This book teaches systems engineers how large language model inference actually works on real hardware, from transformer mechanics and quantization mathematics through GGUF internals and llama.cpp deployment to production-grade local inference services. You will learn to calculate exact memory requirements, diagnose performance bottlenecks systematically, configure GPU offloading correctly, benchmark rigorously, and build reliable multi-user inference systems that run efficiently on commodity CPUs and GPUs. No hand-waving about AI magic, just the engineering details that matter when you are responsible for making it work.

Bundle

Bundles that include this book

Author

About the Author

Steve Publications

Steve is a technology professional with over 20 years of experience in software development, server infrastructure, cybersecurity, vulnerability research and reverse engineering. He specializes in analyzing complex systems, identifying weaknesses and improving security.

Beyond his professional work, Steve collaborates with researchers and industry experts to create practical technical books covering software development, cybersecurity, cloud computing, DevOps, AI and enterprise technologies. His goal is to help IT professionals, students and enthusiasts develop practical skills through clear explanations, real-world examples and hands-on exercises.

At Steve Publications, we use AI to assist with translation, proofreading and editing but not to replace the research, technical expertise or hands-on experience behind our books. Some authors publish under pseudonyms for privacy or professional reasons.

Every book is written, reviewed and maintained by experienced professionals, supported by a private community of over 420 engineers and researchers. We prioritize technical accuracy, practical value and regularly updated content over mass-produced AI-generated text.

We welcome experienced professionals interested in writing or reviewing books, especially in specialized and emerging technology fields. If you'd like to contribute, contact us with your area of expertise.

We stand behind our work. If a book doesn't meet your expectations, Leanpub offers a 60-day money-back guarantee.

Contents

Table of Contents

Quantization, GGUF and Local Models

Introduction: The Local Inference Stack

  1. Why Engineers Care About Local Inference
  2. What This Book Will Not Teach You
  3. The Real Bottleneck: Memory Bandwidth, Not Compute
  4. How to Read This Book

Chapter 1: Transformer Inference Fundamentals

  1. From Training to Inference: What Changes
  2. The Forward Pass Anatomy
  3. Self-Attention and Its Costs
  4. Why Autoregression Matters
  5. Arithmetic Intensity and Compute Density

Chapter 2: Tokenization, Prefill, and Decode

  1. How Tokenizers Actually Work
  2. The Prefill Phase: Parallel Computation
  3. The Decode Phase: Sequential Bottleneck
  4. Context Length and Its Real Cost
  5. Why These Phases Demand Different Optimizations

Chapter 3: Model Weights, Formats, and GGUF Architecture

  1. From Checkpoints to Inference: Weight Formats
  2. The GGML Story and Design Goals
  3. GGUF Header Structure and Metadata
  4. Tensor Storage Layout and Quantization Types
  5. Reading a GGUF File: A Practical Walkthrough

Chapter 4: Quantization: Mathematics, Methods, and Tradeoffs

  1. Why Quantization Works on Transformers
  2. Symmetric vs Asymmetric Quantization
  3. Per-Tensor, Per-Channel, Per-Group Schemes
  4. GGUF Quantization Types Decoded
  5. Measuring Quality Loss: Benchmarks and Perception
  6. Choosing a Quant Level for Your Use Case

Chapter 5: Memory, Bandwidth, and Hardware Constraints

  1. Computing Model Size: The Exact Formula
  2. KV-Cache Memory Requirements
  3. Memory Bandwidth vs Compute Throughput
  4. CPU Architectures for Inference
  5. GPU Architectures and VRAM Realities
  6. Hardware Selection Decision Framework

Chapter 6: llama.cpp: Installation, Models, and Core Usage

  1. Building llama.cpp from Source
  2. Installing Prebuilt Binaries
  3. Acquiring Models: Hugging Face and Beyond
  4. Converting Weights to GGUF
  5. Quantizing Models with llama.cpp
  6. Your First Inference Run

Chapter 7: GPU Acceleration and Offloading Strategies

  1. How Offloading Works Under the Hood
  2. Full vs Partial Offloading: When Each Wins
  3. CUDA Backend Configuration
  4. Vulkan and Cross-Vendor GPU Support
  5. Apple Silicon and Metal Acceleration
  6. Diagnosing Offloading Failures

Chapter 8: KV-Cache, Context Windows, and Memory Management

  1. How the KV-Cache Works
  2. Sizing Your KV-Cache Correctly
  3. Context Overflow and Handling Strategies
  4. RoPE Scaling and Long-Context Techniques
  5. Cache Eviction and Sliding Windows
  6. Memory Fragmentation and Allocation Patterns

Chapter 9: Throughput, Batching, and Concurrency

  1. Single Request vs Concurrent Serving
  2. Static Batching Mechanics
  3. Continuous Batching and Scheduling Strategies
  4. Queue Management Under Load
  5. Configuring llama.cpp Server for Throughput
  6. Capacity Planning and Dimensioning

Chapter 10: Benchmarking, Profiling, and Bottleneck Diagnosis

  1. Metrics That Matter: Definitions and Formulas
  2. Designing Valid Benchmark Experiments
  3. Profiling CPU Utilization and Vector Units
  4. GPU Profiling and Occupancy Analysis
  5. Memory Bandwidth Measurement Techniques
  6. Systematic Bottleneck Diagnosis Workflow

Chapter 11: Production Systems: APIs, RAG, and Deployment

  1. Building a Private Local Assistant
  2. Coding Assistant Integration Patterns
  3. RAG Service Architecture
  4. Multi-User Inference API Design
  5. Containerization and Orchestration
  6. Observability, Security, and Reliability

Chapter 12: Troubleshooting, Comparisons, and the Road Ahead

  1. Common Failure Modes and Diagnostics
  2. Performance Troubleshooting Decision Tree
  3. llama.cpp vs Other Inference Runtimes
  4. What Is Durable vs Rapidly Changing
  5. Emerging Trends and Open Problems

Conclusion: Engineering Judgment Over Magic Numbers

References

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

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...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

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.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

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

Write and Publish on Leanpub

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.

Learn more about writing on Leanpub