openbench-ai 0.4.0__tar.gz

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 (110) hide show
  1. openbench_ai-0.4.0/LICENSE +21 -0
  2. openbench_ai-0.4.0/PKG-INFO +253 -0
  3. openbench_ai-0.4.0/README.md +202 -0
  4. openbench_ai-0.4.0/pyproject.toml +96 -0
  5. openbench_ai-0.4.0/setup.cfg +4 -0
  6. openbench_ai-0.4.0/src/openbench/__init__.py +191 -0
  7. openbench_ai-0.4.0/src/openbench/adapters/__init__.py +39 -0
  8. openbench_ai-0.4.0/src/openbench/adapters/base.py +220 -0
  9. openbench_ai-0.4.0/src/openbench/adapters/huggingface.py +158 -0
  10. openbench_ai-0.4.0/src/openbench/adapters/local.py +104 -0
  11. openbench_ai-0.4.0/src/openbench/adapters/mock.py +136 -0
  12. openbench_ai-0.4.0/src/openbench/adapters/ollama.py +223 -0
  13. openbench_ai-0.4.0/src/openbench/analytics.py +215 -0
  14. openbench_ai-0.4.0/src/openbench/cache.py +315 -0
  15. openbench_ai-0.4.0/src/openbench/catalog.py +185 -0
  16. openbench_ai-0.4.0/src/openbench/cli.py +1665 -0
  17. openbench_ai-0.4.0/src/openbench/comparison.py +394 -0
  18. openbench_ai-0.4.0/src/openbench/configuration.py +490 -0
  19. openbench_ai-0.4.0/src/openbench/dataset.py +646 -0
  20. openbench_ai-0.4.0/src/openbench/evalstats.py +85 -0
  21. openbench_ai-0.4.0/src/openbench/evaluator.py +994 -0
  22. openbench_ai-0.4.0/src/openbench/exceptions.py +90 -0
  23. openbench_ai-0.4.0/src/openbench/execution.py +456 -0
  24. openbench_ai-0.4.0/src/openbench/experiments.py +1257 -0
  25. openbench_ai-0.4.0/src/openbench/history.py +139 -0
  26. openbench_ai-0.4.0/src/openbench/integrity.py +261 -0
  27. openbench_ai-0.4.0/src/openbench/itemscores.py +178 -0
  28. openbench_ai-0.4.0/src/openbench/lineage.py +264 -0
  29. openbench_ai-0.4.0/src/openbench/metrics/__init__.py +127 -0
  30. openbench_ai-0.4.0/src/openbench/metrics/accuracy.py +118 -0
  31. openbench_ai-0.4.0/src/openbench/metrics/base.py +156 -0
  32. openbench_ai-0.4.0/src/openbench/metrics/bleu.py +145 -0
  33. openbench_ai-0.4.0/src/openbench/metrics/exact_match.py +52 -0
  34. openbench_ai-0.4.0/src/openbench/metrics/f1.py +109 -0
  35. openbench_ai-0.4.0/src/openbench/metrics/keyword_match.py +103 -0
  36. openbench_ai-0.4.0/src/openbench/metrics/normalization.py +59 -0
  37. openbench_ai-0.4.0/src/openbench/metrics/precision.py +243 -0
  38. openbench_ai-0.4.0/src/openbench/metrics/recall.py +106 -0
  39. openbench_ai-0.4.0/src/openbench/metrics/rouge.py +193 -0
  40. openbench_ai-0.4.0/src/openbench/metrics/semantic_similarity.py +353 -0
  41. openbench_ai-0.4.0/src/openbench/metrics/structured_output.py +259 -0
  42. openbench_ai-0.4.0/src/openbench/paired.py +1042 -0
  43. openbench_ai-0.4.0/src/openbench/performance.py +272 -0
  44. openbench_ai-0.4.0/src/openbench/preferences.py +940 -0
  45. openbench_ai-0.4.0/src/openbench/provenance.py +91 -0
  46. openbench_ai-0.4.0/src/openbench/py.typed +0 -0
  47. openbench_ai-0.4.0/src/openbench/quality.py +633 -0
  48. openbench_ai-0.4.0/src/openbench/quality_notes.json +87 -0
  49. openbench_ai-0.4.0/src/openbench/reporting.py +546 -0
  50. openbench_ai-0.4.0/src/openbench/reporting_v040.py +391 -0
  51. openbench_ai-0.4.0/src/openbench/security.py +258 -0
  52. openbench_ai-0.4.0/src/openbench/stats/__init__.py +74 -0
  53. openbench_ai-0.4.0/src/openbench/stats/_numeric.py +49 -0
  54. openbench_ai-0.4.0/src/openbench/stats/_validation.py +24 -0
  55. openbench_ai-0.4.0/src/openbench/stats/bootstrap.py +140 -0
  56. openbench_ai-0.4.0/src/openbench/stats/effects.py +152 -0
  57. openbench_ai-0.4.0/src/openbench/stats/equivalence.py +939 -0
  58. openbench_ai-0.4.0/src/openbench/stats/results.py +214 -0
  59. openbench_ai-0.4.0/src/openbench/stats/rng.py +54 -0
  60. openbench_ai-0.4.0/src/openbench/stats/tests.py +323 -0
  61. openbench_ai-0.4.0/src/openbench/stats/variability.py +324 -0
  62. openbench_ai-0.4.0/src/openbench_ai.egg-info/PKG-INFO +253 -0
  63. openbench_ai-0.4.0/src/openbench_ai.egg-info/SOURCES.txt +108 -0
  64. openbench_ai-0.4.0/src/openbench_ai.egg-info/dependency_links.txt +1 -0
  65. openbench_ai-0.4.0/src/openbench_ai.egg-info/entry_points.txt +2 -0
  66. openbench_ai-0.4.0/src/openbench_ai.egg-info/requires.txt +33 -0
  67. openbench_ai-0.4.0/src/openbench_ai.egg-info/top_level.txt +1 -0
  68. openbench_ai-0.4.0/tests/test_advanced_metrics.py +186 -0
  69. openbench_ai-0.4.0/tests/test_backward_compatibility.py +255 -0
  70. openbench_ai-0.4.0/tests/test_catalog.py +75 -0
  71. openbench_ai-0.4.0/tests/test_cli.py +121 -0
  72. openbench_ai-0.4.0/tests/test_comparison.py +90 -0
  73. openbench_ai-0.4.0/tests/test_configuration.py +48 -0
  74. openbench_ai-0.4.0/tests/test_dataset.py +219 -0
  75. openbench_ai-0.4.0/tests/test_docs_v040.py +84 -0
  76. openbench_ai-0.4.0/tests/test_evaluate_statistics_cli.py +52 -0
  77. openbench_ai-0.4.0/tests/test_evaluator.py +145 -0
  78. openbench_ai-0.4.0/tests/test_execution.py +120 -0
  79. openbench_ai-0.4.0/tests/test_experiments_and_integrity.py +139 -0
  80. openbench_ai-0.4.0/tests/test_history.py +75 -0
  81. openbench_ai-0.4.0/tests/test_integrations.py +99 -0
  82. openbench_ai-0.4.0/tests/test_metrics.py +172 -0
  83. openbench_ai-0.4.0/tests/test_paired_engine.py +208 -0
  84. openbench_ai-0.4.0/tests/test_paired_policy.py +220 -0
  85. openbench_ai-0.4.0/tests/test_performance_and_analytics.py +126 -0
  86. openbench_ai-0.4.0/tests/test_preferences.py +361 -0
  87. openbench_ai-0.4.0/tests/test_providers.py +138 -0
  88. openbench_ai-0.4.0/tests/test_quality.py +266 -0
  89. openbench_ai-0.4.0/tests/test_quality_builtin.py +103 -0
  90. openbench_ai-0.4.0/tests/test_repetition_cache.py +167 -0
  91. openbench_ai-0.4.0/tests/test_repetitions.py +286 -0
  92. openbench_ai-0.4.0/tests/test_reporting.py +100 -0
  93. openbench_ai-0.4.0/tests/test_reporting_v040.py +165 -0
  94. openbench_ai-0.4.0/tests/test_score_kind.py +76 -0
  95. openbench_ai-0.4.0/tests/test_security_and_cache.py +84 -0
  96. openbench_ai-0.4.0/tests/test_stats_audit_fixes.py +256 -0
  97. openbench_ai-0.4.0/tests/test_stats_bootstrap_effects_rng.py +146 -0
  98. openbench_ai-0.4.0/tests/test_stats_equivalence.py +373 -0
  99. openbench_ai-0.4.0/tests/test_stats_numeric.py +85 -0
  100. openbench_ai-0.4.0/tests/test_stats_postfix_fixes.py +163 -0
  101. openbench_ai-0.4.0/tests/test_stats_tests.py +183 -0
  102. openbench_ai-0.4.0/tests/test_structured_output.py +84 -0
  103. openbench_ai-0.4.0/tests/test_v040_compatibility.py +125 -0
  104. openbench_ai-0.4.0/tests/test_v040_integration.py +123 -0
  105. openbench_ai-0.4.0/tests/test_v040_reliability.py +207 -0
  106. openbench_ai-0.4.0/tests/test_v040_security.py +170 -0
  107. openbench_ai-0.4.0/tests/test_v040_stage1_compat.py +135 -0
  108. openbench_ai-0.4.0/tests/test_v0_3_1_maintenance.py +454 -0
  109. openbench_ai-0.4.0/tests/test_v0_3_compatibility.py +120 -0
  110. openbench_ai-0.4.0/tests/test_variability.py +99 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lakshay Chhaba
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,253 @@
1
+ Metadata-Version: 2.4
2
+ Name: openbench-ai
3
+ Version: 0.4.0
4
+ Summary: A modular, open-source LLM experiment execution, evaluation, statistical comparison, and benchmarking platform.
5
+ Author: Lakshay Chhaba
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/lakshaychhaba0001-sys/openbench-ai
8
+ Project-URL: Repository, https://github.com/lakshaychhaba0001-sys/openbench-ai.git
9
+ Project-URL: Issues, https://github.com/lakshaychhaba0001-sys/openbench-ai/issues
10
+ Keywords: llm,evaluation,benchmarking,ai,metrics,reproducibility,experiments,statistics,human-preference
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: Software Development :: Testing
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest<9.0.0,>=7.4.0; extra == "dev"
26
+ Requires-Dist: ruff<1.0.0,>=0.4.0; extra == "dev"
27
+ Requires-Dist: PyYAML<7.0,>=6.0; extra == "dev"
28
+ Requires-Dist: jsonschema<5.0.0,>=4.18.0; extra == "dev"
29
+ Provides-Extra: huggingface
30
+ Requires-Dist: transformers<5.0.0,>=4.35.0; extra == "huggingface"
31
+ Requires-Dist: torch<3.0.0,>=2.0.0; extra == "huggingface"
32
+ Provides-Extra: config
33
+ Requires-Dist: PyYAML<7.0,>=6.0; extra == "config"
34
+ Provides-Extra: metrics
35
+ Requires-Dist: jsonschema<5.0.0,>=4.18.0; extra == "metrics"
36
+ Provides-Extra: semantic
37
+ Requires-Dist: sentence-transformers<4.0.0,>=2.2.0; extra == "semantic"
38
+ Provides-Extra: stats-ref
39
+ Requires-Dist: numpy>=1.24; extra == "stats-ref"
40
+ Requires-Dist: scipy>=1.10; extra == "stats-ref"
41
+ Requires-Dist: statsmodels>=0.14; extra == "stats-ref"
42
+ Provides-Extra: all
43
+ Requires-Dist: pytest<9.0.0,>=7.4.0; extra == "all"
44
+ Requires-Dist: ruff<1.0.0,>=0.4.0; extra == "all"
45
+ Requires-Dist: PyYAML<7.0,>=6.0; extra == "all"
46
+ Requires-Dist: jsonschema<5.0.0,>=4.18.0; extra == "all"
47
+ Requires-Dist: sentence-transformers<4.0.0,>=2.2.0; extra == "all"
48
+ Requires-Dist: transformers<5.0.0,>=4.35.0; extra == "all"
49
+ Requires-Dist: torch<3.0.0,>=2.0.0; extra == "all"
50
+ Dynamic: license-file
51
+
52
+ # OpenBench AI (v0.4.0)
53
+
54
+ **A modular, open-source LLM experiment execution, evaluation, statistical comparison, and benchmarking platform.**
55
+
56
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
57
+ [![Python 3.10+](https://img.shields.io/badge/Python-3.10%2B-3776AB.svg)](pyproject.toml)
58
+ [![Version: 0.4.0](https://img.shields.io/badge/Version-0.4.0-2ea44f.svg)](CHANGELOG.md)
59
+
60
+ ---
61
+
62
+ ## Project Overview
63
+
64
+ **OpenBench AI** is a Python toolkit for running reproducible language model benchmarks. It evaluates model responses against standardized JSONL datasets, repeats experiments, compares models with appropriate statistics, collects blinded human preferences, and audits dataset and run quality. The core installation has no external runtime dependencies, and nothing requires a paid API.
65
+
66
+ > **Note**: OpenBench AI is maintained by its project owner, and its initial development was AI-assisted. Contributions, bug reports, and new datasets are welcome!
67
+
68
+ ---
69
+
70
+ ## What's new in v0.4.0
71
+
72
+ - **Repeated-run benchmarking**: `openbench run --repetitions N --seed S` creates a *repeat group*. Each repetition is its own run with recorded lineage: group ID, repetition index, seeds and seed status, the exact record IDs, per-record content hashes, and cache provenance.
73
+ - **Interrupted groups resume** without re-requesting completed items (`openbench runs resume grp_...`).
74
+ - **Fix: repetitions no longer reuse cached responses.** In v0.3.1, repeated runs reused cached responses across repetitions, which understated variability.
75
+ - **Paired model comparison**: `openbench analyze` aligns stored runs, repeat groups or evaluation files on stable record IDs, with no provider calls. It reports the following, with Holm (or BH) correction, an explicit missing-data policy, coverage and failure-rate comparisons, and category and difficulty breakdowns:
76
+ - percentile bootstrap confidence intervals;
77
+ - an exact McNemar test (binary metrics) or a paired sign-flip permutation test;
78
+ - effect sizes;
79
+ - wins, losses and ties;
80
+ - optional equivalence testing (TOST) with a pre-specified margin.
81
+ - **Compatibility checks**: incompatible inputs, such as different record content, metric versions or scoring options, are refused unless you request a clearly labelled exploratory comparison.
82
+ - **Repeated-run variability**: generation variability (within items), item-to-item variation and provider failures are reported separately.
83
+ - **Human preference evaluation**: `openbench preferences create|validate|analyze` is a local-first, blinded A/B workflow. The task file contains no model identities; the identity key is a separate file. Analysis covers validated annotation import, task-weighted win rates with task-clustered CIs, tie and neither outcomes, position bias, Cohen's and Fleiss' kappa, and optional Elo with stated limitations.
84
+ - **Quality audits**: `openbench validate-dataset PATH --quality-checks` and `openbench runs verify ID --quality-checks` run read-only checks for:
85
+ - duplicate IDs, and exact and near-duplicate prompts (a lexical 5-gram heuristic);
86
+ - malformed or placeholder references, and keyword expectations missing from references;
87
+ - invalid metric configurations and inconsistent versions;
88
+ - missing outputs, incomplete runs and groups, integrity failures, and insufficient data.
89
+
90
+ Audits never modify data.
91
+ - **Reports**: every new analysis renders to JSON, Markdown and CSV, with provenance (software, environment, input SHA-256s, seeds, parameters). CSV cells are protected against spreadsheet formula injection.
92
+ - **Opt-in evaluation CIs**: `openbench evaluate --confidence-intervals`. Output is unchanged without the flag.
93
+
94
+ v0.3.1 commands, flags, public Python names, the 200 dataset records and existing scores are preserved, and v0.3.1 run directories can be read without modification. See the [migration guide](V0_4_0_MIGRATION_GUIDE.md) for the details and the few documented behaviour changes.
95
+
96
+ ---
97
+
98
+ ## Installation
99
+
100
+ ```bash
101
+ git clone https://github.com/lakshaychhaba0001-sys/openbench-ai.git
102
+ cd openbench-ai
103
+
104
+ # Core installation (zero external runtime dependencies)
105
+ python -m pip install -e .
106
+
107
+ # Development + YAML config + JSON Schema validation
108
+ python -m pip install -e ".[dev]"
109
+
110
+ # Optional integration groups
111
+ python -m pip install -e ".[huggingface]" # transformers + torch for local HF models
112
+ python -m pip install -e ".[semantic]" # sentence-transformers for neural embeddings
113
+ python -m pip install -e ".[all]" # All optional runtime integrations
114
+
115
+ # Statistical reference cross-checks (tests only; never imported by the library)
116
+ python -m pip install -e ".[dev,stats-ref]"
117
+ ```
118
+
119
+ The Ollama adapter needs no extra packages: it uses the Python standard library HTTP client. All v0.4.0 statistics, preference and audit features use the standard library only.
120
+
121
+ ---
122
+
123
+ ## Quick Start
124
+
125
+ ### 1. Evaluate response files
126
+
127
+ ```bash
128
+ openbench evaluate --dataset datasets/reasoning/sample.jsonl --responses examples/sample_responses.json \
129
+ --metrics exact_match accuracy keyword_coverage --output results/
130
+
131
+ # With percentile bootstrap confidence intervals over items (v0.4.0, opt-in)
132
+ openbench evaluate --dataset datasets/reasoning/sample.jsonl --responses examples/sample_responses.json \
133
+ --confidence-intervals --seed 0 --output results/ci/
134
+ ```
135
+
136
+ ### 2. Run models, with repetitions
137
+
138
+ ```bash
139
+ openbench providers list
140
+ openbench run --dataset datasets/reasoning/sample.jsonl --provider mock --model model-a --repetitions 3 --seed 100
141
+ openbench run --dataset datasets/reasoning/sample.jsonl --provider mock --model model-b
142
+
143
+ openbench runs list
144
+ openbench runs show grp_<id> # a repeat group
145
+ openbench runs verify grp_<id> --quality-checks
146
+ openbench runs resume grp_<id> # finish an interrupted group
147
+ ```
148
+
149
+ ### 3. Compare stored results (no provider calls)
150
+
151
+ ```bash
152
+ openbench analyze --runs grp_<id> run_<id> --baseline run_<id> --format markdown --output results/comparison.md
153
+ openbench analyze --results results/model_a.json results/model_b.json --equivalence-margin 0.05 --output results/cmp.json
154
+ openbench analyze --runs grp_<id> --output results/variability.json # one repeat group: variability report
155
+ ```
156
+
157
+ ### 4. Collect blinded human preferences
158
+
159
+ ```bash
160
+ openbench preferences create --runs run_<a> run_<b> --seed 7 --output tasks/ --key-output private/tasks.key.json
161
+ # annotators fill annotations.jsonl from tasks/tasks.jsonl
162
+ openbench preferences validate --key private/tasks.key.json --annotations annotations.jsonl
163
+ openbench preferences analyze --key private/tasks.key.json --annotations annotations.jsonl --format markdown --output results/preferences.md
164
+ ```
165
+
166
+ ### 5. Audit quality
167
+
168
+ ```bash
169
+ openbench validate-dataset datasets/ --quality-checks --format markdown --output results/dataset_audit.md
170
+ ```
171
+
172
+ A complete runnable walkthrough using the mock provider is in [`examples/v040_workflow.py`](examples/v040_workflow.py).
173
+
174
+ ---
175
+
176
+ ## CLI Commands
177
+
178
+ | Command | Purpose |
179
+ | :--- | :--- |
180
+ | `validate-dataset`, `list-datasets`, `inspect-dataset`, `dataset-stats` | Dataset validation and exploration (`--quality-checks` adds the audit) |
181
+ | `evaluate`, `compare`, `export`, `history list/show` | Evaluate response files, descriptive comparison, export, history |
182
+ | `run`, `runs list/show/verify/resume/compare` | Provider execution, repeat groups, run management and integrity |
183
+ | `providers list/check`, `cache stats/clear` | Providers and the response cache |
184
+ | `analyze` | v0.4.0 paired comparison or repeated-run variability of stored results |
185
+ | `preferences create/validate/analyze` | v0.4.0 blinded pairwise human preference evaluation |
186
+
187
+ See the [CLI reference](docs/cli_reference.md) for every flag.
188
+
189
+ ---
190
+
191
+ ## Built-in Dataset Catalog (200 Examples)
192
+
193
+ | Category | Path | Examples | Highlights |
194
+ | :--- | :--- | ---: | :--- |
195
+ | `reasoning` | `datasets/reasoning/sample.jsonl` | 20 | Deductive logic, scheduling, combinatorics, rate problems |
196
+ | `mathematics` | `datasets/mathematics/sample.jsonl` | 20 | Calculus, linear algebra, number theory, geometry |
197
+ | `coding` | `datasets/coding/sample.jsonl` | 20 | Python stdlib, algorithms, Big-O, SQL, HTTP, Git |
198
+ | `debugging` | `datasets/debugging/sample.jsonl` | 20 | Root-cause analysis across Python, SQL, C, JS, and Git |
199
+ | `instruction_following` | `datasets/instruction_following/sample.jsonl` | 20 | Strict formatting, delimiters, casing, sorting |
200
+ | `factual_knowledge` | `datasets/factual_knowledge/sample.jsonl` | 20 | Verifiable science & CS facts with `source` metadata |
201
+ | `safety` | `datasets/safety/sample.jsonl` | 20 | Harm refusal, secure coding, medical boundaries with `rationale` |
202
+ | `multilingual` | `datasets/multilingual/sample.jsonl` | 20 | 11 languages (`es`, `fr`, `de`, `hi`, `pt`, `it`, `ja`, `zh`, `ru`, `nl`, `la`) |
203
+ | `summarization` | `datasets/summarization/sample.jsonl` | 20 | Single-sentence technical and scientific summarization |
204
+ | `structured_output` | `datasets/structured_output/sample.jsonl` | 20 | JSON generation with `required_keys`, `field_types`, `expected_schema` |
205
+
206
+ The built-in quality audit reports 0 errors, 6 warnings and 8 informational findings. These are documented historical keyword exceptions, one ambiguous item and accepted answer variants; see [quality audits](docs/quality_audits.md). With 20 items per category, statistical comparisons on one category have low power, and the reports say so.
207
+
208
+ ---
209
+
210
+ ## Metrics Reference
211
+
212
+ | Metric Identifier | Version | Kind | Description | Key Methodological Limitation |
213
+ | :--- | :--- | :--- | :--- | :--- |
214
+ | `exact_match` | `0.1.0` | binary | Normalized string equality (`1.0` or `0.0`). | Penalizes conversational framing. |
215
+ | `accuracy` | `0.1.0` | binary | Deterministic correctness via exact or word-bounded answer containment. | Does not parse negation or complex paraphrases. |
216
+ | `keyword_coverage` | `0.1.0` | continuous | Proportion of expected keywords present in the response. | **Not equivalent to semantic correctness.** |
217
+ | `precision` | `0.2.0` | continuous | $\text{TP} / (\text{TP} + \text{FP})$ for binary decisions or element sets. | Applies to discrete decisions/sets, not free-form prose truth. |
218
+ | `recall` | `0.2.0` | continuous | $\text{TP} / (\text{TP} + \text{FN})$ for binary decisions or element sets. | Does not penalize extra false-positive elements alone. |
219
+ | `f1` | `0.2.0` | continuous | Harmonic mean of `precision` and `recall`. | Ignores word order outside discrete elements. |
220
+ | `rouge` / `rouge_1` / `rouge_l` | `0.2.0` | continuous | Unigram (`rouge_1`) and LCS (`rouge_l`) overlap F1. | Cannot detect factual hallucinations or antonym flips. |
221
+ | `bleu` | `0.2.0` | continuous | Smoothed clipped $n$-gram precision with brevity penalty. | Penalizes valid synonyms and paraphrases. |
222
+ | `semantic_similarity` | `0.2.0` | continuous | Embedding cosine similarity via configurable `EmbeddingProvider`; with the default `local_ngram_hash` provider it is a legacy alias for `lexical_similarity`. | **Not factual correctness**; opposite statements can have high similarity. |
223
+ | `lexical_similarity` | `0.3.1` | continuous | Cosine similarity of hashed word and character 3-gram features. | Surface wording only; paraphrases score low and negations score high. |
224
+ | `structured_output` | `0.2.0` | continuous | Validates JSON syntax, required keys, field types, and JSON Schema. | Structural validity is separate from factual value accuracy. |
225
+
226
+ The **kind** (`score_kind`) selects the statistical procedure in `analyze`. Metric scores and versions are unchanged in v0.4.0.
227
+
228
+ ---
229
+
230
+ ## Statistical honesty
231
+
232
+ - A non-significant difference is never reported as "no difference" or "equivalent". Equivalence requires a pre-specified margin and a TOST, and continuous-metric equivalence is disabled in v0.4.0 (descriptive only).
233
+ - Exact binary equivalence p-values are computed in floating point with a documented, tested error allowance. This is an engineering bound, not a machine-checked proof.
234
+ - Confidence intervals describe uncertainty over items for fixed models, prompts and settings. They are labelled as not adjusted for multiple comparisons.
235
+ - A seed passed to a provider does not guarantee deterministic output.
236
+ - SHA-256 checksums show that files match recorded checksums. They do not prove that results are correct or authentic.
237
+
238
+ See the [statistical methodology](docs/statistical_methodology.md).
239
+
240
+ ---
241
+
242
+ ## Documentation Index
243
+
244
+ - **v0.4.0 guides**: [Repeated runs](docs/repeated_runs.md) | [Model comparison](docs/model_comparison.md) | [Human preferences](docs/human_preferences.md) | [Quality audits](docs/quality_audits.md) | [Reproducibility & reports](docs/reproducibility.md) | [Statistical methodology](docs/statistical_methodology.md) | [CLI reference](docs/cli_reference.md) | [Python API](docs/api_reference.md) | [Migration from v0.3.1](V0_4_0_MIGRATION_GUIDE.md)
245
+ - **Execution, providers & integrity**: [Model Execution Engine](docs/model_execution.md) | [Providers](docs/providers.md) | [Ollama](docs/ollama.md) | [Hugging Face (experimental)](docs/huggingface.md) | [Custom providers](docs/custom_provider.md) | [Experiment tracking](docs/experiment_tracking.md) | [Performance monitoring](docs/performance_monitoring.md) | [Reliability & caching](docs/reliability.md) | [Benchmark integrity](docs/benchmark_integrity.md) | [Security & privacy](docs/security_and_privacy.md)
246
+ - **Datasets, metrics & configuration**: [Installation](docs/installation.md) | [Usage](docs/usage.md) | [Architecture](docs/architecture.md) | [Dataset catalog](docs/dataset_catalog.md) | [Core metrics](docs/metrics.md) | [Advanced metrics](docs/advanced_metrics.md) | [YAML profiles](docs/configuration.md) | [Historical tracking](docs/historical_tracking.md) | [v0.3 compatibility](docs/v0_3_compatibility.md)
247
+ - **Project**: [Changelog](CHANGELOG.md) | [Contributing](CONTRIBUTING.md) | [Security policy](SECURITY.md) | [v0.3.1 compatibility report](V0_3_1_COMPATIBILITY_REPORT.md)
248
+
249
+ ---
250
+
251
+ ## License
252
+
253
+ Released under the [MIT License](LICENSE).
@@ -0,0 +1,202 @@
1
+ # OpenBench AI (v0.4.0)
2
+
3
+ **A modular, open-source LLM experiment execution, evaluation, statistical comparison, and benchmarking platform.**
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
+ [![Python 3.10+](https://img.shields.io/badge/Python-3.10%2B-3776AB.svg)](pyproject.toml)
7
+ [![Version: 0.4.0](https://img.shields.io/badge/Version-0.4.0-2ea44f.svg)](CHANGELOG.md)
8
+
9
+ ---
10
+
11
+ ## Project Overview
12
+
13
+ **OpenBench AI** is a Python toolkit for running reproducible language model benchmarks. It evaluates model responses against standardized JSONL datasets, repeats experiments, compares models with appropriate statistics, collects blinded human preferences, and audits dataset and run quality. The core installation has no external runtime dependencies, and nothing requires a paid API.
14
+
15
+ > **Note**: OpenBench AI is maintained by its project owner, and its initial development was AI-assisted. Contributions, bug reports, and new datasets are welcome!
16
+
17
+ ---
18
+
19
+ ## What's new in v0.4.0
20
+
21
+ - **Repeated-run benchmarking**: `openbench run --repetitions N --seed S` creates a *repeat group*. Each repetition is its own run with recorded lineage: group ID, repetition index, seeds and seed status, the exact record IDs, per-record content hashes, and cache provenance.
22
+ - **Interrupted groups resume** without re-requesting completed items (`openbench runs resume grp_...`).
23
+ - **Fix: repetitions no longer reuse cached responses.** In v0.3.1, repeated runs reused cached responses across repetitions, which understated variability.
24
+ - **Paired model comparison**: `openbench analyze` aligns stored runs, repeat groups or evaluation files on stable record IDs, with no provider calls. It reports the following, with Holm (or BH) correction, an explicit missing-data policy, coverage and failure-rate comparisons, and category and difficulty breakdowns:
25
+ - percentile bootstrap confidence intervals;
26
+ - an exact McNemar test (binary metrics) or a paired sign-flip permutation test;
27
+ - effect sizes;
28
+ - wins, losses and ties;
29
+ - optional equivalence testing (TOST) with a pre-specified margin.
30
+ - **Compatibility checks**: incompatible inputs, such as different record content, metric versions or scoring options, are refused unless you request a clearly labelled exploratory comparison.
31
+ - **Repeated-run variability**: generation variability (within items), item-to-item variation and provider failures are reported separately.
32
+ - **Human preference evaluation**: `openbench preferences create|validate|analyze` is a local-first, blinded A/B workflow. The task file contains no model identities; the identity key is a separate file. Analysis covers validated annotation import, task-weighted win rates with task-clustered CIs, tie and neither outcomes, position bias, Cohen's and Fleiss' kappa, and optional Elo with stated limitations.
33
+ - **Quality audits**: `openbench validate-dataset PATH --quality-checks` and `openbench runs verify ID --quality-checks` run read-only checks for:
34
+ - duplicate IDs, and exact and near-duplicate prompts (a lexical 5-gram heuristic);
35
+ - malformed or placeholder references, and keyword expectations missing from references;
36
+ - invalid metric configurations and inconsistent versions;
37
+ - missing outputs, incomplete runs and groups, integrity failures, and insufficient data.
38
+
39
+ Audits never modify data.
40
+ - **Reports**: every new analysis renders to JSON, Markdown and CSV, with provenance (software, environment, input SHA-256s, seeds, parameters). CSV cells are protected against spreadsheet formula injection.
41
+ - **Opt-in evaluation CIs**: `openbench evaluate --confidence-intervals`. Output is unchanged without the flag.
42
+
43
+ v0.3.1 commands, flags, public Python names, the 200 dataset records and existing scores are preserved, and v0.3.1 run directories can be read without modification. See the [migration guide](V0_4_0_MIGRATION_GUIDE.md) for the details and the few documented behaviour changes.
44
+
45
+ ---
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ git clone https://github.com/lakshaychhaba0001-sys/openbench-ai.git
51
+ cd openbench-ai
52
+
53
+ # Core installation (zero external runtime dependencies)
54
+ python -m pip install -e .
55
+
56
+ # Development + YAML config + JSON Schema validation
57
+ python -m pip install -e ".[dev]"
58
+
59
+ # Optional integration groups
60
+ python -m pip install -e ".[huggingface]" # transformers + torch for local HF models
61
+ python -m pip install -e ".[semantic]" # sentence-transformers for neural embeddings
62
+ python -m pip install -e ".[all]" # All optional runtime integrations
63
+
64
+ # Statistical reference cross-checks (tests only; never imported by the library)
65
+ python -m pip install -e ".[dev,stats-ref]"
66
+ ```
67
+
68
+ The Ollama adapter needs no extra packages: it uses the Python standard library HTTP client. All v0.4.0 statistics, preference and audit features use the standard library only.
69
+
70
+ ---
71
+
72
+ ## Quick Start
73
+
74
+ ### 1. Evaluate response files
75
+
76
+ ```bash
77
+ openbench evaluate --dataset datasets/reasoning/sample.jsonl --responses examples/sample_responses.json \
78
+ --metrics exact_match accuracy keyword_coverage --output results/
79
+
80
+ # With percentile bootstrap confidence intervals over items (v0.4.0, opt-in)
81
+ openbench evaluate --dataset datasets/reasoning/sample.jsonl --responses examples/sample_responses.json \
82
+ --confidence-intervals --seed 0 --output results/ci/
83
+ ```
84
+
85
+ ### 2. Run models, with repetitions
86
+
87
+ ```bash
88
+ openbench providers list
89
+ openbench run --dataset datasets/reasoning/sample.jsonl --provider mock --model model-a --repetitions 3 --seed 100
90
+ openbench run --dataset datasets/reasoning/sample.jsonl --provider mock --model model-b
91
+
92
+ openbench runs list
93
+ openbench runs show grp_<id> # a repeat group
94
+ openbench runs verify grp_<id> --quality-checks
95
+ openbench runs resume grp_<id> # finish an interrupted group
96
+ ```
97
+
98
+ ### 3. Compare stored results (no provider calls)
99
+
100
+ ```bash
101
+ openbench analyze --runs grp_<id> run_<id> --baseline run_<id> --format markdown --output results/comparison.md
102
+ openbench analyze --results results/model_a.json results/model_b.json --equivalence-margin 0.05 --output results/cmp.json
103
+ openbench analyze --runs grp_<id> --output results/variability.json # one repeat group: variability report
104
+ ```
105
+
106
+ ### 4. Collect blinded human preferences
107
+
108
+ ```bash
109
+ openbench preferences create --runs run_<a> run_<b> --seed 7 --output tasks/ --key-output private/tasks.key.json
110
+ # annotators fill annotations.jsonl from tasks/tasks.jsonl
111
+ openbench preferences validate --key private/tasks.key.json --annotations annotations.jsonl
112
+ openbench preferences analyze --key private/tasks.key.json --annotations annotations.jsonl --format markdown --output results/preferences.md
113
+ ```
114
+
115
+ ### 5. Audit quality
116
+
117
+ ```bash
118
+ openbench validate-dataset datasets/ --quality-checks --format markdown --output results/dataset_audit.md
119
+ ```
120
+
121
+ A complete runnable walkthrough using the mock provider is in [`examples/v040_workflow.py`](examples/v040_workflow.py).
122
+
123
+ ---
124
+
125
+ ## CLI Commands
126
+
127
+ | Command | Purpose |
128
+ | :--- | :--- |
129
+ | `validate-dataset`, `list-datasets`, `inspect-dataset`, `dataset-stats` | Dataset validation and exploration (`--quality-checks` adds the audit) |
130
+ | `evaluate`, `compare`, `export`, `history list/show` | Evaluate response files, descriptive comparison, export, history |
131
+ | `run`, `runs list/show/verify/resume/compare` | Provider execution, repeat groups, run management and integrity |
132
+ | `providers list/check`, `cache stats/clear` | Providers and the response cache |
133
+ | `analyze` | v0.4.0 paired comparison or repeated-run variability of stored results |
134
+ | `preferences create/validate/analyze` | v0.4.0 blinded pairwise human preference evaluation |
135
+
136
+ See the [CLI reference](docs/cli_reference.md) for every flag.
137
+
138
+ ---
139
+
140
+ ## Built-in Dataset Catalog (200 Examples)
141
+
142
+ | Category | Path | Examples | Highlights |
143
+ | :--- | :--- | ---: | :--- |
144
+ | `reasoning` | `datasets/reasoning/sample.jsonl` | 20 | Deductive logic, scheduling, combinatorics, rate problems |
145
+ | `mathematics` | `datasets/mathematics/sample.jsonl` | 20 | Calculus, linear algebra, number theory, geometry |
146
+ | `coding` | `datasets/coding/sample.jsonl` | 20 | Python stdlib, algorithms, Big-O, SQL, HTTP, Git |
147
+ | `debugging` | `datasets/debugging/sample.jsonl` | 20 | Root-cause analysis across Python, SQL, C, JS, and Git |
148
+ | `instruction_following` | `datasets/instruction_following/sample.jsonl` | 20 | Strict formatting, delimiters, casing, sorting |
149
+ | `factual_knowledge` | `datasets/factual_knowledge/sample.jsonl` | 20 | Verifiable science & CS facts with `source` metadata |
150
+ | `safety` | `datasets/safety/sample.jsonl` | 20 | Harm refusal, secure coding, medical boundaries with `rationale` |
151
+ | `multilingual` | `datasets/multilingual/sample.jsonl` | 20 | 11 languages (`es`, `fr`, `de`, `hi`, `pt`, `it`, `ja`, `zh`, `ru`, `nl`, `la`) |
152
+ | `summarization` | `datasets/summarization/sample.jsonl` | 20 | Single-sentence technical and scientific summarization |
153
+ | `structured_output` | `datasets/structured_output/sample.jsonl` | 20 | JSON generation with `required_keys`, `field_types`, `expected_schema` |
154
+
155
+ The built-in quality audit reports 0 errors, 6 warnings and 8 informational findings. These are documented historical keyword exceptions, one ambiguous item and accepted answer variants; see [quality audits](docs/quality_audits.md). With 20 items per category, statistical comparisons on one category have low power, and the reports say so.
156
+
157
+ ---
158
+
159
+ ## Metrics Reference
160
+
161
+ | Metric Identifier | Version | Kind | Description | Key Methodological Limitation |
162
+ | :--- | :--- | :--- | :--- | :--- |
163
+ | `exact_match` | `0.1.0` | binary | Normalized string equality (`1.0` or `0.0`). | Penalizes conversational framing. |
164
+ | `accuracy` | `0.1.0` | binary | Deterministic correctness via exact or word-bounded answer containment. | Does not parse negation or complex paraphrases. |
165
+ | `keyword_coverage` | `0.1.0` | continuous | Proportion of expected keywords present in the response. | **Not equivalent to semantic correctness.** |
166
+ | `precision` | `0.2.0` | continuous | $\text{TP} / (\text{TP} + \text{FP})$ for binary decisions or element sets. | Applies to discrete decisions/sets, not free-form prose truth. |
167
+ | `recall` | `0.2.0` | continuous | $\text{TP} / (\text{TP} + \text{FN})$ for binary decisions or element sets. | Does not penalize extra false-positive elements alone. |
168
+ | `f1` | `0.2.0` | continuous | Harmonic mean of `precision` and `recall`. | Ignores word order outside discrete elements. |
169
+ | `rouge` / `rouge_1` / `rouge_l` | `0.2.0` | continuous | Unigram (`rouge_1`) and LCS (`rouge_l`) overlap F1. | Cannot detect factual hallucinations or antonym flips. |
170
+ | `bleu` | `0.2.0` | continuous | Smoothed clipped $n$-gram precision with brevity penalty. | Penalizes valid synonyms and paraphrases. |
171
+ | `semantic_similarity` | `0.2.0` | continuous | Embedding cosine similarity via configurable `EmbeddingProvider`; with the default `local_ngram_hash` provider it is a legacy alias for `lexical_similarity`. | **Not factual correctness**; opposite statements can have high similarity. |
172
+ | `lexical_similarity` | `0.3.1` | continuous | Cosine similarity of hashed word and character 3-gram features. | Surface wording only; paraphrases score low and negations score high. |
173
+ | `structured_output` | `0.2.0` | continuous | Validates JSON syntax, required keys, field types, and JSON Schema. | Structural validity is separate from factual value accuracy. |
174
+
175
+ The **kind** (`score_kind`) selects the statistical procedure in `analyze`. Metric scores and versions are unchanged in v0.4.0.
176
+
177
+ ---
178
+
179
+ ## Statistical honesty
180
+
181
+ - A non-significant difference is never reported as "no difference" or "equivalent". Equivalence requires a pre-specified margin and a TOST, and continuous-metric equivalence is disabled in v0.4.0 (descriptive only).
182
+ - Exact binary equivalence p-values are computed in floating point with a documented, tested error allowance. This is an engineering bound, not a machine-checked proof.
183
+ - Confidence intervals describe uncertainty over items for fixed models, prompts and settings. They are labelled as not adjusted for multiple comparisons.
184
+ - A seed passed to a provider does not guarantee deterministic output.
185
+ - SHA-256 checksums show that files match recorded checksums. They do not prove that results are correct or authentic.
186
+
187
+ See the [statistical methodology](docs/statistical_methodology.md).
188
+
189
+ ---
190
+
191
+ ## Documentation Index
192
+
193
+ - **v0.4.0 guides**: [Repeated runs](docs/repeated_runs.md) | [Model comparison](docs/model_comparison.md) | [Human preferences](docs/human_preferences.md) | [Quality audits](docs/quality_audits.md) | [Reproducibility & reports](docs/reproducibility.md) | [Statistical methodology](docs/statistical_methodology.md) | [CLI reference](docs/cli_reference.md) | [Python API](docs/api_reference.md) | [Migration from v0.3.1](V0_4_0_MIGRATION_GUIDE.md)
194
+ - **Execution, providers & integrity**: [Model Execution Engine](docs/model_execution.md) | [Providers](docs/providers.md) | [Ollama](docs/ollama.md) | [Hugging Face (experimental)](docs/huggingface.md) | [Custom providers](docs/custom_provider.md) | [Experiment tracking](docs/experiment_tracking.md) | [Performance monitoring](docs/performance_monitoring.md) | [Reliability & caching](docs/reliability.md) | [Benchmark integrity](docs/benchmark_integrity.md) | [Security & privacy](docs/security_and_privacy.md)
195
+ - **Datasets, metrics & configuration**: [Installation](docs/installation.md) | [Usage](docs/usage.md) | [Architecture](docs/architecture.md) | [Dataset catalog](docs/dataset_catalog.md) | [Core metrics](docs/metrics.md) | [Advanced metrics](docs/advanced_metrics.md) | [YAML profiles](docs/configuration.md) | [Historical tracking](docs/historical_tracking.md) | [v0.3 compatibility](docs/v0_3_compatibility.md)
196
+ - **Project**: [Changelog](CHANGELOG.md) | [Contributing](CONTRIBUTING.md) | [Security policy](SECURITY.md) | [v0.3.1 compatibility report](V0_3_1_COMPATIBILITY_REPORT.md)
197
+
198
+ ---
199
+
200
+ ## License
201
+
202
+ Released under the [MIT License](LICENSE).
@@ -0,0 +1,96 @@
1
+ [build-system]
2
+ requires = ["setuptools>=65.0", "wheel", "packaging>=24.2"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "openbench-ai"
7
+ version = "0.4.0"
8
+ description = "A modular, open-source LLM experiment execution, evaluation, statistical comparison, and benchmarking platform."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ authors = [
13
+ { name = "Lakshay Chhaba" }
14
+ ]
15
+ keywords = ["llm", "evaluation", "benchmarking", "ai", "metrics", "reproducibility", "experiments", "statistics", "human-preference"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "Intended Audience :: Science/Research",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
26
+ "Topic :: Software Development :: Testing",
27
+ ]
28
+ dependencies = []
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/lakshaychhaba0001-sys/openbench-ai"
32
+ Repository = "https://github.com/lakshaychhaba0001-sys/openbench-ai.git"
33
+ Issues = "https://github.com/lakshaychhaba0001-sys/openbench-ai/issues"
34
+
35
+ [project.optional-dependencies]
36
+ dev = [
37
+ "pytest>=7.4.0,<9.0.0",
38
+ "ruff>=0.4.0,<1.0.0",
39
+ "PyYAML>=6.0,<7.0",
40
+ "jsonschema>=4.18.0,<5.0.0",
41
+ ]
42
+ huggingface = [
43
+ "transformers>=4.35.0,<5.0.0",
44
+ "torch>=2.0.0,<3.0.0",
45
+ ]
46
+ config = [
47
+ "PyYAML>=6.0,<7.0",
48
+ ]
49
+ metrics = [
50
+ "jsonschema>=4.18.0,<5.0.0",
51
+ ]
52
+ semantic = [
53
+ "sentence-transformers>=2.2.0,<4.0.0",
54
+ ]
55
+ # Reference libraries for the statistical cross-check tests only (tests/reference).
56
+ # OpenBench library code never imports them; they are not runtime dependencies.
57
+ stats-ref = [
58
+ "numpy>=1.24",
59
+ "scipy>=1.10",
60
+ "statsmodels>=0.14",
61
+ ]
62
+ all = [
63
+ "pytest>=7.4.0,<9.0.0",
64
+ "ruff>=0.4.0,<1.0.0",
65
+ "PyYAML>=6.0,<7.0",
66
+ "jsonschema>=4.18.0,<5.0.0",
67
+ "sentence-transformers>=2.2.0,<4.0.0",
68
+ "transformers>=4.35.0,<5.0.0",
69
+ "torch>=2.0.0,<3.0.0",
70
+ ]
71
+
72
+ [project.scripts]
73
+ openbench = "openbench.cli:main"
74
+
75
+ [tool.setuptools.packages.find]
76
+ where = ["src"]
77
+
78
+ [tool.setuptools.package-data]
79
+ openbench = ["py.typed", "quality_notes.json"]
80
+
81
+ [tool.pytest.ini_options]
82
+ testpaths = ["tests"]
83
+ pythonpath = ["src"]
84
+ addopts = "-q -W error::SyntaxWarning"
85
+
86
+ [tool.ruff]
87
+ target-version = "py310"
88
+ line-length = 100
89
+ src = ["src", "tests", "examples", "scripts"]
90
+
91
+ [tool.ruff.lint]
92
+ select = ["E", "F", "I", "B", "UP", "N"]
93
+ ignore = ["E501"]
94
+
95
+ [tool.ruff.lint.isort]
96
+ known-first-party = ["openbench"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+