.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ node_modules/
README.md CHANGED
@@ -60,4 +60,68 @@ python src/main.py update-to-self-contained \
60
  python src/main.py validate-question \
61
  --output "${output_dir}" \
62
  | jq .
63
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  python src/main.py validate-question \
61
  --output "${output_dir}" \
62
  | jq .
63
+ ```
64
+
65
+ ## Promptfoo Evaluation
66
+
67
+ This repo can run the rulesheet benchmark against frontier models using [promptfoo](https://promptfoo.dev). The benchmark pulls 2 random rows per rulesheet CSV and renders each as a question, judged with an LLM-rubric assertion that compares the model answer to the gold answer and its supporting quote.
68
+
69
+ ### Configure
70
+
71
+ Edit [`benchmarks/promptfooconfig.yaml`](./benchmarks/promptfooconfig.yaml) and replace the `<...>` model id
72
+ placeholders with the model ids you want to test, for example:
73
+
74
+ ```yaml
75
+ providers:
76
+ - id: openai:gpt-5.6-luna
77
+ - anthropic:claude-3-7-sonnet
78
+ - xai:grok-4
79
+ - google:gemini-2.5-pro
80
+ - deepseek:deepseek-chat
81
+ ```
82
+
83
+ Set the matching API keys as environment variables (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `XAI_API_KEY`,
84
+ `GOOGLE_API_KEY`, `DEEPSEEK_API_KEY`) or via promptfoo's [`promptfoo auth`](https://promptfoo.dev/docs/configuration/providers/).
85
+
86
+ ### Generate tests
87
+
88
+ The promptfoo test file `benchmarks/tests.csv` is derived from the data CSVs. (Re)generate it with:
89
+
90
+ ```bash
91
+ # sample 2 random rows per data CSV, write benchmarks/tests.csv
92
+ python src/make_promptfoo_tests.py
93
+
94
+ # reproducible sampling
95
+ python src/make_promptfoo_tests.py --seed 42
96
+
97
+ # custom source dir / rows per file / output
98
+ python src/make_promptfoo_tests.py --data-dir data --per-file 2 --output benchmarks/tests.csv
99
+ ```
100
+
101
+ ### Install and run
102
+
103
+ ```bash
104
+ # install promptfoo (Node)
105
+ npm install
106
+
107
+ # run the full benchmark (5 providers x all questions, with LLM-rubric judging)
108
+ npm run eval
109
+ ```
110
+
111
+ ### View results
112
+
113
+ After a run, promptfoo prints a results table in the terminal and writes a shareable report. Open the web UI with:
114
+
115
+ ```bash
116
+ promptfoo view
117
+ ```
118
+
119
+ ## Benchmark Results
120
+ Benchmark was ran against smaller frontier models w/o tool or context to purely measure weights. Results were lack luster to say the least.
121
+
122
+ | Model | Accurate | % Accurate |
123
+ |------------------------------------- |---------- |------------ |
124
+ | OpenAI gpt-5.6-luna | 31 | 18.13% |
125
+ | Anthropic claude-haiku-4-5-20251001 | 3 | 1.75% |
126
+ | x.ai grok-4.3 | 26 | 15.20% |
127
+ | Google gemini-3.6-flash | 40 | 23.39% |
benchmarks/promptfooconfig.yaml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ description: Pinball rulesheet benchmark - frontier models
2
+ prompts:
3
+ - "Answer the question based on the pinball rulesheet. Be concise.\n{{__test}}"
4
+ providers:
5
+ - id: openai:responses:gpt-5.6-luna
6
+ - id: anthropic:messages:claude-haiku-4-5-20251001
7
+ - id: xai:grok-4.3
8
+ - id: google:gemini-3.6-flash
9
+
10
+ tests: file://tests.csv
benchmarks/tests.csv ADDED
The diff for this file is too large to render. See raw diff
 
package-lock.json ADDED
The diff for this file is too large to render. See raw diff
 
package.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "pinball-benchmarks",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "eval": "promptfoo eval --config benchmarks/promptfooconfig.yaml",
7
+ "view": "promptfoo view"
8
+ },
9
+ "dependencies": {
10
+ "promptfoo": "0.122.2"
11
+ }
12
+ }
src/make_promptfoo_tests.py ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ import csv
3
+ import random
4
+ from pathlib import Path
5
+
6
+
7
+ def build_parser() -> argparse.ArgumentParser:
8
+ parser = argparse.ArgumentParser(
9
+ prog="make_promptfoo_tests",
10
+ description=(
11
+ "Sample 2 random rows from each data CSV and write them as a "
12
+ "promptfoo CSV test file (benchmarks/tests.csv)."
13
+ ),
14
+ )
15
+ parser.add_argument(
16
+ "--data-dir",
17
+ type=Path,
18
+ default=Path("data"),
19
+ help="Directory containing the source CSV files.",
20
+ )
21
+ parser.add_argument(
22
+ "--output",
23
+ type=Path,
24
+ default=Path("benchmarks/tests.csv"),
25
+ help="Output promptfoo tests.csv path.",
26
+ )
27
+ parser.add_argument(
28
+ "--per-file",
29
+ type=int,
30
+ default=2,
31
+ help="Number of random rows to pull from each source CSV.",
32
+ )
33
+ parser.add_argument(
34
+ "--seed",
35
+ type=int,
36
+ default=None,
37
+ help="Optional random seed for reproducible output.",
38
+ )
39
+ return parser
40
+
41
+
42
+ def build_expected(answer: str, source_quote: str) -> str:
43
+ rubric = (
44
+ 'Compare the model\'s answer to the reference answer "{answer}". '
45
+ 'Supporting quote: "{source_quote}". '
46
+ "Pass if the answer matches (exact, numeric, or paraphrased equivalent); "
47
+ "fail otherwise. One-line reasoning."
48
+ ).format(answer=answer, source_quote=source_quote)
49
+ return f"llm-rubric:{rubric}"
50
+
51
+
52
+ def main(args: argparse.Namespace) -> None:
53
+ if args.seed is not None:
54
+ random.seed(args.seed)
55
+
56
+ source_paths = sorted(args.data_dir.glob("*.csv"))
57
+ output_name = args.output.name
58
+ source_paths = [p for p in source_paths if p.name != output_name]
59
+
60
+ rows = []
61
+ for csv_path in source_paths:
62
+ with open(csv_path, mode="r", newline="", encoding="utf-8") as f:
63
+ reader = csv.DictReader(f)
64
+ file_rows = [dict(row) for row in reader]
65
+ picked = random.sample(file_rows, min(args.per_file, len(file_rows)))
66
+ rows.extend(picked)
67
+
68
+ args.output.parent.mkdir(exist_ok=True)
69
+ with open(args.output, mode="w", newline="", encoding="utf-8") as f:
70
+ writer = csv.writer(f)
71
+ writer.writerow(
72
+ ["__test", "__expected", "answer", "source_quote", "section", "manufacturer", "game"]
73
+ )
74
+ for row in rows:
75
+ writer.writerow(
76
+ [
77
+ row["question"],
78
+ build_expected(row["answer"], row["source_quote"]),
79
+ row["answer"],
80
+ row["source_quote"],
81
+ row["section"],
82
+ row["manufacturer"],
83
+ row["game"],
84
+ ]
85
+ )
86
+
87
+ print(f"wrote {len(rows)} tests from {len(source_paths)} files to {args.output}")
88
+
89
+
90
+ if __name__ == "__main__":
91
+ main(build_parser().parse_args())