Repository navigation
Release v0.12.0: cubic B-splines, threading, three-mass backgrounds and growth - #100
marcobonici wants to merge 57 commits into
Conversation
Add traced vector and matrix B-spline evaluation, preserve extrapolation semantics, and update stencil AD rules and regression coverage. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Add 12 tests covering: Reactant Enzyme gradient through CubicBSplinePlan (vector + matrix), Reactant Enzyme gradient through stencil evaluation, Float32 and ForwardDiff Dual plan support, matrix plan extrapolation policies, and Reactant CubicBSpline with non-uniform knots. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Replace scalar band substitution with an affine scan so Reactant plans remain dynamic and differentiable while substantially reducing vector execution cost. Add deterministic solve, shape, Float32, and Enzyme regression coverage plus the performance investigation record. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Register the existing B-spline ChainRules rules with Mooncake and add plan-specific Akima and cubic-spline pullbacks. This removes large generic reverse-mode tapes from prepared vector and matrix plans. Add dense-plan, plain-Julia benchmark, JET, and DifferentiationInterface coverage. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Prepare fixed-grid Reactant B-spline plans as a single dense interpolation operator instead of silently falling back to the affine scan. This cuts matrix runtime and compilation substantially while retaining the scan for direct coefficient solves and guarding excessive operator storage. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Derive the not-a-knot basis exclusively from interpolation sites and make endpoint clamping the default extrapolation behavior. Remove unsupported custom-knot API branches, tests, and obsolete reference fixtures while retaining explicit strict and zero extrapolation policies. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Keep host B-spline plans lean by constructing dense interpolation operators only during Reactant adaptation. Remove the obsolete threshold and sentinel state, and require dense-plan Enzyme gradients to pass without the old failure fallback. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Advance the minor version for the new cubic B-spline interpolation API and its Julia, AD, and Reactant support. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Ensure exported spline and plan helpers propagate site and query derivatives consistently across ChainRules, Mooncake, and Reactant while keeping dense-plan preparation bounded and tested. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Preserve scalar behavior, expose explicit thermal models and typed growth sources, and include solver and cross-language fixtures with forward/reverse AD checks. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Use a pre-1.0 minor release to signal the new prescriptions and changed explicit three-mass convention. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #100 +/- ##
==========================================
+ Coverage 99.13% 99.37% +0.24%
==========================================
Files 13 21 +8
Lines 1852 3708 +1856
==========================================
+ Hits 1836 3685 +1849
- Misses 16 23 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Benchmark Results (Julia v1.10)Time benchmarks
Memory benchmarks
|
Benchmark Results (Julia v1.11)Time benchmarks
Memory benchmarks
|
Benchmark Results (Julia v1.12)Time benchmarks
Memory benchmarks
|
Restore the historical positional constructor and enforce the supported growth interval, with reusable-cache and mass-sensitivity regressions. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Verify changed and zero-mass inputs with reused preparations and record componentwise forward/reverse convergence without changing the public API. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Distinguish the static Julia interpolation table from the JAX runtime quadrature without changing any numerical report values or production code. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
|
Review follow-up published as All 54 numerical rows are preserved; only the six E-setting labels and explanatory text changed. Generator syntax and formatting checks passed. No production code, test-suite logic, dependency, or numerical fixture changed. The Computer Scientist independently completed 3330/3330 tests on a pristine archive of parent The pre-existing local distance-performance candidate remains uncommitted and unaccepted. Its timings are not evidence about this PR, and this update makes no performance-regression acceptance claim. All unrelated local edits were preserved. PR remains open and unmerged. |
|
Independent Computer Scientist follow-up: correctness approved at 8633d82. Reviewer verified the label-only diff and independently passed 3330 tests on the identical production/test-suite parent tree. No newly introduced correctness blocker remains. Performance acceptance remains an explicit maintainer decision: existing prepared-Zygote CI evidence includes vector r_z 32.7→50.5 ms, D_z 1.43→1.70 ms, and f_z 1.50→1.73 ms on Julia 1.12. The local distance optimization candidate is uncommitted and not certified; no hidden performance acceptance is being made. New-head CI and required GitHub reviews remain separate gates. PR stays open and unmerged. |
AirspeedVelocity creates a separate environment and does not inherit benchmark/Project.toml, so its extra packages must include the imported Reactant dependency. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Restore complete plan cotangents, handle structured inputs and scalar activity, and correct affine scan composition. Add public-path regressions and repair benchmark baseline handling. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Remove temporary focused dispatch branches that conflict with develop while preserving every unconditional full-suite include. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
…owth. Remove the scalar model and its lookup tables while preserving emulator total-mass inputs and historical labels. Validate the new API, constructor AD, and converged ODE gradients against unchanged scientific references. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
|
Pushed 32a7f62 for Marco’s approved breaking analytic API change. Background/growth functions and cosmology constructors now require exactly three physical masses; scalar values (including zero) produce migration errors, with no implicit split. Omitted masses use the explicit massless triple. Emulator total-mass inputs and weights are unchanged. Removed the historical scalar formulas and lookup tables. Existing three-mass CLASS/CAMB numerical fixtures are retained. Compatibility of the unchanged 300303 emulator labels is checked against a text reference frozen from the pre-retirement implementation, NOT against a newly chosen mass splitting; the old trained growth label and new three-species ODE differ by about 0.4% at the test point. Independent validation: full normal Pkg.test passed 3167/3167; three-mass focused 1341/1341; Neff focused 802/802; artifact compatibility 16/16. Original strict gradient thresholds remain unchanged: a prepared-AD convergence sweep justified tightening ONLY the test solver tolerances, not production defaults. Fresh CI is running. Laptop timing measurements were rejected at 97–101 C, so no performance claim. The coordinated JAX implementation is pushed at 368596b, with 326 local tests and fresh push/PR CI successful. Original unrelated working-tree edits were restored separately and are not part of this commit. No merge, tag, or release performed. The separate B-spline buffer-ownership finding in #97 remains outstanding. |
…ase. Retain common baseline benchmarks without executing the new physical model against scalar-only revisions. Keep all three-mass cases enabled on the head. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
|
Benchmark-only follow-up pushed at 5c6f20a. AirspeedVelocity runs the head script against legacy main too; that implementation cannot execute the new explicit-three-mass cases, and the differing physical models are not like-for-like timing baselines. The script now retains all common interpolation benchmarks on legacy main and all background/gradient cases on the current head. Both baseline and head smoke checks executed successfully. No production or unit-test changes in this follow-up; the 3167-test validation remains applicable. Final-head CI is monitored; no merge performed. |
…e regression. Audit only genuine runtime dependencies after lower-bound CI promotions, and temporarily cap optional Zygote at 0.7.16 with exact public-caller regressions and documented compatibility consequences. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
| # Artifacts alone do not avoid the 20–36 minute dependency precompile | ||
| # seen on macOS. Preserve compiled packages separately; include the | ||
| # matrix and architecture, and leave cache deletion permissions off. | ||
| - uses: julia-actions/cache@d10a6fd8f31b12404a54613ebad242900567f2b9 # v2 |
There was a problem hiding this comment.
Why this specific cache version..?
There was a problem hiding this comment.
Maybe this file should be removed...?
| `w(a) = w0 + wa*(1-a)`; its present density is fixed by Friedmann closure. | ||
| `ln10Aₛ` and `nₛ` are stored parameters, not inputs to the background equations. | ||
|
|
||
| `mν` is a tuple or vector of exactly three individual masses in eV. Masses must |
There was a problem hiding this comment.
Are we sure the choice of a tuple here is not causing some slowdowns and overhead?
| const _NEFF_PER_FD_SPECIES = (_T_NCDM_OVER_T_CMB / (4 / 11)^(1 / 3))^4 | ||
| const _N_UR_THREE_MASS = _NEFF_THREE_MASS - 3 * _NEFF_PER_FD_SPECIES | ||
|
|
||
| const _SCALAR_MASS_MESSAGE = "A scalar neutrino mass `mν` is no longer supported by the analytic " * |
There was a problem hiding this comment.
When does this message show up?
| Neutrinos enter the expansion separately; dark energy closes the density sum. | ||
| See [`w0waCDMCosmology`](@ref) for masses, units and Neff prescriptions. | ||
| """ | ||
| function E_a(a, Ωcb0, h; mν=(0.0, 0.0, 0.0), w0=-1.0, wa=0.0, Ωk0=0.0, Neff=3.044, neutrino_prescription=:temperature) |
There was a problem hiding this comment.
I think it might be better to remove these methods, the ones with MANY arguments here that have a corrsponding method that gets as an input a struct. In this way, we can likely avoid some issues I presume!
There was a problem hiding this comment.
The same applies to other similar methods...tell me which ones you would modify according to these new guidellines :)
| Ωk0=0.0, order=9, Neff=3.044, neutrino_prescription=:temperature) | ||
|
|
||
| Line-of-sight comoving distance χ(z), in Mpc (not Mpc/h): | ||
| `χ(z) = c/H₀ * ∫₀ᶻ dz′/E(z′)`. Scalar input returns a scalar; use a redshift |
There was a problem hiding this comment.
Rather than the integral symbol here, I would rpefer the docstring to use latex :)
| # Prepared frozen-inference rules reuse them instead; see `_FrozenMLPWeights`. | ||
| _reverse_weight(::Nothing, ::Int, weight, ::Type{T}) where {T} = T.(weight) | ||
|
|
||
| _linearize_mlp(::Tuple{}, ::Tuple{}, ::Tuple{}, input, frozen, i) = (input, ()) |
There was a problem hiding this comment.
Why the "linearize" name?
| @@ -0,0 +1,7 @@ | |||
| [reference_fixtures] | |||
There was a problem hiding this comment.
Maybe, in general: can we move all of the "fixutres" files we are introducing into a new object on zenodo? In this manner,w e can keep the repo clean.
There was a problem hiding this comment.
This would be true as well for the files to generate the fixtures! Could we put them there as well?
| OrdinaryDiffEqTsit5 = "b1df2697-797e-41e3-8120-5422d3b24e4a" | ||
| Reactant = "3c362404-f566-11ee-1572-e11a4b42c853" | ||
| SciMLSensitivity = "1ed8b502-d754-442c-8d5d-10ac956f44a1" | ||
| Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" |
There was a problem hiding this comment.
Wait! We sure we want a dependency on Zygote? What is this necessary for? SHould that be in an extension?
marcobonici
left a comment
There was a problem hiding this comment.
There are some comments I have left that are worth addressing before going ahead!
… fixtures. Remove duplicate public parameter-list interfaces while preserving numerical kernels, and restore frozen reference data from a verified Zenodo archive containing its generators and provenance. Address review naming, documentation, cache-version and pullback-coverage requests. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
…ntation. Restore figure and network fixtures through separate checksum-verified manifests instead of tracking payloads, and explicitly attach the raw radial-distance docstring. Cover restoration boundaries, existing fixture consumers and public documentation bindings. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Preserve curvature dependence through the flat limit and differentiate fixed neutrino lookup queries without repeatedly clearing table cotangents. Add frozen-reference, public-gradient and import-order regressions. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
…ata. Add explicit query-time pullbacks while retaining SciML parameter sensitivities, with endpoint and duplicate-query coverage and calibrated pre-repair references. Export the trained-emulator loader and retain empty metadata when a description is absent. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
…tives. Preserve fixed masses and existing defaults while selecting cooling below Neff=3.044 and radiation at or above it. Cover prepared Mooncake reuse, ForwardDiff and Zygote agreement, one-sided derivatives, and independent CLASS background fixtures in the normal test suite. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Archive the independent CLASS references and generator alongside preserved historical fixtures, and validate their restoration through the normal Pkg.test bootstrap. Keep immutable archive and per-file checksums rather than tracked generated payloads. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Reuse gradient references and Reactant executables, remove tautological checks, and retain both curvature cases. Fingerprint the resolved test environment and bound cache saves so completed precompilation survives test timeouts. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
There was a problem hiding this comment.
Why is the tsv here? Shouldn't that be on zenodo?
Pin the v4 reference artifact and verify automatic restoration of the unchanged TSVs without tracking duplicate copies in git. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Retain the vector, matrix, plateau and replay cases. Time each full-suite file and give Julia 1.12 on macOS a longer test window. Run its PR edge regression in an isolated process while retaining the integrated push run. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Record the child exit as a test result so subsequent files still run. Restore the explicit forward finiteness check. Remove an unused print-only JET script, point fixture provenance at the archive, and document the existing Julia 1.11 Reactant spline limitation. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Use the shared physics-based dictionary keys, expose the thermal prescription in model metadata, and document registry lookup. Pin the published Zenodo archives and test the eleven-output contract. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Select temperature rescaling below Neff=3.044 and the radiation branch at and above the switch. Retain both explicit prescriptions and test the omitted setting on both sides and at equality. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
…ut precision. Document the changed input ordering and eleven outputs, and cover the radiation-side derivative at the represented threshold in both float precisions. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Keep the ArgumentError contract for every scalar case and check the actionable three-mass guidance instead of requiring an unrelated emulator reference. Drop unused weight-index and stencil-size calculations. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Use read-only views when accumulating the three matrix bands. This preserves the accumulation order and saves 12.69 MB per prepared Mooncake gradient at 1024 knots and 256 curves. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Use split Gauss–Legendre quadrature only at table initialization. Keep the existing Akima grid and runtime lookup unchanged. Remove the Integrals extension trigger and update the associated tests and examples. Handle offset-indexed queries in matrix Akima evaluation and its pullback. Clarify loader exports, background examples, and automatic postprocessing. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
The lowest supported dependency set produced a relative norm difference of about 1.1e-10 between Mooncake and ForwardDiff. Relax only this test assertion; leave solver settings and independent references unchanged. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
v0.12.0 release candidate (
develop→main)Matrix natural-cubic spline gradients (
89dfdfa): The reverse rule now reads column views instead of copying six slices per curve. In two local runs the complete prepared Mooncake gradient allocated 35–37% fewer bytes across three matrix sizes. At 1,024 knots × 256 curves this was 34.06 MB → 21.37 MB and 4,786 → 178 allocations. GC-inclusive mean runtime fell at all three sizes in both runs, although one median was mixed. Spline values, scalar losses, and gradients of both knot positions and curve values were bit-identical on the tested inputs, including A→B→A preparation reuse. Small Float32/64 gradients agreed with ForwardDiff. All 38 focused interpolation and AD tests passed locally. No API or forward-solver change.Migration: the two old registry keys are removed, not aliases. The dictionary exposes 16 new scalar models. Rebuild inputs from each model’s ordered metadata and select outputs by label (7 → 11). The old flat nine-vector ended
Mnu, w0, wa; the new flat one-mass, default-helium vector endsw0, wa, Neff. One-mass models fix (0.06, 0, 0) eV; degenerate models take a mass sum.sigma8keys denote total matter at z=0.Analytic API: pass three physical masses, not a scalar. Hybrid is the default: temperature rescaling below Neff=3.044, radiation at and above the switch, using the radiation-side derivative at equality in Float32 and Float64. Pass temperature explicitly to recover the previous convention. Cold+baryon growth and approximate matter growth are distinct; the latter is not full scale-dependent perturbation growth. Reusable cubic B-spline plans include banded construction and local evaluation.
Validation: matched CLASS fixtures check analytic expansion and distances; separate growth-ODE and CAMB background checks are not independent tests of all 11 neural outputs. Registry checks establish loading and inference, not full-domain accuracy. The archives report internal errors and some nonpositive distance predictions. Independent 10k evaluation and amplitude round trips remain pending. Use the Checks tab for current-head CI; historical counts below apply only to the revisions named. No merge or tag is part of this update.
Historical release notes and validation at earlier revisions (superseded where inconsistent)
v0.12.0 release candidate (
develop→main)Changes for callers
w0waCDMCosmology. Pass three physical neutrino masses in eV (zeros allowed); scalar masses, including scalar zero, are no longer accepted. Emulator input conventions and shipped weights are separate and unchanged by this PR.neutrino_prescription=:temperatureremains the default.:radiationfixes the neutrino temperature;:hybriduses temperature scaling belowNeff=3.044and radiation at and above it. The hybrid value is continuous; its derivative at the switch uses the radiation side.1/139 ≤ a ≤ 1.01.CBGrowth()andMatterGrowthApprox()are distinct; the latter is not scale-dependent perturbation growth.set_threadscontrols new FFTW plans and host spline solves; it replacesset_fft_threads.Validation and release gate
See the checks on the current head. At
a32c9ba, both lower-bound and coverage checks passed; both Julia 1.12/macOS jobs timed out. The follow-up preserves the full matrix and numerical cases, times each top-level suite file, and runs the consolidated Akima edge test in a fresh Julia process on the macOS 1.12 PR lane versus in-process on push. Only this matrix cell has a longer test budget. A timeout is not a passing test. No blanket performance nonregression is claimed.Package and dependency compatibility, a completed macOS run, and the repository's required approval must be checked before merge. This PR does not create a tag or GitHub release.
Historical review notes and performance evidence (earlier commits, superseded where inconsistent)
Current release scope — updated 2026-11-11
Merge
developintomainfor v0.12.0.Project.tomlis already at0.12.0.Current source head:
7a48a98d836ba617f88c111f7ba3a9f2f3c1b612. This PR followsdevelop, including the B-spline merge from PR #97 and the native Mooncake/frozen-inference changes below. The earlier B-spline scope audit was atc5f9ca06d1cd00a6b224ea505bb36f612477004e; it is not a full audit of every later change.No tag or GitHub release is created by this PR. Release tagging remains a separate, explicitly authorized action from merged
main.Cubic B-splines and threading
cubic_b_spline_interpolation,CubicBSplineandCubicBSplinePlan: vector/matrix ordinates, scalar/vector evaluation queries, and:clamp/:throw/:zeroextrapolation. Plans take a fixed vector query grid. High-level constructors derive their knot vector from the sites; they do not accept custom knots.CubicBSplineBasis, knot/domain/support accessors,basis_row,basis_stencil,basis_matrix,bspline_basisandbspline_coefficients. The low-level basis supports explicit custom knot vectors;basis_matrixcurrently supports dense storage only.:throwis unsupported; host-validated fixed plans can use it.set_threads(n)controls FFTW plans created afterwards and the task budget for host B-spline solves/pullbacks. The Julia pool must be provisioned at startup.set_fft_threadsis deprecated and forwards toset_threads.Background/growth changes and compatibility
CBGrowth()/MatterGrowthApprox()sources. These are intentional thermal prescriptions, not a claim to reproduce CAMB's default hybrid prescription.1/139 ≤ a ≤ 1.01. Default production ODE tolerances and raw initial-condition growth normalization remain unchanged.5421f07keeps inactive denominators positive independently of the final selection mask, with unconditional vector/matrix forward and AD regressions.Native Mooncake input gradients and frozen inference
d764e83adds an explicit input-only reverse rule for stateless, nonempty Lux Dense chains withidentity,tanh, ortanh_fast, CPU vectors/matrices and Float32/Float64 inputs/weights. The supported native path does not call ForwardDiff internally. Unsupported architectures retain the explicitly documented legacy ForwardDiff-backed bridge.rrule!!retains per-call owned reverse weights.Lux.apply/Lux.Trainingor SimpleChains API; this rule does not suppress training parameter gradients. Retraining should create a new inference emulator/preparation. In-place mutation of weights under a live preparation, including aliasing an optimizer's writable parameters, is unsupported.c1289bafixes prepared-cache binding for abstractly declared parameter fields by retaining the direct native path, with direct/root/nested regression coverage and a no-ForwardDiff tripwire.Lowest-compatible-dependency CI
7a48a98adds a separate Linux / Julia 1.12 lower-bound job, alongside the existing Julia 1.10/1.11/1.12 × Linux/Windows/macOS matrix.julia-actions/julia-downgrade-compatv2.7.0 pinned by commit, inalldepsmode, including weak/extension dependencies and test extras. No backend is excluded.allow_reresolve: falseandforce_latest_compatible_version: false, preventing test setup from silently upgrading away from the selected minimum environment. The resolved Project/Manifest are uploaded for diagnosis even when the job fails.Native-rule validation and performance evidence
Pkg.test(): 12,863 package checks + 11 fixture checks passed for the frozen-rule candidate. That snapshot also contained unrelated local loader/export edits, so this is not an exact-clean-PR-head certification. An earlier one-hour run timed out; the unchanged two-hour retry passed. Both logs were retained.d764e83plus exactly the five repair files: reproduced the original abstract-parameter failure, then passed 1,266 native checks, four isolated precision-policy runs and 11 fixture checks. Those five file blobs match committedc1289ba.Matched ten-second BenchmarkTools blocks, four fresh A/B/B/A processes, one physical CPU and BLAS thread, prepared value-and-input-gradient calls, with all GC samples retained:
Allocated bytes fell 7.7% / 55.3% versus the old bridge. Effort's median passed the stability gate; Capse's candidate median and both workloads' GC-inclusive means did not meet the predeclared 10% block-spread threshold. Mean-time nonregression remains inconclusive despite the favorable observations; no universal speedup is claimed. Effort D/bias were fixed, and these are not complete likelihood benchmarks. Capse's default SimpleChains backend is not optimized by this Lux-only rule.
Current CI status and companion Python scope
Current-head checks remain authoritative. The lower-bound CI addition has just been pushed; earlier passing checks do not certify
7a48a98. At the precedingc1289basnapshot, both documentation jobs and Julia 1.10/1.11 benchmark jobs passed, while package-test results were still pending. Codecov gates failed: patch coverage 94.80% against a 99.13% target; project coverage 96.92% (−2.22 percentage points). The newlux_mlp.jlreported 98.92% coverage, one uncovered line; most uncovered changed lines belong to the broader release PR. Coverage thresholds have not been weakened. This PR is not claimed CI-green or merge-ready.Companion Python release: jaxace #57, current head
368596b916ae11265883cfa5f8ce3d65f70693cf.rtol=atol=1e-12. Reused JIT plan construction/application and live value/site/query gradients were exercised on JAX 0.4.38. Those fixtures identify Julia132a6e5plus recorded local source hashes; this was not a fresh numerical rerun of the exact merge tree.Outstanding qualifications
No blanket cross-language feature/performance parity or universal speedup is claimed. The historical review below records Zygote performance findings, an uncommitted positional-call optimization, and a transverse-distance derivative issue at exactly Ωk0=0. This B-spline scope audit does not revalidate those findings at the new head or claim they are fixed. User-local background/loader/test edits remain outside this PR.
Historical release review and measurements (older heads; superseded where noted above)
Release preparation
Merge
developintomainfor v0.12.0, following releasedv0.11.0.Project.tomlis bumped to0.12.0.This is a pre-1.0 minor release. It adds public thermal and growth prescriptions and deliberately changes the explicit vector-mass convention. No tag or GitHub release is created by this PR. Tag the merged main commit later.
Reviewed head:
1ece493(1ece4938d9814ea92b714708f5bd42825d5e7edd). Companion Python release: jaxace v0.8.0, CosmologicalEmulators/jaxace#57Changes
:temperature/:radiationprescriptions across backgrounds, distances and growth.CBGrowth()(the unchanged default) andMatterGrowthApprox()growth sources, selected outside the numerical ODE parameter vector.mνthermal model, default ODE tolerances and raw initial-condition growth normalisation are kept. Legacy scalarmνis intentionally a different model from(m, 0, 0).Review fixes (
4017d90,1ece493)w0waCDMCosmologyconstructor is restored, with the new thermal defaults and Dual-valued fields.D_z,f_zandD_f_znow raiseArgumentErrorfor queries outside the integration interval1/139 ≤ a=1/(1+z) ≤ 1.01, including non-finite redshifts. Previously such queries depended on solver-specificsaveatbehaviour. The exact endpoints are accepted and tested. Background and distance functions are not restricted.test/fixtures/neutrino_neff/ad_convergence.mdis a forward-vs-reverse agreement report: 54 rows covering E, four distance integration orders and four growth tolerances, for both prescriptions. It is not an independent accuracy guarantee.Compatibility and physics notes
MatterGrowthApproxaddsρν(masses) − ρν(massless reference)for all species at the same temperature and Neff. It is neitherρν − 3pνnor scale-dependent total-matter perturbation growth.Validation
Immutable evidence. All 16 pre-existing ACE fixture files are byte-for-byte unchanged across the review follow-ups; the independent reviewer compared them. New references were added alongside them, not substituted.
Cross-language. 40 model combinations, 200 redshift rows. Maximum relative differences: E ~1.3e-12, raw D ~6.3e-11, f ~2.8e-10. The saved CLASS growth references check CLASS's background-growth ODE, not perturbation growth.
Full
Pkg.test()at1ece493, Julia 1.12.6.The reviewer also re-ran
generate_ad_convergence.jl, and all 54 rows reproduced exactly.Current-head CI at
1ece493: all 23 checks reported SUCCESS at snapshot 2026-10-04 21:35 UTC.Performance (separate from correctness)
Julia Zygote regression introduced by this PR (open). The PR benchmark job at
1ece493compares main with the PR head. On the legacy scalar-mνfunctions, Mooncake, ForwardDiff and primal timings are unchanged. Zygote is slower:zygote_r_z(100 redshifts)single_z/zygote_r_zzygote_D_z,zygote_f_z(direct and DI)Distances: diagnosed, with an uncommitted local follow-up. Every internal keyword hop costs extra in Zygote's backward pass, and each extra keyword adds to that cost. This PR forwards
Neffandneutrino_prescriptionthrough everyr_z → r̃_z → E_ahop, once per redshift. Marking only the input validation as non-differentiable recovered about 3%, so validation is not the main cost.A local follow-up passes positional arguments on those internal hops. Public keyword signatures, validation, defaults and AD inputs are unchanged. On Julia 1.12.6 (laptop, one pinned core, two reps), direct Zygote
r_zover 100 redshifts went from ~18 ms (main) and ~28 ms (1ece493) to ~4.5 ms. Values and Zygote/ForwardDiff gradients were string-identical across all three versions. Mooncake, ForwardDiff and primal timings did not change.This follow-up is not yet pushed or accepted. The CI results above do not cover it. It still needs independent review, a push and a fresh CI benchmark run. Local tests of that uncommitted tree:
test_args=["neutrino_neff"]: 1052/1052, including 250 new Zygote/ForwardDiff/Mooncake parity and validation assertions;Pkg.test(): 3582/3582, which is 3330 committed + 2 unrelated local loader assertions + 250 new ones.Growth: still regressed, not resolved. The
D_z/f_zZygote slowdown comes from code outside the ODE right-hand side. It shows up as about 1,000 more allocations in pullback construction plus a slower adjoint backward pass. Making the RHS calls positional changed nothing. The mechanism was not isolated within the time-boxed investigation, and maintainer acceptance or a follow-up is needed.JAX scalar reverse-mode growth tradeoff. This is a separate, disclosed accuracy/cost tradeoff in jaxace Mooncake support #57 and does not apply to this Julia package.
This PR makes no blanket "no performance regression" claim.
Known pre-existing issue (not introduced or fixed here)
At exactly
Ωk0 = 0, gradients of the transverse distances (dM_z,dA_z,dL_z) are unreliable. ForwardDiff returns NaN, and Zygote (through theS_of_Krrule limit) and Mooncake disagree on ∂/∂Ωk0. All other components agree. The same behaviour occurs onmain. It needs a separate fix. The new parity test usesΩk0 = -0.01only because of this singular point; that choice does not fix the issue.Related release
jaxace v0.8.0 preparation: CosmologicalEmulators/jaxace#57. Its separate JAX scalar reverse-mode growth tradeoff is described there.