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