omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / docs / estimation / EST23_PROTOCOL_V1.md
| 1 | # EST-2 / EST-3 protocol v1: real-signal replay and calibration (pre-registered) |
| 2 | |
| 3 | Workstream: ARCH-0020 (belief / estimation layer). This protocol is frozen by the |
| 4 | commit that adds it. The freeze commit hash is written into every EST-2/EST-3 |
| 5 | receipt. Any change after that commit is a new protocol version, and the |
| 6 | result under v1 stays on record. |
| 7 | |
| 8 | ## 1. Signal and evidence |
| 9 | |
| 10 | - Signal: CPU thermal zone 0, `thermal_mc` first field, milli-degrees Celsius, |
| 11 | from `machine-state.ndjson` (1 Hz, `tools/r15_machine_state.sh`). |
| 12 | - Fit run (A): `evidence/R15/raw/20260929T020536Z-ad8e1f2ea4e4-silicon/machine-state.ndjson`. |
| 13 | - Held-out run (B): `evidence/R15/raw/20260929T025735Z-3e9e53be3358-silicon/machine-state.ndjson`. |
| 14 | - Before use, each file's SHA-256 must equal its line in that run's |
| 15 | `raw/SHA256SUMS`; otherwise the replay refuses to start. |
| 16 | - Disclosure: both runs were recorded on 2026-09-29 during R15, before this |
| 17 | workstream existed. As of the freeze no one has computed temperature |
| 18 | statistics from them for estimation purposes (the orchestrator looked at the |
| 19 | first line of run A to learn the field names). A read-only survey worker on |
| 20 | 2026-09-30 also reported descriptive facts: line counts 1953 / 2009, largest |
| 21 | gap about 1.13 s, zone 0 range 35.4 to 53.8 C, readings in 100 mC steps, |
| 22 | `spbm_uj` cumulative. No dynamics, residuals or noise levels were examined. |
| 23 | They are pre-existing evidence that has not been examined for this purpose, |
| 24 | not blind data in the CAL-0 sense. |
| 25 | - Load regime: a sample is "in trial" when its `t` lies inside a |
| 26 | begin/end pair of that run's `machine-state-marks.txt`, otherwise "idle". |
| 27 | |
| 28 | ## 2. Replay rules (EST-2) |
| 29 | |
| 30 | - One strictly causal forward pass per file, in file order. Each step uses only |
| 31 | observations at or before its own time. Test: running on the first k lines |
| 32 | must reproduce the first k outputs bit for bit, for k = 100, 500, 1000. |
| 33 | - Time. The raw `t` is parsed as integer seconds plus exactly nine fractional |
| 34 | digits (no floating-point parse) and is used only to compute the gap to the |
| 35 | previous sample. The gap is rounded to whole steps of 1 s, minimum 1 |
| 36 | (horizon = max(1, round(gap / 1 s))). The filter runs on a logical grid: |
| 37 | prior t_ns = 0, prediction t_ns = belief t_ns + horizon * 1e9, and the |
| 38 | observation record carries that same grid time. The wall-clock `t` stays in |
| 39 | the raw line, which the observation's evidence digest binds. |
| 40 | - A line that fails to parse, or has a non-finite or missing value, is a |
| 41 | missing observation. The filter coasts through it, and the replay counts and |
| 42 | reports it. It is never dropped silently. |
| 43 | Coasted steps contribute nothing to the fit likelihood or to any run B statistic. |
| 44 | - Every raw observation is preserved. The output stream records, for each |
| 45 | step, the observation record, the prediction record and the innovation record, |
| 46 | plus their digests. The raw input file is only read. |
| 47 | - Observation noise: the model's R (fitted, section 3) is the declared |
| 48 | observation noise. The source digest is SHA-256 of the text |
| 49 | `R15.machine-state.thermal_mc[0]`. The evidence digest is SHA-256 of the raw |
| 50 | line bytes, without the newline. |
| 51 | |
| 52 | ## 3. Models and fitting (on run A only) |
| 53 | |
| 54 | - M0, random walk: 1 state, temperature in mC. F = 1, H = 1, |
| 55 | Q = q * dt, R = r. |
| 56 | - M1, constant velocity: 2 states, temperature in mC and rate in mC/s. |
| 57 | F = [[1, dt], [0, 1]], H = [1, 0], |
| 58 | Q = q * [[dt^3/3, dt^2/2], [dt^2/2, dt]], R = r. |
| 59 | - Prior: x0 = [first valid observation, 0], P0 = diag(r, 1e6 mC^2/s^2) |
| 60 | (M0: P0 = r). |
| 61 | - Fit: maximise the Gaussian innovation log-likelihood on run A, excluding the |
| 62 | first 30 steps, over a fixed log grid. q runs over 10^k for |
| 63 | k = -3.0, -2.5, ..., 6.0 (19 values). r runs over 10^k for |
| 64 | k = 0.0, 0.25, ..., 6.0 (25 values). Ties go to the smaller q, then the |
| 65 | smaller r. The chosen (q, r) per model are written to a parameter file. |
| 66 | The parameter file's digest goes into the receipt. |
| 67 | - The fitting program opens run A only. The evaluation program takes the |
| 68 | parameter file and run B only. |
| 69 | |
| 70 | ## 4. Calibration statistics (EST-3, on run B) |
| 71 | |
| 72 | Burn-in: the first 30 steps are excluded. Then, for each model: |
| 73 | |
| 74 | 1. One-step coverage of the central 50 %, 80 % and 95 % predicted intervals |
| 75 | (|nu| <= z * sqrt(S), with z = 0.674490, 1.281552, 1.959964). Each is |
| 76 | reported with a Wilson 95 % interval. |
| 77 | 2. Mean NIS (for m = 1, the expected value is 1). |
| 78 | 3. Standardized bias: mean(nu) / sd(nu). |
| 79 | 4. Lag-1 autocorrelation of the normalized innovation nu / sqrt(S). The |
| 80 | Ljung-Box Q statistic at lag 10 is reported but is not a gate. |
| 81 | 5. Drift: 95 % coverage in each quarter of run B, by time. |
| 82 | 6. Regime: 95 % coverage for in-trial and for idle samples separately. |
| 83 | 7. Ten-step coverage: from each belief at step k, predict 10 steps ahead and |
| 84 | compare with the observation at step k + 10 when it exists. Report 95 % |
| 85 | coverage. |
| 86 | 8. Accuracy: mean log predictive density (Gaussian log score) and RMSE of the |
| 87 | one-step prediction. For comparison, the persistence baseline predicts the |
| 88 | last observation and reports its RMSE. |
| 89 | |
| 90 | ## 5. Pass rules |
| 91 | |
| 92 | A model is **calibrated** when all of the following hold on run B: |
| 93 | |
| 94 | - One-step coverage lies within these bands: |
| 95 | - 50 %: [0.46, 0.54] |
| 96 | - 80 %: [0.76, 0.84] |
| 97 | - 95 %: [0.93, 0.97] |
| 98 | - Mean NIS lies in [0.80, 1.25]. |
| 99 | - The absolute standardized bias is at most 0.10. |
| 100 | - The absolute lag-1 autocorrelation of the normalized innovation is at most 0.20. |
| 101 | - Every quarter's 95 % coverage lies in [0.90, 0.99]. |
| 102 | - Each regime with at least 100 samples has 95 % coverage in [0.90, 0.99]. |
| 103 | - Ten-step 95 % coverage lies in [0.90, 0.99]. |
| 104 | |
| 105 | The **selected** estimator is the simplest calibrated model (M0 before M1) |
| 106 | whose one-step log score is within 0.01 nats per step of the best calibrated |
| 107 | model's. |
| 108 | |
| 109 | `ESTIMATION_REAL_SIGNAL = PASS` when: |
| 110 | |
| 111 | - both files verify against SHA256SUMS; |
| 112 | - the replay completes; |
| 113 | - the prefix-invariance test holds; |
| 114 | - raw observations are preserved; |
| 115 | - the prediction then observation then innovation chain is recorded for every |
| 116 | step. |
| 117 | |
| 118 | `ESTIMATION_CALIBRATION = PASS` when at least one model is calibrated and its |
| 119 | one-step RMSE is no worse than persistence's. Otherwise the result is FAIL. |
| 120 | The FAIL is recorded with the statistics that failed and the most likely |
| 121 | failure class: wrong process noise, wrong observation noise, nonlinear |
| 122 | dynamics, nonstationarity, regime switching, quantization, sensor bias or |
| 123 | model misspecification. No estimator is promoted after a FAIL. |
| 124 | |
| 125 | ## 5a. Anticipated failure (stated before any run) |
| 126 | |
| 127 | Readings come in 100 mC steps. In quiet stretches this produces runs of |
| 128 | exactly-zero innovation, which can break the 50 % band and the lag-1 test when |
| 129 | the filter is confident. If v1 fails for that reason, the FAIL is recorded as |
| 130 | the quantization class and accepted. It is not a reason to widen bands or to |
| 131 | add a quantization-aware R under v1. |
| 132 | |
| 133 | ## 6. What this protocol does not allow |
| 134 | |
| 135 | - Developing or debugging the replay, fit or evaluation programs on run B. They |
| 136 | are built and debugged on run A and on synthetic data only; their commit hash |
| 137 | goes in the receipt. The first execution against run B is the recorded one. |
| 138 | Any second execution on run B is a new protocol version. |
| 139 | |
| 140 | - Refitting q or r on run B. |
| 141 | - Changing the grid, thresholds, burn-in, models or intervals after seeing any |
| 142 | run B statistic. |
| 143 | - Dropping outliers. |
| 144 | - Adding a model after the fact. A new model is protocol v2, and it is |
| 145 | evaluated on fresh data (section 7). |
| 146 | |
| 147 | ## 7. Stronger follow-up (EST-3b, optional) |
| 148 | |
| 149 | Collect a new 1 Hz thermal series after this freeze. Do this with a shell |
| 150 | reader of `/sys/class/thermal` only, never during a heavy run owned by another |
| 151 | session unless that regime is the declared target. Then evaluate the frozen |
| 152 | v1 parameters on it with the same rules. |