/** * SemanticDeterminismGate — the P1 cross-fleet determinism harness for the * learned-semantic novelty advisory (scope 2026-05-23_holoembed-semantic-encoder, P1). * * THE DECISION THIS GATE MAKES: the trigram novelty guard is RECEIPT-BINDING because it * is perfectly deterministic. The learned-semantic layer (SemanticNoveltyEncoder) is * ADVISORY ONLY until proven reproducible across the heterogeneous fleet — a learned model * introduces floating-point non-determinism (CPU/BLAS/quantization differences between * machines), and a receipt that cannot replay identically forever is not a receipt. This * module produces the EVIDENCE that decides advisory → receipt-binding promotion. * * THE HONEST FALLBACK IS BAKED IN: a verdict from a SINGLE machine is `insufficient-evidence`, * never `byte-identical` — you cannot prove cross-fleet reproducibility from one machine. The * gate only returns `byte-identical` (→ receipt-binding-eligible) when ≥2 DISTINCT machines * independently produce identical fingerprints at the same precision. Any disagreement, or * any same-machine instability, → `divergent` (stays advisory). This is a graceful degrade, * not a failure: if the fleet can't reproduce it, the trigram guard remains the receipt * binding and the semantic layer stays a review signal (per scope §Honest risks). * * HOW THE FLEET USES IT: each machine runs `buildDeterminismManifest({ machineLabel })`, * which embeds a fixed probe set N times (verifying same-machine stability) and emits a * portable manifest of machine-INDEPENDENT fingerprints (sha256 of the quantized vector — * the quantization absorbs sub-precision jitter, the hash catches real divergence). Collect * the manifests from ≥2 machines + CI, feed them to `assessDeterminismGate(manifests)`, and * the pure verdict decides. Fingerprints are pure functions of (model, text, precision) by * construction, so the comparison is exact and the gate logic is testable without the model. */ import { SEMANTIC_NOVELTY_MODEL } from './SemanticNoveltyEncoder'; export declare const DETERMINISM_MANIFEST_VERSION: 1; /** Decimal places the embedding is rounded to before hashing — absorbs sub-epsilon FP jitter. */ export declare const DETERMINISM_DEFAULT_PRECISION = 6; /** Same-machine repeats per probe text — verifies run-to-run stability on one machine. */ export declare const DETERMINISM_DEFAULT_REPEATS = 3; /** * Fixed, ORDERED probe set — the manifest hashes these in this exact order, so the same texts * must be compared across machines. Spans the engine's live claim domains (topology, geometry, * number theory) plus an unrelated control, matching the labeled eval set's coverage. */ export declare const DETERMINISM_PROBE_TEXTS: ReadonlyArray; /** * Canonical token for one vector component at a fixed precision. Rounds to `precision` decimals * and normalizes negative zero, so `-0.0000004` and `+0.0000001` both become the same `0.000000` * token — sub-precision FP jitter cannot change the fingerprint, but a real difference does. */ export declare function quantizeToken(x: number, precision: number): string; /** * Machine-INDEPENDENT fingerprint of an embedding vector at a fixed precision. * Pure: sha256 over `modelId|precision|`. Two machines that produce * the same vector (to `precision` decimals) get byte-identical fingerprints by construction. */ export declare function vectorFingerprint(vector: ReadonlyArray, precision?: number): string; export interface DeterminismProbeEntry { text: string; /** Machine-independent fingerprint of the (quantized) embedding. */ fingerprint: string; /** True iff all same-machine repeats produced a byte-identical vector. */ sameMachineStable: boolean; } export interface DeterminismManifest { manifestVersion: typeof DETERMINISM_MANIFEST_VERSION; modelId: typeof SEMANTIC_NOVELTY_MODEL; /** Identifier for the machine that produced this manifest (NOT part of any fingerprint). */ machineLabel: string; precision: number; dim: number; repeats: number; /** True iff every probe entry was same-machine stable across its repeats. */ sameMachineStable: boolean; entries: ReadonlyArray; } export interface BuildDeterminismManifestOptions { /** Identifier for this machine (e.g. os.hostname() + arch). Required — the gate needs ≥2 distinct. */ machineLabel: string; precision?: number; repeats?: number; texts?: ReadonlyArray; } /** * Build this machine's determinism manifest by embedding each probe text `repeats` times and * recording the machine-independent fingerprint plus whether the repeats were byte-identical. * Async (runs the local model). The emitted manifest is the portable artifact the fleet compares. */ export declare function buildDeterminismManifest(options: BuildDeterminismManifestOptions): Promise; export interface ManifestComparison { /** False when the two manifests describe different model/precision/dim/text-sets (not comparable). */ comparable: boolean; reason?: string; /** True iff comparable AND every probe fingerprint matches. */ identical: boolean; machineA: string; machineB: string; mismatchedTexts: ReadonlyArray; } /** Pure pairwise comparison of two manifests. No model required. */ export declare function compareDeterminismManifests(a: DeterminismManifest, b: DeterminismManifest): ManifestComparison; export type DeterminismVerdict = 'insufficient-evidence' | 'incomparable' | 'unstable' | 'divergent' | 'byte-identical'; export interface DeterminismGateAssessment { verdict: DeterminismVerdict; /** * The promotion decision. ONLY `byte-identical` across ≥2 distinct machines is eligible. * Everything else keeps the semantic layer ADVISORY and the trigram guard receipt-binding. */ receiptBindingEligible: boolean; machineCount: number; machineLabels: ReadonlyArray; modelId: typeof SEMANTIC_NOVELTY_MODEL; precision: number | null; /** Texts that diverged across machines (for `divergent`). */ divergentTexts: ReadonlyArray; notes: string; } /** * PURE verdict over a set of fleet manifests. The honest fallback is structural: a single * machine can never reach `byte-identical` — promotion requires ≥2 DISTINCT machines whose * fingerprints all match and whose runs were all same-machine stable. No model required. */ export declare function assessDeterminismGate(manifests: ReadonlyArray): DeterminismGateAssessment; /** Raw (un-quantized) embedding manifest — the shape emitted by scripts/.../determinism-raw.mjs. */ export interface RawVectorManifest { machineLabel: string; modelId: typeof SEMANTIC_NOVELTY_MODEL; dim: number; /** probe text → its L2-normalized embedding on this machine. */ vectors: Readonly>>; } /** * Default tolerance: 1e-5. Well above the measured cross-fleet float32 jitter (~1e-7) and far * below any semantically meaningful embedding delta — so it absorbs ULP noise without masking a * real model/version change. Tune per measured fleet jitter before promotion. */ export declare const DEFAULT_DETERMINISM_TOLERANCE = 0.00001; export interface RawToleranceComparison { comparable: boolean; reason?: string; withinTolerance: boolean; maxAbsDelta: number; machineA: string; machineB: string; /** Probes whose max component delta exceeded ε. */ exceedingTexts: ReadonlyArray; } /** Pure: compare two raw manifests component-wise; agree iff every |Δ| ≤ ε. */ export declare function compareRawWithinTolerance(a: RawVectorManifest, b: RawVectorManifest, epsilon?: number): RawToleranceComparison; export interface RawToleranceGateAssessment { verdict: 'insufficient-evidence' | 'incomparable' | 'divergent' | 'within-tolerance'; receiptBindingEligible: boolean; epsilon: number; maxAbsDelta: number; machineCount: number; machineLabels: ReadonlyArray; modelId: typeof SEMANTIC_NOVELTY_MODEL; exceedingTexts: ReadonlyArray; notes: string; } /** * PURE tolerance verdict over raw-vector manifests from the fleet. Same honest fallback as the * fingerprint gate — a single machine is `insufficient-evidence`, never eligible. Eligible only * when ≥2 DISTINCT machines all agree to within ε. This is the robust promotion gate the scope * recommends over fixed-precision hashing (no boundary-straddle). */ export declare function assessRawToleranceGate(manifests: ReadonlyArray, epsilon?: number): RawToleranceGateAssessment; //# sourceMappingURL=SemanticDeterminismGate.d.ts.map