Leanpub Header

Skip to main content

Built and Proven — C++, SQL, LLMs & Claude

Most technical books hand you a recipe and ask you to trust it. This one refuses. Eight books across SQL, C++, LLMs, and Claude workflows — every mechanism built from scratch, pushed until it breaks, and measured with real numbers. Nothing asserted. Everything demonstrated. No black boxes.

Bought separately

$107.80

$69.00

You pay

Author earns

$

Also available for 3 book credits with a Reader Membership

These books have a total suggested price of $107.80. Get them now for only $69.00!
About

About

About the Bundle

Four subjects. Eight books. One philosophy: nothing asserted, everything demonstrated.

Most technical books hand you a recipe and a result. "Use INT4, lose 1%." "B+Trees are logarithmic." "Just write this prompt." They tell you what happens and ask you to trust it. This library refuses to stop there. Every mechanism is built from the ground up, in tested code, pushed until it breaks, and measured with real numbers produced by running it. When a claim is made, there is a benchmark, a derivation, or a compiler's own output behind it. No hand-waving. No magic. No black boxes.

This is the complete collection — four subjects, one method.

── C++ & SYSTEMS ──

Build real systems from an empty directory, one compilable challenge at a time.

- Build an LLM Inference Engine in C++ — from a blank project to an engine that loads a real Llama-family model and generates text: tensors, SIMD kernels, a BPE tokenizer, the full Transformer, quantization, and GGUF loading.

- Build a SQL Database Engine in C++ — from raw 4 KiB pages to a working query executor: slotted pages, B+Trees proven against a million keys, a buffer pool, a parser, and an executor that runs real SQL against data on disk.

- C++ Autopsy — ten forensic investigations into programs that compile clean, run to completion, return exit code zero, and still lie. The bugs that reach production.

- C++ Algorithmic Mastery — 1000 problems across eight volumes, from your first line of C++ to the frontiers of modern algorithms, every solution compiled and tested.

── LLMs, FROM THE BITS UP ──

Understand what actually happens inside a model, not by reading but by building.

- LLM Quantization — the entire field from a single weight up: the Δ²/12 noise law, GPTQ, AWQ, SmoothQuant, and the GGUF K-quant byte layout, every mechanism coded from scratch and measured on a real model.

── SQL, FROM QUERY TO ENGINE ──

Master the language, then build the engine that runs it.

- SQL Mastery Series — 84 hand-picked problems across seven volumes, from your first SELECT to interview-grade analytical queries, every one tested against a real database.

── WORKING WITH CLAUDE ──

The same philosophy applied to the model itself: no "write a prompt and hope," but a real method.

- Beyond Chat — a system for managing long, complex projects with Claude without them drifting apart: direction, memory, decisions that survive, and continuous review.

- Claude Patterns — ten reusable workflows for the walls that principles alone don't get you through, each combining principles into a procedure you can run.

Build it, break it, measure it — across four subjects and eight books, until you can see how every one of them works.

Books

About the Books

C++ Algorithmic Mastery: 1000 Challenges from Beginner to Legendary

Solved and Tested — A Complete 8-Volume Journey from Beginner to Advanced Algorithms

1000 problems. Eight volumes. One complete journey from your very first line of C++ to the frontiers of modern algorithms.

This is the complete collection: 1000 carefully designed C++ problems, organized into 8 progressive volumes that take you from absolute beginner to advanced algorithmic mastery — with every single solution compiled and tested on g++.

What you get:

- 1000 problems, carefully ordered by difficulty across 8 volumes

- A complete, working C++ solution for every problem

- Clear explanations, hints, and complexity analysis throughout

- A structured path, so you never have to guess what to learn next

Every problem includes:

- A clear statement with examples and constraints

- A hint to point you in the right direction

- A full, tested C++ solution

- Time and space complexity

- A plain-language explanation of how it works

The 8 volumes:

1. Absolute Beginner — I/O, Variables, Conditions, Loops, Functions, Arrays

2. Beginner — Strings, Recursion, Basic Math, Simple Data Structures

3. Elementary — Sorting, Searching, Core Algorithms, the STL

4. Upper-Intermediate — Data Structures, Two Pointers, Prefix Sums, Greedy

5. Advanced — Graphs, Dynamic Programming, Trees, Shortest Paths

