ai-nikolai commited on
Commit
07e65f2
·
verified ·
1 Parent(s): a681db7

Upload ScienceKernelBench

Browse files
CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Changelog
2
+
3
+ ## 0.1.0 — 2026-11-12
4
+
5
+ Initial release.
6
+
7
+ - 22 reference tasks across physics, chemistry, biology, statistics,
8
+ mathematics and economics.
9
+ - `level_1` (8 tasks), `level_2` (7 tasks), `level_3` (7 tasks).
10
+ - Stable `problem_id`, `task_key`, `task_version` and `reference_hash` for
11
+ every task.
12
+ - Same Hugging Face layout as `ai-nikolai/KernelBench`: one `default` config
13
+ with `level_1`, `level_2`, `level_3` splits under `data/`.
14
+ - Compatible with `robust-kernelbench >= 0.2.0`.
README.md ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: agpl-3.0
3
+ language:
4
+ - en
5
+ task_categories:
6
+ - other
7
+ pretty_name: Science KernelBench
8
+ tags:
9
+ - kernelbench
10
+ - gpu
11
+ - cuda
12
+ - triton
13
+ - scientific-computing
14
+ - pde
15
+ - kernel-methods
16
+ configs:
17
+ - config_name: default
18
+ data_files:
19
+ - split: level_1
20
+ path: data/level_1-*
21
+ - split: level_2
22
+ path: data/level_2-*
23
+ - split: level_3
24
+ path: data/level_3-*
25
+ ---
26
+
27
+ # Science KernelBench
28
+
29
+ A science-focused task set for `robust-kernelbench`. Each task provides a
30
+ PyTorch reference implementation of a numerical primitive; the candidate must
31
+ produce a faster, numerically equivalent GPU kernel.
32
+
33
+ This directory is the **source of truth**. `to_hf.py` expands the manifest into
34
+ a Hugging Face dataset; the generated export is not committed.
35
+
36
+ Current starter set: **22 tasks** across physics, chemistry, biology,
37
+ statistics, mathematics and economics.
38
+
39
+ | level | focus | tasks |
40
+ | --- | --- | --- |
41
+ | `level_1` | single stencil, reduction or short elementwise expression | 8 |
42
+ | `level_2` | all-pairs interactions, batched linear algebra, multi-state updates | 7 |
43
+ | `level_3` | sequential dynamic programs, FFTs, tree backward induction | 7 |
44
+
45
+ Each task carries `domain`, `subdomain`, `level`, `tags` and a `source` block.
46
+ The reference files contain a docstring with the domain, the problem solved and
47
+ the canonical paper/source.
48
+
49
+ ### Task list
50
+
51
+ | id | task | domain | level |
52
+ | --- | --- | --- | --- |
53
+ | 101 | `pairwise_rbf` | statistics | 1 |
54
+ | 102 | `laplacian_2d` | physics | 1 |
55
+ | 103 | `heat_step_2d` | physics | 1 |
56
+ | 104 | `lennard_jones_energy` | chemistry | 1 |
57
+ | 105 | `lotka_volterra_step` | biology | 1 |
58
+ | 106 | `gaussian_kde` | statistics | 1 |
59
+ | 107 | `horner_eval` | mathematics | 1 |
60
+ | 108 | `black_scholes_call` | economics | 1 |
61
+ | 201 | `nbody_acceleration` | physics | 2 |
62
+ | 202 | `coulomb_energy` | chemistry | 2 |
63
+ | 203 | `hodgkin_huxley_step` | biology | 2 |
64
+ | 204 | `kalman_update` | statistics | 2 |
65
+ | 205 | `graph_laplacian` | mathematics | 2 |
66
+ | 206 | `portfolio_variance` | economics | 2 |
67
+ | 207 | `wave_step_2d` | physics | 2 |
68
+ | 301 | `needleman_wunsch_score` | biology | 3 |
69
+ | 302 | `fft_convolution` | mathematics | 3 |
70
+ | 303 | `binomial_option_crr` | economics | 3 |
71
+ | 304 | `split_step_schrodinger` | physics | 3 |
72
+ | 305 | `ewald_real_space` | chemistry | 3 |
73
+ | 306 | `gaussian_process_posterior` | statistics | 3 |
74
+ | 307 | `floyd_warshall` | mathematics | 3 |
75
+
76
+
77
+ ## Versioning
78
+
79
+ Current release: **0.1.0** (`schema_version: kernelbench-v1`), compatible with
80
+ `robust-kernelbench >= 0.2.0`.
81
+
82
+ The dataset version is independent of the package version:
83
+
84
+ - `PATCH` — documentation, metadata or provenance fixes with no scoring change.
85
+ - `MINOR` — new tasks, domains or levels; existing tasks unchanged.
86
+ - `MAJOR` — removal/renumbering, reference-output changes, or benchmark-split
87
+ changes.
88
+
89
+ Every task has a permanent `problem_id`, a stable `task_key`, a `task_version`
90
+ and a `reference_hash`. Removed tasks are marked `retired`; IDs are never reused.
91
+ Pin production runs to an HF tag or commit:
92
+
93
+ ```bash
94
+ robust-kernelbench \
95
+ --dataset ai-nikolai/ScienceKernelBench \
96
+ --dataset_revision v0.1.0 \
97
+ --dataset_split level_1 \
98
+ ...
99
+ ```
100
+
101
+ ## Schema
102
+
103
+ Required columns:
104
+
105
+ | column | type | meaning |
106
+ | --- | --- | --- |
107
+ | `problem_id` | int | unique task id |
108
+ | `name` | string | filesystem-safe task name |
109
+ | `code` | string | self-contained reference source |
110
+
111
+ The `code` must define:
112
+
113
+ ```python
114
+ class Model(nn.Module): ...
115
+ def get_inputs(): ...
116
+ def get_init_inputs(): ...
117
+ ```
118
+
119
+ Optional columns understood by the harness:
120
+
121
+ | column | meaning |
122
+ | --- | --- |
123
+ | `level` | dataset split / difficulty grouping (1-3 here) |
124
+ | `domain` | physics, chemistry, biology, statistics, mathematics, economics |
125
+ | `subdomain` | finer label, e.g. `molecular dynamics`, `PDE`, `bioinformatics` |
126
+ | `filter` | include in the representative subset |
127
+ | `task_type` | `pytorch_reference` or `kernel_reference` |
128
+ | `backend` | `cuda`, `triton`, ... |
129
+ | `precision` | `fp32`, `fp16`, `bf16` |
130
+ | `tags` | searchable labels |
131
+ | `source` | provenance / license metadata |
132
+
133
+ ## Local layout
134
+
135
+ ```text
136
+ data/science_kernels/
137
+ ├── README.md # this dataset card
138
+ ├── manifest.json # versioned task list and provenance
139
+ ├── CHANGELOG.md # dataset release history
140
+ ├── requirements.txt # minimal HF/export dependencies
141
+ ├── kernels/
142
+ │ ├── level_1/ # 8 tasks
143
+ │ ├── level_2/ # 7 tasks
144
+ │ └── level_3/ # 7 tasks
145
+ └── to_hf.py # per-level export / optional push_to_hub
146
+ ```
147
+
148
+ ## Minimal dependencies
149
+
150
+ ```bash
151
+ pip install -r requirements.txt
152
+ ```
153
+
154
+ `torch` is optional and only needed for `--execute` smoke tests; it is listed as
155
+ a comment in the requirements file so the dataset can be loaded and exported on
156
+ a lightweight machine.
157
+
158
+ ## Validate locally
159
+
160
+ ```bash
161
+ # Schema only
162
+ robust-kernelbench-dataset validate \
163
+ --dataset_path data/science_kernels \
164
+ --dataset_format directory
165
+
166
+ # Counts by level and domain, and a browsable list
167
+ robust-kernelbench-dataset stats \
168
+ --dataset_path data/science_kernels \
169
+ --dataset_format directory
170
+ robust-kernelbench-dataset list \
171
+ --dataset_path data/science_kernels \
172
+ --dataset_format directory --domain physics
173
+
174
+ # Also run one forward pass per task
175
+ robust-kernelbench-dataset validate \
176
+ --dataset_path data/science_kernels \
177
+ --dataset_format directory \
178
+ --execute --device cpu
179
+ ```
180
+
181
+ ## Use with robust-kernelbench
182
+
183
+ Evaluation only:
184
+
185
+ ```bash
186
+ robust-kernelbench-eval \
187
+ --dataset_path data/science_kernels \
188
+ --dataset_format directory \
189
+ --dataset_split level_1 \
190
+ --experiment science_exp --trial 1
191
+ ```
192
+
193
+ Agentic generate -> compile -> evaluate:
194
+
195
+ ```bash
196
+ robust-kernelbench \
197
+ --dataset_path data/science_kernels \
198
+ --dataset_format directory \
199
+ --dataset_split level_1 \
200
+ --dataset_name science-kernels \
201
+ --version science_v0 \
202
+ --model_name Qwen/Qwen3-Coder-30B-A3B-Instruct \
203
+ "1 1 kernelbench"
204
+ ```
205
+
206
+ ## Export for Hugging Face
207
+
208
+ ```bash
209
+ python data/science_kernels/to_hf.py --output /tmp/science_kernels_hf
210
+
211
+ # huggingface_hub >= 1 uses the `hf` command:
212
+ hf upload ai-nikolai/ScienceKernelBench /tmp/science_kernels_hf --repo-type dataset
213
+
214
+ # Works with any huggingface_hub version:
215
+ python data/science_kernels/upload_to_hf.py \
216
+ --path /tmp/science_kernels_hf
217
+ ```
218
+
219
+ Or export and push in one step:
220
+
221
+ ```bash
222
+ python data/science_kernels/to_hf.py \
223
+ --output /tmp/science_kernels_hf \
224
+ --push
225
+ ```
226
+
227
+ ## Provenance and licensing
228
+
229
+ Only add kernels you have the right to redistribute. Record the source
230
+ repository, commit, and license in each task's `source` block. Original tasks
231
+ written for this dataset are released under AGPL-3.0, matching the repository.
232
+ If you combine sources with different licenses, use the strictest compatible
233
+ license for the combined dataset and document it in this card.
234
+
235
+
236
+ ## Citation
237
+
238
+ If you use this dataset, please cite `robust-kernelbench`:
239
+
240
+ ```bibtex
241
+ @misc{rozanov2026robustkernelbench,
242
+ title = {Robust KernelBench: A Robust Harness for GPU Kernel Generation and Evaluation},
243
+ author = {Rozanov, Nikolai},
244
+ year = {2026},
245
+ howpublished = {\url{https://github.com/ai-nikolai/robust_kernelbench}},
246
+ note = {ScienceKernelBench dataset, version 0.1.0}
247
+ }
248
+ ```
249
+
250
+ The dataset card and version should also be cited when reporting benchmark
251
+ results, together with the exact `dataset_revision` used.
data/level_1-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be00f5836c75061311e1769203605a79d550e0825492f7fe0145e68b98b88538
3
+ size 21262
data/level_2-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7268a0eeee2e40174f7ab526145bcbdbba571aa0245c3fdc6291f7d6a11b27ee
3
+ size 20237
data/level_3-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e10af2baaa50c510f86bea612839b7b52e84423a8d10839fa26403335c4812a1
3
+ size 23308
requirements.txt ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ # Minimal dependencies for loading, validating and exporting ScienceKernelBench.
2
+ # The dataset itself is plain Parquet; no dataset loading script is required.
3
+ datasets>=2.19
4
+ pandas>=2.0
5
+ pyarrow>=15
6
+ huggingface_hub>=0.23
7
+
8
+ # Optional: only needed for `robust-kernelbench-dataset ... --execute`
9
+ # (a forward-pass smoke test for each reference task).
10
+ # torch>=2.1