@cogitator-ai/evals 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +159 -40
- package/dist/calibrate-judge.d.ts +53 -0
- package/dist/calibrate-judge.d.ts.map +1 -0
- package/dist/calibrate-judge.js +114 -0
- package/dist/calibrate-judge.js.map +1 -0
- package/dist/comparison-stats.d.ts +104 -0
- package/dist/comparison-stats.d.ts.map +1 -0
- package/dist/comparison-stats.js +179 -0
- package/dist/comparison-stats.js.map +1 -0
- package/dist/datasets/dataset.d.ts.map +1 -1
- package/dist/datasets/dataset.js +3 -27
- package/dist/datasets/dataset.js.map +1 -1
- package/dist/eval-comparison.d.ts +30 -10
- package/dist/eval-comparison.d.ts.map +1 -1
- package/dist/eval-comparison.js +73 -103
- package/dist/eval-comparison.js.map +1 -1
- package/dist/eval-suite.d.ts +33 -0
- package/dist/eval-suite.d.ts.map +1 -1
- package/dist/eval-suite.js +81 -2
- package/dist/eval-suite.js.map +1 -1
- package/dist/index.d.ts +21 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/metrics/g-eval.d.ts +29 -0
- package/dist/metrics/g-eval.d.ts.map +1 -0
- package/dist/metrics/g-eval.js +89 -0
- package/dist/metrics/g-eval.js.map +1 -0
- package/dist/metrics/index.d.ts +3 -1
- package/dist/metrics/index.d.ts.map +1 -1
- package/dist/metrics/index.js +1 -0
- package/dist/metrics/index.js.map +1 -1
- package/dist/metrics/judge-prompt.d.ts +31 -0
- package/dist/metrics/judge-prompt.d.ts.map +1 -0
- package/dist/metrics/judge-prompt.js +90 -0
- package/dist/metrics/judge-prompt.js.map +1 -0
- package/dist/metrics/llm-judge.d.ts +96 -9
- package/dist/metrics/llm-judge.d.ts.map +1 -1
- package/dist/metrics/llm-judge.js +265 -120
- package/dist/metrics/llm-judge.js.map +1 -1
- package/dist/metrics/types.d.ts +25 -0
- package/dist/metrics/types.d.ts.map +1 -1
- package/dist/metrics/types.js.map +1 -1
- package/dist/options.d.ts +4 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +9 -0
- package/dist/options.js.map +1 -0
- package/dist/pairwise.d.ts +53 -0
- package/dist/pairwise.d.ts.map +1 -0
- package/dist/pairwise.js +118 -0
- package/dist/pairwise.js.map +1 -0
- package/dist/reporters/comparison.d.ts +24 -0
- package/dist/reporters/comparison.d.ts.map +1 -0
- package/dist/reporters/comparison.js +290 -0
- package/dist/reporters/comparison.js.map +1 -0
- package/dist/reporters/format.d.ts +21 -0
- package/dist/reporters/format.d.ts.map +1 -1
- package/dist/reporters/format.js +31 -0
- package/dist/reporters/format.js.map +1 -1
- package/dist/reporters/github.d.ts.map +1 -1
- package/dist/reporters/github.js +1 -16
- package/dist/reporters/github.js.map +1 -1
- package/dist/reporters/html-format.d.ts +11 -0
- package/dist/reporters/html-format.d.ts.map +1 -0
- package/dist/reporters/html-format.js +111 -0
- package/dist/reporters/html-format.js.map +1 -0
- package/dist/reporters/html.d.ts +12 -0
- package/dist/reporters/html.d.ts.map +1 -0
- package/dist/reporters/html.js +119 -0
- package/dist/reporters/html.js.map +1 -0
- package/dist/reporters/index.d.ts +20 -6
- package/dist/reporters/index.d.ts.map +1 -1
- package/dist/reporters/index.js +15 -4
- package/dist/reporters/index.js.map +1 -1
- package/dist/reporters/markdown.d.ts +15 -0
- package/dist/reporters/markdown.d.ts.map +1 -0
- package/dist/reporters/markdown.js +67 -0
- package/dist/reporters/markdown.js.map +1 -0
- package/dist/runs/compare.d.ts +103 -0
- package/dist/runs/compare.d.ts.map +1 -0
- package/dist/runs/compare.js +208 -0
- package/dist/runs/compare.js.map +1 -0
- package/dist/runs/index.d.ts +9 -0
- package/dist/runs/index.d.ts.map +1 -0
- package/dist/runs/index.js +5 -0
- package/dist/runs/index.js.map +1 -0
- package/dist/runs/json.d.ts +11 -0
- package/dist/runs/json.d.ts.map +1 -0
- package/dist/runs/json.js +58 -0
- package/dist/runs/json.js.map +1 -0
- package/dist/runs/run.d.ts +44 -0
- package/dist/runs/run.d.ts.map +1 -0
- package/dist/runs/run.js +136 -0
- package/dist/runs/run.js.map +1 -0
- package/dist/runs/schema.d.ts +504 -0
- package/dist/runs/schema.d.ts.map +1 -0
- package/dist/runs/schema.js +171 -0
- package/dist/runs/schema.js.map +1 -0
- package/dist/runs/store.d.ts +57 -0
- package/dist/runs/store.d.ts.map +1 -0
- package/dist/runs/store.js +146 -0
- package/dist/runs/store.js.map +1 -0
- package/dist/schema.d.ts +16 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +17 -0
- package/dist/schema.js.map +1 -1
- package/dist/stats/bootstrap.d.ts +22 -0
- package/dist/stats/bootstrap.d.ts.map +1 -0
- package/dist/stats/bootstrap.js +34 -0
- package/dist/stats/bootstrap.js.map +1 -0
- package/dist/stats/correlation.d.ts +11 -0
- package/dist/stats/correlation.d.ts.map +1 -0
- package/dist/stats/correlation.js +42 -0
- package/dist/stats/correlation.js.map +1 -0
- package/dist/stats/effect-size.d.ts +7 -0
- package/dist/stats/effect-size.d.ts.map +1 -0
- package/dist/stats/effect-size.js +17 -0
- package/dist/stats/effect-size.js.map +1 -0
- package/dist/stats/holm.d.ts +7 -0
- package/dist/stats/holm.d.ts.map +1 -0
- package/dist/stats/holm.js +21 -0
- package/dist/stats/holm.js.map +1 -0
- package/dist/stats/index.d.ts +10 -2
- package/dist/stats/index.d.ts.map +1 -1
- package/dist/stats/index.js +7 -1
- package/dist/stats/index.js.map +1 -1
- package/dist/stats/mcnemar.d.ts +9 -0
- package/dist/stats/mcnemar.d.ts.map +1 -1
- package/dist/stats/mcnemar.js +27 -13
- package/dist/stats/mcnemar.js.map +1 -1
- package/dist/stats/normal.d.ts +5 -0
- package/dist/stats/normal.d.ts.map +1 -0
- package/dist/stats/normal.js +19 -0
- package/dist/stats/normal.js.map +1 -0
- package/dist/stats/precision.d.ts +12 -0
- package/dist/stats/precision.d.ts.map +1 -0
- package/dist/stats/precision.js +29 -0
- package/dist/stats/precision.js.map +1 -0
- package/dist/stats/random.d.ts +6 -0
- package/dist/stats/random.d.ts.map +1 -0
- package/dist/stats/random.js +25 -0
- package/dist/stats/random.js.map +1 -0
- package/dist/stats/ranks.d.ts +5 -0
- package/dist/stats/ranks.d.ts.map +1 -0
- package/dist/stats/ranks.js +24 -0
- package/dist/stats/ranks.js.map +1 -0
- package/dist/stats/t-test.d.ts +4 -0
- package/dist/stats/t-test.d.ts.map +1 -1
- package/dist/stats/t-test.js +9 -3
- package/dist/stats/t-test.js.map +1 -1
- package/dist/stats/wilcoxon.d.ts +19 -0
- package/dist/stats/wilcoxon.d.ts.map +1 -0
- package/dist/stats/wilcoxon.js +70 -0
- package/dist/stats/wilcoxon.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { pairedTTest } from './stats/t-test.js';
|
|
2
|
+
import { mcnemarExact, mcnemarsTest } from './stats/mcnemar.js';
|
|
3
|
+
import { wilcoxonSignedRank } from './stats/wilcoxon.js';
|
|
4
|
+
import { bootstrapCI } from './stats/bootstrap.js';
|
|
5
|
+
import { cohensD } from './stats/effect-size.js';
|
|
6
|
+
import { holm } from './stats/holm.js';
|
|
7
|
+
import { mean } from './stats/percentiles.js';
|
|
8
|
+
import { pairedDifference } from './stats/precision.js';
|
|
9
|
+
import { truncateInput } from './reporters/format.js';
|
|
10
|
+
/** A score moves when it changes by more than this */
|
|
11
|
+
export const SCORE_EPSILON = 1e-9;
|
|
12
|
+
function isBinary(scores) {
|
|
13
|
+
return scores.every((s) => s === 0 || s === 1);
|
|
14
|
+
}
|
|
15
|
+
/** Below this many discordant pairs McNemar's test is exact */
|
|
16
|
+
const EXACT_MCNEMAR_BELOW = 25;
|
|
17
|
+
function pairedTest(baseline, challenger, continuous, binaryAllowed) {
|
|
18
|
+
const direction = Math.sign(mean(differencesOf(baseline, challenger)));
|
|
19
|
+
if (baseline.length < 2)
|
|
20
|
+
return { test: 'none', pValue: 1, direction };
|
|
21
|
+
if (binaryAllowed && isBinary(baseline) && isBinary(challenger)) {
|
|
22
|
+
let b = 0;
|
|
23
|
+
let c = 0;
|
|
24
|
+
for (let i = 0; i < baseline.length; i++) {
|
|
25
|
+
if (baseline[i] === 1 && challenger[i] === 0)
|
|
26
|
+
b++;
|
|
27
|
+
if (baseline[i] === 0 && challenger[i] === 1)
|
|
28
|
+
c++;
|
|
29
|
+
}
|
|
30
|
+
return b + c < EXACT_MCNEMAR_BELOW
|
|
31
|
+
? { test: 'mcnemar-exact', pValue: mcnemarExact(b, c).pValue, direction }
|
|
32
|
+
: { test: 'mcnemar', pValue: mcnemarsTest(b, c).pValue, direction };
|
|
33
|
+
}
|
|
34
|
+
if (continuous === 'wilcoxon') {
|
|
35
|
+
const { statistic, n, pValue } = wilcoxonSignedRank(baseline, challenger);
|
|
36
|
+
return { test: 'wilcoxon', pValue, direction: Math.sign((n * (n + 1)) / 4 - statistic) };
|
|
37
|
+
}
|
|
38
|
+
return { test: 't', pValue: pairedTTest(baseline, challenger).pValue, direction };
|
|
39
|
+
}
|
|
40
|
+
/** Challenger minus baseline per case, without float noise */
|
|
41
|
+
function differencesOf(baseline, challenger) {
|
|
42
|
+
return challenger.map((score, i) => pairedDifference(score, baseline[i]));
|
|
43
|
+
}
|
|
44
|
+
function meanOrNaN(values) {
|
|
45
|
+
return values.length === 0 ? Number.NaN : mean(values);
|
|
46
|
+
}
|
|
47
|
+
function compareMetric(name, baselineScores, challengerScores, config) {
|
|
48
|
+
const differences = differencesOf(baselineScores, challengerScores);
|
|
49
|
+
const { low, high } = bootstrapCI(differences, {
|
|
50
|
+
confidence: 1 - config.alpha,
|
|
51
|
+
...(config.seed !== undefined && { seed: `${String(config.seed)}:${name}` }),
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
baseline: meanOrNaN(baselineScores),
|
|
55
|
+
challenger: meanOrNaN(challengerScores),
|
|
56
|
+
n: baselineScores.length,
|
|
57
|
+
difference: meanOrNaN(differences),
|
|
58
|
+
ci: { low, high },
|
|
59
|
+
effectSize: cohensD(differences),
|
|
60
|
+
...pairedTest(baselineScores, challengerScores, config.test, true),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Compares each metric on its paired scores, then adjusts the p-values with Holm's correction
|
|
65
|
+
* across the metrics and decides each metric's winner
|
|
66
|
+
*/
|
|
67
|
+
export function compareMetrics(paired, config) {
|
|
68
|
+
const names = [...paired.keys()];
|
|
69
|
+
const compared = names.map((name) => {
|
|
70
|
+
const [baselineScores, challengerScores] = paired.get(name);
|
|
71
|
+
return compareMetric(name, baselineScores, challengerScores, config);
|
|
72
|
+
});
|
|
73
|
+
const adjusted = holm(compared.map((metric) => metric.pValue));
|
|
74
|
+
const decided = {};
|
|
75
|
+
for (const [at, name] of names.entries()) {
|
|
76
|
+
const { direction, ...metric } = compared[at];
|
|
77
|
+
const significant = adjusted[at] < config.alpha && direction !== 0;
|
|
78
|
+
decided[name] = {
|
|
79
|
+
...metric,
|
|
80
|
+
adjustedPValue: adjusted[at],
|
|
81
|
+
significant,
|
|
82
|
+
winner: !significant ? 'tie' : direction > 0 ? 'challenger' : 'baseline',
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return decided;
|
|
86
|
+
}
|
|
87
|
+
export function compareResource(baseline, challenger, config) {
|
|
88
|
+
const difference = meanOrNaN(differencesOf(baseline, challenger));
|
|
89
|
+
const { test, pValue, direction } = pairedTest(baseline, challenger, config.test, false);
|
|
90
|
+
const significant = pValue < config.alpha && direction !== 0;
|
|
91
|
+
return {
|
|
92
|
+
baseline: meanOrNaN(baseline),
|
|
93
|
+
challenger: meanOrNaN(challenger),
|
|
94
|
+
n: baseline.length,
|
|
95
|
+
difference,
|
|
96
|
+
test,
|
|
97
|
+
pValue,
|
|
98
|
+
significant,
|
|
99
|
+
winner: !significant ? 'tie' : direction < 0 ? 'challenger' : 'baseline',
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/** The side more metrics name as their winner, a tie when as many name each */
|
|
103
|
+
export function determineOverallWinner(metrics) {
|
|
104
|
+
let baselineWins = 0;
|
|
105
|
+
let challengerWins = 0;
|
|
106
|
+
for (const mc of Object.values(metrics)) {
|
|
107
|
+
if (mc.winner === 'baseline')
|
|
108
|
+
baselineWins++;
|
|
109
|
+
if (mc.winner === 'challenger')
|
|
110
|
+
challengerWins++;
|
|
111
|
+
}
|
|
112
|
+
if (challengerWins > baselineWins)
|
|
113
|
+
return 'challenger';
|
|
114
|
+
if (baselineWins > challengerWins)
|
|
115
|
+
return 'baseline';
|
|
116
|
+
return 'tie';
|
|
117
|
+
}
|
|
118
|
+
/** The names of the metrics any trial of the cases was scored on, in the order first seen */
|
|
119
|
+
export function scoredMetricNames(results) {
|
|
120
|
+
const names = new Set();
|
|
121
|
+
for (const r of results) {
|
|
122
|
+
for (const trial of r.trials ?? [r]) {
|
|
123
|
+
for (const s of trial.scores)
|
|
124
|
+
names.add(s.name);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return names;
|
|
128
|
+
}
|
|
129
|
+
/** A case's score of a metric: the mean over its trials the metric scored, none when it scored none */
|
|
130
|
+
export function caseScore(result, metricName) {
|
|
131
|
+
if (!result)
|
|
132
|
+
return undefined;
|
|
133
|
+
const trials = result.trials ?? [result];
|
|
134
|
+
if (trials.every((trial) => trial.error !== undefined))
|
|
135
|
+
return undefined;
|
|
136
|
+
const scores = trials.flatMap((trial) => trial.error !== undefined
|
|
137
|
+
? [0]
|
|
138
|
+
: trial.scores.filter((s) => s.name === metricName).map((s) => s.score));
|
|
139
|
+
return scores.length === 0 ? undefined : mean(scores);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The scores of a metric for each pair, side by side, with the index of the pair. A case one side
|
|
143
|
+
* errored on counts as a 0 for that side, since a target that fails loses the case, and a case
|
|
144
|
+
* both sides errored on is left out, telling nothing about either
|
|
145
|
+
*/
|
|
146
|
+
function pairedCaseScores(pairs, metricName) {
|
|
147
|
+
const scored = [];
|
|
148
|
+
for (const [index, [first, second]] of pairs.entries()) {
|
|
149
|
+
const before = caseScore(first, metricName);
|
|
150
|
+
const after = caseScore(second, metricName);
|
|
151
|
+
if (before === undefined && after === undefined)
|
|
152
|
+
continue;
|
|
153
|
+
scored.push({ index, before: before ?? 0, after: after ?? 0 });
|
|
154
|
+
}
|
|
155
|
+
return scored;
|
|
156
|
+
}
|
|
157
|
+
/** The scores of a metric for each pair, side by side, as `pairedCaseScores` pairs them */
|
|
158
|
+
export function pairedScores(pairs, metricName) {
|
|
159
|
+
const scored = pairedCaseScores(pairs, metricName);
|
|
160
|
+
return [scored.map((s) => s.before), scored.map((s) => s.after)];
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* The cases whose score of a metric rose or fell from the first side to the second by more than
|
|
164
|
+
* `SCORE_EPSILON`, the largest moves first
|
|
165
|
+
*/
|
|
166
|
+
export function caseChanges(pairs, metricName, inputOf) {
|
|
167
|
+
const improved = [];
|
|
168
|
+
const regressed = [];
|
|
169
|
+
for (const { index, before, after } of pairedCaseScores(pairs, metricName)) {
|
|
170
|
+
const delta = pairedDifference(after, before);
|
|
171
|
+
if (Math.abs(delta) <= SCORE_EPSILON)
|
|
172
|
+
continue;
|
|
173
|
+
const change = { index, input: truncateInput(inputOf(index)), before, after, delta };
|
|
174
|
+
(delta > 0 ? improved : regressed).push(change);
|
|
175
|
+
}
|
|
176
|
+
const byMove = (a, b) => Math.abs(b.delta) - Math.abs(a.delta) || a.index - b.index;
|
|
177
|
+
return { improved: improved.sort(byMove), regressed: regressed.sort(byMove) };
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=comparison-stats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comparison-stats.js","sourceRoot":"","sources":["../src/comparison-stats.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;A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AC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC;IACD,MAAM,MAAM,GAAG,CAAC,CAAa,EAAE,CAAa,EAAE,EAAE,CAC9C,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;IAC7D,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;AAChF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataset.d.ts","sourceRoot":"","sources":["../../src/datasets/dataset.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"dataset.d.ts","sourceRoot":"","sources":["../../src/datasets/dataset.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAK1C,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAE7C,OAAO;IAIP,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO;WAI1B,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;WAKzC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKpD,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,KAAK,IAAI,SAAS,QAAQ,EAAE,CAE/B;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC;IAavC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,OAAO,GAAG,OAAO;IAI7C;;;OAGG;IACH,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAO,GAAG,OAAO;IAYpE,yEAAyE;IACzE,OAAO,CAAC,OAAO,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAO,GAAG,OAAO;CAG3D"}
|
package/dist/datasets/dataset.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EvalCaseSchema } from '../schema.js';
|
|
2
2
|
import { loadJsonl } from './jsonl-loader.js';
|
|
3
3
|
import { loadCsv } from './csv-loader.js';
|
|
4
|
+
import { seededRandom } from '../stats/random.js';
|
|
4
5
|
export class Dataset {
|
|
5
6
|
_cases;
|
|
6
7
|
constructor(cases) {
|
|
@@ -47,12 +48,12 @@ export class Dataset {
|
|
|
47
48
|
return new Dataset([]);
|
|
48
49
|
}
|
|
49
50
|
const count = Math.min(n, this._cases.length);
|
|
50
|
-
const indices = shuffled(Array.from({ length: this._cases.length }, (_, i) => i),
|
|
51
|
+
const indices = shuffled(Array.from({ length: this._cases.length }, (_, i) => i), seededRandom(options.seed));
|
|
51
52
|
return new Dataset(indices.slice(0, count).map((i) => this._cases[i]));
|
|
52
53
|
}
|
|
53
54
|
/** The cases in random order, the same order on every run with `seed` */
|
|
54
55
|
shuffle(options = {}) {
|
|
55
|
-
return new Dataset(shuffled([...this._cases],
|
|
56
|
+
return new Dataset(shuffled([...this._cases], seededRandom(options.seed)));
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
/** Shuffles `items` in place (Fisher-Yates) with the random numbers `random` gives */
|
|
@@ -63,29 +64,4 @@ function shuffled(items, random) {
|
|
|
63
64
|
}
|
|
64
65
|
return items;
|
|
65
66
|
}
|
|
66
|
-
/**
|
|
67
|
-
* `Math.random`, or a mulberry32 generator seeded by the hash of `seed`, so every number and
|
|
68
|
-
* string seeds its own sequence (`1.2` and `1.7`, `-1` and `2 ** 32 - 1` alike)
|
|
69
|
-
*/
|
|
70
|
-
function randomOf(seed) {
|
|
71
|
-
if (seed === undefined)
|
|
72
|
-
return Math.random;
|
|
73
|
-
let state = hashSeed(String(seed));
|
|
74
|
-
return () => {
|
|
75
|
-
state = (state + 0x6d2b79f5) >>> 0;
|
|
76
|
-
let t = state;
|
|
77
|
-
t = Math.imul(t ^ (t >>> 15), t | 1);
|
|
78
|
-
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
|
|
79
|
-
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
/** FNV-1a of a string, to seed the generator */
|
|
83
|
-
function hashSeed(seed) {
|
|
84
|
-
let hash = 0x811c9dc5;
|
|
85
|
-
for (let i = 0; i < seed.length; i++) {
|
|
86
|
-
hash ^= seed.charCodeAt(i);
|
|
87
|
-
hash = Math.imul(hash, 0x01000193) >>> 0;
|
|
88
|
-
}
|
|
89
|
-
return hash;
|
|
90
|
-
}
|
|
91
67
|
//# sourceMappingURL=dataset.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataset.js","sourceRoot":"","sources":["../../src/datasets/dataset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"dataset.js","sourceRoot":"","sources":["../../src/datasets/dataset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,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AG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACzC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAE,EAAE,KAAK,CAAC,CAAC,CAAE,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -2,6 +2,8 @@ import type { EvalTarget, EvalSuiteResult } from './eval-suite.js';
|
|
|
2
2
|
import type { MetricFn, StatisticalMetricFn } from './metrics/types.js';
|
|
3
3
|
import type { JudgeConfigInput } from './schema.js';
|
|
4
4
|
import { Dataset } from './datasets/index.js';
|
|
5
|
+
import type { PairwiseOptions, PairwiseResult } from './pairwise.js';
|
|
6
|
+
import type { ComparisonWinner, MetricComparison, ResourceComparison } from './comparison-stats.js';
|
|
5
7
|
export interface EvalComparisonOptions {
|
|
6
8
|
dataset: Dataset;
|
|
7
9
|
targets: {
|
|
@@ -10,6 +12,7 @@ export interface EvalComparisonOptions {
|
|
|
10
12
|
};
|
|
11
13
|
metrics?: MetricFn[];
|
|
12
14
|
statisticalMetrics?: StatisticalMetricFn[];
|
|
15
|
+
/** The judge of LLM metrics and of `pairwise`, on both sides */
|
|
13
16
|
judge?: JudgeConfigInput;
|
|
14
17
|
concurrency?: number;
|
|
15
18
|
timeout?: number;
|
|
@@ -19,6 +22,23 @@ export interface EvalComparisonOptions {
|
|
|
19
22
|
* mean over its scored trials, and `passAtK()` statistical metrics see every trial
|
|
20
23
|
*/
|
|
21
24
|
trials?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Significance level, 0.05 by default. A metric is significant when its p-value, adjusted with
|
|
27
|
+
* Holm's correction across the compared metrics, is below it, and its `ci` covers `1 - alpha`
|
|
28
|
+
*/
|
|
29
|
+
alpha?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Test of metrics that are not binary, and of latency and cost: `t` (paired t-test, the
|
|
32
|
+
* default) or `wilcoxon` (Wilcoxon signed-rank). Binary metrics always take McNemar's test
|
|
33
|
+
*/
|
|
34
|
+
test?: 't' | 'wilcoxon';
|
|
35
|
+
/** Seeds the bootstrap of each metric's `ci`, so the intervals are the same on every run */
|
|
36
|
+
seed?: number | string;
|
|
37
|
+
/**
|
|
38
|
+
* Asks the judge which side answered each case better, both ways round, into
|
|
39
|
+
* `result.pairwise`. Needs `judge`, run by `judge.cogitator` or an agent target's `cogitator`
|
|
40
|
+
*/
|
|
41
|
+
pairwise?: PairwiseOptions;
|
|
22
42
|
onProgress?: (progress: {
|
|
23
43
|
target: string;
|
|
24
44
|
completed: number;
|
|
@@ -29,25 +49,25 @@ export interface EvalComparisonRunOptions {
|
|
|
29
49
|
/** Cancels both runs; `run()` rejects with the signal's reason */
|
|
30
50
|
signal?: AbortSignal;
|
|
31
51
|
}
|
|
32
|
-
export
|
|
33
|
-
baseline: number;
|
|
34
|
-
challenger: number;
|
|
35
|
-
/** Cases compared: those at least one side scored, an errored side counting as a 0 */
|
|
36
|
-
n: number;
|
|
37
|
-
pValue: number;
|
|
38
|
-
significant: boolean;
|
|
39
|
-
winner: 'baseline' | 'challenger' | 'tie';
|
|
40
|
-
}
|
|
52
|
+
export type { ComparisonTest, ComparisonWinner, MetricComparison, ResourceComparison, } from './comparison-stats.js';
|
|
41
53
|
export interface ComparisonResult {
|
|
42
54
|
summary: {
|
|
43
|
-
winner:
|
|
55
|
+
winner: ComparisonWinner;
|
|
44
56
|
metrics: Record<string, MetricComparison>;
|
|
57
|
+
/** Milliseconds per case, the mean over the answered trials of a case */
|
|
58
|
+
latency: ResourceComparison;
|
|
59
|
+
/** USD per case, over the cases both sides reported usage on. Absent when none did */
|
|
60
|
+
cost?: ResourceComparison;
|
|
45
61
|
};
|
|
46
62
|
baseline: EvalSuiteResult;
|
|
47
63
|
challenger: EvalSuiteResult;
|
|
64
|
+
/** The judge's pairwise verdicts, with the `pairwise` option */
|
|
65
|
+
pairwise?: PairwiseResult;
|
|
48
66
|
}
|
|
49
67
|
export declare class EvalComparison {
|
|
50
68
|
private readonly opts;
|
|
69
|
+
private readonly config;
|
|
70
|
+
private readonly pairwiseJudge?;
|
|
51
71
|
constructor(opts: EvalComparisonOptions);
|
|
52
72
|
run(options?: EvalComparisonRunOptions): Promise<ComparisonResult>;
|
|
53
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eval-comparison.d.ts","sourceRoot":"","sources":["../src/eval-comparison.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"eval-comparison.d.ts","sourceRoot":"","sources":["../src/eval-comparison.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAoB,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,KAAK,EAAwC,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEvF,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAUlE,OAAO,KAAK,EAEV,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE;QACP,QAAQ,EAAE,UAAU,CAAC;QACrB,UAAU,EAAE,UAAU,CAAC;KACxB,CAAC;IACF,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;IACrB,kBAAkB,CAAC,EAAE,mBAAmB,EAAE,CAAC;IA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AQ,CAAC,MAAM,CAAuB;IAC9C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAe;gBAElC,IAAI,EAAE,qBAAqB;IAiCjC,GAAG,CAAC,OAAO,GAAE,wBAA6B,GAAG,OAAO,CAAC,gBAAgB,CAAC;CA8F7E"}
|
package/dist/eval-comparison.js
CHANGED
|
@@ -1,77 +1,37 @@
|
|
|
1
1
|
import { EvalSuite } from './eval-suite.js';
|
|
2
|
-
import { EvalComparisonConfigSchema } from './schema.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { EvalComparisonConfigSchema, JudgeConfigSchema } from './schema.js';
|
|
3
|
+
import { judgeContextFor } from './metrics/llm-judge.js';
|
|
4
|
+
import { judgePairwise } from './pairwise.js';
|
|
5
|
+
import { parseOptions } from './options.js';
|
|
5
6
|
import { mean } from './stats/percentiles.js';
|
|
6
|
-
|
|
7
|
-
return scores.every((s) => s === 0 || s === 1);
|
|
8
|
-
}
|
|
9
|
-
function compareMetric(baselineScores, challengerScores) {
|
|
10
|
-
const baselineMean = mean(baselineScores);
|
|
11
|
-
const challengerMean = mean(challengerScores);
|
|
12
|
-
const n = baselineScores.length;
|
|
13
|
-
if (n < 2) {
|
|
14
|
-
return {
|
|
15
|
-
baseline: baselineMean,
|
|
16
|
-
challenger: challengerMean,
|
|
17
|
-
n,
|
|
18
|
-
pValue: 1,
|
|
19
|
-
significant: false,
|
|
20
|
-
winner: 'tie',
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
const binary = isBinary(baselineScores) && isBinary(challengerScores);
|
|
24
|
-
let pValue;
|
|
25
|
-
let significant;
|
|
26
|
-
if (binary) {
|
|
27
|
-
let bCorrect_cIncorrect = 0;
|
|
28
|
-
let bIncorrect_cCorrect = 0;
|
|
29
|
-
for (let i = 0; i < n; i++) {
|
|
30
|
-
if (baselineScores[i] === 1 && challengerScores[i] === 0)
|
|
31
|
-
bCorrect_cIncorrect++;
|
|
32
|
-
if (baselineScores[i] === 0 && challengerScores[i] === 1)
|
|
33
|
-
bIncorrect_cCorrect++;
|
|
34
|
-
}
|
|
35
|
-
const result = mcnemarsTest(bCorrect_cIncorrect, bIncorrect_cCorrect);
|
|
36
|
-
pValue = result.pValue;
|
|
37
|
-
significant = result.significant;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
const result = pairedTTest(baselineScores, challengerScores);
|
|
41
|
-
pValue = result.pValue;
|
|
42
|
-
significant = result.significant;
|
|
43
|
-
}
|
|
44
|
-
let winner = 'tie';
|
|
45
|
-
if (significant) {
|
|
46
|
-
winner = challengerMean > baselineMean ? 'challenger' : 'baseline';
|
|
47
|
-
}
|
|
48
|
-
return { baseline: baselineMean, challenger: challengerMean, n, pValue, significant, winner };
|
|
49
|
-
}
|
|
50
|
-
function determineOverallWinner(metrics) {
|
|
51
|
-
let baselineWins = 0;
|
|
52
|
-
let challengerWins = 0;
|
|
53
|
-
for (const mc of Object.values(metrics)) {
|
|
54
|
-
if (mc.winner === 'baseline')
|
|
55
|
-
baselineWins++;
|
|
56
|
-
if (mc.winner === 'challenger')
|
|
57
|
-
challengerWins++;
|
|
58
|
-
}
|
|
59
|
-
if (challengerWins > baselineWins)
|
|
60
|
-
return 'challenger';
|
|
61
|
-
if (baselineWins > challengerWins)
|
|
62
|
-
return 'baseline';
|
|
63
|
-
return 'tie';
|
|
64
|
-
}
|
|
7
|
+
import { compareMetrics, compareResource, determineOverallWinner, pairedScores, scoredMetricNames, } from './comparison-stats.js';
|
|
65
8
|
export class EvalComparison {
|
|
66
9
|
opts;
|
|
10
|
+
config;
|
|
11
|
+
pairwiseJudge;
|
|
67
12
|
constructor(opts) {
|
|
68
|
-
|
|
13
|
+
this.config = parseOptions(EvalComparisonConfigSchema, {
|
|
69
14
|
concurrency: opts.concurrency,
|
|
70
15
|
timeout: opts.timeout,
|
|
71
16
|
retries: opts.retries,
|
|
72
17
|
trials: opts.trials,
|
|
73
|
-
|
|
18
|
+
alpha: opts.alpha,
|
|
19
|
+
test: opts.test,
|
|
20
|
+
seed: opts.seed,
|
|
21
|
+
pairwise: opts.pairwise,
|
|
22
|
+
}, 'EvalComparison');
|
|
74
23
|
this.opts = opts;
|
|
24
|
+
if (this.config.pairwise) {
|
|
25
|
+
if (!opts.judge)
|
|
26
|
+
throw new Error('Pairwise judging requires a judge config');
|
|
27
|
+
const judgeConfig = JudgeConfigSchema.parse(opts.judge);
|
|
28
|
+
const cogitator = judgeConfig.cogitator ??
|
|
29
|
+
(opts.targets.baseline.cogitator ?? opts.targets.challenger.cogitator);
|
|
30
|
+
if (!cogitator) {
|
|
31
|
+
throw new Error('Pairwise judging needs a Cogitator to run the judge: pass judge.cogitator, or use an agent target');
|
|
32
|
+
}
|
|
33
|
+
this.pairwiseJudge = judgeContextFor(cogitator, judgeConfig);
|
|
34
|
+
}
|
|
75
35
|
}
|
|
76
36
|
async run(options = {}) {
|
|
77
37
|
const { dataset, targets, metrics, statisticalMetrics, judge, concurrency, timeout, retries, trials, onProgress, } = this.opts;
|
|
@@ -103,59 +63,69 @@ export class EvalComparison {
|
|
|
103
63
|
baselineSuite.run({ signal: options.signal }),
|
|
104
64
|
challengerSuite.run({ signal: options.signal }),
|
|
105
65
|
]);
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
const metricComparisons = {};
|
|
116
|
-
for (const name of metricNames) {
|
|
117
|
-
const [baselineScores, challengerScores] = pairedScores(baselineResult, challengerResult, name);
|
|
118
|
-
metricComparisons[name] = compareMetric(baselineScores, challengerScores);
|
|
66
|
+
const pairs = casePairs(baselineResult, challengerResult);
|
|
67
|
+
const paired = new Map();
|
|
68
|
+
for (const name of scoredMetricNames([
|
|
69
|
+
...baselineResult.results,
|
|
70
|
+
...challengerResult.results,
|
|
71
|
+
])) {
|
|
72
|
+
paired.set(name, pairedScores(pairs, name));
|
|
119
73
|
}
|
|
74
|
+
const metricComparisons = compareMetrics(paired, this.config);
|
|
75
|
+
const latency = compareResource(...pairedResource(baselineResult, challengerResult, caseLatency), this.config);
|
|
76
|
+
const [baselineCost, challengerCost] = pairedResource(baselineResult, challengerResult, caseCost);
|
|
77
|
+
const cost = baselineCost.length > 0
|
|
78
|
+
? compareResource(baselineCost, challengerCost, this.config)
|
|
79
|
+
: undefined;
|
|
80
|
+
const pairwise = this.pairwiseJudge && this.config.pairwise
|
|
81
|
+
? await judgePairwise(baselineResult, challengerResult, this.pairwiseJudge, this.config.pairwise, this.config.concurrency, options.signal)
|
|
82
|
+
: undefined;
|
|
120
83
|
return {
|
|
121
84
|
summary: {
|
|
122
85
|
winner: determineOverallWinner(metricComparisons),
|
|
123
86
|
metrics: metricComparisons,
|
|
87
|
+
latency,
|
|
88
|
+
...(cost && { cost }),
|
|
124
89
|
},
|
|
125
90
|
baseline: baselineResult,
|
|
126
91
|
challenger: challengerResult,
|
|
92
|
+
...(pairwise && { pairwise }),
|
|
127
93
|
};
|
|
128
94
|
}
|
|
129
95
|
}
|
|
130
|
-
/**
|
|
131
|
-
function
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
96
|
+
/** The trials of a case that answered */
|
|
97
|
+
function answeredTrials(result) {
|
|
98
|
+
return (result.trials ?? [result]).filter((trial) => trial.error === undefined);
|
|
99
|
+
}
|
|
100
|
+
/** A case's latency: the mean duration of its answered trials, none when none answered */
|
|
101
|
+
function caseLatency(result) {
|
|
102
|
+
const answered = answeredTrials(result);
|
|
103
|
+
return answered.length === 0 ? undefined : mean(answered.map((trial) => trial.duration));
|
|
104
|
+
}
|
|
105
|
+
/** A case's cost: the mean cost of its answered trials that reported usage */
|
|
106
|
+
function caseCost(result) {
|
|
107
|
+
const costs = answeredTrials(result).flatMap((trial) => trial.usage === undefined ? [] : [trial.usage.cost]);
|
|
108
|
+
return costs.length === 0 ? undefined : mean(costs);
|
|
141
109
|
}
|
|
142
|
-
/**
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
*/
|
|
147
|
-
function pairedScores(baseline, challenger, metricName) {
|
|
148
|
-
const scoreOf = (result, at) => caseScore(result.results[at], metricName);
|
|
149
|
-
const baselineScores = [];
|
|
150
|
-
const challengerScores = [];
|
|
110
|
+
/** A per-case figure of both sides, over the cases both have it for */
|
|
111
|
+
function pairedResource(baseline, challenger, figure) {
|
|
112
|
+
const baselineValues = [];
|
|
113
|
+
const challengerValues = [];
|
|
151
114
|
for (let at = 0; at < baseline.results.length; at++) {
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
if (b === undefined && c === undefined)
|
|
115
|
+
const challengerResult = challenger.results[at];
|
|
116
|
+
if (!challengerResult)
|
|
155
117
|
continue;
|
|
156
|
-
|
|
157
|
-
|
|
118
|
+
const b = figure(baseline.results[at]);
|
|
119
|
+
const c = figure(challengerResult);
|
|
120
|
+
if (b === undefined || c === undefined)
|
|
121
|
+
continue;
|
|
122
|
+
baselineValues.push(b);
|
|
123
|
+
challengerValues.push(c);
|
|
158
124
|
}
|
|
159
|
-
return [
|
|
125
|
+
return [baselineValues, challengerValues];
|
|
126
|
+
}
|
|
127
|
+
/** The cases of the two runs side by side, by position */
|
|
128
|
+
function casePairs(baseline, challenger) {
|
|
129
|
+
return baseline.results.map((result, at) => [result, challenger.results[at]]);
|
|
160
130
|
}
|
|
161
131
|
//# sourceMappingURL=eval-comparison.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eval-comparison.js","sourceRoot":"","sources":["../src/eval-comparison.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"eval-comparison.js","sourceRoot":"","sources":["../src/eval-comparison.ts"],"names":[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