import type { Digest, HeldoutApproval, HeldoutAttempt, HeldoutCorpus, HeldoutPreregistration } from '../heldout/types.js'; /** * Staged D09 calibration preparation (#2611). The corpus, gold, split manifest, review template and native * templates are exactly the diagnostic ones for the same seed (the corpus module, and therefore the corpus * pin, is unchanged); only the preregistration, the v2 analysis, the calibration-phase approval form and the * per-phase dry run differ. The v1 diagnostic preparation remains available and unchanged. */ export declare function prepareD17StagedStudy(seed: string, moduleDigest: Digest, sourceDigests: Record): { preregistration: HeldoutPreregistration; analysis: { schemaVersion: string; protocol: { readonly schemaVersion: "decision-d17-protocol/v1"; readonly minimumPairs: 1200; readonly slices: readonly ["direct-facts", "multi-fact", "negation", "authority"]; readonly minimumPerSlice: 300; readonly interval: { readonly method: "newcombe-10"; readonly levelBps: 9500; readonly nonInferiorityMarginBps: -300; readonly benefitLowerExclusiveBps: 0; }; readonly brier: { readonly method: "percentile-bootstrap"; readonly levelBps: 9500; readonly seed: 2611; readonly resamples: 20000; readonly maximumUpperBps: 200; }; readonly risk: { readonly method: "wilson"; readonly levelBps: 9500; readonly maximumAcceptedErrorUpperBps: 500; readonly minimumCoverageLowerBps: 6000; }; readonly abstention: { readonly method: "newcombe-10"; readonly levelBps: 9500; readonly maximumUpperBps: 500; }; readonly maximumP95LatencyIncreaseMs: 15000; readonly acceptance: { readonly tieRule: "defer"; readonly disagreementMetric: "jensen-shannon-v1"; readonly maximumDisagreementBps: 1000; readonly minimumSuccessfulMembers: 3; readonly highAgreementWarningBps: 100; }; readonly economics: { readonly kind: "additional-cost-tolerance"; readonly positiveNetSavingsRequired: false; readonly separateTradeoffApprovalRequired: true; }; readonly native: { metric: "slice" | "tokens" | "cost" | "calibration" | "quality" | "risk-coverage" | "abstention" | "latency"; comparison: "delta-at-least" | "delta-at-most"; bound: number; minimumPairs: 1200; }[]; }; scope: string; calibration: { readonly schemaVersion: "decision-d17-calibration-protocol/v1"; readonly phaseSplits: readonly ["tuning", "calibration"]; readonly fitSplit: "calibration"; readonly method: "isotonic-pav-laplace-v1"; readonly smoothing: "laplace-1"; readonly minimumBlockN: 10; readonly calibrators: { readonly member: { readonly id: "d17-single-call-isotonic"; readonly version: "1"; readonly input: "single-call-yes-probability"; readonly requests: readonly ["champion", "member_1", "member_2", "member_3"]; }; readonly aggregate: { readonly id: "d17-three-sample-mean-isotonic"; readonly version: "1"; readonly input: "three-sample-mean-yes-probability"; readonly requests: readonly ["member_1", "member_2", "member_3"]; }; }; readonly application: { readonly champion: "member"; readonly challenger: "aggregate"; readonly tie: "defer"; readonly acceptance: "calibrated-yes-probability-not-0.5-and-native-aggregate-accept"; }; readonly metricsArm: { readonly member: "champion"; readonly aggregate: "challenger"; }; readonly qualificationMetrics: { readonly method: "slice-stratified-k-fold-out-of-fold"; readonly folds: 5; readonly assignment: "row-id-order-within-slice-modulo-folds"; readonly finalMapping: "full-calibration-split"; }; readonly profile: { readonly minimumTotalSamples: 380; readonly minimumPerSliceSamples: 95; readonly powerRule: null; readonly confidenceInterval: { readonly method: "wilson"; readonly level: 0.95; }; readonly maximumCalibrationError: 0.1; readonly maximumSelectiveRisk: 0.1; readonly expiresAfterDays: 30; }; readonly developmentReview: { readonly stage: "development"; readonly assessments: 40; readonly requiredFor: readonly ["phase-bundle", "calibration-fit", "calibration-registration", "test-scoring"]; readonly approvalBinding: "calibration-phase approvalReference cites the development review digest"; }; readonly promotion: { readonly studyDecision: "HOLD-or-ROLLBACK"; readonly route: "D09 PromotionEligibility + promoteChampionChallenger"; readonly requires: readonly ["locked-snapshot integrity gate PROMOTE", "statistical gate pass", "positive quality lower bound", "anchored extra-cost tradeoff approval", "D09 promotion eligibility"]; }; readonly calibrationSetBinding: "approval.calibration.calibrationArtifactDigest = heldoutDigest(decision-d17-calibration-set/v1)"; }; sourceDigests: Record; splitManifestDigest: `sha256:${string}`; nativeTemplatesDigest: `sha256:${string}`; }; approvalTemplate: { preregistrationDigest: `sha256:${string}`; budget: { calls: 24000; tokens: 96000000; usd: 8; }; calibration: { mode: string; phase: string; }; priceBound: { inputUsdPerMTok: number; outputUsdPerMTok: number; perRequestUsd: number; evidenceReferences: string[]; approvalReference: null; }; schemaVersion: string; approved: boolean; study: import("../heldout/types.js").Study; runId: null; reviewer: null; approvalReference: null; sourceCommit: null; exactHeadCi: null; stagingHost: string; stagingWorkspace: null; model: string; servedModel: string; region: null; credentialRef: null; credentialResolverDigest: null; corpusDigest: `sha256:${string}`; executionDigest: null; providerTermsReference: null; priorStudySpendUsd: null; priorPortfolioSpendUsd: null; }; dryRun: { schemaVersion: string; approvalCeilings: { calls: 24000; tokens: 96000000; usd: 8; }; phases: { calibration: { splits: string[]; rows: number; firstAttempts: number; worstCaseAttempts: number; }; test: { splits: string[]; rows: number; firstAttempts: number; worstCaseAttempts: number; }; }; missingInputs: string[]; providerCalls: number; syntheticOnly: boolean; subjects: number; splits: { readonly tuning: 200; readonly calibration: 400; readonly test: 1200; }; expected: { firstAttempts: number; retryRateBps: number; attempts: number; inputTokens: number; outputTokens: null; usd: number; costSource: string; }; worstCase: { attempts: number; totalTokens: number; reservedUsd: number; priceFloorUsdPerMTok: number; }; portfolioUsd: number; stopFraction: number; fitsStudyCapBeforeStop: boolean; sessionLimitMs: number; requiresResumableSessions: boolean; reviewAssessments: number; }; corpus: HeldoutCorpus; gold: import("./corpus.js").D17Gold; splitManifest: { schemaVersion: string; frozenAt: string; seed: string; allocation: string; familyIsolation: boolean; duplicatePayloads: number; splits: { [k: string]: { count: number; digest: `sha256:${string}`; members: { id: string; familyId: string; slice: string; inputDigest: `sha256:${string}`; }[]; }; }; }; nativeTemplates: { schemaVersion: string; approved: boolean; policy: { schemaVersion: string; id: string; version: string; mode: string; riskTiers: string[]; definition: import("../types.js").ArtifactPin; primitive: string; options: string[]; compatibleUncertaintyProfiles: string[]; requiredCapabilities: string[]; members: { id: string; memberType: string; definition: import("../types.js").ArtifactPin; binding: null; adapter: { id: string; version: string; }; model: { provider: string; backend: string; requested: string; pinnedVersion: string; }; primitive: string; uncertaintyProfile: string; requiredCapabilities: string[]; capabilities: string[]; calibration: null; samples: number; fallbackDepth: number; estimate: { attemptsPerSample: number; tokensPerAttempt: number; costMicrosPerAttempt: number; deadlineMsPerAttempt: number; }; approvalReference: null; }[]; aggregation: { algorithm: string; tieRule: "defer"; }; disagreement: { metric: "jensen-shannon-v1"; thresholdBps: 1000; onExceeded: string; }; acceptance: { minimumSuccessfulMembers: number; onInsufficientMembers: string; highAgreementWarningBps: 100; }; calibration: { requirement: string; }; ceilings: { members: number; attempts: number; deadlineMs: number; tokens: number; costMicros: number; concurrency: number; fallbackDepth: number; unknownCost: { rule: string; }; }; }; comparison: { schemaVersion: string; id: string; alias: null; champion: { aliasRevision: null; identityDigest: null; actualModel: string; binding: null; adapter: { id: string; version: string; }; calibration: null; ensemblePolicy: null; }; challenger: { identityDigest: null; actualModel: string; binding: null; adapter: { id: string; version: string; }; calibration: null; ensemblePolicy: null; }; inputSet: { id: string; digest: `sha256:${string}`; itemCount: number; frozenAt: string; purpose: string; }; pairedMetrics: { metric: "slice" | "tokens" | "cost" | "calibration" | "quality" | "risk-coverage" | "abstention" | "latency"; comparison: "delta-at-least" | "delta-at-most"; bound: number; minimumPairs: 1200; }[]; preregistration: { thresholdsDigest: `sha256:${string}`; registeredAt: string; holdoutAccessedAt: null; }; eligibilityId: null; evaluationIntegrityReport: { id: null; digest: null; }; approval: { reference: null; approvedAt: null; }; rollbackTarget: { aliasRevision: null; identityDigest: null; }; }; instructions: string; }; reviewTemplate: { schemaVersion: string; reviewer: null; preregistrationReview: null; finalDispositionReview: null; assessments: { assessmentId: string; rowId: string; slice: string; stage: string; inputDigest: `sha256:${string}`; payload: unknown; reviewedAt: null; goldAuditLabel: null; goldAmbiguousOrIncorrect: null; blindedResultAudit: null; rationale: null; }[]; instructions: string; }; guide: { schemaVersion: string; population: string; yes: string; no: string; authority: string; oracleAudit: string; invalidGold: string; timing: string; independence: string; }; }; export declare const D17_STAGED_BUDGET: Readonly<{ calls: 24000; tokens: 96000000; usd: 8; }>; /** Staged planning bounds: the same 7,200 first attempts, split into the calibration and test phases. */ export declare function d17StagedDryRun(): { schemaVersion: string; approvalCeilings: { calls: 24000; tokens: 96000000; usd: 8; }; phases: { calibration: { splits: string[]; rows: number; firstAttempts: number; worstCaseAttempts: number; }; test: { splits: string[]; rows: number; firstAttempts: number; worstCaseAttempts: number; }; }; missingInputs: string[]; providerCalls: number; syntheticOnly: boolean; subjects: number; splits: { readonly tuning: 200; readonly calibration: 400; readonly test: 1200; }; expected: { firstAttempts: number; retryRateBps: number; attempts: number; inputTokens: number; outputTokens: null; usd: number; costSource: string; }; worstCase: { attempts: number; totalTokens: number; reservedUsd: number; priceFloorUsdPerMTok: number; }; portfolioUsd: number; stopFraction: number; fitsStudyCapBeforeStop: boolean; sessionLimitMs: number; requiresResumableSessions: boolean; reviewAssessments: number; }; type PlanApproval = Pick; interface PhasePlan { rows: number; firstAttempts: number; maximumAttempts: number; maximumRequestEstimateTokens: number; reservedTokens: number; reservedUsdMicros: number; } /** * Worst-case reservations for both staged phases from the actual projected request bytes and the approval's price bound, * with every preregistered retry. The collector plans one phase at a time; this bounds the whole study before any spend. */ export declare function d17TwoPhasePlan(corpus: HeldoutCorpus, preregistration: HeldoutPreregistration, approval: PlanApproval): Promise<{ calibration: PhasePlan; test: PhasePlan; combined: { maximumAttempts: number; reservedTokens: number; reservedUsdMicros: number; }; }>; /** Both phases must fit the remaining collector allowance (the 80% stop thresholds net of prior charges). */ export declare function d17TwoPhaseFit(plan: Awaited>, allowance: { calls: number; tokens: number; usdMicros: number; }): { allowance: { calls: number; tokens: number; usdMicros: number; }; headroom: { calls: number; tokens: number; usdMicros: number; }; fits: boolean; }; /** A fresh ledger's allowance for an approval: the first approval's thresholds net of its attested prior spend floors. */ export declare function d17FreshAllowance(approval: HeldoutApproval): { calls: number; tokens: number; usdMicros: number; }; /** * The staged corpus is the diagnostic corpus for the same seed. Any attempt in the ledger on this corpus under another * preregistration (for example a diagnostic run that saw test rows) means the seed is spent: use a fresh seed. */ export declare function assertD17SeedUnused(attempts: readonly HeldoutAttempt[], approval: Pick): void; export {}; //# sourceMappingURL=staged.d.ts.map