judge-eval 0.1.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.
- judge_eval-0.1.0/LICENSE +201 -0
- judge_eval-0.1.0/PKG-INFO +14 -0
- judge_eval-0.1.0/README.md +416 -0
- judge_eval-0.1.0/judge_eval/__init__.py +0 -0
- judge_eval-0.1.0/judge_eval/cli.py +190 -0
- judge_eval-0.1.0/judge_eval/data/__init__.py +0 -0
- judge_eval-0.1.0/judge_eval/data/adapter_utils.py +49 -0
- judge_eval-0.1.0/judge_eval/data/adapters.py +233 -0
- judge_eval-0.1.0/judge_eval/data/dataset_specs/helpsteer2.yaml +11 -0
- judge_eval-0.1.0/judge_eval/data/dataset_specs/helpsteer3.yaml +11 -0
- judge_eval-0.1.0/judge_eval/data/dataset_specs/hh_rlhf.yaml +7 -0
- judge_eval-0.1.0/judge_eval/data/dataset_specs/judgebench.yaml +8 -0
- judge_eval-0.1.0/judge_eval/data/dataset_specs/openrubric_v2.yaml +9 -0
- judge_eval-0.1.0/judge_eval/data/dataset_specs/ppe_human_preference.yaml +10 -0
- judge_eval-0.1.0/judge_eval/data/dataset_specs/reward_bench.yaml +9 -0
- judge_eval-0.1.0/judge_eval/data/dataset_specs/reward_bench_2.yaml +11 -0
- judge_eval-0.1.0/judge_eval/data/dataset_specs/rm_bench.yaml +10 -0
- judge_eval-0.1.0/judge_eval/data/dataset_specs/rmb_bon.yaml +9 -0
- judge_eval-0.1.0/judge_eval/data/dataset_specs/rmb_pairwise.yaml +9 -0
- judge_eval-0.1.0/judge_eval/data/spec_loader.py +289 -0
- judge_eval-0.1.0/judge_eval/expansion.py +236 -0
- judge_eval-0.1.0/judge_eval/formatting.py +245 -0
- judge_eval-0.1.0/judge_eval/hub/__init__.py +0 -0
- judge_eval-0.1.0/judge_eval/hub/conf/__init__.py +0 -0
- judge_eval-0.1.0/judge_eval/hub/conf/discriminative.yaml +73 -0
- judge_eval-0.1.0/judge_eval/hub/conf/hub_config.yaml +106 -0
- judge_eval-0.1.0/judge_eval/hub/config.py +193 -0
- judge_eval-0.1.0/judge_eval/hub/orchestrator.py +293 -0
- judge_eval-0.1.0/judge_eval/hub/workers/__init__.py +0 -0
- judge_eval-0.1.0/judge_eval/hub/workers/aggregator.py +363 -0
- judge_eval-0.1.0/judge_eval/hub/workers/dataset_worker.py +202 -0
- judge_eval-0.1.0/judge_eval/hub/workers/discriminative_hf_engine_worker.py +183 -0
- judge_eval-0.1.0/judge_eval/hub/workers/discriminative_vllm_engine_worker.py +134 -0
- judge_eval-0.1.0/judge_eval/hub/workers/generative_vllm_engine_worker.py +142 -0
- judge_eval-0.1.0/judge_eval/io/__init__.py +0 -0
- judge_eval-0.1.0/judge_eval/io/utils.py +33 -0
- judge_eval-0.1.0/judge_eval/metrics/__init__.py +0 -0
- judge_eval-0.1.0/judge_eval/metrics/core.py +170 -0
- judge_eval-0.1.0/judge_eval/metrics/helpers.py +58 -0
- judge_eval-0.1.0/judge_eval/metrics/rewardbench_metric.py +180 -0
- judge_eval-0.1.0/judge_eval/parsers/__init__.py +0 -0
- judge_eval-0.1.0/judge_eval/parsers/core.py +8 -0
- judge_eval-0.1.0/judge_eval/parsers/functions.py +93 -0
- judge_eval-0.1.0/judge_eval/parsers/registry.py +25 -0
- judge_eval-0.1.0/judge_eval/preference.py +170 -0
- judge_eval-0.1.0/judge_eval/reduction.py +229 -0
- judge_eval-0.1.0/judge_eval/reporting/__init__.py +0 -0
- judge_eval-0.1.0/judge_eval/reporting/tables.py +124 -0
- judge_eval-0.1.0/judge_eval/templates/__init__.py +0 -0
- judge_eval-0.1.0/judge_eval/templates/prompt_templates.py +397 -0
- judge_eval-0.1.0/judge_eval/templates/registry.py +24 -0
- judge_eval-0.1.0/judge_eval/types.py +147 -0
- judge_eval-0.1.0/judge_eval.egg-info/PKG-INFO +14 -0
- judge_eval-0.1.0/judge_eval.egg-info/SOURCES.txt +58 -0
- judge_eval-0.1.0/judge_eval.egg-info/dependency_links.txt +1 -0
- judge_eval-0.1.0/judge_eval.egg-info/entry_points.txt +2 -0
- judge_eval-0.1.0/judge_eval.egg-info/requires.txt +9 -0
- judge_eval-0.1.0/judge_eval.egg-info/top_level.txt +1 -0
- judge_eval-0.1.0/pyproject.toml +30 -0
- judge_eval-0.1.0/setup.cfg +4 -0
judge_eval-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: judge-eval
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Requires-Python: >=3.10
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Dist: ray[default]>=2.9
|
|
7
|
+
Requires-Dist: vllm>=0.4
|
|
8
|
+
Requires-Dist: datasets
|
|
9
|
+
Requires-Dist: transformers
|
|
10
|
+
Requires-Dist: jinja2
|
|
11
|
+
Requires-Dist: hydra-core>=1.3
|
|
12
|
+
Provides-Extra: dev
|
|
13
|
+
Requires-Dist: pytest; extra == "dev"
|
|
14
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
# judge-eval-hub
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
4
|
+
[](https://hydra.cc/)
|
|
5
|
+
|
|
6
|
+
Unified judge evaluation hub — supports **generative** and **discriminative** judge/reward models, **pairwise** and **pointwise** input types, across multiple datasets in parallel.
|
|
7
|
+
|
|
8
|
+
Loads the model **once**, evaluates across **multiple datasets simultaneously**, and maximises GPU utilisation via a Ray-based pipeline with vLLM.
|
|
9
|
+
|
|
10
|
+
**Key advantages:**
|
|
11
|
+
- **Easy to extend** — adding a new dataset is just a YAML spec + adapter function. Adding a new template is just a Python class + registry entry. No pipeline changes needed.
|
|
12
|
+
- **Unified pipeline** — same architecture for generative and discriminative judge/reward models, both powered by vLLM with tensor parallelism.
|
|
13
|
+
- **Multi-dataset parallel** — evaluate one model across all benchmarks in a single run.
|
|
14
|
+
- **Dataset-specific aggregation** — each dataset defines its own reduction and aggregation strategy (e.g., micro, macro, weighted sections).
|
|
15
|
+
- **Resume support** — checkpoint per unit, re-run to pick up where you left off.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Install
|
|
23
|
+
pip install -e .
|
|
24
|
+
|
|
25
|
+
# Generative judge/reward model (default config: hub_config.yaml)
|
|
26
|
+
judge-eval
|
|
27
|
+
|
|
28
|
+
# Discriminative judge/reward model
|
|
29
|
+
judge-eval --config-name discriminative
|
|
30
|
+
|
|
31
|
+
# CLI overrides (Hydra)
|
|
32
|
+
judge-eval model.path=Qwen/Qwen3-8B-Instruct
|
|
33
|
+
judge-eval --config-name discriminative model.path=Skywork/Skywork-Reward-V2-Qwen3-8B
|
|
34
|
+
judge-eval model.engine.gpu_memory_utilization=0.95
|
|
35
|
+
judge-eval "resources.gpu_groups=[[0,1],[2,3]]"
|
|
36
|
+
|
|
37
|
+
# Validate config — resolves datasets/templates, prints summary, no model loading
|
|
38
|
+
judge-eval run.dry_run=true
|
|
39
|
+
|
|
40
|
+
# Preview formatted prompts — 1 sample per dataset, no inference
|
|
41
|
+
judge-eval run.show_prompt=true
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Supported Datasets
|
|
47
|
+
|
|
48
|
+
| Dataset | Adapter | Unit Structure | Reduction | Overall Aggregation |
|
|
49
|
+
|--------------------------|------------------|----------------|-------------|----------------------------|
|
|
50
|
+
| `nvidia/HelpSteer2` | `helpsteer2` | pair | direct | micro |
|
|
51
|
+
| `nvidia/HelpSteer3` | `helpsteer3` | pair | direct | micro |
|
|
52
|
+
| `Anthropic/hh-rlhf` | `hh_rlhf` | pair | direct | micro |
|
|
53
|
+
| `allenai/reward-bench` | `reward_bench` | pair | direct | custom (weighted sections) |
|
|
54
|
+
| `allenai/reward-bench-2` | `reward_bench_2` | one_vs_many | all_correct | macro:subset |
|
|
55
|
+
| `THU-KEG/RM-Bench` | `rm_bench` | pair | direct | macro:domain |
|
|
56
|
+
| `ScalerLab/JudgeBench` | `judgebench` | pair | direct | micro |
|
|
57
|
+
|
|
58
|
+
## Supported Templates & Parsers
|
|
59
|
+
|
|
60
|
+
| Template Name | Input Type | Output Format | Parser |
|
|
61
|
+
|----------------------------|------------|--------------------------|-------------------------|
|
|
62
|
+
| `pairwise-fixed` | Pairwise | `<verdict>A/B</verdict>` | `parse_binary_verdict` |
|
|
63
|
+
| `pairwise-fixed-concrete` | Pairwise | `<verdict>A/B</verdict>` | `parse_binary_verdict` |
|
|
64
|
+
| `pairwise-adaptive` | Pairwise | `<verdict>A/B</verdict>` | `parse_binary_verdict` |
|
|
65
|
+
| `pairwise-adaptive-verify` | Pairwise | `<verdict>A/B</verdict>` | `parse_binary_verdict` |
|
|
66
|
+
| `pairwise-openrubric` | Pairwise | `Winner: Response A/B` | `parse_binary_winner` |
|
|
67
|
+
| `pairwise-mtbench` | Pairwise | `\boxed{A/B}` | `parse_binary_boxed` |
|
|
68
|
+
| `pointwise-score` | Pointwise | `<score>N</score>` | `parse_score` |
|
|
69
|
+
| `passthrough` | Pointwise | — | `None` (discriminative) |
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Config Reference
|
|
74
|
+
|
|
75
|
+
All settings live in `judge_eval/hub/conf/hub_config.yaml` (generative) or `judge_eval/hub/conf/discriminative.yaml`. Every field can be overridden via Hydra CLI.
|
|
76
|
+
|
|
77
|
+
### `run` — execution settings
|
|
78
|
+
|
|
79
|
+
| Key | Default | Description |
|
|
80
|
+
|---------------|-----------|---------------------------------------------------------|
|
|
81
|
+
| `seed` | `42` | Global RNG seed (affects shuffle_label, shuffle_sample) |
|
|
82
|
+
| `save_dir` | `results` | Root output directory |
|
|
83
|
+
| `log_level` | `INFO` | Logging level |
|
|
84
|
+
| `override` | `false` | If true, discard previous results and regenerate |
|
|
85
|
+
| `dry_run` | `false` | Print config summary without launching Ray |
|
|
86
|
+
| `show_prompt` | `false` | Show formatted prompts (1 sample per dataset) and exit |
|
|
87
|
+
|
|
88
|
+
### `model` — model settings
|
|
89
|
+
|
|
90
|
+
| Key | Default | Description |
|
|
91
|
+
|------------------------|------------------|--------------------------------------------------------------------------------|
|
|
92
|
+
| `path` | — | HuggingFace model ID or local path |
|
|
93
|
+
| `backend` | `generative` | `generative` (vLLM generate) or `discriminative` (vLLM reward) |
|
|
94
|
+
| `input_type` | `pairwise` | `pairwise` (compare A vs B) or `pointwise` (score each response independently) |
|
|
95
|
+
| `dtype` | `auto` | Model dtype |
|
|
96
|
+
| `max_model_len` | `null` | Max context length; `null` = auto-detect |
|
|
97
|
+
| `custom_chat_template` | `null` | Override the tokenizer's chat template |
|
|
98
|
+
| `enable_thinking` | `false` | Pass `enable_thinking` to `apply_chat_template` |
|
|
99
|
+
| `template` | `pairwise-fixed` | Prompt template name. Use `passthrough` for discriminative models |
|
|
100
|
+
| `parse_mode` | `text` | `text` (parse from generated text) or `logprob` (extract from logprobs) |
|
|
101
|
+
|
|
102
|
+
### `model.engine` — engine tuning
|
|
103
|
+
|
|
104
|
+
| Key | Default | Description |
|
|
105
|
+
|--------------------------|---------|-------------------------------------|
|
|
106
|
+
| `gpu_memory_utilization` | `0.92` | Fraction of GPU memory for KV cache |
|
|
107
|
+
| `enable_prefix_caching` | `true` | Cache shared system-prompt KV |
|
|
108
|
+
| `enforce_eager` | `false` | Disable CUDA graph capture |
|
|
109
|
+
|
|
110
|
+
### `model.generation` — sampling parameters (generative only)
|
|
111
|
+
|
|
112
|
+
| Key | Default | Description |
|
|
113
|
+
|---------------|---------|----------------------------------|
|
|
114
|
+
| `max_tokens` | `8192` | Max new tokens per response |
|
|
115
|
+
| `temperature` | `0.7` | Sampling temperature |
|
|
116
|
+
| `top_p` | `0.8` | Nucleus sampling |
|
|
117
|
+
| `top_k` | `20` | Top-k sampling |
|
|
118
|
+
| `min_p` | `0.0` | Min-p sampling |
|
|
119
|
+
| `n` | `1` | Number of generations per prompt |
|
|
120
|
+
| `stop` | `null` | Stop sequences |
|
|
121
|
+
|
|
122
|
+
### `resources` — pipeline resources
|
|
123
|
+
|
|
124
|
+
| Key | Default | Description |
|
|
125
|
+
|---------------------|-----------------|--------------------------------------------------------------------------|
|
|
126
|
+
| `gpu_groups` | `[[0],[1],...]` | List of GPU-ID lists. One engine per sub-list. Sub-list length = TP size |
|
|
127
|
+
| `engine_batch_size` | `512` | Max requests per engine per inference call |
|
|
128
|
+
| `n_workers` | `8` | CPU workers for misc tasks |
|
|
129
|
+
|
|
130
|
+
GPU group examples:
|
|
131
|
+
|
|
132
|
+
```yaml
|
|
133
|
+
gpu_groups: [[0],[1],[2],[3],[4],[5],[6],[7]] # 8 × single-GPU
|
|
134
|
+
gpu_groups: [[0,1,2,3],[4,5,6,7]] # 2 × 4-GPU tensor-parallel
|
|
135
|
+
gpu_groups: [[0,1],[2,3],[4,5],[6,7]] # 4 × 2-GPU tensor-parallel
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### `evaluation` — universal evaluation flags
|
|
139
|
+
|
|
140
|
+
Defaults apply to all datasets. Per-dataset overrides are allowed.
|
|
141
|
+
|
|
142
|
+
| Key | Default | Description |
|
|
143
|
+
|-------------------|---------|------------------------------------------------------------|
|
|
144
|
+
| `position_swap` | `false` | Create swapped-position copies for consistency measurement |
|
|
145
|
+
| `shuffle_label` | `true` | Randomly swap A/B assignment (pairwise only) |
|
|
146
|
+
| `shuffle_sample` | `true` | Shuffle sample order |
|
|
147
|
+
| `format_context` | `true` | Apply multi-turn `<user>/<assistant>` formatting to context |
|
|
148
|
+
| `format_response` | `true` | Wrap responses in `<assistant>` tags |
|
|
149
|
+
| `max_samples` | `null` | Limit samples per dataset; `null` = all |
|
|
150
|
+
|
|
151
|
+
### `datasets` — dataset list
|
|
152
|
+
|
|
153
|
+
Simple string form or override dict form:
|
|
154
|
+
|
|
155
|
+
```yaml
|
|
156
|
+
datasets:
|
|
157
|
+
- nvidia/HelpSteer3 # simple: use all defaults
|
|
158
|
+
- allenai/reward-bench
|
|
159
|
+
- name: ScalerLab/JudgeBench # override form
|
|
160
|
+
position_swap: true
|
|
161
|
+
- name: allenai/reward-bench-2
|
|
162
|
+
template: pairwise-fixed-concrete
|
|
163
|
+
max_samples: 500
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Per-dataset override keys: `position_swap`, `shuffle_label`, `shuffle_sample`, `format_context`, `format_response`, `max_samples`, `template`.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Run Tag & Resume
|
|
171
|
+
|
|
172
|
+
### Run tag format
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
{template}_fc{format_context}_fr{format_response}_sl{shuffle_label}_seed{seed}_et{enable_thinking}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Example: `pairwise-fixed_fc1_fr1_sl1_seed42_etFalse`
|
|
179
|
+
|
|
180
|
+
**Included** (changing any of these produces a new run):
|
|
181
|
+
- `template`, `format_context`, `format_response`, `shuffle_label`, `seed`, `enable_thinking`
|
|
182
|
+
|
|
183
|
+
**Excluded** (intentionally):
|
|
184
|
+
- `position_swap` — excluded so original results are reused when enabling swap later, saving 50% of compute.
|
|
185
|
+
- `parse_mode` — derived from the template, not independent.
|
|
186
|
+
- Generation params (temperature, etc.) — use `run.override=true` to force regeneration if changed.
|
|
187
|
+
|
|
188
|
+
### Resuming
|
|
189
|
+
|
|
190
|
+
Every completed `UnitJudgment` is written to JSONL immediately. On re-run, completed units are skipped automatically.
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
judge-eval # resume — skips completed units
|
|
194
|
+
judge-eval run.override=true # force fresh run
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Output Structure
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
results/
|
|
203
|
+
└── {model_name}/
|
|
204
|
+
└── {dataset_name}/
|
|
205
|
+
├── {run_tag}.jsonl # per-unit checkpoint (resume)
|
|
206
|
+
├── {run_tag}_metrics.json # metric summary
|
|
207
|
+
└── {run_tag}_*_accuracy_table.txt # per-dimension accuracy tables
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Aggregating results across models
|
|
211
|
+
|
|
212
|
+
`generate_table.py` aggregates `_metrics.json` files across models and benchmarks:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
python generate_table.py --format txt # plain text
|
|
216
|
+
python generate_table.py --format latex # LaTeX
|
|
217
|
+
python generate_table.py --format csv # tab-separated (for spreadsheets)
|
|
218
|
+
python generate_table.py --results_dir /path/to/results --output table.txt
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Output columns: `Model | Overall Acc. | Avg Len | <sub-groups> | Pos. Cons.` (if `position_swap` was enabled).
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Extending
|
|
226
|
+
|
|
227
|
+
### Adding a dataset
|
|
228
|
+
|
|
229
|
+
1. **Create a YAML spec** in `judge_eval/data/dataset_specs/`:
|
|
230
|
+
|
|
231
|
+
```yaml
|
|
232
|
+
name: org/my-dataset # HuggingFace dataset path
|
|
233
|
+
split: test # HF split (null for all splits)
|
|
234
|
+
adapter: my_dataset # maps to judge_eval.data.adapters.extract_my_dataset
|
|
235
|
+
unit_structure: pair # pair | one_vs_many
|
|
236
|
+
reduction: direct # direct | all_correct | custom:module:fn
|
|
237
|
+
aggregation:
|
|
238
|
+
overall: micro # micro | macro:<dimension> | custom:module:fn
|
|
239
|
+
dimensions:
|
|
240
|
+
category: micro
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
2. **Write an adapter function** in `judge_eval/data/adapters.py`:
|
|
244
|
+
|
|
245
|
+
```python
|
|
246
|
+
def extract_my_dataset(example) -> EvalUnit:
|
|
247
|
+
return EvalUnit(
|
|
248
|
+
unit_id="", # assigned by DatasetWorker
|
|
249
|
+
prompt=example["question"],
|
|
250
|
+
responses=[example["response_a"], example["response_b"]],
|
|
251
|
+
chosen_idx=0 if example["label"] == "a" else 1,
|
|
252
|
+
dimensions={"category": example["category"]},
|
|
253
|
+
)
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
3. **Add to config**: `datasets: [org/my-dataset]`
|
|
257
|
+
|
|
258
|
+
#### Dataset spec fields
|
|
259
|
+
|
|
260
|
+
| Field | Required | Description |
|
|
261
|
+
|------------------|----------|-------------------------------------------------------------------|
|
|
262
|
+
| `name` | Yes | HuggingFace dataset path |
|
|
263
|
+
| `split` | No | HF split name (null = all splits) |
|
|
264
|
+
| `data_dir` | No | HF `data_dir` parameter |
|
|
265
|
+
| `adapter` | Yes | Name → `extract_{adapter}` in `judge_eval.data.adapters` |
|
|
266
|
+
| `unit_structure` | Yes | `pair` (2 responses) or `one_vs_many` (1 chosen + N rejected) |
|
|
267
|
+
| `reduction` | Yes | `direct`, `all_correct`, or `custom:<module>:<fn>` |
|
|
268
|
+
| `aggregation` | Yes | Dict with `overall` and optional `dimensions` |
|
|
269
|
+
| `filters` | No | List of filter expressions applied before the adapter |
|
|
270
|
+
|
|
271
|
+
#### Filters
|
|
272
|
+
|
|
273
|
+
Applied to the raw HuggingFace dataset before the adapter. Form: `column op value`.
|
|
274
|
+
|
|
275
|
+
```yaml
|
|
276
|
+
filters:
|
|
277
|
+
- "preference_strength != 0"
|
|
278
|
+
- "split != train"
|
|
279
|
+
- "subset != Ties"
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Supported operators: `==`, `!=`, `>`, `<`, `>=`, `<=`. Values are auto-parsed as int, float, or string.
|
|
283
|
+
|
|
284
|
+
#### Reduction strategies
|
|
285
|
+
|
|
286
|
+
- **`direct`**: Each pair independently graded. Pairwise: predict matches label. Pointwise: argmax of scores matches chosen.
|
|
287
|
+
- **`all_correct`**: All comparisons for the unit must be correct (e.g., RewardBench-2: must beat all rejected responses).
|
|
288
|
+
- **`custom:<module>:<fn>`**: Signature `(preferences, input_type, position_swap) -> UnitJudgment`.
|
|
289
|
+
|
|
290
|
+
#### Aggregation strategies
|
|
291
|
+
|
|
292
|
+
- **`micro`**: Simple average over all units.
|
|
293
|
+
- **`macro:<dimension>`**: Average of per-group micro averages, grouped by the named dimension.
|
|
294
|
+
- **`custom:<module>:<fn>`**: Signature `(judgments, aggregation_config, position_swap) -> dict`.
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
### Adding a template
|
|
299
|
+
|
|
300
|
+
1. **Create a template class** in `judge_eval/templates/prompt_templates.py`:
|
|
301
|
+
|
|
302
|
+
```python
|
|
303
|
+
class my_custom_template(BasePromptTemplate):
|
|
304
|
+
def __init__(self):
|
|
305
|
+
system_msg = "You are a judge. Evaluate..."
|
|
306
|
+
user_msg = (
|
|
307
|
+
"Context: {context}\n"
|
|
308
|
+
"Response A: {response1}\n" # pairwise: {response1}, {response2}
|
|
309
|
+
"Response B: {response2}\n" # pointwise: {response}
|
|
310
|
+
"Verdict:"
|
|
311
|
+
)
|
|
312
|
+
super().__init__(system_msg, user_msg)
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
Standard field names:
|
|
316
|
+
|
|
317
|
+
| Field | Input Type | Description |
|
|
318
|
+
|--------------|------------|-----------------------------------|
|
|
319
|
+
| `{context}` | Both | The prompt / conversation context |
|
|
320
|
+
| `{response1}`| Pairwise | Response in the A position |
|
|
321
|
+
| `{response2}`| Pairwise | Response in the B position |
|
|
322
|
+
| `{response}` | Pointwise | Single response being evaluated |
|
|
323
|
+
|
|
324
|
+
Additional custom fields are populated from `EvalUnit.extra` (see below). The `passthrough` template bypasses the system/user prompt structure and builds raw `[user, assistant]` messages directly — use this for discriminative models.
|
|
325
|
+
|
|
326
|
+
#### Injecting extra context into templates via `extra`
|
|
327
|
+
|
|
328
|
+
Templates can reference any field from `EvalUnit.extra`. This lets adapters pass additional context (e.g., rubrics, feedback) into the prompt without modifying the pipeline. The key names in `extra` must match the `{field}` placeholders in the template exactly (e.g., `extra["rubric"]` → `{rubric}`).
|
|
329
|
+
|
|
330
|
+
**Step 1: Adapter** — add fields to `extra`:
|
|
331
|
+
|
|
332
|
+
```python
|
|
333
|
+
def extract_my_dataset(example) -> EvalUnit:
|
|
334
|
+
extra = {
|
|
335
|
+
"rubric": example["rubric"], # position-independent
|
|
336
|
+
"feedback": example["feedback"], # position-dependent (references "Assistant A"/"Assistant B")
|
|
337
|
+
"_swap_markers": ["Assistant A", "Assistant B"], # markers to swap when positions change
|
|
338
|
+
}
|
|
339
|
+
return EvalUnit(
|
|
340
|
+
unit_id="",
|
|
341
|
+
prompt=example["prompt"],
|
|
342
|
+
responses=[example["response_a"], example["response_b"]],
|
|
343
|
+
chosen_idx=0 if example["label"] == "A" else 1,
|
|
344
|
+
extra=extra,
|
|
345
|
+
)
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
**Step 2: Template** — reference `{rubric}` and `{feedback}` in the prompt:
|
|
349
|
+
|
|
350
|
+
```python
|
|
351
|
+
class pairwise_with_rubric_and_feedback(BasePromptTemplate):
|
|
352
|
+
def __init__(self):
|
|
353
|
+
system_msg = ""
|
|
354
|
+
user_msg = (
|
|
355
|
+
"[Context]\n{context}\n\n"
|
|
356
|
+
"[Assistant A]\n{response1}\n\n"
|
|
357
|
+
"[Assistant B]\n{response2}\n\n"
|
|
358
|
+
"Rubric:\n{rubric}\n\n"
|
|
359
|
+
"Feedback:\n{feedback}\n\n"
|
|
360
|
+
"Verdict (A or B) in <verdict>...</verdict>."
|
|
361
|
+
)
|
|
362
|
+
super().__init__(system_msg, user_msg)
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
**Position-aware marker swapping (`_swap_markers`):**
|
|
366
|
+
|
|
367
|
+
When `shuffle_label` or `position_swap` swaps response positions, the expansion layer automatically swaps all marker occurrences in every string field of `extra`:
|
|
368
|
+
- `rubric` has no markers → stays unchanged.
|
|
369
|
+
- `feedback` contains "Assistant A" / "Assistant B" → references get swapped to match the new positions.
|
|
370
|
+
|
|
371
|
+
Without `_swap_markers`, position-sensitive text would point to the wrong response after a swap. See `extract_helpsteer3_feedback` in `adapters.py` for a working example.
|
|
372
|
+
|
|
373
|
+
2. **Register** in `judge_eval/templates/registry.py`:
|
|
374
|
+
|
|
375
|
+
```python
|
|
376
|
+
TEMPLATE_REGISTRY = {
|
|
377
|
+
...
|
|
378
|
+
"my-custom": templates.my_custom_template,
|
|
379
|
+
}
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
3. **Add a matching parser** (see below) and use in config: `model.template: my-custom`
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
### Adding a parser
|
|
387
|
+
|
|
388
|
+
1. **Add a parser function** in `judge_eval/parsers/functions.py`:
|
|
389
|
+
|
|
390
|
+
```python
|
|
391
|
+
def parse_my_format(text: str, strict: bool = True) -> str | None:
|
|
392
|
+
"""Returns "A", "B", or None on parse failure.
|
|
393
|
+
strict=True: only match structured tags.
|
|
394
|
+
strict=False: fall back to regex anywhere in text.
|
|
395
|
+
"""
|
|
396
|
+
...
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
2. **Register** in `judge_eval/parsers/registry.py` using the same key as the template:
|
|
400
|
+
|
|
401
|
+
```python
|
|
402
|
+
PARSER_REGISTRY = {
|
|
403
|
+
...
|
|
404
|
+
"my-custom": parsers.parse_my_format,
|
|
405
|
+
}
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
The parser key must match the template name — the parser is derived from the template automatically. For `passthrough` (discriminative models), no parser is needed.
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## Future Work
|
|
413
|
+
|
|
414
|
+
- **API backend** — support API-based judge/reward models (e.g., OpenAI, Anthropic) alongside vLLM.
|
|
415
|
+
- **Custom dataset sources** — support local JSONL files and custom data loaders beyond HuggingFace.
|
|
416
|
+
- **Majority voting** — `generation.n > 1`: generate N judgments per sample and take a majority vote.
|
|
File without changes
|