From 4700764a3a3ab2a2d30a8e7de9ee891d97a10c3c Mon Sep 17 00:00:00 2001 From: ruv Date: Sun, 31 May 2026 12:12:20 -0400 Subject: [PATCH] diag(proof): characterize cross-microarch divergence on FAIL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a divergence report (count + fraction outside tolerance, per-feature breakdown, worst offenders) so we can tell a few branch-flip elements from a pervasive regression. The CI tolerance gate failed with max|d|=0.85 / maxrel=345 — far beyond FP rounding — so we need to see WHICH feature elements diverge structurally on the Azure runner. --- archive/v1/data/proof/verify.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/archive/v1/data/proof/verify.py b/archive/v1/data/proof/verify.py index 2eea2599..7ffc276c 100644 --- a/archive/v1/data/proof/verify.py +++ b/archive/v1/data/proof/verify.py @@ -588,6 +588,35 @@ def main(): print(f" Status: {match_status}") print() + if not hash_match and max_abs_dev is not None: + block_sizes = [56, 56, 55, 9, 64, 128] # per-frame feature layout + block_names = ["amp_mean", "amp_var", "phase_diff", "corr", "doppler", "psd"] + frame_len = sum(block_sizes) + tol = TOLERANCE_ATOL + TOLERANCE_RTOL * np.abs(ref_vec) + outside = diff > tol + n_out = int(outside.sum()) + print( + f" DIVERGENCE: {n_out}/{computed_vector.size} outside tol " + f"({100.0 * n_out / computed_vector.size:.4f}%) " + f"max|d|={max_abs_dev:.3e} maxrel={max_rel_dev:.3e}" + ) + if n_out: + wf = np.where(outside)[0] % frame_len + bounds = np.cumsum([0] + block_sizes) + parts = [] + for bi, name in enumerate(block_names): + c = int(((wf >= bounds[bi]) & (wf < bounds[bi + 1])).sum()) + if c: + parts.append(f"{name}={c}") + print(f" by feature: {', '.join(parts)}") + for w in np.argsort(diff)[::-1][:4]: + b = int(np.searchsorted(bounds, int(w) % frame_len, side="right")) - 1 + print( + f" worst idx {int(w)} ({block_names[b]}): " + f"ref={ref_vec[int(w)]:.6g} got={computed_vector[int(w)]:.6g}" + ) + print() + # --------------------------------------------------------------- # Step 4: Audit (if requested or always in full mode) # ---------------------------------------------------------------