Files
ML-Porosity/docs/research/p3-code-review.md
holale 9976abc96b Complete P3 F3 evaluation and Windows execution
Implement the frozen F3 protocol, nested LOWO, posterior label banks,
ablations, diagnostics, checkpoint validation and full-volume inference.
Record the negative G-C result: improvement at 1/4 wells, coverage80 52.38%
and coverage90 60.91%, with unchanged thresholds and historical P2 results.

Add native Windows logging, the RTX 3060 environment lock, detached runs,
and an audited dashboard-lock recovery that preserves frozen scientific code.
Update report.html, the plan and agent guidance with completed P3 status.
Archive thesis sources under code_thesis with identical Git blobs and record
the original-output audit without committing large data or model artifacts.

Validation: 129 tests passed, 13 skipped; CUDA end-to-end smoke passed;
completion audit verified 1,320 checkpoint/prediction pairs, 28 registration
bundles and all 649 interior volume inlines. Scripts 04 and 09 were not rerun.

Co-authored-by: Codex <codex@openai.com>
2026-10-28 07:01:08 +07:00

10 KiB
Raw Blame History

P3 implementation review before the main experiment

Date: 27 October 2026. Repository pulled from Gitea main, fast-forward from 5a6fb2f to a22f9d9. The incoming commits add AGENTS.md and ten agent skills; they do not change the scientific pipeline. Existing local work was preserved.

This review concerns the new, uncommitted P3 implementation. The original P2 G-B failure and the registered P2r results remain unchanged. No P3 main grid has been run and no field outcome was used to select the fixes below.

Findings and changes

Finding Consequence Resolution
Training workers loaded held-out labels and markers even though the optimizer did not use them. The software boundary did not enforce the blind-well rule. Training data views now expose only training logs/markers and seismic-only targets. Access to held-out labels or logs raises an error. A perturbation test verifies that changing the current outer well's labels cannot change its checkpoint or prediction.
A completed prediction cache could be accepted without its checkpoint. A resumed job could later fail at deployment or mix artifacts. Prediction and checkpoint checksums, fingerprints, atomic checkpoint writes, and matching-pair validation are required.
Missing porosity logs were extended by interpolation without a support check. Warped labels could include values outside the measured interval. Keep measured-support masks, exclude invalid warp particles, assign zero mass to invalid anchor samples, record retained counts, and fail if too few particles remain. AI's constant edge extension is a separate forward-model assumption.
The SMC class required anchors, so the new no-anchor ablation could not run. The ablation failed before sampling. Add an explicit opt-in prior-only initialization with empty anchor operators; the existing P2 default still requires anchors. Exercise both paths on synthetic wells.
P3 depended on scripts and P1 settings outside its initial code fingerprint. Editing a classical-baseline dependency could escape resume validation. The P3 lock covers all project Python modules/scripts, the Windows driver, baseline settings, prepared data, raw well inputs, and package versions.
The original run logger imported POSIX-only modules. Logging and detached execution failed on native Windows. Add Windows process groups and CSV locking; retain POSIX behavior. Unavailable resource/VRAM measurements remain null. Test nested child logging on both platforms; POSIX signal semantics are explicitly skipped on Windows.
The all command stopped before volume fitting/prediction. A command named all did not complete the P3 deliverables. Connect deployment fitting and streamed volume prediction; reduced scope requires explicit flags.
Volume uncertainty used subtraction of large second moments. Rounding could erase a small predictive variance. Use a stable online variance calculation and test a small variance around a large mean.
A resume state could outlive a missing volume file. Completed rows could be skipped even though their predictions were gone. Refuse that inconsistent resume state.
Smoke and intermediate stages could mark full ablation/protocol tasks complete. report.html could overstate progress. Separate smoke, protocol, training, diagnostics and volume states; mark the combined ablation task complete only after its required outputs exist.
Plot lines relied on color, and intervals lacked a precise definition. Visual comparisons and uncertainty could be misread. Add distinct line styles, shared scales, PNG/PDF outputs and a source/interval manifest. Intervals are nominal, moment-matched Gaussian predictive intervals, with calibration evaluated separately.

Scientific boundaries retained

  • The sampling unit is the well: four outer folds, each with three inner validation folds. Network seeds and 126 time samples do not increase the number of independent field wells.
  • Registration, normalization, wavelet estimation, label banks, and LFM inputs use the exact inner training wells. The outer well supplies seismic input; logs and markers enter only the separate scoring/sensitivity stage.
  • Checkpoints use inner validation total MSE. The point baseline for G-C is selected from inner validation, never by outer-test performance.
  • G-C retains improvement at at least three of four wells and the original coverage tolerances. Failure is reported; no post-hoc interval widening or replacement by a better-looking ablation is allowed.
  • F3 was already observed in P1. P3 is a descriptive follow-up on the same four wells, not an untouched independent field replication.
  • B3d-Sa averages forward maps t(tau) before inversion, matching P2r; it is not the mean inverse map or mean porosity label.
  • LOAO uses an explicitly identified linearized, anchor-only GP approximation. It is not evidence that the SMC posterior is calibrated.
  • The no-anchor ablation retains the common sonic datum. It is an information removal diagnostic, not a new proof of absolute-time identifiability.
  • The LFM ablation appends a training-only time trend. It is not the horizon-guided classical inversion baseline.
  • Maps report sonic-derived porosity and predictive dispersion. They do not establish geological validity or calibrated uncertainty.

