Skip to content

Scoring Functions

Estimates the probability of at least one success in k attempts. Answers: “can the agent do this at all?”

Uses the unbiased combinatorial estimator (Chen et al., 2021):

pass@k = 1 - C(n-c, k) / C(n, k)
Parameter Type Description
n number Total number of trials run
c number Number of successful trials
k number Number of attempts to consider
function passAtK(n: number, c: number, k: number): number;

Example: 3 successes out of 5 trials → passAtK(5, 3, 5) = 1.0 (guaranteed at least one success since we already observed 3)

The simpler 1 - (1-p)^k formula. Available for comparison but not used in scoring — the unbiased estimator above is more accurate when K is small (which it always is in evals).

function passAtKNaive(perTrialPassRate: number, k: number): number;

Estimates the probability that all k trials succeed. Answers: “can I rely on this in production?”

pass^k = p^k
function passToTheK(perTrialPassRate: number, k: number): number;

Example: 80% pass rate, 5 trials → passToTheK(0.8, 5) = 0.328 (only 33% chance all 5 succeed)

Computes all multi-trial metrics from a set of trial pass/fail results.

function computeMultiTrialMetrics(trialPassed: boolean[]): MultiTrialMetrics;

This is what the pipeline reports. It calls passAtK(n, c, k) with k equal to the trial count, so the reported passAtK is 1 when any trial passed and 0 otherwise. To estimate pass@k for a smaller k, call passAtK directly.

Example:

computeMultiTrialMetrics([true, true, false, true, true]);
// → { perTrialPassRate: 0.8, passAtK: 1, passToTheK: 0.328, k: 5 }

Aggregates trial results into multi-trial metrics (pass@k, pass^k, pass rate, and flakiness detection) for a stimulus.

function computeStimulusScore(
stimulusName: string,
trialGrades: Array<{ grade: GraderResult; passed: boolean }>,
hasGraders: boolean,
): StimulusScore;
interface MultiTrialMetrics {
perTrialPassRate: number; // fraction of trials that passed
passAtK: number; // P(≥1 success in k trials)
passToTheK: number; // P(all k trials succeed)
k: number; // number of trials run
}
interface StimulusScore {
stimulusName: string;
trialResults: GraderResult[][]; // [trial][grader]
multiTrial: MultiTrialMetrics;
unscored: boolean; // true when no graders were configured
flaky: boolean; // true when 0 < passRate < 1
flakinessPercent: number; // minority outcome / total × 100
}

For interpretation guidance — including how verdicts and pass@k are reported — see Scoring concepts.