litmus-kernels / README.md
NagaYu's picture
Litmus kernel verification corpus: labelled kernels with the inputs that expose their bugs
e279649 verified
|
Raw
History Blame Contribute Delete
2.45 kB
---
license: apache-2.0
task_categories:
- other
language:
- en
tags:
- triton
- gpu-kernels
- verification
- numerical-analysis
- reward-model
- rl-environments
pretty_name: Litmus Kernel Verification Corpus
size_categories:
- n<1K
configs:
- config_name: kernels
data_files: kernels.jsonl
- config_name: bug_pairs
data_files: bug_pairs.jsonl
---
# Litmus Kernel Verification Corpus
Correct and deliberately-broken Triton kernels, each broken one shipped **with
the input that exposes it**.
The corpus exists to measure one thing: how much of what a fixed-shape
`torch.rand()` `allclose` test calls "correct" actually is. On this corpus the
answer is that **88% of the planted bugs pass that test**.
## Columns
| column | meaning |
|---|---|
| `name` | kernel identifier |
| `family` | elementwise / reduction / softmax / layernorm / matmul / attention |
| `bug_class` | `none` for correct kernels, otherwise one of six planted defect families |
| `triton_source` | the kernel, annotated with its buffer contract |
| `correct` | ground-truth label |
| `numerically_observable` | `false` when the defect has **no** numerical signature at any shape |
| `why_standard_misses` | why the fixed-shape `allclose` test lets this bug through |
| `witness_inputs` | JSON arrays: the exposing input (buggy kernels only) |
| `witness_dims` | the shape the witness uses |
| `witness_max_abs_error` | deviation from the float64 oracle on the witness |
| `standard_test_detects` | did `allclose(rtol=1e-2)` on the fixed shape catch it? |
| `litmus_verdict` | `accept` / `reject` / `unknown` at build time |
## Bug families
- **`dtype_promotion`** — 2 kernels
- **`mask_leak`** — 4 kernels
- **`no_max_subtract`** — 2 kernels
- **`race`** — 3 kernels
- **`reduction_init`** — 3 kernels
- **`stride`** — 2 kernels
## Caveat
The corpus is deliberately bug-heavy (16 buggy, 9 correct), so the
absolute "fraction correct" is a property of this corpus, not of kernels in
general. The finding is the **gap** between the standard test's pass rate and
the truth.
## Reproduce
```bash
git clone https://github.com/NagaYu/litmus && cd litmus
pip install -e ".[dev]"
python benchmarks/run.py # regenerates the numbers above
```
Built by [Litmus](https://github.com/NagaYu/litmus) -- error bounds, symbolic GPU safety checks and targeted
falsification for Triton kernels. Interactive demo: [Space](https://huggingface.co/spaces/NagaYu/litmus).