--- license: [apache-2.0, bsd-3-clause, mit] language: [en, code] pretty_name: Kernel-Opt RL (vLLM / SGLang / FlashInfer) size_categories: [10K 1 means the PR is better. When a PR states only a ratio, `stated_speedup` is used. Extraction was done by `Qwen3-235B-A22B-Instruct-2507`, with `gpt-oss-120b` as a fallback for very long tables, using an extract-only prompt (no computed numbers). Audit: in 98.8% of extracted baseline/optimized pairs, both values appear verbatim in the PR text. The remainder were mostly averages of repeated runs. Extraction failed for 5 PRs (malformed model output), which have empty `gains`. ## Using it for RL Rewards live in [`code/reward.py`](code/reward.py): - **`tuned_configs`**: `config_reward` is deliberately a stub, because the partial-credit scheme is a design choice. Compare the parsed JSON config to `best_config` as an offline proxy (exact match is sparse, so use partial credit or log-distance on the power-of-two tile sizes). `speedup_vs_default` tells you how much a config actually matters for that row and can weight the reward. On hardware, launch `kernel_source` with the predicted config and reward `t_best / t_pred`. The tuned config is only the best within the tuner's search space, so it can be beaten. - **`kernel_commits`**: `patch_reward(completion, before_code, after_code)` follows SWE-RL. It returns −1 if the edits are malformed or don't apply, and otherwise the `difflib` similarity between the changed lines and the real commit's. Validated on this data: the oracle edit scores 1.0 on 98.7% of rows and ≥ 0.95 on all but one. For an execution reward, run through an environment such as [KernelGYM](https://github.com/hkust-nlp/KernelGYM). Watch for reward hacking (timer exploits, cached outputs; see the [CUDA-L1](https://github.com/ornith-ai/CUDA-L1) notes). ```python from datasets import load_dataset ds = load_dataset("guychuk/kernel-opt-rl", "kernel_commits", split="train") ds = ds.filter(lambda r: len(r["prompt"]) < 32_000 and r["kernel_speedup"]) # short, with documented gains ``` Both subsets have a plain-string `prompt` column. TRL's `GRPOTrainer` forwards the other columns (`best_config`, `before_code`, `after_code`, …) to reward functions as keyword arguments. ## Limitations - Tuned configs record only the *winner*, not the full latency table, so offline config rewards are a proxy. `speedup_vs_default` covers only rows whose PR documented that exact M. - `candidate_models` comes from shape matching (`E == experts`, `N == intermediate / TP`, or `E == experts / EP`). Shapes are shared across models, e.g. DeepSeek-V3, Kimi-K2 and MiMo-V2-Flash. - PR gains are self-reported by the authors, on their hardware and benchmark setup, and are not reproduced. - Snapshots are from each repo's HEAD at build time (see `commit`). Rebuild for fresher data. ## Licensing All code comes from vLLM, SGLang and FlashInfer (all Apache-2.0). Some vendored files carry their own licenses. Each row has a `license` field taken from the file header (Apache-2.0: 1,481 commit rows and all config rows; BSD-3-Clause / BSD: 35; MIT: 1). Files under non-open-source licenses (the NVIDIA TensorRT Source Code License Agreement and NVIDIA proprietary headers) are **excluded**. License and copyright headers in the code are kept verbatim. The upstream `LICENSE` and `NOTICE` files are in [`licenses/`](licenses/), as Apache-2.0 §4 requires. The compilation itself is released under Apache-2.0. PR descriptions are quoted from public GitHub PRs and linked via `pr_url`. ## Related datasets [KernelBench](https://huggingface.co/datasets/ScalingIntelligence/KernelBench) (eval; keep held out), [KernelBook](https://huggingface.co/datasets/GPUMODE/KernelBook) (PyTorch→Triton pairs), [Nemotron-SFT-CUDA-v1](https://huggingface.co/datasets/nvidia/Nemotron-SFT-CUDA-v1) (CUDA SFT with tests), [CUDA-L1](https://github.com/ornith-ai/CUDA-L1) (RL-optimized KernelBench solutions per GPU). ## Reproduce The build code is in [`code/`](code/). `uv run build.py --push ` clones the three repos as blobless clones, mines configs and commits, fetches PR descriptions with `gh`, extracts gains via HF Inference Providers (cached), and pushes.