@tangle-network/agent-bench 2.0.0 → 3.0.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/CHANGELOG.md +20 -0
- package/README.md +24 -2
- package/dist/adapters.d.ts +3 -3
- package/dist/adapters.js +3 -5
- package/dist/adapters.js.map +1 -1
- package/dist/benchmarks/_harness.d.ts +4 -4
- package/dist/benchmarks/_harness.js +5 -2
- package/dist/benchmarks/_harness.js.map +1 -1
- package/dist/benchmarks/aec-bench.d.ts +2 -2
- package/dist/benchmarks/aec-bench.js +49 -42
- package/dist/benchmarks/aec-bench.js.map +1 -1
- package/dist/benchmarks/agentbench.d.ts +2 -2
- package/dist/benchmarks/agentbench.js +41 -34
- package/dist/benchmarks/agentbench.js.map +1 -1
- package/dist/benchmarks/appworld.d.ts +4 -4
- package/dist/benchmarks/appworld.js +67 -53
- package/dist/benchmarks/appworld.js.map +1 -1
- package/dist/benchmarks/bfcl.d.ts +2 -2
- package/dist/benchmarks/bfcl.js +52 -44
- package/dist/benchmarks/bfcl.js.map +1 -1
- package/dist/benchmarks/cad-design.d.ts +2 -2
- package/dist/benchmarks/cad-design.js +53 -44
- package/dist/benchmarks/cad-design.js.map +1 -1
- package/dist/benchmarks/cadbench.d.ts +2 -2
- package/dist/benchmarks/cadbench.js +1 -1
- package/dist/benchmarks/cadgenbench.d.ts +2 -2
- package/dist/benchmarks/cadgenbench.js +1 -1
- package/dist/benchmarks/commit0.d.ts +2 -2
- package/dist/benchmarks/commit0.js +38 -31
- package/dist/benchmarks/commit0.js.map +1 -1
- package/dist/benchmarks/crag.d.ts +2 -2
- package/dist/benchmarks/crag.js +37 -32
- package/dist/benchmarks/crag.js.map +1 -1
- package/dist/benchmarks/dabstep.d.ts +2 -2
- package/dist/benchmarks/dabstep.js +41 -34
- package/dist/benchmarks/dabstep.js.map +1 -1
- package/dist/benchmarks/finresearchbench.d.ts +4 -4
- package/dist/benchmarks/finresearchbench.js +61 -48
- package/dist/benchmarks/finresearchbench.js.map +1 -1
- package/dist/benchmarks/finsearchcomp.d.ts +3 -3
- package/dist/benchmarks/finsearchcomp.js +54 -43
- package/dist/benchmarks/finsearchcomp.js.map +1 -1
- package/dist/benchmarks/frames.d.ts +2 -2
- package/dist/benchmarks/frames.js +66 -51
- package/dist/benchmarks/frames.js.map +1 -1
- package/dist/benchmarks/hotpotqa.d.ts +2 -2
- package/dist/benchmarks/hotpotqa.js +59 -47
- package/dist/benchmarks/hotpotqa.js.map +1 -1
- package/dist/benchmarks/humaneval.d.ts +3 -3
- package/dist/benchmarks/humaneval.js +39 -35
- package/dist/benchmarks/humaneval.js.map +1 -1
- package/dist/benchmarks/mcad-bench.d.ts +2 -2
- package/dist/benchmarks/mcad-bench.js +68 -56
- package/dist/benchmarks/mcad-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-bench.d.ts +2 -2
- package/dist/benchmarks/mcad-cq-bench.js +69 -57
- package/dist/benchmarks/mcad-cq-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-cq-golds.js +1 -1
- package/dist/benchmarks/mcad-cq-golds.js.map +1 -1
- package/dist/benchmarks/mcad-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-golds.js.map +1 -1
- package/dist/benchmarks/mind2web.d.ts +3 -3
- package/dist/benchmarks/mind2web.js +62 -49
- package/dist/benchmarks/mind2web.js.map +1 -1
- package/dist/benchmarks/nomiracl.d.ts +2 -2
- package/dist/benchmarks/nomiracl.js +43 -36
- package/dist/benchmarks/nomiracl.js.map +1 -1
- package/dist/benchmarks/open-rag-bench.d.ts +2 -2
- package/dist/benchmarks/open-rag-bench.js +37 -32
- package/dist/benchmarks/open-rag-bench.js.map +1 -1
- package/dist/benchmarks/programbench.d.ts +2 -2
- package/dist/benchmarks/programbench.js +28 -23
- package/dist/benchmarks/programbench.js.map +1 -1
- package/dist/benchmarks/rag-shared.d.ts +2 -2
- package/dist/benchmarks/rag-shared.js +15 -13
- package/dist/benchmarks/rag-shared.js.map +1 -1
- package/dist/benchmarks/ragbench.d.ts +2 -2
- package/dist/benchmarks/ragbench.js +34 -29
- package/dist/benchmarks/ragbench.js.map +1 -1
- package/dist/benchmarks/simpleqa.d.ts +2 -2
- package/dist/benchmarks/simpleqa.js +62 -51
- package/dist/benchmarks/simpleqa.js.map +1 -1
- package/dist/benchmarks/swe-bench.d.ts +4 -4
- package/dist/benchmarks/swe-bench.js +47 -41
- package/dist/benchmarks/swe-bench.js.map +1 -1
- package/dist/benchmarks/t2-ragbench.d.ts +2 -2
- package/dist/benchmarks/t2-ragbench.js +37 -32
- package/dist/benchmarks/t2-ragbench.js.map +1 -1
- package/dist/benchmarks/tau-bench-shared.d.ts +2 -2
- package/dist/benchmarks/tau-bench-shared.js +43 -36
- package/dist/benchmarks/tau-bench-shared.js.map +1 -1
- package/dist/benchmarks/tau2-bench.d.ts +2 -2
- package/dist/benchmarks/tau2-bench.js.map +1 -1
- package/dist/benchmarks/tau3-banking.d.ts +2 -2
- package/dist/benchmarks/tau3-banking.js.map +1 -1
- package/dist/benchmarks/terminal-bench.d.ts +2 -2
- package/dist/benchmarks/terminal-bench.js +29 -23
- package/dist/benchmarks/terminal-bench.js.map +1 -1
- package/dist/benchmarks/toollm.d.ts +2 -2
- package/dist/benchmarks/toollm.js +40 -34
- package/dist/benchmarks/toollm.js.map +1 -1
- package/dist/benchmarks/trata-hedge.d.ts +2 -2
- package/dist/benchmarks/trata-hedge.js +46 -38
- package/dist/benchmarks/trata-hedge.js.map +1 -1
- package/dist/benchmarks/types.d.ts +33 -63
- package/dist/benchmarks/types.js +36 -1
- package/dist/benchmarks/types.js.map +1 -0
- package/dist/benchmarks/webarena-verified.d.ts +2 -2
- package/dist/benchmarks/webarena-verified.js +29 -24
- package/dist/benchmarks/webarena-verified.js.map +1 -1
- package/dist/{cadbench-Byr5gO1M.js → cadbench-htzAmMaI.js} +39 -32
- package/dist/cadbench-htzAmMaI.js.map +1 -0
- package/dist/{cadgenbench-Tvk16YKT.js → cadgenbench-BLvEtnxU.js} +28 -22
- package/dist/cadgenbench-BLvEtnxU.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +667 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +9 -8
- package/dist/index.js +61 -56
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
- package/scripts/enterpriseops-gym-run.sh +82 -0
- package/scripts/grade-recorded-evidence.mjs +6 -6
- package/scripts/harvey-lab-judge.py +50 -0
- package/scripts/harvey-lab-run.sh +53 -0
- package/scripts/harvey-lab-sandbox.sh +21 -0
- package/scripts/healthbench-professional-run.sh +30 -0
- package/scripts/healthbench_professional_run.py +112 -0
- package/scripts/mlcr-run.sh +17 -0
- package/scripts/mlcr_run.py +133 -0
- package/scripts/prbench-run.sh +39 -0
- package/scripts/prbench_run.py +53 -0
- package/scripts/verify-packed-consumer.mjs +32 -27
- package/src/adapters.ts +5 -7
- package/src/benchmarks/_harness.test.mts +18 -1
- package/src/benchmarks/_harness.ts +12 -7
- package/src/benchmarks/aec-bench.test.mts +14 -14
- package/src/benchmarks/aec-bench.ts +62 -56
- package/src/benchmarks/agent-eval-contract.test.mts +38 -0
- package/src/benchmarks/agentbench.ts +44 -37
- package/src/benchmarks/appworld.test.mts +7 -7
- package/src/benchmarks/appworld.ts +88 -75
- package/src/benchmarks/bfcl.ts +60 -53
- package/src/benchmarks/cad-design.ts +34 -32
- package/src/benchmarks/cadbench.ts +34 -32
- package/src/benchmarks/cadgenbench.ts +30 -28
- package/src/benchmarks/commit0.test.mts +9 -9
- package/src/benchmarks/commit0.ts +50 -43
- package/src/benchmarks/crag.ts +45 -40
- package/src/benchmarks/dabstep-official.test.mts +8 -8
- package/src/benchmarks/dabstep.test.mts +11 -11
- package/src/benchmarks/dabstep.ts +47 -40
- package/src/benchmarks/external-adapters.test.mts +43 -44
- package/src/benchmarks/finresearchbench.ts +57 -47
- package/src/benchmarks/finsearchcomp.ts +72 -67
- package/src/benchmarks/frames.ts +76 -69
- package/src/benchmarks/hotpotqa.ts +69 -64
- package/src/benchmarks/humaneval.ts +37 -35
- package/src/benchmarks/mcad-bench.test.mts +30 -30
- package/src/benchmarks/mcad-bench.ts +66 -60
- package/src/benchmarks/mcad-cq-bench.ts +69 -63
- package/src/benchmarks/mcad-cq-golds.ts +1 -1
- package/src/benchmarks/mcad-cq.test.mts +40 -40
- package/src/benchmarks/mcad-golds.ts +1 -1
- package/src/benchmarks/mind2web.ts +66 -58
- package/src/benchmarks/nomiracl.ts +53 -46
- package/src/benchmarks/open-rag-bench.ts +47 -42
- package/src/benchmarks/programbench.test.mts +10 -10
- package/src/benchmarks/programbench.ts +38 -33
- package/src/benchmarks/rag-benchmarks.test.mts +31 -31
- package/src/benchmarks/rag-shared.ts +13 -16
- package/src/benchmarks/ragbench.ts +44 -39
- package/src/benchmarks/simpleqa.ts +78 -73
- package/src/benchmarks/swe-bench.test.mts +3 -3
- package/src/benchmarks/swe-bench.ts +66 -61
- package/src/benchmarks/t2-ragbench.ts +47 -42
- package/src/benchmarks/tau-bench-shared.ts +51 -44
- package/src/benchmarks/tau-pin.test.mts +1 -1
- package/src/benchmarks/tau2-bench.ts +2 -2
- package/src/benchmarks/tau3-banking.ts +2 -2
- package/src/benchmarks/terminal-bench.test.mts +3 -3
- package/src/benchmarks/terminal-bench.ts +41 -36
- package/src/benchmarks/toollm.ts +54 -47
- package/src/benchmarks/trata-hedge.ts +57 -52
- package/src/benchmarks/types.ts +70 -59
- package/src/benchmarks/webarena-verified.ts +49 -42
- package/src/cli.ts +74 -0
- package/src/corpus-replay.mts +9 -9
- package/src/examples/benchmark-matrix.mts +13 -10
- package/src/gate-cli.mts +5 -5
- package/src/gate.test.mts +14 -12
- package/src/gate.ts +23 -22
- package/src/index.ts +17 -11
- package/src/published.test.mts +534 -0
- package/src/published.ts +524 -0
- package/src/run-benchmarks-cli.mts +2 -2
- package/src/run-benchmarks.test.mts +58 -48
- package/src/run-benchmarks.ts +64 -57
- package/src/swe-bench-env.ts +6 -6
- package/src/worker.ts +1 -1
- package/dist/benchmarks/enterpriseops-gym.d.ts +0 -6
- package/dist/benchmarks/enterpriseops-gym.js +0 -236
- package/dist/benchmarks/enterpriseops-gym.js.map +0 -1
- package/dist/cadbench-Byr5gO1M.js.map +0 -1
- package/dist/cadgenbench-Tvk16YKT.js.map +0 -1
- package/fixtures/enterpriseops-gym.json +0 -103
- package/scripts/enterpriseops_gym_judge.py +0 -281
- package/src/benchmarks/enterpriseops-gym.test.mts +0 -77
- package/src/benchmarks/enterpriseops-gym.ts +0 -343
- package/src/eops-skills/address-every-subtask.md +0 -5
- package/src/eops-skills/exact-tools-and-args.md +0 -5
- package/src/eops-skills/full-sequence-to-goal.md +0 -5
- package/src/eops-skills/ground-every-value.md +0 -5
- package/src/eops-skills/honor-the-policies.md +0 -5
|
@@ -8,23 +8,23 @@
|
|
|
8
8
|
* and {response} (the student answer) placeholders. We faithfully REPLICATE the
|
|
9
9
|
* benchmark's judge — fill the template, run it under the record's system prompt
|
|
10
10
|
* via the pinned router (temperature 0), and parse the JSON the judge emits. The
|
|
11
|
-
* judge returns an `answer_score` field; 1/positive =
|
|
11
|
+
* judge returns an `answer_score` field; 1/positive = passed, else not.
|
|
12
12
|
* This matches the FinSearchComp leaderboard (Grok-4-web 68.9%).
|
|
13
13
|
*
|
|
14
14
|
* There is NO deterministic Tier-1 path here: the gold answer is prose with
|
|
15
15
|
* region-specific units, embedded tolerances ("允许1%的误差"), and multi-point
|
|
16
16
|
* scoring criteria. The benchmark intends its own LLM judge to be the arbiter,
|
|
17
17
|
* so the judge IS the score — fail loud on unparseable judge output (never
|
|
18
|
-
* default to
|
|
18
|
+
* default to passed).
|
|
19
19
|
*
|
|
20
20
|
* SCOPE: T2 (Simple_Historical_Lookup) + T3 (Complex_Historical_Investigation)
|
|
21
21
|
* are fully self-contained and supported. T1 (Time_Sensitive_Data_Fetching)
|
|
22
22
|
* needs a live market snapshot / akshare ground truth to fill the judge's
|
|
23
|
-
* {ground_truth} slot — it is SKIPPED in
|
|
23
|
+
* {ground_truth} slot — it is SKIPPED in loadAll and flagged in preflight.
|
|
24
24
|
* See {@link T1Seam}.
|
|
25
25
|
*
|
|
26
26
|
* Requires for a live run: network access to the GitHub-hosted dataset JSON and
|
|
27
|
-
* a TANGLE_API_KEY for the judge. For offline/CI verification,
|
|
27
|
+
* a TANGLE_API_KEY for the judge. For offline/CI verification, loadAll falls back
|
|
28
28
|
* to the committed fixtures (bench/fixtures/finsearchcomp.json) with an explicit
|
|
29
29
|
* console.warn — never a silent fallback.
|
|
30
30
|
*/
|
|
@@ -33,7 +33,7 @@ import { readFile } from 'node:fs/promises'
|
|
|
33
33
|
import { join } from 'node:path'
|
|
34
34
|
import { fileURLToPath } from 'node:url'
|
|
35
35
|
import { runBenchRouterTurn } from '../router-turn'
|
|
36
|
-
import
|
|
36
|
+
import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
|
|
37
37
|
|
|
38
38
|
const BENCH_ROOT = fileURLToPath(new URL('../..', import.meta.url))
|
|
39
39
|
const FIXTURES = join(BENCH_ROOT, 'fixtures', 'finsearchcomp.json')
|
|
@@ -64,7 +64,7 @@ const WORKER_CONTRACT = [
|
|
|
64
64
|
* live market snapshot the judge consumes via a {ground_truth} template slot;
|
|
65
65
|
* the adapter does NOT fabricate that snapshot. Wiring T1 means supplying a
|
|
66
66
|
* resolver that fetches the akshare/market value for the record at judge time
|
|
67
|
-
* and filling {ground_truth}. Until then T1 is excluded from
|
|
67
|
+
* and filling {ground_truth}. Until then T1 is excluded from loadAll.
|
|
68
68
|
*/
|
|
69
69
|
export interface T1Seam {
|
|
70
70
|
promptId: string
|
|
@@ -119,8 +119,7 @@ function recordToTask(rec: FinSearchRecord): BenchTask {
|
|
|
119
119
|
}
|
|
120
120
|
return {
|
|
121
121
|
id: rec.prompt_id,
|
|
122
|
-
|
|
123
|
-
prompt: rec.prompt + WORKER_CONTRACT,
|
|
122
|
+
payload: { prompt: rec.prompt + WORKER_CONTRACT, subset: taskType },
|
|
124
123
|
metadata: meta as unknown as Record<string, unknown>,
|
|
125
124
|
}
|
|
126
125
|
}
|
|
@@ -134,7 +133,7 @@ function readMeta(task: BenchTask): FinSearchMeta {
|
|
|
134
133
|
typeof md.judgeSystemPrompt !== 'string' ||
|
|
135
134
|
typeof md.rawPrompt !== 'string'
|
|
136
135
|
) {
|
|
137
|
-
throw new Error(`FinSearchComp task ${task.id} missing judge metadata —
|
|
136
|
+
throw new Error(`FinSearchComp task ${task.id} missing judge metadata — loadAll did not populate it`)
|
|
138
137
|
}
|
|
139
138
|
return md as unknown as FinSearchMeta
|
|
140
139
|
}
|
|
@@ -206,7 +205,7 @@ function parseJudgeOutput(content: string): { resolved: boolean; score: number;
|
|
|
206
205
|
}
|
|
207
206
|
|
|
208
207
|
/** Run the record's own judge via the router. Fail loud on transport/parse errors. */
|
|
209
|
-
async function runRecordJudge(meta: FinSearchMeta, response: string, router: JudgeRouter): Promise<
|
|
208
|
+
async function runRecordJudge(meta: FinSearchMeta, response: string, router: JudgeRouter): Promise<BenchEvaluation> {
|
|
210
209
|
const turn = await runBenchRouterTurn(
|
|
211
210
|
{
|
|
212
211
|
routerBaseUrl: router.baseUrl,
|
|
@@ -227,15 +226,17 @@ async function runRecordJudge(meta: FinSearchMeta, response: string, router: Jud
|
|
|
227
226
|
const content = turn.finalText
|
|
228
227
|
if (!content) throw new Error('FinSearchComp judge returned no message content')
|
|
229
228
|
const { resolved, score, raw } = parseJudgeOutput(content)
|
|
229
|
+
const evidence = {
|
|
230
|
+
taskType: meta.taskType,
|
|
231
|
+
region: meta.region,
|
|
232
|
+
answerScore: raw,
|
|
233
|
+
judgeModel: router.model,
|
|
234
|
+
}
|
|
230
235
|
return {
|
|
231
|
-
resolved,
|
|
236
|
+
passed: resolved,
|
|
232
237
|
score,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
region: meta.region,
|
|
236
|
-
answerScore: raw,
|
|
237
|
-
judgeModel: router.model,
|
|
238
|
-
}),
|
|
238
|
+
notes: JSON.stringify(evidence),
|
|
239
|
+
raw: evidence,
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
242
|
|
|
@@ -243,7 +244,7 @@ function selectRecords(records: FinSearchRecord[], opts: LoadOptions): BenchTask
|
|
|
243
244
|
let tasks = records
|
|
244
245
|
.filter((r) => SUPPORTED_TYPES.has(parseTaskType(r.prompt_id)))
|
|
245
246
|
.map(recordToTask)
|
|
246
|
-
if (opts.
|
|
247
|
+
if (opts.subset) tasks = tasks.filter((t) => t.payload.subset === opts.subset)
|
|
247
248
|
if (opts.ids) {
|
|
248
249
|
const want = new Set(opts.ids)
|
|
249
250
|
tasks = tasks.filter((t) => want.has(t.id))
|
|
@@ -292,45 +293,13 @@ async function fetchDataset(): Promise<FinSearchRecord[]> {
|
|
|
292
293
|
return data
|
|
293
294
|
}
|
|
294
295
|
|
|
295
|
-
export function createFinsearchcompAdapter():
|
|
296
|
+
export function createFinsearchcompAdapter(): RuntimeBenchmark {
|
|
296
297
|
const fixturesMode = process.env.FINSEARCHCOMP_FIXTURES === '1'
|
|
297
298
|
|
|
298
|
-
return {
|
|
299
|
-
|
|
299
|
+
return runtimeBenchmark({
|
|
300
|
+
id: 'finsearchcomp',
|
|
300
301
|
|
|
301
|
-
async
|
|
302
|
-
// The per-record LLM judge is the arbiter in both modes — its router
|
|
303
|
-
// config must exist or no score can be produced.
|
|
304
|
-
judgeRouter()
|
|
305
|
-
console.warn(
|
|
306
|
-
'[finsearchcomp] T1 (Time_Sensitive_Data_Fetching) is NOT scored: it needs a live ' +
|
|
307
|
-
'market snapshot / akshare ground truth for the judge {ground_truth} slot. ' +
|
|
308
|
-
'loadTasks supports T2 + T3 only; wire T1Seam to add T1.',
|
|
309
|
-
)
|
|
310
|
-
if (fixturesMode) {
|
|
311
|
-
await readFile(FIXTURES, 'utf8').catch((err) => {
|
|
312
|
-
throw new Error(
|
|
313
|
-
`FINSEARCHCOMP_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`,
|
|
314
|
-
)
|
|
315
|
-
})
|
|
316
|
-
return
|
|
317
|
-
}
|
|
318
|
-
const res = await fetch(DATASET_URL, { method: 'HEAD' }).catch((err) => {
|
|
319
|
-
throw new Error(
|
|
320
|
-
`finsearchcomp preflight failed reaching ${DATASET_URL}: ${err instanceof Error ? err.message : err}\n` +
|
|
321
|
-
`Fix: ensure network access to raw.githubusercontent.com, or set FINSEARCHCOMP_FIXTURES=1 ` +
|
|
322
|
-
`to run against the committed fixtures offline.`,
|
|
323
|
-
)
|
|
324
|
-
})
|
|
325
|
-
if (!res.ok) {
|
|
326
|
-
throw new Error(
|
|
327
|
-
`finsearchcomp preflight: dataset HEAD ${res.status} for ${DATASET_URL}. ` +
|
|
328
|
-
`Set FINSEARCHCOMP_FIXTURES=1 to run against the committed fixtures offline.`,
|
|
329
|
-
)
|
|
330
|
-
}
|
|
331
|
-
},
|
|
332
|
-
|
|
333
|
-
async loadTasks(opts: LoadOptions = {}) {
|
|
302
|
+
async loadAll(opts: LoadOptions = {}) {
|
|
334
303
|
if (fixturesMode) return loadFixtures(opts)
|
|
335
304
|
let records: FinSearchRecord[]
|
|
336
305
|
try {
|
|
@@ -345,27 +314,63 @@ export function createFinsearchcompAdapter(): BenchmarkAdapter {
|
|
|
345
314
|
return selectRecords(records, opts)
|
|
346
315
|
},
|
|
347
316
|
|
|
348
|
-
async
|
|
349
|
-
// Gold artifact = the record's response_reference fed back as the student
|
|
350
|
-
// answer, so verify-judge proves gold→resolved through the SAME per-record
|
|
351
|
-
// judge the real artifact takes. The reference may carry tolerance/criteria
|
|
352
|
-
// prose; the judge is built to read the value out of it.
|
|
353
|
-
const meta = readMeta(task)
|
|
354
|
-
return meta.responseReference
|
|
355
|
-
},
|
|
356
|
-
|
|
357
|
-
async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
|
|
317
|
+
async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
|
|
358
318
|
const meta = readMeta(task)
|
|
359
319
|
const response = artifact.trim()
|
|
360
320
|
if (response.length === 0) {
|
|
361
321
|
// Fail-closed — the benchmark's own judges score an empty answer 0.
|
|
322
|
+
const raw = { taskType: meta.taskType, region: meta.region, reason: 'empty answer' }
|
|
362
323
|
return {
|
|
363
|
-
|
|
324
|
+
passed: false,
|
|
364
325
|
score: 0,
|
|
365
|
-
|
|
326
|
+
notes: JSON.stringify(raw),
|
|
327
|
+
raw,
|
|
366
328
|
}
|
|
367
329
|
}
|
|
368
330
|
return runRecordJudge(meta, response, judgeRouter())
|
|
369
331
|
},
|
|
370
|
-
|
|
332
|
+
|
|
333
|
+
runtime: {
|
|
334
|
+
async preflight() {
|
|
335
|
+
// The per-record LLM judge is the arbiter in both modes — its router
|
|
336
|
+
// config must exist or no score can be produced.
|
|
337
|
+
judgeRouter()
|
|
338
|
+
console.warn(
|
|
339
|
+
'[finsearchcomp] T1 (Time_Sensitive_Data_Fetching) is NOT scored: it needs a live ' +
|
|
340
|
+
'market snapshot / akshare ground truth for the judge {ground_truth} slot. ' +
|
|
341
|
+
'loadAll supports T2 + T3 only; wire T1Seam to add T1.',
|
|
342
|
+
)
|
|
343
|
+
if (fixturesMode) {
|
|
344
|
+
await readFile(FIXTURES, 'utf8').catch((err) => {
|
|
345
|
+
throw new Error(
|
|
346
|
+
`FINSEARCHCOMP_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`,
|
|
347
|
+
)
|
|
348
|
+
})
|
|
349
|
+
return
|
|
350
|
+
}
|
|
351
|
+
const res = await fetch(DATASET_URL, { method: 'HEAD' }).catch((err) => {
|
|
352
|
+
throw new Error(
|
|
353
|
+
`finsearchcomp preflight failed reaching ${DATASET_URL}: ${err instanceof Error ? err.message : err}\n` +
|
|
354
|
+
`Fix: ensure network access to raw.githubusercontent.com, or set FINSEARCHCOMP_FIXTURES=1 ` +
|
|
355
|
+
`to run against the committed fixtures offline.`,
|
|
356
|
+
)
|
|
357
|
+
})
|
|
358
|
+
if (!res.ok) {
|
|
359
|
+
throw new Error(
|
|
360
|
+
`finsearchcomp preflight: dataset HEAD ${res.status} for ${DATASET_URL}. ` +
|
|
361
|
+
`Set FINSEARCHCOMP_FIXTURES=1 to run against the committed fixtures offline.`,
|
|
362
|
+
)
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
|
|
366
|
+
async goldArtifact(task: BenchTask) {
|
|
367
|
+
// Gold artifact = the record's response_reference fed back as the student
|
|
368
|
+
// answer, so verify-judge proves gold→passed through the SAME per-record
|
|
369
|
+
// judge the real artifact takes. The reference may carry tolerance/criteria
|
|
370
|
+
// prose; the judge is built to read the value out of it.
|
|
371
|
+
const meta = readMeta(task)
|
|
372
|
+
return meta.responseReference
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
})
|
|
371
376
|
}
|
package/src/benchmarks/frames.ts
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
* temperature 0), fired ONLY when Tier 1 misses, to absorb the
|
|
12
12
|
* paraphrase/alias equivalence FRAMES intends to allow.
|
|
13
13
|
*
|
|
14
|
-
* score is binary (
|
|
14
|
+
* score is binary (passed ? 1 : 0) — FRAMES has no partial credit. The judge
|
|
15
15
|
* resolves strictly on the Answer value; wiki_links are a SOFT signal surfaced
|
|
16
|
-
* in `
|
|
16
|
+
* in `notes` for the critic, never a hard pass criterion.
|
|
17
17
|
*
|
|
18
18
|
* Requires for a live run: the bench `.venv` with `datasets` installed and a
|
|
19
19
|
* JUDGE_MODEL router key. For offline/CI verification set FRAMES_FIXTURES=1 to
|
|
@@ -27,7 +27,7 @@ import { fileURLToPath } from 'node:url'
|
|
|
27
27
|
import { promisify } from 'node:util'
|
|
28
28
|
import { runBenchRouterTurn } from '../router-turn'
|
|
29
29
|
import { FINAL_ANSWER_SENTINEL, parseCitations, parseFinalAnswer } from './rag-shared'
|
|
30
|
-
import
|
|
30
|
+
import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
|
|
31
31
|
|
|
32
32
|
const execFileAsync = promisify(execFile)
|
|
33
33
|
const BENCH_ROOT = fileURLToPath(new URL('../..', import.meta.url))
|
|
@@ -338,8 +338,7 @@ function rowToTask(row: FramesRow, index: number): BenchTask {
|
|
|
338
338
|
}
|
|
339
339
|
return {
|
|
340
340
|
id: `frames-${index}`,
|
|
341
|
-
|
|
342
|
-
prompt: row.Prompt + WORKER_CONTRACT,
|
|
341
|
+
payload: { prompt: row.Prompt + WORKER_CONTRACT, subset: 'test' },
|
|
343
342
|
metadata: meta as unknown as Record<string, unknown>,
|
|
344
343
|
}
|
|
345
344
|
}
|
|
@@ -347,7 +346,7 @@ function rowToTask(row: FramesRow, index: number): BenchTask {
|
|
|
347
346
|
function readMeta(task: BenchTask): FramesMeta {
|
|
348
347
|
const md = task.metadata
|
|
349
348
|
if (!md || typeof md.gold !== 'string') {
|
|
350
|
-
throw new Error(`FRAMES task ${task.id} missing metadata.gold —
|
|
349
|
+
throw new Error(`FRAMES task ${task.id} missing metadata.gold — loadAll did not populate it`)
|
|
351
350
|
}
|
|
352
351
|
return md as unknown as FramesMeta
|
|
353
352
|
}
|
|
@@ -365,40 +364,13 @@ async function loadFixtures(opts: LoadOptions): Promise<BenchTask[]> {
|
|
|
365
364
|
return tasks
|
|
366
365
|
}
|
|
367
366
|
|
|
368
|
-
export function createFramesAdapter():
|
|
367
|
+
export function createFramesAdapter(): RuntimeBenchmark {
|
|
369
368
|
const fixturesMode = process.env.FRAMES_FIXTURES === '1'
|
|
370
369
|
|
|
371
|
-
return {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
async preflight() {
|
|
375
|
-
// Tier-2 judge router config must be present in both modes — the loop's
|
|
376
|
-
// citation-coverage stop gate is meaningless without the equivalence judge.
|
|
377
|
-
judgeRouter()
|
|
378
|
-
if (fixturesMode) {
|
|
379
|
-
await readFile(FIXTURES, 'utf8').catch((err) => {
|
|
380
|
-
throw new Error(`FRAMES_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`)
|
|
381
|
-
})
|
|
382
|
-
return
|
|
383
|
-
}
|
|
384
|
-
try {
|
|
385
|
-
await py(
|
|
386
|
-
`from datasets import load_dataset
|
|
387
|
-
load_dataset(${JSON.stringify(DATASET)}, split='test', revision=${JSON.stringify(DATASET_REVISION)})
|
|
388
|
-
print('ok')`,
|
|
389
|
-
)
|
|
390
|
-
} catch (err) {
|
|
391
|
-
const msg = err instanceof Error ? err.message : String(err)
|
|
392
|
-
throw new Error(
|
|
393
|
-
`frames preflight failed: ${msg}\n` +
|
|
394
|
-
`Fix: (1) python3 -m venv bench/.venv && bench/.venv/bin/pip install datasets ; ` +
|
|
395
|
-
`(2) ensure network access to Hugging Face for ${DATASET} ; ` +
|
|
396
|
-
`or set FRAMES_FIXTURES=1 to run against the committed fixtures offline.`,
|
|
397
|
-
)
|
|
398
|
-
}
|
|
399
|
-
},
|
|
370
|
+
return runtimeBenchmark({
|
|
371
|
+
id: 'frames',
|
|
400
372
|
|
|
401
|
-
async
|
|
373
|
+
async loadAll(opts: LoadOptions = {}) {
|
|
402
374
|
if (fixturesMode) return loadFixtures(opts)
|
|
403
375
|
const limit = opts.limit ?? 10
|
|
404
376
|
const script = `
|
|
@@ -427,15 +399,7 @@ print(json.dumps(out))
|
|
|
427
399
|
return rows.map((r) => rowToTask(r, r._index))
|
|
428
400
|
},
|
|
429
401
|
|
|
430
|
-
async
|
|
431
|
-
// Gold artifact = the worker-contract serialization of the gold Answer, so
|
|
432
|
-
// verify-judge proves gold→resolved through the SAME parse path the real
|
|
433
|
-
// artifact takes (Tier-1 short-circuits with no model tokens).
|
|
434
|
-
const meta = readMeta(task)
|
|
435
|
-
return `${FINAL_ANSWER_SENTINEL} ${meta.gold}`
|
|
436
|
-
},
|
|
437
|
-
|
|
438
|
-
async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
|
|
402
|
+
async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
|
|
439
403
|
const meta = readMeta(task)
|
|
440
404
|
const finalAnswer = parseFinalAnswer(artifact)
|
|
441
405
|
const citations = parseCitations(artifact)
|
|
@@ -443,45 +407,88 @@ print(json.dumps(out))
|
|
|
443
407
|
|
|
444
408
|
if (finalAnswer.length === 0) {
|
|
445
409
|
// Fail-closed: distinguish prompt-adherence failure from a wrong answer.
|
|
410
|
+
const raw = {
|
|
411
|
+
tier: 'none',
|
|
412
|
+
reason: 'no parseable answer',
|
|
413
|
+
normalizedGold: normalizeFramesAnswer(meta.gold),
|
|
414
|
+
citationCoverage: coverage,
|
|
415
|
+
}
|
|
446
416
|
return {
|
|
447
|
-
|
|
417
|
+
passed: false,
|
|
448
418
|
score: 0,
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
reason: 'no parseable answer',
|
|
452
|
-
normalizedGold: normalizeFramesAnswer(meta.gold),
|
|
453
|
-
citationCoverage: coverage,
|
|
454
|
-
}),
|
|
419
|
+
notes: JSON.stringify(raw),
|
|
420
|
+
raw,
|
|
455
421
|
}
|
|
456
422
|
}
|
|
457
423
|
|
|
458
424
|
// Tier 1 — free, deterministic.
|
|
459
425
|
if (tier1Match(finalAnswer, meta.gold)) {
|
|
426
|
+
const raw = {
|
|
427
|
+
tier: 1,
|
|
428
|
+
normalizedAnswer: normalizeFramesAnswer(finalAnswer),
|
|
429
|
+
normalizedGold: normalizeFramesAnswer(meta.gold),
|
|
430
|
+
citationCoverage: coverage,
|
|
431
|
+
}
|
|
460
432
|
return {
|
|
461
|
-
|
|
433
|
+
passed: true,
|
|
462
434
|
score: 1,
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
normalizedAnswer: normalizeFramesAnswer(finalAnswer),
|
|
466
|
-
normalizedGold: normalizeFramesAnswer(meta.gold),
|
|
467
|
-
citationCoverage: coverage,
|
|
468
|
-
}),
|
|
435
|
+
notes: JSON.stringify(raw),
|
|
436
|
+
raw,
|
|
469
437
|
}
|
|
470
438
|
}
|
|
471
439
|
|
|
472
440
|
// Tier 2 — constrained LLM equivalence gate (fail loud on unparseable output).
|
|
473
441
|
const verdict = await tier2Judge(meta.rawPrompt, meta.gold, finalAnswer, judgeRouter())
|
|
442
|
+
const raw = {
|
|
443
|
+
tier: 2,
|
|
444
|
+
normalizedAnswer: normalizeFramesAnswer(finalAnswer),
|
|
445
|
+
normalizedGold: normalizeFramesAnswer(meta.gold),
|
|
446
|
+
judgeVerdict: verdict ? 'correct' : 'incorrect',
|
|
447
|
+
citationCoverage: coverage,
|
|
448
|
+
}
|
|
474
449
|
return {
|
|
475
|
-
|
|
450
|
+
passed: verdict,
|
|
476
451
|
score: verdict ? 1 : 0,
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
normalizedAnswer: normalizeFramesAnswer(finalAnswer),
|
|
480
|
-
normalizedGold: normalizeFramesAnswer(meta.gold),
|
|
481
|
-
judgeVerdict: verdict ? 'correct' : 'incorrect',
|
|
482
|
-
citationCoverage: coverage,
|
|
483
|
-
}),
|
|
452
|
+
notes: JSON.stringify(raw),
|
|
453
|
+
raw,
|
|
484
454
|
}
|
|
485
455
|
},
|
|
486
|
-
|
|
456
|
+
|
|
457
|
+
runtime: {
|
|
458
|
+
async preflight() {
|
|
459
|
+
// Tier-2 judge router config must be present in both modes — the loop's
|
|
460
|
+
// citation-coverage stop gate is meaningless without the equivalence judge.
|
|
461
|
+
judgeRouter()
|
|
462
|
+
if (fixturesMode) {
|
|
463
|
+
await readFile(FIXTURES, 'utf8').catch((err) => {
|
|
464
|
+
throw new Error(`FRAMES_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`)
|
|
465
|
+
})
|
|
466
|
+
return
|
|
467
|
+
}
|
|
468
|
+
try {
|
|
469
|
+
await py(
|
|
470
|
+
`from datasets import load_dataset
|
|
471
|
+
load_dataset(${JSON.stringify(DATASET)}, split='test', revision=${JSON.stringify(DATASET_REVISION)})
|
|
472
|
+
print('ok')`,
|
|
473
|
+
)
|
|
474
|
+
} catch (err) {
|
|
475
|
+
const msg = err instanceof Error ? err.message : String(err)
|
|
476
|
+
throw new Error(
|
|
477
|
+
`frames preflight failed: ${msg}\n` +
|
|
478
|
+
`Fix: (1) python3 -m venv bench/.venv && bench/.venv/bin/pip install datasets ; ` +
|
|
479
|
+
`(2) ensure network access to Hugging Face for ${DATASET} ; ` +
|
|
480
|
+
`or set FRAMES_FIXTURES=1 to run against the committed fixtures offline.`,
|
|
481
|
+
)
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
|
|
485
|
+
async goldArtifact(task: BenchTask) {
|
|
486
|
+
// Gold artifact = the worker-contract serialization of the gold Answer, so
|
|
487
|
+
// verify-judge proves gold→passed through the SAME parse path the real
|
|
488
|
+
// artifact takes (Tier-1 short-circuits with no model tokens).
|
|
489
|
+
const meta = readMeta(task)
|
|
490
|
+
return `${FINAL_ANSWER_SENTINEL} ${meta.gold}`
|
|
491
|
+
},
|
|
492
|
+
},
|
|
493
|
+
})
|
|
487
494
|
}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* Judge is the official HotpotQA / SQuAD-style metric, FULLY DETERMINISTIC — no
|
|
6
6
|
* LLM. Both the predicted final answer and the gold are normalized (lowercase,
|
|
7
7
|
* strip articles a/an/the, strip punctuation, collapse whitespace), then scored
|
|
8
|
-
* by exact-match (EM) and token-level F1.
|
|
9
|
-
* (default 0.6); score = the F1 (0..1).
|
|
8
|
+
* by exact-match (EM) and token-level F1. passed = EM OR F1 >= HOTPOTQA_F1_PASS
|
|
9
|
+
* (default 0.6); score = the F1 (0..1). notes carries em + f1. This gives the
|
|
10
10
|
* suite a judge that needs no model tokens at all.
|
|
11
11
|
*
|
|
12
12
|
* metadata carries the gold answer + supporting_facts (the title/sent_id pairs of
|
|
@@ -24,7 +24,7 @@ import { join } from 'node:path'
|
|
|
24
24
|
import { fileURLToPath } from 'node:url'
|
|
25
25
|
import { promisify } from 'node:util'
|
|
26
26
|
import { FINAL_ANSWER_SENTINEL, parseFinalAnswer } from './rag-shared'
|
|
27
|
-
import
|
|
27
|
+
import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
|
|
28
28
|
|
|
29
29
|
const execFileAsync = promisify(execFile)
|
|
30
30
|
const BENCH_ROOT = fileURLToPath(new URL('../..', import.meta.url))
|
|
@@ -154,8 +154,7 @@ function rowToTask(row: HotpotRow): BenchTask {
|
|
|
154
154
|
}
|
|
155
155
|
return {
|
|
156
156
|
id: `hotpotqa-${row.id}`,
|
|
157
|
-
|
|
158
|
-
prompt: row.question + WORKER_CONTRACT,
|
|
157
|
+
payload: { prompt: row.question + WORKER_CONTRACT, subset: DATASET_SPLIT },
|
|
159
158
|
metadata: meta as unknown as Record<string, unknown>,
|
|
160
159
|
}
|
|
161
160
|
}
|
|
@@ -163,7 +162,7 @@ function rowToTask(row: HotpotRow): BenchTask {
|
|
|
163
162
|
function readMeta(task: BenchTask): HotpotMeta {
|
|
164
163
|
const md = task.metadata
|
|
165
164
|
if (!md || typeof md.gold !== 'string') {
|
|
166
|
-
throw new Error(`HotpotQA task ${task.id} missing metadata.gold —
|
|
165
|
+
throw new Error(`HotpotQA task ${task.id} missing metadata.gold — loadAll did not populate it`)
|
|
167
166
|
}
|
|
168
167
|
return md as unknown as HotpotMeta
|
|
169
168
|
}
|
|
@@ -183,41 +182,15 @@ async function loadFixtures(opts: LoadOptions): Promise<BenchTask[]> {
|
|
|
183
182
|
return tasks
|
|
184
183
|
}
|
|
185
184
|
|
|
186
|
-
export function createHotpotqaAdapter():
|
|
185
|
+
export function createHotpotqaAdapter(): RuntimeBenchmark {
|
|
187
186
|
const fixturesMode = process.env.HOTPOTQA_FIXTURES === '1'
|
|
188
187
|
// Validate the threshold at construction so a malformed env fails before any run.
|
|
189
188
|
f1PassThreshold()
|
|
190
189
|
|
|
191
|
-
return {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
async preflight() {
|
|
195
|
-
if (fixturesMode) {
|
|
196
|
-
await readFile(FIXTURES, 'utf8').catch((err) => {
|
|
197
|
-
throw new Error(
|
|
198
|
-
`HOTPOTQA_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`,
|
|
199
|
-
)
|
|
200
|
-
})
|
|
201
|
-
return
|
|
202
|
-
}
|
|
203
|
-
try {
|
|
204
|
-
await py(
|
|
205
|
-
`from datasets import load_dataset
|
|
206
|
-
load_dataset(${JSON.stringify(DATASET)}, ${JSON.stringify(DATASET_CONFIG)}, split=${JSON.stringify(DATASET_SPLIT)})
|
|
207
|
-
print('ok')`,
|
|
208
|
-
)
|
|
209
|
-
} catch (err) {
|
|
210
|
-
const msg = err instanceof Error ? err.message : String(err)
|
|
211
|
-
throw new Error(
|
|
212
|
-
`hotpotqa preflight failed: ${msg}\n` +
|
|
213
|
-
`Fix: (1) python3 -m venv bench/.venv && bench/.venv/bin/pip install datasets ; ` +
|
|
214
|
-
`(2) ensure network access to Hugging Face for ${DATASET} (${DATASET_CONFIG}) ; ` +
|
|
215
|
-
`or set HOTPOTQA_FIXTURES=1 to run against the committed fixtures offline.`,
|
|
216
|
-
)
|
|
217
|
-
}
|
|
218
|
-
},
|
|
190
|
+
return runtimeBenchmark({
|
|
191
|
+
id: 'hotpotqa',
|
|
219
192
|
|
|
220
|
-
async
|
|
193
|
+
async loadAll(opts: LoadOptions = {}) {
|
|
221
194
|
if (fixturesMode) return loadFixtures(opts)
|
|
222
195
|
const limit = opts.limit ?? 10
|
|
223
196
|
const script = `
|
|
@@ -251,29 +224,23 @@ print(json.dumps(out))
|
|
|
251
224
|
return rows.map(rowToTask)
|
|
252
225
|
},
|
|
253
226
|
|
|
254
|
-
async
|
|
255
|
-
// Gold artifact = the worker-contract serialization of the gold answer, so
|
|
256
|
-
// verify-judge proves gold→resolved through the SAME parse path the real
|
|
257
|
-
// artifact takes.
|
|
258
|
-
const meta = readMeta(task)
|
|
259
|
-
return `${FINAL_ANSWER_SENTINEL} ${meta.gold}`
|
|
260
|
-
},
|
|
261
|
-
|
|
262
|
-
async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
|
|
227
|
+
async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
|
|
263
228
|
const meta = readMeta(task)
|
|
264
229
|
const finalAnswer = parseFinalAnswer(artifact)
|
|
265
230
|
|
|
266
231
|
if (finalAnswer.length === 0) {
|
|
267
232
|
// Fail-closed: distinguish prompt-adherence failure from a wrong answer.
|
|
233
|
+
const raw = {
|
|
234
|
+
reason: 'no parseable answer',
|
|
235
|
+
em: false,
|
|
236
|
+
f1: 0,
|
|
237
|
+
normalizedGold: normalizeHotpotAnswer(meta.gold),
|
|
238
|
+
}
|
|
268
239
|
return {
|
|
269
|
-
|
|
240
|
+
passed: false,
|
|
270
241
|
score: 0,
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
em: false,
|
|
274
|
-
f1: 0,
|
|
275
|
-
normalizedGold: normalizeHotpotAnswer(meta.gold),
|
|
276
|
-
}),
|
|
242
|
+
notes: JSON.stringify(raw),
|
|
243
|
+
raw,
|
|
277
244
|
}
|
|
278
245
|
}
|
|
279
246
|
|
|
@@ -281,20 +248,58 @@ print(json.dumps(out))
|
|
|
281
248
|
const f1 = hotpotTokenF1(finalAnswer, meta.gold)
|
|
282
249
|
const threshold = f1PassThreshold()
|
|
283
250
|
const resolved = em || f1 >= threshold
|
|
251
|
+
const raw = {
|
|
252
|
+
em,
|
|
253
|
+
f1,
|
|
254
|
+
threshold,
|
|
255
|
+
normalizedAnswer: normalizeHotpotAnswer(finalAnswer),
|
|
256
|
+
normalizedGold: normalizeHotpotAnswer(meta.gold),
|
|
257
|
+
type: meta.type,
|
|
258
|
+
level: meta.level,
|
|
259
|
+
supportingFacts: meta.supportingFacts,
|
|
260
|
+
}
|
|
284
261
|
return {
|
|
285
|
-
resolved,
|
|
262
|
+
passed: resolved,
|
|
286
263
|
score: f1,
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
f1,
|
|
290
|
-
threshold,
|
|
291
|
-
normalizedAnswer: normalizeHotpotAnswer(finalAnswer),
|
|
292
|
-
normalizedGold: normalizeHotpotAnswer(meta.gold),
|
|
293
|
-
type: meta.type,
|
|
294
|
-
level: meta.level,
|
|
295
|
-
supportingFacts: meta.supportingFacts,
|
|
296
|
-
}),
|
|
264
|
+
notes: JSON.stringify(raw),
|
|
265
|
+
raw,
|
|
297
266
|
}
|
|
298
267
|
},
|
|
299
|
-
|
|
268
|
+
|
|
269
|
+
runtime: {
|
|
270
|
+
async preflight() {
|
|
271
|
+
if (fixturesMode) {
|
|
272
|
+
await readFile(FIXTURES, 'utf8').catch((err) => {
|
|
273
|
+
throw new Error(
|
|
274
|
+
`HOTPOTQA_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`,
|
|
275
|
+
)
|
|
276
|
+
})
|
|
277
|
+
return
|
|
278
|
+
}
|
|
279
|
+
try {
|
|
280
|
+
await py(
|
|
281
|
+
`from datasets import load_dataset
|
|
282
|
+
load_dataset(${JSON.stringify(DATASET)}, ${JSON.stringify(DATASET_CONFIG)}, split=${JSON.stringify(DATASET_SPLIT)})
|
|
283
|
+
print('ok')`,
|
|
284
|
+
)
|
|
285
|
+
} catch (err) {
|
|
286
|
+
const msg = err instanceof Error ? err.message : String(err)
|
|
287
|
+
throw new Error(
|
|
288
|
+
`hotpotqa preflight failed: ${msg}\n` +
|
|
289
|
+
`Fix: (1) python3 -m venv bench/.venv && bench/.venv/bin/pip install datasets ; ` +
|
|
290
|
+
`(2) ensure network access to Hugging Face for ${DATASET} (${DATASET_CONFIG}) ; ` +
|
|
291
|
+
`or set HOTPOTQA_FIXTURES=1 to run against the committed fixtures offline.`,
|
|
292
|
+
)
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
|
|
296
|
+
async goldArtifact(task: BenchTask) {
|
|
297
|
+
// Gold artifact = the worker-contract serialization of the gold answer, so
|
|
298
|
+
// verify-judge proves gold→passed through the SAME parse path the real
|
|
299
|
+
// artifact takes.
|
|
300
|
+
const meta = readMeta(task)
|
|
301
|
+
return `${FINAL_ANSWER_SENTINEL} ${meta.gold}`
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
})
|
|
300
305
|
}
|