benchkit-cli 0.1.0__py3-none-any.whl

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.
Files changed (149) hide show
  1. benchkit/__init__.py +1 -0
  2. benchkit/_pi_proxy.py +219 -0
  3. benchkit/answer_key_guard.ts +49 -0
  4. benchkit/artifacts.py +87 -0
  5. benchkit/benchmarks/__init__.py +105 -0
  6. benchkit/benchmarks/aider_polyglot.py +405 -0
  7. benchkit/benchmarks/arc.py +52 -0
  8. benchkit/benchmarks/banking77.py +149 -0
  9. benchkit/benchmarks/base.py +19 -0
  10. benchkit/benchmarks/boolq.py +49 -0
  11. benchkit/benchmarks/chartqa.py +133 -0
  12. benchkit/benchmarks/code_verifier.py +77 -0
  13. benchkit/benchmarks/downloads.py +166 -0
  14. benchkit/benchmarks/evalplus.py +288 -0
  15. benchkit/benchmarks/git_surgery.py +485 -0
  16. benchkit/benchmarks/gpqa.py +56 -0
  17. benchkit/benchmarks/gsm8k.py +97 -0
  18. benchkit/benchmarks/hellaswag.py +49 -0
  19. benchkit/benchmarks/humaneval.py +103 -0
  20. benchkit/benchmarks/ifeval.py +56 -0
  21. benchkit/benchmarks/ifeval_instructions.py +477 -0
  22. benchkit/benchmarks/mbpp.py +60 -0
  23. benchkit/benchmarks/mc_arena.py +479 -0
  24. benchkit/benchmarks/mcq.py +94 -0
  25. benchkit/benchmarks/medfailbench.py +537 -0
  26. benchkit/benchmarks/mmlu.py +54 -0
  27. benchkit/benchmarks/mmlu_pro.py +62 -0
  28. benchkit/benchmarks/mmvp.py +115 -0
  29. benchkit/benchmarks/ocrbench.py +96 -0
  30. benchkit/benchmarks/openbookqa.py +52 -0
  31. benchkit/benchmarks/patcheval.py +929 -0
  32. benchkit/benchmarks/piqa.py +52 -0
  33. benchkit/benchmarks/ruler.py +172 -0
  34. benchkit/benchmarks/ruler_generator.py +535 -0
  35. benchkit/benchmarks/sanity.py +174 -0
  36. benchkit/benchmarks/treejs_arena.py +268 -0
  37. benchkit/benchmarks/truthfulqa.py +52 -0
  38. benchkit/benchmarks/utils.py +25 -0
  39. benchkit/benchmarks/vision.py +230 -0
  40. benchkit/benchmarks/vstar.py +108 -0
  41. benchkit/benchmarks/winogrande.py +52 -0
  42. benchkit/benchmarks/xstest.py +116 -0
  43. benchkit/browser.py +429 -0
  44. benchkit/catalog.py +121 -0
  45. benchkit/cli.py +1000 -0
  46. benchkit/client.py +1413 -0
  47. benchkit/controls.py +87 -0
  48. benchkit/datasets/MMLU_LICENSE.txt +21 -0
  49. benchkit/datasets/README.md +142 -0
  50. benchkit/datasets/arc_challenge.jsonl +1172 -0
  51. benchkit/datasets/banking77.jsonl +3080 -0
  52. benchkit/datasets/banking77_intents.json +79 -0
  53. benchkit/datasets/boolq.jsonl +3270 -0
  54. benchkit/datasets/code_verifier.jsonl +500 -0
  55. benchkit/datasets/gpqa_diamond.jsonl +198 -0
  56. benchkit/datasets/gsm8k.jsonl +1319 -0
  57. benchkit/datasets/hellaswag.jsonl +1000 -0
  58. benchkit/datasets/humaneval.jsonl +164 -0
  59. benchkit/datasets/ifeval.jsonl +541 -0
  60. benchkit/datasets/mbpp.jsonl +500 -0
  61. benchkit/datasets/mc_blocks_1_20_1.jsonl +1003 -0
  62. benchkit/datasets/medfailbench_hard30.jsonl +30 -0
  63. benchkit/datasets/medfailbench_hard30.md +13 -0
  64. benchkit/datasets/openbookqa.jsonl +500 -0
  65. benchkit/datasets/piqa.jsonl +1838 -0
  66. benchkit/datasets/sanity_code.jsonl +6 -0
  67. benchkit/datasets/truthfulqa.jsonl +817 -0
  68. benchkit/datasets/winogrande.jsonl +1267 -0
  69. benchkit/datasets/xstest.csv +451 -0
  70. benchkit/decision.py +194 -0
  71. benchkit/demo.py +451 -0
  72. benchkit/dockerfiles.py +247 -0
  73. benchkit/engine.py +1270 -0
  74. benchkit/evaluation.py +195 -0
  75. benchkit/events.py +141 -0
  76. benchkit/executor.py +96 -0
  77. benchkit/git_surgery/backport-release-stack/setup.sh +328 -0
  78. benchkit/git_surgery/backport-release-stack/verify.sh +119 -0
  79. benchkit/git_surgery/bisect-the-regression/setup.sh +49 -0
  80. benchkit/git_surgery/bisect-the-regression/verify.sh +34 -0
  81. benchkit/git_surgery/rebase-conflict-chain/setup.sh +65 -0
  82. benchkit/git_surgery/rebase-conflict-chain/verify.sh +43 -0
  83. benchkit/git_surgery/recover-complex-stash/setup.sh +152 -0
  84. benchkit/git_surgery/recover-complex-stash/verify.sh +95 -0
  85. benchkit/git_surgery/recover-lost-work/setup.sh +40 -0
  86. benchkit/git_surgery/recover-lost-work/verify.sh +36 -0
  87. benchkit/git_surgery/repair-force-pushed-remote/setup.sh +171 -0
  88. benchkit/git_surgery/repair-force-pushed-remote/verify.sh +83 -0
  89. benchkit/git_surgery/revert-merge-with-followups/setup.sh +198 -0
  90. benchkit/git_surgery/revert-merge-with-followups/verify.sh +98 -0
  91. benchkit/git_surgery/secret-in-history/README.md +27 -0
  92. benchkit/git_surgery/secret-in-history/setup.sh +107 -0
  93. benchkit/git_surgery/secret-in-history/verify.sh +106 -0
  94. benchkit/git_surgery/split-the-mega-commit/setup.sh +50 -0
  95. benchkit/git_surgery/split-the-mega-commit/verify.sh +48 -0
  96. benchkit/git_surgery/untangle-nested-submodules/setup.sh +193 -0
  97. benchkit/git_surgery/untangle-nested-submodules/verify.sh +90 -0
  98. benchkit/history.py +474 -0
  99. benchkit/jobs.py +332 -0
  100. benchkit/leakage.py +51 -0
  101. benchkit/looping.py +873 -0
  102. benchkit/mc_render.py +274 -0
  103. benchkit/mc_viewer/dist/atlas.png +0 -0
  104. benchkit/mc_viewer/dist/blockStates.json.gz +0 -0
  105. benchkit/mc_viewer/dist/version.json +4 -0
  106. benchkit/mc_viewer/dist/viewer.html +23 -0
  107. benchkit/mc_viewer/dist/viewer.js +2 -0
  108. benchkit/mc_viewer/dist/viewer.js.LICENSE.txt +25 -0
  109. benchkit/mc_viewer/dist/worker.js +2 -0
  110. benchkit/mc_viewer/dist/worker.js.LICENSE.txt +19 -0
  111. benchkit/metrics.py +100 -0
  112. benchkit/ollama.py +60 -0
  113. benchkit/perf.py +353 -0
  114. benchkit/perf_report.py +207 -0
  115. benchkit/perturbations.py +208 -0
  116. benchkit/pi_agent.py +476 -0
  117. benchkit/pi_package/package-lock.json +1827 -0
  118. benchkit/pi_package/package.json +8 -0
  119. benchkit/report.py +142 -0
  120. benchkit/report_markdown.py +645 -0
  121. benchkit/results.py +688 -0
  122. benchkit/retry.py +163 -0
  123. benchkit/runner.py +769 -0
  124. benchkit/sandbox.py +1167 -0
  125. benchkit/template_check.py +291 -0
  126. benchkit/templates/arena.html +504 -0
  127. benchkit/templates/history.html +58 -0
  128. benchkit/templates/perf.html +509 -0
  129. benchkit/templates/report.html +769 -0
  130. benchkit/tui/__init__.py +5 -0
  131. benchkit/tui/app.py +87 -0
  132. benchkit/tui/app.tcss +512 -0
  133. benchkit/tui/formatting.py +84 -0
  134. benchkit/tui/screens/__init__.py +1 -0
  135. benchkit/tui/screens/connect.py +191 -0
  136. benchkit/tui/screens/detail.py +288 -0
  137. benchkit/tui/screens/help.py +84 -0
  138. benchkit/tui/screens/modals.py +544 -0
  139. benchkit/tui/screens/results.py +361 -0
  140. benchkit/tui/screens/run.py +988 -0
  141. benchkit/tui/screens/setup.py +733 -0
  142. benchkit/tui/theme.py +135 -0
  143. benchkit/tui/widgets.py +120 -0
  144. benchkit_cli-0.1.0.dist-info/METADATA +294 -0
  145. benchkit_cli-0.1.0.dist-info/RECORD +149 -0
  146. benchkit_cli-0.1.0.dist-info/WHEEL +5 -0
  147. benchkit_cli-0.1.0.dist-info/entry_points.txt +3 -0
  148. benchkit_cli-0.1.0.dist-info/licenses/LICENSE +201 -0
  149. benchkit_cli-0.1.0.dist-info/top_level.txt +1 -0
