Quabla

Quabla Developer Guide

This guide explains how to use Quabla and how it works inside. It is written as a sequence of chapters: the first ones teach the Python API from the ground up, the middle ones cover each library area in depth, and the last ones describe the implementation for contributors.

The guide complements, and does not replace, the other documents:

Every code example in the guide was run against Quabla v0.5.0 on the CPU backend unless it says otherwise; printed output is shown in a text block right after the code.

Chapters

Using Quabla

  1. Getting Started: installation, the first gradient, and the mental model of eager arrays, traced values, and transforms.
  2. Arrays and Operations: creating arrays, dtypes and promotion, indexing, broadcasting, reductions, the math library, and NumPy interoperability.
  3. Function Transforms: grad, value_and_grad, jvp, vjp, jacobian, hessian, vmap, and jit, and how they compose.
  4. Control Flow: cond, fori_loop, scan, and while_loop as differentiable IR regions.
  5. Custom Derivatives and Checkpointing: custom_vjp, custom_jvp, checkpoint, and stop_gradient.
  6. Pytrees, Random Numbers, and Serialization: structured parameters, keyed random sampling, and save/load.
  7. Optimization: Adam, AdamW, SGD, learning-rate schedules, gradient clipping, L-BFGS, and the retained-buffer Trainer.
  8. Linear Algebra and Solvers: quabla.linalg, Krylov solvers, and Newton’s method with implicit gradients.
  9. Differential Equations: quabla.ode.odeint with fixed-step, adaptive, and stiff integrators.
  10. Devices and Compilation: running on CUDA and MLX, precision, ahead-of-time lowering, the compiler facade, and data parallelism.
  11. Tutorial: Training a PINN: an end-to-end physics-informed neural network, from model to Adam-then-L-BFGS training and device execution.
  12. Performance, Debugging, and Limitations: tracing costs, error types, common pitfalls, and known limits.

Inside Quabla

  1. Architecture: crates, the tensor IR, autodiff transforms, plan compilation, and the CPU, CUDA, and MLX backends.
  2. Contributing and Extending: the development workflow, the test suites, and how to add a new operation.
  3. Migrating From the v0.1 API: mapping the v0.1 helpers that v1.0 removed to the core API.

Conventions