/** * Scoring — weighted aggregation, multi-trial metrics, and verdicts. */ import type { GraderResult } from "../graders/types.js"; export interface MultiTrialMetrics { perTrialPassRate: number; passAtK: number; passToTheK: number; k: number; } export interface StimulusScore { stimulusName: string; trialResults: GraderResult[][]; aggregateScore: number; multiTrial: MultiTrialMetrics; unscored: boolean; flaky: boolean; flakinessPercent: number; } export interface SkillScore { skillName: string; stimulusScores: StimulusScore[]; overallScore: number; overallMultiTrial: MultiTrialMetrics; passed: boolean; } /** Returns true when a threshold is a finite number in the supported [0, 1] range. */ export declare function isValidThreshold(threshold: number): boolean; /** * Resolve whether a graded result counts as a pass. * * When a threshold is configured, the verdict is driven by the aggregate * (possibly weighted) score — `score >= threshold` — so reporters and * `vally grade` agree with pass@k and the eval-level verdict. Without a * threshold, it falls back to the binary all-graders-passed flag. * * This is the single source of truth for the per-trial pass rule; the plan * summarizer, the reporters, and `vally grade` MUST use it so the glyphs, * counts, pass@k, and verdicts never disagree. */ export declare function resolveGradePass(grade: { passed: boolean; score: number; }, threshold: number | undefined): boolean; /** * Unbiased pass@k estimator (Chen et al., 2021 — Codex paper). * pass@k = 1 - C(n-c, k) / C(n, k) * where n = total trials, c = successes, k = target attempts. * * More accurate than the naive 1-(1-p)^k at small sample sizes (k=3..10), * which is exactly the regime evals operate in. */ export declare function passAtK(n: number, c: number, k: number): number; /** * Naive pass@k for comparison/testing. * Formula: 1 - (1 - p)^k where p = per-trial pass rate. */ export declare function passAtKNaive(perTrialPassRate: number, k: number): number; /** * Compute pass^k: probability that ALL k trials succeed. * Formula: p^k where p = per-trial pass rate. */ export declare function passToTheK(perTrialPassRate: number, k: number): number; /** Compute multi-trial metrics from a set of trial pass/fail results. */ export declare function computeMultiTrialMetrics(trialPassed: boolean[]): MultiTrialMetrics; /** Compute a StimulusScore from trial summaries. */ export declare function computeStimulusScore(stimulusName: string, trialGrades: Array<{ grade: GraderResult; passed: boolean; }>, hasGraders: boolean): StimulusScore; /** * Aggregate per-stimulus scores into a per-skill score. * Skill-level multi-trial metrics are the mean of per-stimulus metrics — * NOT a pool of raw trial outcomes across different stimuli. */ export declare function computeSkillScore(skillName: string, stimulusScores: StimulusScore[], threshold: number): SkillScore; //# sourceMappingURL=scorer.d.ts.map