benchkit/controls.py ADDED
@@ -0,0 +1,87 @@
1
+ """Run controls the front-ends flip while the engine works."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import threading
6
+
7
+
8
+ class RunControls:
9
+ """Thread-safe pause / skip / stop / force-unload switches for the UI."""
10
+
11
+ def __init__(self, force_unload: bool = False) -> None:
12
+ self._stop = threading.Event()
13
+ self._skip = threading.Event()
14
+ self._cancel_request = threading.Event()
15
+ self._running = threading.Event()
16
+ self._running.set()
17
+ self._force_unload = force_unload
18
+
19
+ @property
20
+ def stopped(self) -> bool:
21
+ return self._stop.is_set()
22
+
23
+ @property
24
+ def cancel_event(self) -> threading.Event:
25
+ """Event passed to clients to kill every active model request."""
26
+ return self._cancel_request
27
+
28
+ @property
29
+ def cancel_requested(self) -> bool:
30
+ return self._cancel_request.is_set()
31
+
32
+ @property
33
+ def paused(self) -> bool:
34
+ return not self._running.is_set()
35
+
36
+ @property
37
+ def force_unload(self) -> bool:
38
+ return self._force_unload
39
+
40
+ def toggle_force_unload(self) -> bool:
41
+ """Flip force-unload and return the new state."""
42
+ self._force_unload = not self._force_unload
43
+ return self._force_unload
44
+
45
+ def stop(self) -> None:
46
+ self._stop.set()
47
+ self._cancel_request.set()
48
+ self._running.set()
49
+
50
+ def skip_job(self) -> None:
51
+ self._skip.set()
52
+ self._cancel_request.set()
53
+ self._running.set()
54
+
55
+ @property
56
+ def skip_requested(self) -> bool:
57
+ return self._skip.is_set()
58
+
59
+ def pause(self) -> None:
60
+ self._running.clear()
61
+
62
+ def resume(self) -> None:
63
+ self._running.set()
64
+
65
+ def toggle_pause(self) -> bool:
66
+ """Flip the paused state and return ``True`` when now paused."""
67
+ if self.paused:
68
+ self.resume()
69
+ return False
70
+ self.pause()
71
+ return True
72
+
73
+ def take_skip(self) -> bool:
74
+ """Consume a pending skip request."""
75
+ if self._skip.is_set():
76
+ self._skip.clear()
77
+ self._cancel_request.clear()
78
+ return True
79
+ return False
80
+
81
+ def cancel_active(self) -> None:
82
+ """Cancel in-flight requests while unwinding an internal job failure."""
83
+ self._cancel_request.set()
84
+ self._running.set()
85
+
86
+ def wait_while_paused(self) -> None:
87
+ self._running.wait()
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Dan Hendrycks
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,142 @@
1
+ # Dataset attribution
2
+
3
+ ## GPQA Diamond
4
+
5
+ `gpqa_diamond.jsonl` is a transformed copy of the 198-question GPQA Diamond
6
+ split by David Rein et al. The source answer choices were shuffled with the
7
+ official evaluator's default seed (`0`) and converted from CSV to BenchKit's
8
+ JSONL schema.
9
+
10
+ - Source: <https://github.com/idavidrein/gpqa>
11
+ - Paper: <https://arxiv.org/abs/2311.12022>
12
+ - Dataset license: [Creative Commons Attribution 4.0 International][cc-by-4.0]
13
+
14
+ [cc-by-4.0]: https://creativecommons.org/licenses/by/4.0/
15
+
16
+ ## XSTest
17
+
18
+ `xstest.csv` is the complete 450-prompt XSTest suite: 250 safe prompts across
19
+ ten prompt types and 200 unsafe contrast prompts. BenchKit uses the authors'
20
+ offline string-matching evaluator, which is less reliable than manual or
21
+ LLM-based classification and cannot identify partial refusals.
22
+
23
+ - Source: <https://github.com/paul-rottger/xstest>
24
+ - Paper: <https://aclanthology.org/2024.naacl-long.301/>
25
+ - Dataset license: [Creative Commons Attribution 4.0 International][cc-by-4.0]
26
+
27
+ ## WinoGrande
28
+
29
+ `winogrande.jsonl` is a transformed copy of the 1,267-example labeled
30
+ development split from WinoGrande 1.1.
31
+
32
+ - Source: <https://github.com/allenai/winogrande>
33
+ - Dataset license: [Creative Commons Attribution 2.0][cc-by-2.0]
34
+
35
+ ## PIQA
36
+
37
+ `piqa.jsonl` is a transformed copy of the 1,838-example labeled validation
38
+ split from Physical Interaction: Question Answering.
39
+
40
+ - Source: <https://yonatanbisk.com/piqa/data/>
41
+ - Dataset license: [Academic Free License 3.0][afl-3.0]
42
+
43
+ ## MMLU
44
+
45
+ `mmlu.jsonl` is a transformed copy of the 14,042-question test split covering
46
+ all 57 MMLU subjects. BenchKit evaluates it zero-shot. It is not bundled: it is
47
+ downloaded on first use from a pinned commit of this repository and verified
48
+ against the sha256 in `benchmarks/downloads.py`.
49
+
50
+ - Source: <https://github.com/hendrycks/test>
51
+ - Dataset license: MIT; see `MMLU_LICENSE.txt`
52
+
53
+ ## MMLU-Pro
54
+
55
+ `mmlu_pro.jsonl` is a transformed copy of the MMLU-Pro test split: ten-option
56
+ questions across 14 categories, filtered by the authors for ones that require
57
+ reasoning. Only the schema changed - `question_id` became a namespaced
58
+ `task_id` and `options` became `choices`, with the `N/A` padding left by the
59
+ authors' pruning pass dropped, which is why some questions carry fewer than ten
60
+ choices. Regenerate it with `uv run --with datasets python
61
+ scripts/build_mmlu_pro.py`. BenchKit evaluates it zero-shot. Like MMLU it is
62
+ downloaded on first use and checksum-verified rather than bundled.
63
+
64
+ - Source: <https://huggingface.co/datasets/TIGER-Lab/MMLU-Pro>
65
+ - Code: <https://github.com/TIGER-AI-Lab/MMLU-Pro>
66
+ - Paper: <https://arxiv.org/abs/2406.01574>
67
+ - Dataset license: MIT
68
+
69
+ ## BANKING77
70
+
71
+ `banking77.jsonl` is a transformed copy of the 3,080-message BANKING77 test
72
+ split, and `banking77_intents.json` is the upstream list of its 77 intents.
73
+ Only the schema changed - each row keeps its upstream position in `task_id` -
74
+ and rows are interleaved round-robin across intents so that any slice covers
75
+ them evenly. Regenerate both with `uv run python scripts/build_banking77.py`.
76
+
77
+ - Source: <https://github.com/PolyAI-LDN/task-specific-datasets>
78
+ - Paper: Casanueva et al., "Efficient Intent Detection with Dual Sentence
79
+ Encoders" (2020), <https://arxiv.org/abs/2003.04807>
80
+ - Dataset license: [Creative Commons Attribution 4.0 International][cc-by-4.0]
81
+
82
+ ## OpenBookQA
83
+
84
+ `openbookqa.jsonl` is a transformed copy of the 500-question OpenBookQA test
85
+ split.
86
+
87
+ - Source: <https://github.com/allenai/OpenBookQA>
88
+ - Dataset license: Apache 2.0
89
+
90
+ ## BoolQ
91
+
92
+ `boolq.jsonl` is a transformed copy of the 3,270-example labeled validation
93
+ split distributed with SuperGLUE.
94
+
95
+ - Source: <https://github.com/google-research-datasets/boolean-questions>
96
+ - Dataset license: [Creative Commons Attribution-ShareAlike 3.0][cc-by-sa-3.0]
97
+
98
+ ## IFEval
99
+
100
+ `ifeval.jsonl` is a transformed copy of the 541 prompts distributed with the
101
+ IFEval paper. Only the schema changed: `key` became `task_id`, and the
102
+ `instruction_id_list` / `kwargs` pairs are carried over unmodified.
103
+
104
+ - Source: <https://github.com/google-research/google-research/tree/master/instruction_following_eval>
105
+ - Paper: <https://arxiv.org/abs/2311.07911>
106
+ - Dataset license: Apache 2.0
107
+
108
+ ## RULER
109
+
110
+ RULER deterministically generates its NIAH, variable-tracking, CWE, and FWE
111
+ tasks. Essay-backed NIAH uses upstream `PaulGrahamEssays.json`; QA-1 and QA-2
112
+ use SQuAD 2.0 development and HotpotQA distractor validation data cached under
113
+ `~/.cache/benchkit/ruler`. BenchKit downloads the QA files on first use. The
114
+ essay corpus is generated with NVIDIA/RULER's
115
+ `download_paulgraham_essay.py`.
116
+ retrieval and variable-tracking prompts at runtime for each context bucket.
117
+
118
+ The `ruler` benchmark is the practical preset: three samples from each of the
119
+ 13 task families in every supported context bucket (234 generations at
120
+ 4K–128K). Use `ruler-full` to opt into the research-scale configuration of 500
121
+ samples per family (39,000 generations), or slice it explicitly (for example,
122
+ `ruler-full:13`) for round-robin coverage of all task families.
123
+
124
+ - Source design: <https://github.com/NVIDIA/RULER>
125
+ - Paper: <https://arxiv.org/abs/2404.06654>
126
+ - Reference implementation license: Apache 2.0
127
+
128
+ [afl-3.0]: https://opensource.org/license/afl-3-0-php
129
+ [cc-by-2.0]: https://creativecommons.org/licenses/by/2.0/
130
+ [cc-by-sa-3.0]: https://creativecommons.org/licenses/by-sa/3.0/
131
+
132
+ ## Minecraft block ids (mc-arena)
133
+
134
+ `mc_blocks_1_20_1.jsonl` is the block table for Minecraft Java Edition 1.20.1,
135
+ extracted from `pc/1.20/blocks.json` and reduced to the block id, whether it is
136
+ an air variant, and whether it is transparent. `mc-arena` validates generated
137
+ block ids against it, and the same version is what the bundled
138
+ prismarine-viewer renders (see `../mc_viewer/build/README.md`).
139
+
140
+ - Source: <https://github.com/mc-bench/mc-data-files>, a packaging of
141
+ <https://github.com/PrismarineJS/minecraft-data>
142
+ - Dataset license: MIT