Validation status

  • Whole existing and P3 unit suite: 129 passed, 13 skipped (Windows/POSIX differences and unavailable optional datasets), recorded by runlog.
  • Included synthetic-well integration: 2 passed. It exercises the complete registration/label-bank paths with and without anchors, without using real held-out F3 outcomes.
  • Final command-line, dashboard syntax and production-device checks are recorded in outputs/p3/review_checks.json when completed.
  • The streamed volume patch order was checked against SeismicCube.patch on the real F3 cube. The cube and all seven restored horizons match the original manifest's SHA-256 values.
  • The real-data CUDA registration pilot used only F02-1 and F03-2, with P = 1024. The anchor-conditioned path took 122.3 seconds; removing anchors took 256.7 seconds. Both completed. Outputs remain in the benchmark namespace, separate from the registered experiment.
  • A classical-baseline compatibility check produced finite 126-sample predictions for B0a, B0b ridge/RF/GBM, and B1. It did not calculate held-out performance or change settings from such performance.
  • The protocol was frozen before any P3 smoke or production run. Its SHA-256 is 0c756d2825d9b6aa1520be6484f501a538f2ec14e5c8fe98a323cf3b6e1bc50c. The lock additionally checks the two protected historical artifacts; volume prediction verifies the cube again. The scheduler emits a heartbeat every 30 seconds while waiting, and its Windows process prevents automatic sleep only for its own lifetime.
  • The full-runtime extrapolation is 2.57–6.35 hours on the measured RTX 3060 setup with four workers. It includes registration, training, deployment, scoring allowance and full-volume prediction; it is not a confidence interval.
  • A full P3 experiment is separate from these correctness/timing checks; passing tests and completing a smoke run are not scientific G-C verdicts.

The locked CUDA smoke completed on 28 October (6 registration jobs, 18 training jobs, scoring diagnostics and summary, exit 0). Its gate file explicitly says evaluated: false. The complete production command was then launched detached at 00:15:47 +07:00 on 28 October, with four workers on cuda:0. Its progress and eventual verdict are published automatically to report.html through outputs/p3/progress.js; this review does not pre-judge that verdict.

Post-run operational interruption and recovery (28 October)

The full run completed registration, all 1,320 LOWO training trajectories, diagnostics, scoring, and the 20 deployment models. It then stopped at 132/649 volume inlines at 03:57:33 +07:00: Windows denied atomic replacement of the dashboard sidecar outputs/p3/progress.js. The exception handler encountered the same lock. This was a publication failure, after model fitting and scoring; the original failed log is retained at logs/runs/20261028-001548_p3_all/.

operations/resume_f3_volume.py is an explicitly post-run operational adapter. It retries permission errors only for the two dashboard files, and defers a persistently locked sidecar to the next update instead of aborting inference. It calls the original frozen volume function, never registration or fitting. The registered Python source, protocol, checkpoints, inference formula and G-C remain unchanged. The adapter records its own hash and verifies the bytes of the 132 previously completed rows before/after recovery. Its audit record is outputs/p3/volume_recovery.json; the original protocol lock remains valid.

The completed LOWO result is G-C failed: M2-Sa improved band RMSE at one of four wells, and macro coverage was 52.38% (nominal 80%) and 60.91% (nominal 90%). Neither gate condition passes. Volume completion cannot change this verdict.

Recovery completed at 06:50:44 +07:00 on 28 October, exit 0. The same dashboard lock recurred once during inference and the retry succeeded. All 649 interior inlines and eight section previews were produced; the previously completed rows and G-C file were preserved byte-for-byte. The frozen code/data/environment check still passes. The independent artifact audit is recorded in outputs/p3/completion_checks.json.

Protected artifacts and execution constraints

Do not run 04_wavelet_tie.py or 09_fit_warp_prior_f3.py. Do not overwrite outputs/wavelets.npz or outputs/p2/warp_prior_f3.json. P3 estimates its own fold-local quantities in its own output namespace. The frozen P1/P2/P2r YAML content is preserved; LF checkout rules retain the original locked bytes on Windows. No other user's GPU processes are stopped.

Procedural assistance and provenance

Applied the local scientific-critical-thinking, scikit-learn, statistical-analysis, and scientific-visualization skills for review guidance. Their use does not constitute independent empirical validation of this code.

Kassis, T., Agarwal, V., He, Y., Patel, D., & Brueckner, A. M. (2026). Scientific Agent Skills: A Library of Procedural Knowledge for Research Agents. arXiv:2609.00065. DOI: 10.48550/arXiv.2609.00065. Metadata verified against the current arXiv record (v2) on 27 October 2026; no journal reference is listed there.