Skip to content

feat: qualify real AI pressure components and bounded trajectories - #49

Merged
MrScripty merged 3 commits into
mainfrom
feat/ai-pressure-provider
Oct 14, 2026
Merged

MrScripty merged 3 commits into
mainfrom
feat/ai-pressure-provider

Conversation

@MrScripty

@MrScripty MrScripty commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Rheon can execute the real surrogate-lab pressure model as an opt-in solver component. Every prediction is checked against the full pressure residual and predicted-divergence gates; unsupported requests, inference errors and rejected output retain a reason and use the selected Jacobi or SGS reference. Independently evolved full trajectories now qualify the selected backend and fallback behavior.

The isolated rheon::solver_provider API exposes pressure requests, capabilities, version/stage/shape/layout/units metadata, model provenance and invocation timing. Native f64 inference uses the frozen learned gains and basis directly. The exporter verifies checkpoint SHA256 and never executes pickle or trains a model. The core remains standard-library-only.

Compatibility and integration

  • Base: remote main 2209012bc5f902693d0f695ec1c2d854126af317.
  • Actual model: surrogate-lab trajectory-v2, SHA256 25533a2fbaa5ab0f5fb574dc6307a2b8d6a686deb7db867d0d03338d4d70d5a9.
  • Supported model: sealed 32³ unit box at origin zero, density 1.25 kg/m³, dt 1/60 s, zero-cell gauge. No weights or numerical outputs committed.
  • Existing Simulation and desktop defaults remain available. The provider API is ready for the API owner's selection hook; this PR qualifies an explicit component loop using Rheon's real advection, pressure, correction and tracer kernels. It does not claim the existing desktop has provider selection.

Bounded full-trajectory qualification

The experiment was fixed in plan.md before execution: 24 frames (0.4 simulated seconds), public lab seeds 900/901, three rotated timing repetitions, followed by a separate full-field capture replay. Each mode evolves its own accepted state; no teacher states enter learned rollouts. These are known public seeds, not an untouched holdout/generalization test.

Six modes: Jacobi, SGS, learned, learned with a labeled output fault on frame 9, shifted-origin Jacobi, and unsupported-origin fallback. 864 timed frames and 288 captured frames passed. The independent verifier recomputes the full operator residual, actual divergence, Courant, gauge/wall/range and integral ledgers for every captured frame, plus selection and timing ledgers for all frames. An independent NumPy transition oracle reconstructs RK2 advection, prescribed forcing, RHS, correction and tracer evolution from rest and each prior accepted capture. All 288 captures match reconstructed fields exactly on this CPU. Engineering rounding allowances are explicit; this is not a cross-platform error proof. Timed repetitions retain receipts only; complete field verification applies to separate capture replay.

Maximum learned relative L2 errors against both numerical rollouts: velocity 6.80e-8, tracer 2.43e-8, centered pressure 7.91e-8. Maximum actual divergence over the complete capture set: 8.34e-7 s⁻¹, below the 1e-5 s⁻¹ gate. The injected prediction is rejected on frame 9, numerical fallback succeeds, and learned inference resumes afterward. Every unsupported-origin frame declines before inference and matches its corresponding numerical rollout bit for bit.

Single-threaded native Rust 1.92.0 release build, AMD EPYC 9V74 cloud guest:

Path Median complete 24-frame rollout
Jacobi PCG 5.712 s
SGS PCG 4.830 s
Learned pressure 1.335 s
Learned with one injected fallback 1.571 s

Rollout timing includes state/workspace initialization, advection, forcing, pressure inference/qualification/fallback, correction, tracer transport and acceptance. Model file reading/loading measured separately: 0.70 ms. CSV serialization follows the timed loop; captured replay is excluded from timing medians. OS caches are uncontrolled. No speedup threshold gates CI. These results do not establish real-time performance, long-term stability, general physics accuracy, or superiority over an analytic spectral inverse.

The separate isolated-pressure comparison also passed 36 invocations. Independent NumPy replay from the original checkpoint agrees with native pressure to relative L2 1.07e-15; independently recomputed relative residual 3.13e-9.

Validation

Commands for the current trajectory change:

  • cargo run --locked --release --no-default-features --example ai_pressure_trajectory -- /tmp/rheon-modal.bin .generated/ai-provider/trajectory-v1
  • python3 tools/verify_ai_pressure_trajectory.py .generated/ai-provider/trajectory-v1
  • RHEON_AI_TRAJECTORY="$PWD/.generated/ai-provider/trajectory-v1" python3 -m unittest discover -s tools -p test_ai_pressure_trajectory.py -v: 14 passed in normal and optimized Python.
  • RHEON_AI_EXPORT=/tmp/rheon-modal.bin cargo test --locked --no-default-features --test solver_provider_contract -- --include-ignored: 6 passed, actual weights.
  • cargo clippy --locked --no-default-features --all-targets -- -D warnings; desktop-feature trajectory Clippy; formatting and diff checks: passed.
  • Independent review re-ran the real full-field verifier and the transition equations and all four external corruption probes: no blocking findings.

Adversarial coverage rejects coherent frame/receipt duplication, jointly zero timings, zero process/model timers, impossible timed residuals, and underreported positive process time. Active stages must be positive; complete process time contains model loading and all rollouts. Residual L2 is bounded by predicted divergence through the discrete norm inequality. Receipt consistency is not an external clock attestation. Validation worker’s exact four-probe script passes against preserved original captures.

Implementation validation also passed full core/default suites (329 / 336 tests, with the real-artifact test separately enabled), parallel/desktop pressure/provider suites (16 each), Python artifact tests (7, normal and optimized), repository hygiene (6), and strict Clippy for all four feature modes. The dedicated hosted workflow retrieves the immutable model and runs both invocation and complete-trajectory qualification, including corruption/incomplete-output/fallback/timing rejection tests.

Exact head 89997c5b9bb121c96f1fe40a7b050c130cc525b7: hosted real-checkpoint/full-trajectory qualification passed, including all 14 normal/optimized rejection tests. All three reconstructed field errors were zero on the hosted CPU as well. Executable, metadata, rational-contract, core-and-executable and all default/core/desktop feature suites passed on this exact head. The only failed check is the pre-existing research-book build described below; deployment was skipped. The research-book build has a confirmed pre-existing changed qualified native source Cargo.lock failure on base main and this exact PR head. This PR does not change that lockfile or the historical book qualification policy.

GPU, ARM/WASM, other model versions, longer/different scenes, free surfaces, viscosity, obstacles, moving boundaries and desktop interaction remain unqualified. See docs/implementation/ai-provider/README.md for reproduction, ownership and artifact authentication limits. Keep this PR in draft for API-owner integration review; no merge or deployment requested.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@MrScripty MrScripty changed the title feat: qualify real AI pressure inference with numerical fallback feat: qualify real AI pressure components and bounded trajectories Oct 13, 2026
@MrScripty
MrScripty merged commit 14a77d8 into main Oct 14, 2026
11 of 12 checks passed
@MrScripty
MrScripty deleted the feat/ai-pressure-provider branch October 16, 2026 20:13
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