6. Expert — Advanced Strings, Heavy Graph Machinery, Computational Geometry

7. Master — Suffix Structures, Flow & Matching, Number Theory, Combinatorics

8. Genius — Polynomials & Transforms, Advanced Graphs, Capstone Challenges

Who it's for:

Anyone learning C++ who wants a structured, guided path — students, self-taught programmers, and anyone preparing for coding interviews or competitive programming who wants every step explained, not just a list of problems.

One thousand problems. Eight volumes. A complete roadmap from foundations to mastery.

Build an LLM Inference Engine in C++

A Challenge-Driven Guide to Building a CPU-First Inference Engine in C++20

Build an LLM Inference Engine in C++ — Through Challenges

You don't truly understand how large language models run

until you've built the engine yourself.

This book takes you from a blank C++ project to a complete,

working inference engine that loads a real Llama-family model

and generates text — one challenge at a time.

What you'll build:

- A strided tensor system with zero-copy views and arena allocation

- Math kernels: RMSNorm, SwiGLU, softmax, GEMM with SIMD

- A byte-level BPE tokenizer

- A full Transformer: RoPE, GQA, Flash Attention, KV Cache

- int8/int4 quantization with direct block multiplication

- GGUF model loading with mmap

- Sampling, streaming, speculative decoding, and continuous batching

- An optional CUDA capstone for the heaviest kernels

By Unit 14, the engine runs a real model on CPU. Every concept

earns its place right after you've built the thing it improves.

Who this is for: C++20 developers comfortable with algorithms

and memory layout who want to understand what actually happens

inside an LLM runtime — not by reading, but by building.

C++ AUTOPSY

Ten Investigations into Code that Compiled, Ran, and Lied

Every bug in this book passed the compiler. Every bug ran to completion. Every bug returned exit code zero. None of them told the truth.

Most C++ books teach you how to write code. This one teaches you how to investigate it.

C++ Autopsy presents ten forensic investigations into programs that appear perfectly healthy: they compile cleanly, execute normally, and quietly produce the wrong result. No syntax errors. No crashes. No obvious clues. Just evidence waiting to be examined.

Each case unfolds like a real investigation. You begin at the crime scene with a minimal, reproducible program. You examine the evidence, question the suspects—including one deliberate red herring—inspect real diagnostic output from professional tools, identify the true cause, and verify the fix. Every conclusion is backed by the C++ standard, compiler behavior, or observable runtime evidence.

Along the way, you'll uncover some of the language's most deceptive pitfalls: undefined behavior, lifetime errors, memory corruption, concurrency bugs, numerical surprises, optimizer assumptions, and subtle violations of the Standard Library's contracts. Some cases are caught immediately by modern tools. Others pass every warning, every sanitizer, and every test—exactly the kinds of defects that reach production.

Whether you write systems software, libraries, game engines, or high-performance applications, this book will change the way you debug C++. Instead of asking, "Why did my program crash?" you'll learn to ask the more dangerous question:

Why did it appear to work?

For intermediate and advanced C++ developers. Every example compiles with C++20. Every case is real. Every verdict is earned.

LLM Quantization

From the Bits Up

Most explanations of model quantization hand you a recipe and a number: "use INT4, you'll lose about 1% accuracy." This book refuses to stop there. It asks why — and answers from the bits up.

Starting from a single weight and the question of how few bits can represent it, the book builds the entire field from first principles. Every mechanism is coded from scratch in tested Python and PyTorch, deliberately pushed until it breaks, and measured with real numbers produced by executed code. Nothing is asserted; everything is demonstrated. When the book says GPTQ makes 3-bit weights free, there is a measured perplexity behind it. When it says one outlier channel costs 40 dB, there is a derivation and a verification.


What you'll build and measure
  • The Δ²/12 noise law and the 6.02 dB-per-bit rule — derived, then verified in code
  • A proof of why output error, not weight error, is the objective that matters
  • GPTQ, built from the Optimal Brain Surgeon equations, rescuing 3-bit weights
  • AWQ, SmoothQuant, and Hadamard rotation — implemented and compared
  • The GGUF K-quant byte layout that powers llama.cpp, reconstructed byte for byte
  • The quality cliff where low-bit quantization collapses — and exactly why no algorithm can save it
  • A capstone that quantizes a real model end to end and explains every number in the final size × accuracy × speed table

