Leanpub Header

Skip to main content

JAX Programming: From Fundamentals to Large-Scale Systems

A Comprehensive Guide to Accelerated Python Computing

JAX Programming: From Fundamentals to Large-Scale Systems
This book is 100% completeLast updated on 2026-08-02

From your first JAX script to large-scale AI systems, this book shows how to write faster, cleaner Python for modern computing. Learn the ideas behind JAX through practical examples, real projects and clear explanations that help you build everything from scientific simulations to distributed machine learning.

Minimum price

$19.00

$29.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
187
Pages
About

About

About the Book

This book takes you from writing your first JAX program to training large-scale machine learning models on clusters of accelerators. Whether you are a software engineer exploring high-performance computing, a data scientist building modern neural networks, or a researcher pushing the boundaries of scientific simulation, this guide provides the conceptual foundation and practical expertise you need. Through careful explanations, complete working code examples, and real-world case studies, you will learn not only how to use JAX but why it works the way it does and when to reach for each of its powerful tools.

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

A Comprehensive Guide to Accelerated Python Computing

Chapter 1: Why JAX — The Landscape of Python Numerical Computing

  1. The Problem with Existing Tools
  2. Enter JAX: A New Paradigm
  3. What Makes JAX Different
  4. Who Should Use JAX (and Who Should Not)
  5. How to Read This Book

Chapter 2: Getting Started — Installation, Setup, and Your First Program

  1. Python and Environment Prerequisites
  2. Installing JAX for Different Hardware
  3. Verifying Your Installation
  4. Your First JAX Array Operations
  5. Understanding the JAX REPL Experience

Chapter 3: JAX Arrays — The Foundation of Everything

  1. Creating and Inspecting Arrays
  2. Core Array Operations
  3. Broadcasting and Reshaping
  4. Indexing and Slicing
  5. JAX vs NumPy Arrays: Key Differences
  6. Memory Layout and Device Placement

Chapter 4: JIT Compilation — Making Python Code Fly

  1. What Is JIT Compilation
  2. Using @jit in Practice
  3. Static vs Dynamic Arguments
  4. Tracing and the XLA Backend
  5. Common JIT Pitfalls and Solutions
  6. Performance Measurement and Profiling

Chapter 5: Automatic Differentiation — The Engine of Modern ML

  1. How Automatic Differentiation Works
  2. Computing Gradients with jax.grad
  3. Higher-Order Derivatives
  4. Vector-Jacobian and Jacobian Products
  5. Value-and-Gradient Computation
  6. Common Autodiff Patterns in ML

Chapter 6: Functional Programming — Embracing JAX Philosophy

  1. Why Functional Programming Matters
  2. Immutability and No Side Effects
  3. Pure Functions and Determinism
  4. Closures and Function Composition
  5. Thinking Functionally About Data
  6. Anti-Patterns to Avoid

Chapter 7: Vectorization with vmap — Writing Loops Without Loops

  1. The Batch Processing Problem
  2. How vmap Works
  3. In-Axis and Out-Axis Specification
  4. Nested vmapping
  5. Combining vmap with jit and grad
  6. When Not to Use vmap

Chapter 8: Parallelism — pmap, pjit, and Distributed Computing

  1. Understanding Devices in JAX
  2. Device Arrays and Placement
  3. Using pmap for Single-Host Parallelism
  4. Introduction to pjit
  5. Shardings and Mesh Definition
  6. Multi-Host Distributed Training

Chapter 9: Control Flow — Loops and Conditionals That Compile

  1. Why Python Control Flow Fails Under JIT
  2. Conditional Execution with lax.cond
  3. While Loops with lax.while_loop
  4. For Loops with lax.fori_loop
  5. Scan for Sequential Operations
  6. Choosing the Right Primitive

Chapter 10: PyTrees — Structuring Complex Data

  1. What Is a PyTree
  2. Registering Custom Tree Types
  3. Flattening and Unflattening
  4. Operating on PyTrees
  5. PyTrees in Machine Learning Models
  6. Advanced PyTree Patterns

Chapter 11: Randomness — Reproducible Stochasticity

  1. Why JAX Handles Randomness Differently
  2. The PRNG Key System
  3. Splitting Keys for Parallelism
  4. fold_in for Labeling Keys
  5. Seeding and Reproducibility
  6. Common Randomness Pitfalls

Chapter 12: Custom Gradients — Beyond Automatic Differentiation

  1. When You Need Custom Gradients
  2. Using jax.custom_jvp
  3. Using jax.custom_vjp
  4. Gradient Checking Techniques
  5. Practical Examples from Research

Chapter 13: Neural Networks with Flax and Equinox

  1. Building Blocks of Neural Networks in JAX
  2. Introduction to Flax
  3. Introduction to Equinox
  4. Flax vs Equinox: Choosing a Library
  5. Common Architectures and Patterns

Chapter 14: Optimization — Training at Scale

  1. Optimizers in JAX Ecosystem
  2. Learning Rate Scheduling
  3. Gradient Clipping and Normalization
  4. Mixed Precision Training
  5. Checkpointing and Experiment Tracking
  6. Scaling to Large Models

Chapter 15: Advanced Topics — Scientific Computing, Probabilistic Programming, and RL

  1. JAX for Scientific Computing
  2. Introduction to Probabilistic Programming with NumPyro
  3. Reinforcement Learning with JAX
  4. Differentiable Physics Simulations
  5. Case Study: Training a Large Language Model

Chapter 16: Performance Engineering and Deployment

  1. Profiling JAX Programs
  2. Debugging Techniques and Tools
  3. Memory Optimization Strategies
  4. Interoperability with NumPy and Other Libraries
  5. Model Export and Serving
  6. Production Deployment Considerations

Conclusion: The Future of JAX and Accelerated Computing

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