Repository navigation
v1.49.0 — Stage 2b-1: Default 5-op SSA AD, Law 2 Backward Monoid Fusion & CPU BLAS cce_bwd
Highlights — Stage 2b-1: Default 5-op SSA AD, Law 2 Backward Monoid Fusion & CPU BLAS cce_bwd (#301)
This release switches Parakeet's public autodiff APIs (grad, value_and_grad, vjp, jvp, hvp, jacfwd, jacrev, hessian) to the unified 5-op SSA AD engine by default (config.ad_engine = "ssa", with automatic fallback only for the remaining unlifted ops slated for v1.50.0), while delivering major speedups on real ML training loops and zero runtime or memory regressions.
What's New
- Default 5-op SSA AD (
parakeet/ssa/frontend_ad.py,parakeet/ssa/autodiff.py):- Routes
grad,value_and_grad,vjp,jvp,hvp,jacfwd,jacrev, andhessianthrough the value-SSA core IR (Map,Reduce,Scan,Recur,Scatter) with per-target dead constant pruning, higher-order AD,stop_gradient,checkpoint,custom_vjp/custom_jvp, structured control flow (If,ForRange,While), andCarryreduction handling.
- Routes
- Post-AD Law 2 Backward Monoid Fusion (
parakeet/transforms/monoid_bwd.py,parakeet/transforms/monoid_tile.py):- Fuses backward FlashAttention (
flash_monoid_bwd), fused cross-entropy (cce_bwd), and ephemeral pairwise VJP reductions directly on bufferized SSA AD IR with zeroO(T^2)residual allocations and zero atomic scatter write-backs (using injective mixed-radixIndexMapwrite-backs).
- Fuses backward FlashAttention (
- Bounded-Memory CPU BLAS
cce_bwd(parakeet/transforms/lowering.py,parakeet/backends/runtime_c.py):- Lowers CPU
cce_bwdintoBM<=1024, BN<=2048(<= 8 MiB) tiles using@gemmforward logits, SIMD softmax gradient +O(1)target update, and@gemm_accfordHanddW.
- Lowers CPU
- Block Outlining & Scatter/Fusion Parity (
parakeet/transforms/outline.py,parakeet/transforms/fusion.py,parakeet/ssa/bufferize.py):- Preserves multi-site per-layer and derived integer
dim_factsacross outlined transformer blocks, simplifies Euclidean scatter targets, and prevents contractionIndexMaps from fusing intoIndexScatter(keeping all 37/37 BLAS GEMMs intact in nanoGPT).
- Preserves multi-site per-layer and derived integer
Benchmarks (Matched CPU Release Suite)
| Workload | Previous (v1.48.0 / Legacy AD) |
v1.49.0 (SSA AD) |
Speedup |
|---|---|---|---|
mlp_grad (bench_release.py) |
2.85 ms |
0.81 ms (min 0.60 ms) |
3.5× faster |
attn_grad (causal FlashAttention) |
min 2.420 ms |
min 2.429 ms |
Parity (+0.4%, 0 O(T^2) alloc, 0 scatters) |
nanoGPT L=2 (step_batched_compiled) |
med 35.17 ms (cold 2736 ms) |
med 8.72 ms (cold 2307 ms) |
4.0× faster (-429 ms cold compile) |
Verification
- 17/17 CI checks green across macOS, Linux, Windows (Python 3.11–3.14), pandas interop, atomistic, strict docs, and ruff lint (
PR #309). - Full test suite: 1,927+ passed, 0 failed.