Who it's for

Engineers and researchers who want to understand quantization, not just apply it — people who would rather know why INT4 works than memorize that it does. If you can read Python and basic linear algebra, you can follow every derivation and reproduce every experiment.


How it's taught

The reference model throughout is TinyGPT, a small GPT-style decoder trained from scratch on Shakespeare — chosen so every experiment runs on a single CPU core and every result is reproducible. Seventeen chapters, six parts, fifty-plus figures, and not a single invented number.

This is quantization as a small set of principles — representation, noise, propagation, outliers, algorithms, kernels — that together let you predict exactly what happens when you take the bits away.

Build it, break it, measure it.

SQL Mastery Series

A Problem-Solving Workbook — 84 Solved SQL Challenges from Beginner to Interview-Ready

Stop reading SQL theory. Start solving.

This book is 84 hand-picked SQL problems that take you from your first SELECT statement to genius-level analytical queries — the kind that show up in real technical interviews.

No theory chapters. No filler. Every single problem gives you a clear prompt, a sample input table, the exact expected output, a working solution, and a plain-English explanation of why it works — not just what to type.

The seven volumes rise one honest step at a time: Beginner → Easy-Medium → Medium → Medium-Hard → Hard → Expert → Genius. Volume 1 is single-table filtering and sorting. By Volume 7 you're computing medians without window functions, counting concurrent events, and finding the smallest missing positive integer — pure interview-grade challenges.

Every query in this book was tested against a real database before publishing. No broken code, no queries that only work in theory.

Who this is for

You already know the basics of SQL and want to get genuinely good at it. Whether you're preparing for a data or backend interview, leveling up from simple queries to window functions and CTEs, or just want deliberate practice instead of passive reading — this is your workbook.

How to use it

Solve each problem yourself first. Open any free SQL playground, recreate the table, and write your own query before reading the solution. The reading comes second; the typing comes first.

Note: examples use standard SQL. A few advanced solutions (window functions, PERCENTILE_CONT, recursive CTEs) target PostgreSQL-style engines; equivalents are explained where they differ.

146 pages · 7 volumes · 84 problems · one complete path from beginner to expert.

What's inside (you can add this as a bulleted section)

Volume 1 — Beginner: single-table filtering, sorting, basic conditions

Volume 2 — Easy-Medium: aggregation, GROUP BY, HAVING, CASE, NULL handling

Volume 3 — Medium: INNER/LEFT joins, subqueries, the classic NULL traps

Volume 4 — Medium-Hard: multi-table joins and CTEs

Volume 5 — Hard: window functions (ROW_NUMBER, RANK, running totals, medians)

Volume 6 — Expert: interview-grade problems — pivots, recursive CTEs, graph traversal, sargability

Volume 7 — Genius: everything at once — gaps-and-islands, concurrent events, hierarchies, the hardest patterns

Build a SQL Database Engine in C++

Through Challenges --- Storage and Query Processing (Parts I & II)

Build a working SQL database engine in C++20 -- from an empty directory to

a query processor that runs real SQL against data on disk -- through a

single relentless method: nothing is asserted; everything is demonstrated.

Every data structure in this book is built, compiled, and run. Every

performance claim is a table printed by a benchmark whose source code is on

the page in front of you. Every design decision is followed by the

measurement that justifies it -- and, where the design has a cost, by the

measurement that exposes that cost too. And once per unit, something fails

in front of you: a real bug, reproduced deterministically, diagnosed from

the evidence, fixed, and locked shut with a regression test.

This is not a survey of database theory. It is a lab manual. You will not

find hand-waving about how B+Trees are "generally logarithmic" -- you will

find the fan-out arithmetic, the page-count math, and a benchmark that

walks a tree of a million keys and prints the real number.

This book takes the engine across two complete parts and eight units:

PART I -- STORAGE

1. Slotted Pages & the Pager -- self-describing 4 KiB pages, records with

stable slot ids, a pager with a free list

2. B+Tree: Insert & Search -- logarithmic lookup, proven against a

million-key tree

3. B+Tree: Delete & Range Scans -- rebalancing, merges, ordered range

queries

4. The Buffer Pool -- a real cache with clock eviction, measured 2.5x

faster with identical logical work

PART II -- FROM BYTES TO A QUERY

