-
Preface: Building Your Own Neural Studio from an Empty Folder
- Why Open the Neural Black Box?
- Setting Up Your Blank Folder & Pure-Python Workspace
- How Every Chapter Works: Everyday Analogy, Glossary, Visual Split-Box Diagrams & Verifiable Code
-
Part I: The Autograd Glassbox — Derivatives & Computation Graphs
-
1. The Derivative Microscope: Measuring Sensitivity by Nudging Numbers
- 1.1 What a Derivative Actually Means in Plain English (The Knob-and-Meter Analogy)
- 1.2 Forward Finite Differences vs Centered Finite Differences
- 1.3 Why Centered Nudges Cancel Out Curvature Error to 1e-11 Precision
-
2. Expression Graphs: Turning Math Formulas into Connected Nodes
- 2.1 Designing the ScalarNode Class with data, grad, and local_grads
- 2.2 Python Operator Overloading (__add__, __mul__, __sub__, __neg__)
- 2.3 Tracing Directed Acyclic Graphs (DAGs) and Local Edge Rules
-
3. The Chain Rule by Hand: Flowing Signals Backward Step by Step
- 3.1 The Bicycle Gear Train Analogy: Multiplying Sensitivities Along a Path
- 3.2 How Addition (+), Multiplication (*), and Max Gates Route Gradients Backward
- 3.3 Walking a 7-Node Computation Graph Backward by Hand and Taking One Learning Step
-
4. Automated Backpropagation: Topological Sort & Fan-Out Accumulation
- 4.1 Ordering Dependencies with Depth-First Topological Sort
- 4.2 The Diamond Fan-Out Bug: Why Gradients Must Accumulate (+=) Instead of Overwrite (=)
- 4.3 Automated Numerical Gradient Verification (verify_gradients)
-
1. The Derivative Microscope: Measuring Sensitivity by Nudging Numbers
-
Part II: Neurons, Multi-Layer Perceptrons & Loss Landscapes
-
5. Inside an Artificial Neuron: Weights, Biases & Non-Linear Activations
- 5.1 Weighted Sums, Bias Shifts, and Why Linear Layers Alone Collapse
- 5.2 Comparing tanh, ReLU, and Sigmoid Activations and Their Local Slopes
- 5.3 Tracing Dead ReLUs and Saturated Tails During Backpropagation
-
6. Composing Multi-Layer Perceptrons: Layers, Parameters & Forward Passes
- 6.1 Building the Module Base Class with parameters() and zero_grad()
- 6.2 Assembling Neuron, Layer, and MultiLayerPerceptron Hierarchies
- 6.3 Auditing Parameter Counts and Gradient Flow Across Deep Layers
-
7. Loss Landscapes: Measuring Error with MSE, Hinge & Cross-Entropy
- 7.1 Why MSE Stalls on Saturated Classification Predictions
- 7.2 Max-Margin SVM Hinge Loss vs Binary & Multi-Class Cross-Entropy
- 7.3 Preventing Exponential Overflow with the Log-Sum-Exp Subtract-Max Trick
-
8. The Training Loop in Action: Carving Non-Linear Decision Boundaries
- 8.1 The 4-Step Heartbeat of Deep Learning: Forward, Zero-Grad, Backward, Step
- 8.2 Why forgetting zero_grad() Causes Runaway Gradient Explosion
- 8.3 Solving the Non-Linear XOR Puzzle and Visualizing 2D Decision Contours
-
5. Inside an Artificial Neuron: Weights, Biases & Non-Linear Activations
-
Part III: Optimization, Signal Health & Language Modeling
-
9. Escaping Ravines: SGD, Momentum, RMSProp & AdamW Optimizers
- 9.1 Why Vanilla SGD Zig-Zags Across Narrow Loss Ravines
- 9.2 Smoothing Velocity with Momentum and Adapting Step Sizes with RMSProp
- 9.3 Implementing AdamW with Bias Correction and Decoupled Weight Decay
-
10. Signal Health & Initialization: Vanishing/Exploding Gradients, Xavier & Kaiming
- 10.1 How Naive Weight Initialization Kills Deep Networks Before Step 1
- 10.2 Preserving Signal Variance Across Layers with Xavier and Kaiming Scaling
- 10.3 Measuring Saturation Fractions and Layer-by-Layer Gradient Norms
-
11. Regularization & Normalization: Weight Decay, Inverted Dropout & BatchNorm1D
- 11.1 Taming Overfitting with L2 Weight Penalties and Inverted Dropout Scaling
- 11.2 Building BatchNorm1D Through the Autograd Graph (Mean, Variance, Gamma, Beta)
- 11.3 Switching Between Training Batch Statistics and Evaluation Running Averages
-
12. Capstone: Building & Training a Character-Level Neural Language Model
- 12.1 Tokenizing Characters and Building Sliding Context-Window Training Pairs
- 12.2 Wiring Learned Character Embedding Tables into a Hidden MLP + Softmax Head
- 12.3 Training with Negative Log-Likelihood and Autoregressively Sampling New Words
-
9. Escaping Ravines: SGD, Momentum, RMSProp & AdamW Optimizers
The Neural Glassbox
Build an Autograd Engine & Train Neural Networks from Scratch
Stop treating neural networks and loss.backward() as a black box. Build a complete automatic differentiation engine and deep learning library from an empty folder in 100% pure Python—from ScalarNode computation graphs and reverse-mode backpropagation to Multi-Layer Perceptrons, AdamW, BatchNorm1D, and a Character-Level Language Model—explained with visual split-box diagrams, plain-English intuition, and verifiable terminal outputs.
Minimum price
$19.00
$29.00
You pay
Author earns
About
About the Book
Open the Black Box of Deep Learning. Build Your Own Autograd Engine and Train Neural Networks from Scratch in Pure Python.
Most deep learning books start by having you import a massive framework like PyTorch or TensorFlow, call loss.backward(), and trust that the calculus works behind the scenes. Within ten lines of code you have a trained classifier—and zero visibility into how derivatives flow backward through computation graphs, why gradients vanish or explode, or how optimizers actually navigate loss landscapes.
The Neural Glassbox takes the exact opposite approach. Starting from a completely empty folder and using 100% pure Python (zero external AI libraries required), you will build a complete automatic differentiation engine and neural network library (gradpulse) from scratch, step by step, and verify every single forward value and backward gradient in your terminal.
What Makes This Book Different?
• Zero Hidden Magic (100% Pure Python From an Empty Folder): You start with a blank neural_glassbox/ directory. Every engine module (gradpulse/) and every chapter verification script is printed in full inside the book.
• Visual Split-Box Computation Graphs: Every calculation is drawn as a glass-box node showing both its forward value (data) and its backward derivative (grad) side by side, so you can trace every signal forward and backward by eye.
• Plain-English Intuition & Everyday Analogies First: Every chapter opens with a simple real-world analogy, a plain-English glossary explaining every scientific term and acronym on the spot, and concrete arithmetic walkthroughs before any code.
• Live 4-Panel Training Dashboards: Every chapter includes a visual telemetry dashboard plotting loss curves, 2D decision boundaries, layer-by-layer activation and gradient health bars, and forward/backward computation traces.
• 100% Verifiable Deterministic Output: Every chapter ends with a standalone Python script and its exact expected terminal output—verified automatically with numerical finite-difference gradient checking.
What You Will Build From Scratch
1. Part I — The Autograd Glassbox (Chapters 1–4): Measure slopes with centered finite differences, build ScalarNode expression graphs (DAGs) with operator overloading, trace the Chain Rule by hand, and automate reverse-mode backpropagation using topological sort and fan-out gradient accumulation (+=).
2. Part II — Neurons, MLPs & Loss Landscapes (Chapters 5–8): Construct artificial neurons with tanh, ReLU, and Sigmoid activations, stack Multi-Layer Perceptrons (MLPs), compare MSE, Hinge, and numerically stable Log-Sum-Exp Cross-Entropy losses, and build the 4-step training loop to carve non-linear XOR decision boundaries.
3. Part III — Optimization, Signal Health & Language Modeling (Chapters 9–12): Escape narrow loss ravines with Momentum and AdamW, diagnose vanishing and exploding gradients with Xavier and Kaiming initialization, regularize networks with L2 Weight Decay, Inverted Dropout, and BatchNorm1D, and train a complete Character-Level Neural Language Model that generates new names from scratch.
Who This Book Is For
• Software Engineers & Python Developers who want to demystify backpropagation and understand how modern AI frameworks work under the hood.
• Machine Learning Students & Practitioners who want crystal-clear visual intuition for calculus, computation graphs, initialization, batch normalization, and optimizers.
• Self-Learners who learn best by building clean, readable, zero-dependency code they can inspect and verify line by line.
Categories
Feedback
Author
About the Author
ZA Publishers is an independent technical publishing imprint founded by a passionate software engineer and systems architect with nearly 15 years of industry experience. Over the past decade and a half, the author has designed, scaled, and maintained mission-critical backend platforms processing millions of daily transactions across global consumer tech platforms, established financial software enterprises, and high-growth digital health tech company. Having sat on both sides of hundreds of technical interviews, the author created The Algorithm Arcade to replace dry, rote puzzle memorization with visual, playable software engineering.
Contents
Table of Contents
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.