File size: 5,639 Bytes
98578db
a61c876
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98578db
a61c876
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
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}
}
```