5. The Record Layer -- typed rows: a schema-aware codec and a table heap,

reached by key through the index

6. The Catalog -- persistent schemas and named tables: the engine's

self-knowledge

7. The Front End -- a SQL tokenizer and recursive-descent parser, with

compiler-quality caret-pointed errors

8. The Executor -- the milestone: a real executor that runs CREATE TABLE,

INSERT, and SELECT end to end, against a database of hundreds of

thousands of rows

By the last page, the engine answers a SQL query it parsed from text,

against rows it stored on disk, through an index it built and a cache it

manages itself -- and every number in the book came from actually running

that code.

Reference machine: g++ 13.3.0, Ubuntu 24.04, C++20, stdlib + POSIX only.

Every benchmark ships with the exact command that produced it, so you can

run it yourself and get the same structural numbers.

A companion volume, "Build a SQL Database Engine in C++, Book 2: Parts III

& IV," continues the engine into durability (crash recovery via a

write-ahead log), concurrency, and performance -- available separately, and

as a discounted bundle with this book.

Beyond Chat

Managing Complex Projects with Claude

Claude can produce a chapter, a module, or a section of a report in minutes. That is exactly what makes long projects dangerous.

The first few days of any book, codebase, or research project built with Claude go well. Then, somewhere around the tenth or the fortieth decision, things start to drift: a chapter contradicts one from last week, a naming convention nobody decided to change has changed anyway, a rejected design resurfaces as if it were new. Nothing crashes. There's no error message. The project just slowly stops holding together — and by the time it's obvious, the drift runs through everything already built.

Beyond Chat is not a book about prompts, and it doesn't try to explain how Claude works internally. It's a practical system for the part of the work Claude can't do for you: setting direction before you generate, keeping a project's memory alive across sessions, dividing large work without losing the whole, catching drift before it compounds, knowing when to restart instead of pushing through a session that's stopped serving you, and reviewing output at a scale no one can read twice.

Built around six core principles and worked through in three complete walkthroughs — a technical book, a software project, and a long technical document — this is a method for advanced Claude users whose work doesn't end after one message: writers, developers, researchers, and teams running projects that last weeks, not minutes.

You'll come away with a complete working system, not a list of tips — including four ready-to-use templates (Project Brief, Decision Log, Context File, and a three-phase Review Checklist) you can start using on your very next project.

Human Direction + Claude Execution + Human Judgment. That's the whole book, in one line.

Claude Patterns

Reusable Workflows for Real Projects with Claude

You already know what to do. That's the strange part.

If you've read Beyond Chat, or learned the same lessons the hard way, you know the principles: direction before generation, context as an asset, decisions that survive, dividing without losing the whole. You can recite them. And still, mid-project, you stop — session open, cursor blinking — and think: I know the principles. What do I actually do right now?

That gap is what this book is about.

A principle is a single tool. It tells you what matters, but it has no steps — you can't run it. Real projects don't arrive shaped like single principles; they arrive shaped like walls. The session grows too large to work in. A decision from three weeks ago turns out wrong, and half the project is built on it. Four people each produced a piece, and now the pieces have to become one thing. Each wall requires several principles at once, used in a particular order.

That ordered combination is a pattern: a reusable workflow that composes two or more principles to resolve a recurring situation. This book is ten of them — each a numbered procedure you run when you hit its wall, each combining principles you already have into something none of them could do alone, and each ending with its most distinctive section: how to know the workflow is starting to fail, before the project collapses.

The ten span the life of a project: defining one you don't yet understand, producing work too big for one pass, navigating a project bigger than your context window, propagating a change after you've built on the old version, merging separate pieces into one whole, sweeping a drifted body back to one standard, reviewing an output too large to read twice, onboarding a new person into shared work, recovering a project whose reasoning was never recorded, and crossing the session boundary intact. Each ends with a one-page reference card.

This is the second book in a series. Beyond Chat gave the principles — the components. Claude Patterns gives the assemblies. It assumes you did the first book and doesn't repeat it: every chapter is a workflow, and every workflow passes three tests — it's drawable as steps, it combines two or more principles, and it could not simply be a chapter in Beyond Chat.

Principles tell you where you're trying to go. Patterns get you through the walls between here and there.

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

In fact, authors have earned over $15 million writing, publishing and selling 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