KernelMosaic / README.md
DERBACH's picture
Upload KernelMosaic v1 trajectories and dataset card
a61c876 verified
|
Raw History Blame Contribute Delete
5.64 kB
---
pretty_name: KernelMosaic
language:
- en
license: other
license_name: source-specific-terms
license_link: https://huggingface.co/datasets/Miaow-Lab/KernelMosaic/blob/main/ATTRIBUTION.md
task_categories:
- text-generation
size_categories:
- 10K<n<100K
tags:
- cuda
- gpu-kernels
- code-generation
- tool-use
- supervised-fine-tuning
- arxiv:2611.14604
configs:
- config_name: default
data_files:
- split: train
path: data/train-*.jsonl.gz
- split: validation
path: data/validation-*.jsonl.gz
---
# KernelMosaic
KernelMosaic pairs CUDA kernel implementation tasks with selected solutions and the
agent trajectories that produced them. A trajectory can include source edits,
compilation, correctness checks, profiling and revisions. The task specifications
cover natural language, PyTorch reference programs, CUDA code, mathematical
specifications and combinations of these formats. [Paper](https://arxiv.org/abs/2611.14604)
## Dataset
| Split | Task–trajectory pairs |
| --- | ---: |
| Train | 13,815 |
| Validation | 751 |
| Total | 14,566 |
Each row represents one task and one trajectory. The train and validation splits
are disjoint by task ID, task family and dataset group. The dataset draws on 41
sources. [Source attribution](ATTRIBUTION.md)
### Record fields
| Field | Contents |
| --- | --- |
| `task_id`, `family_id`, `dataset_group_id`, `split` | Stable IDs and split membership |
| `messages` | Ordered messages with role, content, reasoning, tool calls, tool call IDs and loss weights |
| `final_files`, `candidate_sha256` | Selected source files keyed by filename and a canonical hash of that file map |
| `qualification` | Historical correctness verdict and, where recorded, speedup and PyTorch-reference metadata |
| `provenance`, `ending`, `fresh_recheck_required` | Original outcome and trajectory ending, with a per-row flag for a fresh evaluation |
See the [schema](schema.json) for the remaining fields. Join
[attribution.jsonl.gz](attribution.jsonl.gz) on `task_id` for source identifiers,
revision information, license labels and credit.
## Loading the data
The shards are gzip-compressed JSON Lines. Reading them as JSON preserves nested
tool data and the variable filenames in `final_files`.
```python
import gzip
import json
from huggingface_hub import HfApi, hf_hub_download
repo_id = "Miaow-Lab/KernelMosaic"
# Pin the current Hub revision so enumeration and downloads use the same snapshot.
api = HfApi()
revision = api.dataset_info(repo_id).sha
def iter_split(split):
if split not in {"train", "validation"}:
raise ValueError(f"Unknown split: {split}")
prefix = f"data/{split}-"
filenames = api.list_repo_files(repo_id, repo_type="dataset", revision=revision)
for filename in sorted(filenames):
if filename.startswith(prefix) and filename.endswith(".jsonl.gz"):
path = hf_hub_download(repo_id, filename, repo_type="dataset", revision=revision)
with gzip.open(path, "rt", encoding="utf-8") as shard:
for line in shard:
yield json.loads(line)
example = next(iter_split("train"))
print(example["task_id"], len(example["messages"]))
```
For supervised fine-tuning, use `loss_weight` to supervise assistant messages
while keeping user messages and tool observations as context. Keep assistant
tool calls paired with their responses when splitting a long trajectory into
training windows. The paper describes the decision-window construction used
in the reported 32K-context training run.
## Curation and verification
The collection pipeline selected and adapted tasks from the listed sources and
generated trajectories using Qwen3.8-Flash. Selected implementations passed the
historical checks attached to their tasks. The tests have different coverage
across task families. The time measurements are hardware- and environment-specific.
A speedup was recorded for 8,598 rows.
This snapshot redacts internal paths and identifiers. Paths in tool traces are
historical placeholders that require mapping for replay. In 62 rows, redaction
changed string constants in the final source files. Those rows have recomputed
candidate hashes and `fresh_recheck_required` set to true. Their original
correctness and performance records describe the pre-redaction candidate.
### KernelBench overlap
The exact-reference audit compared the 250 KernelBench v0.1 L1–L3 tasks against
9,985 dataset rows with parseable Python reference programs. It found zero
identical whole-program references after removing comments, docstrings and
formatting. The audit also identified shared computational templates with
different workloads, including L1 #48 (mean reduction), L2 #2 (transposed
convolution fusion) and L3 #17 (SqueezeNet Fire). These findings describe the
programs and task pairs reviewed. [KernelBench revision](https://github.com/ScalingIntelligence/KernelBench/tree/129232ea3c4cfa05c2dd5473bdb935d6246dc84b)
## Attribution and terms
Consult [ATTRIBUTION.md](ATTRIBUTION.md) for source-specific terms, credits and
remaining provenance questions. The [per-task attribution index](attribution.jsonl.gz)
provides the applicable source for each row. The [licenses directory](licenses/)
contains the collected upstream license and notice texts.
## Citation
```bibtex
@article{xi2026kernelmosaic,
title = {KernelMosaic: An Open Dataset and Agentic Framework for CUDA Kernel Generation},
author = {Xi, Ningyuan and Lai, Yuhang and Miao, Ning},
journal = {arXiv preprint arXiv:2611.14604},
year = {2026},
url = {https://arxiv.org/abs/2611.14604}
}
```