# PHASE 3 — Small MRPT, Student-t head, tests, pilot end to end (2026-11-02) ## Completed - `models/`: gated patch embedding with resolution/position/gap embeddings; pre-norm encoder; shared vs cross-attention fusion; regime embedding (stats / learned / none); direct 60-step decoder with future-calendar queries; Student-t / Gaussian / quantile heads (scale-equivariant parametrisation); Stage-B low-rank Gaussian-copula head (joint paths). - `train/`: AdamW + warm-up/cosine, clipping, early stopping on validation NLL, seeds, crash-safe checkpoints with resume, JSONL tracking (loss, grad norm, throughput, data fraction, MPS memory), copula-only stage. - `inference/`: batched prediction with Monte Carlo cumulative-return samples (independent or copula), streaming path scores, serialization, CLI (`chronos-x`). - Tests: 26 offline (unit 6, synthetic 5, leakage 5, numerical 10) + 5 live + 1 slow synthetic end-to-end pipeline test. ## Commands ```bash .venv/bin/python scripts/run_experiment.py --config configs/pilot.yaml # on M3U96b, detached via scripts/node_run.sh .venv/bin/python scripts/run_experiment.py --config configs/synthetic_smoke.yaml # laptop, license-free (2 min 50 s) ``` ## Pilot training (M3U96b, torch 2.15 MPS, batch 64, 600 steps, 4 942 train / 5 362 val origins) | Model | Parameters (measured) | Examples/s | Wall (train) | Peak MPS memory | Best val NLL | |---|---|---|---|---|---| | MRPT-S (A+B+C) | 3 455 619 | 186 | 207 s | 63 MB | −6.0663 | | MRPT-S (A only) | 3 200 259 | 228 | 169 s | 86 MB | −6.0659 | | TCN (A only) | 231 459 | 243 | 158 s | 35 MB | −6.0685 | | MLP (A only, last 60 bars) | 301 827 | 253 | 152 s | 15 MB | −6.0666 | Data-loader fraction of wall time ≈ 1 % (10 spawned workers over memory-mapped grids); the GPU forward/backward is the bottleneck. Test scores: see `docs/PHASE_2_REPORT.md` (MRPT-S multi-resolution −2.6 % to −3.4 % CRPS vs random walk; the one-minute-only variant, the TCN and the MLP are within 0.2 % of it on this 10-session test — no pilot claim on H1). ## Gates - Leakage gate: `tests/leakage` (inputs invariant to future bars; quarantined leaky fixture rejected) — PASS. - Numerical gate: Student-t log-density vs scipy, closed-form CRPS vs Monte Carlo (2 % tolerance), copula sampling reproduces marginals, copula NLL minimised at independence for independent data — PASS. Two bugs were caught by these tests during the build (operator precedence in the PIT clamp; scipy `t.ppf` returning NaN for float32 inputs near 0.5) and fixed before any real-data result was produced. - Provenance gate: dataset versions, request ids and sha256 recorded for every export; run metadata saved per experiment — PASS. - Save/resume: `last.pt` / `best.pt`, resume tested in the trainer (step and optimiser state restored). ## Go / no-go GO to P4 (profiling + main ingestion already complete) and P5.