Skip to content

docs: AUTODIFF_NEXTGEN_PLAN — one derivative functor, algebra as a parameter (W6.3 design) - #582

Merged
gstoner merged 2 commits into
mainfrom
agent/autodiff-nextgen-plan
Aug 18, 2026
Merged

gstoner merged 2 commits into
mainfrom
agent/autodiff-nextgen-plan

Conversation

@gstoner

@gstoner gstoner commented Aug 18, 2026

Copy link
Copy Markdown
Owner

What

Adds docs/audit/compiler/AUTODIFF_NEXTGEN_PLAN.md — a scoped plan (plan_state: draft, not yet bound to INTEGRATED_COMPILER_PLAN.md) that supplies the design + acceptance detail behind W6.3's "research estimate required" row, plus a law-oracle evidence lane that can start immediately.

Core thesis

Every AD mode is one functor evaluated in a different codomain algebra. Today the codomain ℝⁿ is hardwired into two hand-paired registries (vjp.py + jvp.py, ~9.6k lines), and five in-tree structures have each independently paid for that: the dual registry itself, the geometric/ forked tape (_VJPS_GEO/_JVPS_GEO), linear.py's derived-JVP workaround, nonsmooth.py's policy registry, and implicit.py's matvec pattern.

The plan replaces this with one DerivativeContract datum per primitive (multilinearity declaration / holonomic ODE / linearize+transpose pair / kink policy / definability) evaluated under an explicit DifferentialAlgebra parameter — Dual() reproduces today's semantics; TruncatedJet(k) gives order-k derivatives at cost k+1 instead of 2^k; CliffordTangent absorbs the geometric/ fork; OperatorTangent promotes implicit.py's pattern; TaylorModel is the consumer-gated certified mode. Correctness is enforced as six executable algebraic laws (adjoint ⟨Jv,u⟩=⟨v,Jᵀu⟩, homomorphism-exact-by-nilpotency, jet≡nested quotient proof, kink-policy probes, …) rendered to a generated dashboard, instead of tolerance-tuned pointwise gradcheck.

Slices proposed (estimates, Decision #31 ordering: derive → prove differentially → only then retire)

  • AD-LAW-1 (~1–1.5w, host-free, no deps) — law oracles over today's registries incl. geometric; machine-check of the plan's own §3 math per the CORE_SUBSTRATE_VIEW §0.1 discipline
  • AD-WEIL-1 (~3w, host-free) — algebra substrate + Dual() + TruncatedJet(k) + ODE table; settles the W6.4-note GA-substrate hypothesis with ga/signature.py as oracle
  • AD-JET-STRUCT-1 (~4w) — online-softmax jets for flash_attn/norms; STDE-style estimators on Philox with unbiasedness contracts
  • AD-JET-IR-1 (~5–6w, research-adjacent) — TaylorLiftPass(W); coefficient axis in the L5 #tile.layout carrier; L0-shape C++ home
  • AD-OPERATOR-1 (~2w) — OperatorTangent + adopts S8's previously-unowned strict-complementarity hardening (H3)
  • AD-CERT-1 — deferred, consumer-gated (Apple GPU MLA: native f16/bf16 for the absorbed decode kernel #29)

Cross-checks already folded in

  • CORE_SUBSTRATE_VIEW.md (§5a of the plan): one funding correction (vmap is a for-loop — real batching_rules are a dependency, and AD-JET is the second forcing function after G4); PDE's S6 row already demands "jet AD" (second Apple GPU MLA: native f16/bf16 for the absorbed decode kernel #29 consumer); AD-JET-IR-1 is the fourth mandate for the unowned S5 numeric_policy carrier; TaylorModel named as the Decision Apple GPU MLA: same-length B>1 batching in decode_batch (throughput) #28 accuracy-budget certificate
  • CUTE_IR_ASSESSMENT.md (§6 of the plan): the jet coefficient axis is LAYOUT-ALG-1's sixth consumer (logical_product/regroup/cosize//coalesce/crd2idx); AD-JET-IR-1 depends on L1+L5; the jet kernel's eventual C++ descent copies L0's one-home shape

Deliberately NOT in this PR (owner's call, listed as proposed bindings in the doc)

  1. Replacing the W6.3 row in INTEGRATED_COMPILER_PLAN.md with these estimates
  2. The sixth-consumer row in CUTE_IR_ASSESSMENT.md §3
  3. Adding the Law-3 adjoint check to the E2E-REAL-6 family-migration checklist
  4. Routing entry in docs/audit/compiler/README.md's authority chain

No code, no status claims, no generated-doc changes — pure design/plan document.

🤖 Generated with Claude Code

…s parameter

Scoped plan (plan_state: draft, not yet bound to INTEGRATED_COMPILER_PLAN)
supplying the design content behind W6.3's "research estimate required":
one DerivativeContract datum per primitive evaluated under an explicit
DifferentialAlgebra codomain (Dual / TruncatedJet Weil / CliffordTangent /
OperatorTangent / TaylorModel), correctness as six executable laws instead
of pointwise gradcheck, and slices AD-LAW-1 -> AD-WEIL-1 -> AD-JET-STRUCT-1
-> AD-JET-IR-1 (+ AD-OPERATOR-1, AD-CERT-1 consumer-gated).

Cross-checked against CORE_SUBSTRATE_VIEW (S5/S6/S8 findings incorporated,
incl. the vmap-is-a-for-loop funding correction) and CUTE_IR_ASSESSMENT
(jet coefficient axis as LAYOUT-ALG-1's sixth consumer).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 01816e29a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/audit/compiler/AUTODIFF_NEXTGEN_PLAN.md Outdated
Comment thread docs/audit/compiler/AUTODIFF_NEXTGEN_PLAN.md
Comment thread docs/audit/compiler/AUTODIFF_NEXTGEN_PLAN.md Outdated
Comment thread docs/audit/compiler/AUTODIFF_NEXTGEN_PLAN.md Outdated
Comment thread docs/audit/compiler/AUTODIFF_NEXTGEN_PLAN.md Outdated
…ions

All four review findings accepted after independent verification:

- plan_state: draft -> open (AGENTS.md permits only open/landing/closed;
  fixes test_plan_docs_declare_a_valid_plan_state). Proposal status moved
  into the routing banner prose.
- Route AUTODIFF_NEXTGEN_PLAN.md from the compiler README index (fixes
  test_compiler_index_routes_every_live_document).
- §3.1: the nested-vs-jet relationship is the diagonal EMBEDDING
  ℝ[ε]/(ε^{k+1}) ↪ ⊗ᵢℝ[εᵢ]/(εᵢ²), ε ↦ Σεᵢ — the previously claimed
  surjection εᵢ ↦ ε is not an algebra map (εᵢ²=0 would force ε²=0).
  Correction recorded in place; the wrong map becomes a negative fixture
  in the AD-LAW-1 math harness (#10a).
- §3.5/§4: Law 3 re-scoped as complete for the transpose relationship
  only (a matched-wrong JVP/VJP pair passes); derivative correctness
  stays with Laws 1/2/4 + existing FD oracles. E2E-REAL-6 note softened
  to match.
- §3.6: "every primitive is semialgebraic" was false (exp; unrestricted
  trig is not o-minimal-definable). Replaced definable:bool with a
  per-primitive path-differentiability witness (smooth |
  definable:<structure>); program-level guarantee composes via the
  conservative-field chain rule.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gstoner
gstoner merged commit ec513fd into main Aug 18, 2026
18 checks passed
@gstoner
gstoner deleted the agent/autodiff-nextgen-plan branch August 18, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant