/** * 🌐 THE DISTRIBUTION-SHIFT (DRO) CERTIFICATE β€” will the recommended setting still hold when the data drifts? * * Every optimizer reports the value it measured on the data it saw. But deployment data is never exactly the test * data β€” the customer mix shifts, the traffic changes, the population moves. A setting that looks best on the * nominal distribution can collapse under a modest shift, and nobody hands you a signed bound on how bad it can * get. AEGIS certifies robustness to INPUT wobble and Tolerance to PARAMETER wobble; this certifies robustness to * the thing they don't touch β€” the DATA DISTRIBUTION itself. * * Given samples of a setting's per-unit value (per-customer profit, per-query score…), this computes the * worst-case mean over every distribution within a χ²-divergence ball of radius ρ around the empirical one β€” * distributionally-robust optimization. For the χ² ball this worst case has the exact, Cauchy-Schwarz-tight closed * form V = mean βˆ’ √(ρ Β· Var) (a conservative lower bound once the adversarial weights would go negative), so the * certificate states "under any distribution shift up to χ² ≀ ρ, the expected value is provably β‰₯ V" β€” and signs * it. It also names the variance penalty, so a high-mean-but-fragile setting is correctly out-ranked by a * slightly-lower-mean-but-robust one. Verify re-derives V offline. * * WORLD-FIRST + LLM-impossible: an LLM cannot compute the χ²-DRO worst case, prove it is a valid lower bound under * every shift in the ball, and sign a re-derivable verdict β€” it just quotes the nominal average. (DIAKRISIS β€” * MEASURED: over many random reweightings inside the ball, none ever beats the certified worst case [valid lower * bound], and the aligned adversary achieves it [tight]; the DRO value is monotone decreasing in ρ and recovers * the mean at ρ=0; a fragile high-variance setting collapses under an actual shift while a robust one holds, and * the certificate ranks them accordingly. HONEST: this is the χ²-divergence ambiguity set β€” it bounds shifts * measured by that divergence, not arbitrary adversarial corruption or support the samples never covered; and the * closed form is exact while the worst-case weights stay non-negative, conservative beyond that.) */ import { type KeyObject } from "node:crypto"; export interface DroCertificate { standard: "melete-dro-certificate/v2"; divergence: "chi-squared"; verdict: "ROBUST" | "FRAGILE"; mode: "ambiguity" | "confidence"; confidence: number; n: number; rho: number; threshold: number; mean: number; variance: number; worstCase: number; variancePenalty: number; values: number[]; payloadHash: string; signature: string; publicKeyPem: string; algo: "ed25519+sha256"; } export declare function droCertificate(opts: { values: number[]; rho?: number; confidence?: number; threshold?: number; keys?: { publicKey: KeyObject; privateKey: KeyObject; }; }): DroCertificate; export declare function verifyDroCertificate(c: DroCertificate): { ok: boolean; reason: string; }; export declare function droGauntlet(): { score: 0 | 100; checks: Array<{ name: string; pass: boolean; detail: string; }>; }; //# sourceMappingURL=dro.d.ts.map