Skip to content

Commit ef8523f

Browse files
committed
peerbenchJS release 0.0.14
1 parent e25beaf commit ef8523f

318 files changed

Lines changed: 526758 additions & 2885 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

peerBenchJS/README.md

Lines changed: 18 additions & 206 deletions
Original file line numberDiff line numberDiff line change
@@ -1,226 +1,38 @@
1-
# peerBench
21

3-
peerBench framework implementation in TypeScript
42

5-
## Quickstart
63

7-
Clone the repository and install dependencies (we assume that you already installed a working [Node.js dev](https://nodejs.org/en) environment):
4+
# The problem:
85

9-
```shell
10-
npm i # or "yarn install" based on your preference
11-
```
6+
Public benchmark test data sets make AI model performance comparable. But this creates an incentivization for closed source models to cheat the benchmarks by training on test data or creating heuristics that overfit the benchmark test dataset .....
127

13-
peerBench works in three phase;
8+
# Our solution:
149

15-
- Prompt
16-
- Score
17-
- Aggregate
10+
A network of independent experts validating models continuously with newly generated private test data and scoring that can be publicly audited.
1811

19-
Before you start, you need to create a `.env` file. You can use the the example one:
12+
# Addressing Industry Wide Overfitting of AI Models
2013

21-
```sh
22-
cp .env.example .env
23-
```
14+
Another very important piece of context in accelerating AI innovation is **Model Overfitting plaguing the AI industry**.
2415

25-
Then fill out the variables with your values.
16+
Public benchmark test data sets make AI model performance comparable. But this creates an incentivization for closed source models in particular to game the benchmarks by creating heuristics for them or overfitting their training data to include solutions to the known testsets.
2617

27-
> You can generate a private with the following command:
28-
>
29-
> ```shell
30-
> node -e "import('viem/accounts').then(({ generatePrivateKey, privateKeyToAccount }) => > { const pk = generatePrivateKey(); const acc = privateKeyToAccount(pk); console.log('Address:', acc.address); console.log('Private Key:', pk); });"
31-
> ```
18+
For open source models **Dynabench**[^45] tries to solve the problem of overfitting on test datasets with a community of humans **intentionally creating new test data designed to be hard for models**. But Dynabench only works with open source models. Additionally Dynabench has not seen significant adoption even after being managed by mlCommons. We believe this lack of traction is due to a lack of incentives for evaluators or AI model owners to participate.
3219

33-
### Prompt
20+
Requiring recency of test data is another approach taken by LiveBench[^48] but it is primarily focused on the problem of LLM's accidentally including test data as part of training. A malictious actor can still overfit liveBench within days of the test data being released. And as they are a single entity they can be covertly bribed to give out the test data to one AI provider before the release. But the idea of releasing new test data continously is something we agree with and will also push for in our standard.
3421

35-
In prompt phase, peerBench sends the prompts/tasks/questions from the given tasks to the LLM models. Collects the responses and saves them to the local file system:
22+
**Centralized private test data evaluation** is another approach that has been attempted to resolve the problem of AI companies gaming benchmark results. One currently active private evaluator is the SEAL LLM Leaderboards[^46] by Scale.ai[^47]. However, this lacks the transparency and audibility to be fully trustworthy and widely used as a standard.
3623

37-
```shell
38-
./peerbench prompt -c config.example.json
39-
```
24+
**Decentralised systems are strongly positioned to solve** all of those issues thanks to providing proper incentivization to all parties involved while leveraging blockchains' decentralisation and transparency. **Private datasets** still can be a fundamental **part of the validation strategy**.
4025

41-
`-c` points to the configuration file that is going to be used for prompting process. An example is shown below:
26+
# Test Data Quality Control Process
4227

43-
```jsonc
44-
{
45-
// Path of the task files
46-
"tasks": ["./data/tasks/mmlu-pro/mmlu-pro.parquet"],
28+
# Become a Validator
4729

48-
// Models that the task files will be prompted to
49-
// Format is: <provider name>:<model owner name>/<model name>
50-
// Supported providers:
51-
// - openrouter.ai
52-
"models": [
53-
"openrouter.ai:openai/chatgpt-4o-latest",
54-
"openrouter.ai:google/gemini-2.0-flash-001",
55-
"openrouter.ai:google/gemini-2.0-flash-lite-001",
56-
"openrouter.ai:meta-llama/llama-4-scout",
57-
"openrouter.ai:meta-llama/llama-4-maverick",
58-
"openrouter.ai:mistralai/mistral-small-3.1-24b-instruct"
59-
]
60-
}
61-
```
30+
# Get Your Model Benchmarked
6231

63-
If you want, you can also pass the maximum prompt to be executed:
32+
[^45]: Link: https://arxiv.org/abs/2104.14337
6433

65-
```shell
66-
./peerbench prompt -c config.example.json -m 10
67-
```
34+
[^46]: Link: https://scale.com/leaderboard
6835

69-
That means only first 10 prompt from the given task files will be executed over the models and rest will be ignored.
36+
[^47]: Link: https://scale.com/
7037

71-
Once the command is done, the collected responses will be available at
72-
73-
```
74-
data/output/<task name>/<validator id>/<model owner>/<model name>/responses-<task name>-<timestamp>.json
75-
```
76-
77-
### Score
78-
79-
To score your responses you need to run the following command:
80-
81-
```shell
82-
./peerbench score --task <task name>
83-
```
84-
85-
For `<task name>` part, you need to pass the name of the task that you've run. You can generate the scores for only one task at a time. If you've used one of the known task formats, the `task name` would be one of these:
86-
87-
- `mmlu-pro` (whole task)
88-
- `mmlu-pro-<category name(s)>` (e.g `mmlu-pro-history`, `mmlu-pro-history-engineering`)
89-
- `bigbench` (whole task)
90-
- `bigbench-<task name>` (e.g `bigbench-social_iqa`)
91-
92-
Otherwise it will be set to the task file name without extension (e.g `my-task` for `my-task.json`)
93-
94-
### Aggregation
95-
96-
To see the aggregated results, you can use the aggregate command (aliased as `agg`):
97-
98-
You can also use a config file for aggregation, similar to the prompt and score commands:
99-
100-
```shell
101-
./peerbench agg -c config.example.json
102-
```
103-
104-
The aggregate command now provides several enhanced features:
105-
106-
1. **Config File Support**: Use `-c` to specify a config file with tasks and models
107-
2. **Per-Task Analysis**: When multiple tasks are in the config, it generates individual reports for each task
108-
3. **Combined Analysis**: Always provides a combined analysis of all tasks
109-
4. **Automatic File Output**: Results are automatically saved to JSON files (no need to specify `-o`)
110-
5. **Output Directory**: All files are saved to `data/output/aggregates/` directory
111-
112-
When using a config file with multiple tasks, the command will:
113-
- Generate and display a results table for each individual task
114-
- Generate and display a combined results table for all tasks
115-
- Save separate result files for each task and the combined analysis
116-
117-
Output files follow this naming pattern:
118-
```
119-
data/output/aggregates/results-<task-name>-<timestamp>.json # Individual task results
120-
data/output/aggregates/results-combined-<timestamp>.json # Combined results
121-
```
122-
123-
### Data Standardization
124-
125-
The framework provides a data standardization tool that allows you to convert between different question schemas. Currently, it supports conversion between `mmlu-pro` and `medqa` formats.
126-
127-
```shell
128-
./peerbench std --source <source-file> [--from <schema>] --to <schema> [--output <output-file>]
129-
```
130-
131-
Options:
132-
- `--source` (required): Source file with data to be standardized
133-
- `--from` (optional): Source schema type (mmlu-pro or medqa, default: auto-detect)
134-
- `--to` (required): Target schema type (mmlu-pro or medqa, default: medqa)
135-
- `--output` (optional): Output file path (default: derived from source filename)
136-
137-
#### Example
138-
139-
Convert from MMLU-Pro format to MedQA format:
140-
141-
```shell
142-
./peerbench std --source data/tasks/mmlu-pro/history_samples.json --to medqa
143-
```
144-
145-
Convert from MedQA format to MMLU-Pro format:
146-
147-
```shell
148-
./peerbench std --source data/tasks/medqa/samples.jsonl --from medqa --to mmlu-pro --output data/tasks/mmlu-pro/converted.json
149-
```
150-
151-
#### Schema Examples
152-
153-
MMLU-Pro Format:
154-
```json
155-
{
156-
"question": "Australian and America megafauna were probably wiped out by:",
157-
"options": [
158-
"natural disasters such as volcanic eruptions or earthquakes.",
159-
"both humans and environmental changes.",
160-
"the spread of invasive plant species which altered their habitat.",
161-
"a sudden drastic climate change due to global warming.",
162-
"humans who carried diseases over the land bridge.",
163-
"humans.",
164-
"diseases transmitted by other animal species.",
165-
"a comet or asteroid impact.",
166-
"environmental changes.",
167-
"competition with other animal species."
168-
],
169-
"answer": "B",
170-
"answer_index": 1,
171-
"cot_content": "",
172-
"category": "history",
173-
"src": "ori_mmlu-prehistory",
174-
"question_id": 4676,
175-
"other": {
176-
"hash_full_question": "4d53be6330395aeab823bdb8a02e14f7b6edfbc0f5b0dbe2233f53271c346581",
177-
"hash_first_sentence": "4d53be6330395aeab823bdb8a02e14f7b6edfbc0f5b0dbe2233f53271c346581",
178-
"hash_first_question_sentence": "4d53be6330395aeab823bdb8a02e14f7b6edfbc0f5b0dbe2233f53271c346581",
179-
"hash_last_sentence": "4d53be6330395aeab823bdb8a02e14f7b6edfbc0f5b0dbe2233f53271c346581",
180-
"preSTDsrcFileName": "mmlu-pro_test.onlyhistory-first20.jsonl",
181-
"preSTDsrcCID": "bafkreib4kvac3h6tn5ipllbup55asmq63ls33fse3jm2u2ftgfxssywwju"
182-
}
183-
}
184-
```
185-
186-
MedQA Format:
187-
```json
188-
{
189-
"question": "Australian and America megafauna were probably wiped out by:",
190-
"options": {
191-
"A": "natural disasters such as volcanic eruptions or earthquakes.",
192-
"B": "both humans and environmental changes.",
193-
"C": "the spread of invasive plant species which altered their habitat.",
194-
"D": "a sudden drastic climate change due to global warming.",
195-
"E": "humans who carried diseases over the land bridge.",
196-
"F": "humans.",
197-
"G": "diseases transmitted by other animal species.",
198-
"H": "a comet or asteroid impact.",
199-
"I": "environmental changes.",
200-
"J": "competition with other animal species."
201-
},
202-
"answer_idx": "B",
203-
"answer": "both humans and environmental changes.",
204-
"meta_info": "",
205-
"other": {
206-
"hash_full_question": "4d53be6330395aeab823bdb8a02e14f7b6edfbc0f5b0dbe2233f53271c346581",
207-
"hash_first_sentence": "4d53be6330395aeab823bdb8a02e14f7b6edfbc0f5b0dbe2233f53271c346581",
208-
"hash_first_question_sentence": "4d53be6330395aeab823bdb8a02e14f7b6edfbc0f5b0dbe2233f53271c346581",
209-
"hash_last_sentence": "4d53be6330395aeab823bdb8a02e14f7b6edfbc0f5b0dbe2233f53271c346581",
210-
"mmlu-pro__question_id": 4676,
211-
"mmlu-pro__answer_index": 1,
212-
"mmlu-pro__cot_content": "",
213-
"mmlu-pro__category": "history",
214-
"mmlu-pro__src": "ori_mmlu-prehistory",
215-
"preSTDsrcFileName": "mmlu-pro_test.onlyhistory-first20.jsonl",
216-
"preSTDsrcCID": "bafkreib4kvac3h6tn5ipllbup55asmq63ls33fse3jm2u2ftgfxssywwju"
217-
}
218-
}
219-
```
220-
221-
The standardization feature also handles:
222-
- Both JSON and JSONL file formats
223-
- Automatic schema detection
224-
- Generation of content hashes for question matching
225-
- Assignment of UUIDs for tracking
226-
- Preservation of source information
38+
[^48]: Link: https://livebench.ai/#/

peerBenchJS/apps/cli/.env.example

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
# "debug" | "info" | "warning" | "error"
3+
LOG_LEVEL=debug
4+
5+
# "dev" or "production"
6+
NODE_ENV=dev
7+
8+
# Private key of the Validator to signing results
9+
PRIVATE_KEY="<EOA private key>"
10+
11+
# API key of Open Router provider
12+
PB_OPENROUTER_AI_KEY="<open router key>"
13+
14+
# Rate limit to be applied in the range
15+
PB_OPENROUTER_AI_RATE_LIMIT=20
16+
17+
# Max requests (rate limit) that can be done in this time window
18+
PB_OPENROUTER_AI_RATE_LIMIT_TIME_WINDOW=3000
19+
20+
# Timeout for the prompt requests. The request timeouts are retried.
21+
# You can change max retry count via PB_OPENROUTER_AI_MAX_RETRIES
22+
PB_OPENROUTER_AI_TIMEOUT=60000
23+
24+
# Maximum retry count of a failed request
25+
PB_OPENROUTER_AI_MAX_RETRIES=3
26+
27+
# Rate limit to be applied in the range
28+
PB_NEAR_AI_RATE_LIMIT=10
29+
30+
# Max requests (rate limit) that can be done in this time window (in millisecond)
31+
PB_NEAR_AI_RATE_LIMIT_TIME_WINDOW=5000
32+
33+
# Timeout for the prompt requests. The request timeouts are retried.
34+
# You can change max retry count via PB_NEAR_AI_MAX_RETRIES
35+
PB_NEAR_AI_TIMEOUT=60000
36+
37+
# Maximum retry count of a failed request
38+
PB_NEAR_AI_MAX_RETRIES=3
39+
40+
# Configuration path of nearai CLI for credentials
41+
# PB_NEAR_AI_CONFIG_PATH=

peerBenchJS/apps/cli/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules
2+
.vscode
3+
.env*
4+
!.env.*example
5+
dist
6+
data/output
7+
data/logs
8+
config.*.json
9+
!config.example.json
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/dist

peerBenchJS/apps/cli/.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"useTabs": false,
3+
"tabWidth": 2,
4+
"trailingComma": "es5",
5+
"singleQuote": false
6+
}

peerBenchJS/apps/cli/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Forest-Protocols
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 commit comments

Comments
 (0)