PTXBench: Benchmarking and Adapting LLMs for GPU Kernel Optimization with Architecture-specific PTX
Organizations: Stanford University · Carnegie Mellon University · Independent Researcher · RadixArk
Abstract
We introduce PTXBench, a benchmark for evaluating and adapting large language models (LLMs) to use architecture-specific PTX for GPU kernel optimization. PTXBench measures functional correctness, whether selected target instructions execute at runtime, and speedup over frontier libraries across GEMM and attention workloads on H100 and B200 GPUs. Our evaluation shows that architecture-specific PTX capability remains uneven: success rates fall substantially on complex attention backward workloads, and executing the target instructions does not necessarily translate into competitive performance. No evaluated model consistently matches frontier libraries across the suite. We further adapt Qwen3.6-27B using supervised fine-tuning. Repair-conditioned training improves several tasks, but generalization remains uneven; data coverage, balance, and the quality of the reasoning teacher matter in addition to dataset size. PTXBench provides an auditable testbed for measuring and improving LLMs' ability to exploit evolving GPU architectures.
Figures & tables
| GPU | Model | GEMM | MHA-Fwd | MHA-Fwd-Causal | MHA-Bwd | MHA-Bwd-Causal |
| H100 | Gemini 3.1 Pro | 33.3 / 60.4 / 56.2 (33.3 / 62.5 / 59.4) | 33.3 / 39.6 / 45.8 (33.3 / 39.6 / 45.8) | 25.0 / 52.1 / 55.2 (25.0 / 52.1 / 55.2) | 8.3 / 33.3 / 38.5 (8.3 / 33.3 / 38.5) | – / 22.9 / 25.0 (8.3 / 25.0 / 26.0) |
| Claude Opus 4.8 | 91.7 / 95.8 / 94.8 (91.7 / 95.8 / 94.8) | 50.0 / 81.2 / 90.6 (66.7 / 89.6 / 94.8) | 50.0 / 77.1 / 75.0 (83.3 / 89.6 / 82.3) | 8.3 / 62.5 / 79.2 (50.0 / 83.3 / 89.6) | – / 22.9 / 44.8 (25.0 / 41.7 / 59.4) | |
| GLM-5.2 | 33.3 / 60.4 / 61.5 (33.3 / 62.5 / 62.5) | 16.7 / 8.3 / 8.3 (16.7 / 14.6 / 15.6) | – / 8.3 / 10.4 (8.3 / 16.7 / 17.7) | 8.3 / 6.2 / 5.2 (8.3 / 18.8 / 16.7) | – (– / 22.9 / 15.6) | |
| Qwen3.6-27B | – | – | – | – | – | |
| GPT-5.6 xhigh | 91.7 / 81.2 / 77.1 (91.7 / 83.3 / 79.2) | 8.3 / 39.6 / 60.4 (16.7 / 58.3 / 69.8) | – / 50.0 / 56.2 (– / 64.6 / 63.5) | 8.3 / 39.6 / 55.2 (58.3 / 60.4 / 65.6) | – / 31.2 / 52.1 (33.3 / 56.2 / 65.6) | |
| B200 | Gemini 3.1 Pro | 8.3 / 47.9 / 45.8 (8.3 / 47.9 / 45.8) | – / 12.5 / 15.6 (– / 12.5 / 15.6) | – / 8.3 / 10.4 (8.3 / 12.5 / 12.5) | – / 2.1 / 2.1 (– / 2.1 / 2.1) | – (– / 2.1 / 1.0) |
| Model | SWE-bench Pro (%) | Model release | Knowledge cutoff | Lag after PTX release (months) | |
| Hopper | Blackwell | ||||
| Gemini 3.1 Pro | 54.2 | Feb. 2026 | Jan. 2025 | 25 | |
| Claude Opus 4.8 | 69.2 | May 2026 | Jan. 2026 | 37 | 12 |
| GPT-5.6 Sol | 64.6 | July 2026 | Feb. 2026 | 38 | 13 |
| GLM-5.2 | 62.1 | June 2026 | Not disclosed | ||
| Qwen3.6-27B | 53.5 | Apr. 2026 | Not disclosed | ||
| Method or ratio | GEMM | MHA-Fwd | MHA-Fwd-Causal | MHA-Bwd | MHA-Bwd-Causal |
| Multi-turn refinement | |||||
| Antigravity | |||||
| Agent / refinement total tokens |
| Prompt knowledge | Target inst. correctness (%) (turn correctness) | Target inst. best speedup (best speedup) |
| Architecture parameters | – (50.0 / 29.2 / 26.0) | – (0.056 / 0.119 / 0.273) |
| Architecture parameters + PTX template functions | – / 20.8 / 19.8 (– / 20.8 / 19.8) | – / 0.542 / 0.542 (– / 0.542 / 0.542) |
| Architecture parameters + PTX template functions + architecture contract | 8.3 / 33.3 / 38.5 (8.3 / 33.3 / 38.5 ) | 0.206 / 0.375 / 0.515 (0.206 / 0.375 / 0.515) |
| Condition | MHA-Fwd | MHA-Fwd-Causal | MHA-Bwd | MHA-Bwd-Causal |
| Qwen3.6-27B w/o expert guidance | – | – | – | – |
| Qwen3.6-27B | – | – | – | – |
| Qwen3.6-27B-s1 w/o expert guidance | – | – / – / 4.2 (– / – / 4.2) | – / – / 4.2 (– / – / 4.2) | – / 4.2 / 3.1 (– / 4.2 / 3.1) |
| Qwen3.6-27B-s1 | 16.7 / 16.7 / 19.8 (16.7 / 16.7 / 19.8) | – / – / 3.1 (– / – / 3.1) | – / 2.1 / 4.2 (– / 2.1 / 4.2) | – / 2.1 / 4.2 (– / 2.1 / 5.2) |
| Qwen3.6-27B + retrieved repair notes | – | – | – | – |
| Qwen3.6-27B + retrieved repair notes and fixed kernel | – / 29.2 / 29.2 (– / 29.2 / 29.2) | – / 20.8 / 27.1 (– / 20.8 / 27.1) | – / 14.6 / 18.8 (– / 14.6 / 20.8) | – / 20.8 / 33.3 (– / 25.0 / 37.5) |
Appendix figures & tables14 assets
Supplementary material from the paper’s appendix.
Appendix
| Mechanism | Indicator | PTX interface | SASS execution criterion |
| Tensor compute | wgmma.mma_async | ||
| tcgen05.mma , tcgen05.ld | |||
| Data movement | cp.async.bulk.tensor | ||
| tcgen05.cp , tcgen05.st |
| GPU | Component | Tokens |
| H100 | Architecture parameter | 259 |
| Template functions | 18,601 | |
| Architecture contract | 3,454 | |
| Total | 22,314 | |
| B200 | Architecture parameter | 413 |
| Template functions | 18,871 |
| Method or ratio | GEMM | MHA-Fwd | MHA-Fwd-Causal | MHA-Bwd | MHA-Bwd-Causal |
| Multi-turn refinement | |||||
| Codex | |||||
| Agent / refinement total tokens |
| GPU | Model | GEMM | MHA-Fwd | MHA-Fwd-Causal | MHA-Bwd | MHA-Bwd-Causal |
| H100 | Gemini 3.1 Pro | 0.687 / 0.934 / 0.962 (0.687 / 0.934 / 0.962) | 0.555 / 0.730 / 0.730 (0.555 / 0.730 / 0.730) | 0.614 / 0.651 / 0.768 (0.614 / 0.651 / 0.768) | 0.206 / 0.375 / 0.515 (0.206 / 0.375 / 0.515) | – / 0.634 / 0.639 (0.065 / 0.634 / 0.639) |
| Claude Opus 4.8 | 0.770 / 0.968 / 0.976 (0.770 / 0.968 / 0.976) | 0.759 / 0.770 / 0.839 (0.759 / 0.770 / 0.839) | 0.758 / 0.806 / 0.806 (0.758 / 0.806 / 0.806) | 0.300 / 0.440 / 0.489 (0.300 / 0.440 / 0.489) | – / 0.499 / 0.499 (0.058 / 0.499 / 0.499) | |
| GLM-5.2 | 0.447 / 0.692 / 0.692 (0.447 / 0.692 / 0.692) | 0.407 / 0.470 / 0.607 (0.407 / 0.470 / 0.607) | – / 0.471 / 0.533 (0.015 / 0.471 / 0.533) | 0.316 / 0.437 / 0.437 (0.316 / 0.437 / 0.437) | – (– / 0.101 / 0.101) | |
| Qwen3.6-27B | – | – | – | – | – | |
| GPT-5.6 xhigh | 0.788 / 0.870 / 0.870 (0.788 / 0.870 / 0.870) | 0.282 / 0.774 / 0.872 (0.282 / 0.774 / 0.872) | – / 0.699 / 0.865 (– / 0.699 / 0.865) | 0.230 / 0.699 / 0.703 (0.230 / 0.699 / 0.703) | – / 0.650 / 0.746 (0.094 / 0.650 / 0.746) | |
| B200 | Gemini 3.1 Pro | 0.273 / 0.680 / 0.892 (0.273 / 0.680 / 0.892) | – / 0.280 / 0.280 (– / 0.280 / 0.280) | – / 0.206 / 0.248 (0.013 / 0.206 / 0.248) | – / 0.087 / 0.133 (– / 0.087 / 0.133) | – (– / 0.015 / 0.015) |
| SFT-ed Model Label | GEMM | MHA-Fwd | MHA-Fwd-Causal | MHA-Bwd | MHA-Bwd-Causal |
| Qwen3.6-27B-s1 | 25.0 / 14.6 / 13.5 (25.0 / 14.6 / 13.5) | 16.7 / 16.7 / 19.8 (16.7 / 16.7 / 19.8) | – / – / 3.1 (– / – / 3.1) | – / 2.1 / 4.2 (– / 2.1 / 4.2) | – / 2.1 / 4.2 (– / 2.1 / 5.2) |
| Qwen3.6-27B-s2 | – / 2.1 / 2.1 (– / 2.1 / 2.1) | – / 2.1 / 5.2 (– / 2.1 / 5.2) | – / – / 1.0 (– / – / 1.0) | – / – / 1.0 (– / – / 1.0) | – |
| Qwen3.6-27B-s3 | – / 2.1 / 3.1 (– / 2.1 / 3.1) | – / 4.2 / 2.1 (– / 4.2 / 2.1) | – / 6.2 / 4.2 (– / 6.2 / 4.2) | – / 4.2 / 4.2 (– / 4.2 / 4.2) | – |
| Qwen3.6-27B-s4 | 8.3 / 8.3 / 10.4 (8.3 / 8.3 / 10.4) | – / – / 4.2 (– / – / 4.2) | – / 4.2 / 2.1 (– / 4.2 / 2.1) | – / – / 1.0 (– / – / 1.0) | – |
| Qwen3.6-27B-s5 | 16.7 / 14.6 / 12.5 (16.7 / 14.6 / 12.5) | – / 2.1 / 4.2 (– / 2.1 / 4.2) | – / 2.1 / 3.1 (– / 2.1 / 3.1) | – / – / 5.2 (– / – / 5.2) | – / – / 4.2 (– / – / 4.2) |
| Qwen3.6-27B-s6 | 8.3 / 2.1 / 1.0 (8.3 / 2.1 / 1.0) | – | – | – | – |
| SFT-ed Model Label | GEMM | MHA-Fwd | MHA-Fwd-Causal | MHA-Bwd | MHA-Bwd-Causal |
| Qwen3.6-27B-s1 | 0.303 / 0.303 / 0.340 (0.303 / 0.303 / 0.340) | 0.556 / 0.556 / 0.565 (0.556 / 0.556 / 0.565) | – / – / 0.395 (– / – / 0.395) | – / 0.380 / 0.389 (– / 0.380 / 0.389) | – / 0.192 / 0.199 (– / 0.192 / 0.199) |
| Qwen3.6-27B-s2 | – / 0.209 / 0.211 (– / 0.209 / 0.211) | – / 0.548 / 0.548 (– / 0.548 / 0.548) | – / – / 0.315 (– / – / 0.315) | – / – / 0.296 (– / – / 0.296) | – |
| Qwen3.6-27B-s3 | – / 0.274 / 0.280 (– / 0.274 / 0.280) | – / 0.465 / 0.465 (– / 0.465 / 0.465) | – / 0.388 / 0.388 (– / 0.388 / 0.388) | – / 0.494 / 0.494 (– / 0.494 / 0.494) | – |
| Qwen3.6-27B-s4 | 0.276 / 0.373 / 0.373 (0.276 / 0.373 / 0.373) | – / – / 0.452 (– / – / 0.452) | – / 0.383 / 0.383 (– / 0.383 / 0.383) | – / – / 0.199 (– / – / 0.199) | – |
| Qwen3.6-27B-s5 | 0.325 / 0.446 / 0.446 (0.325 / 0.446 / 0.446) | – / 0.425 / 0.573 (– / 0.425 / 0.573) | – / 0.241 / 0.246 (– / 0.241 / 0.246) | – / – / 0.295 (– / – / 0.295) | – / – / 0.246 (– / – / 0.246) |
| Qwen3.6-27B-s6 | 0.073 / 0.073 / 0.073 (0.073 / 0.073 / 0.073) | – | – | – | – |
| SFT-ed Model Label | Config | Reasoning Synthesizer | Record Count |
| Qwen3.6-27B-s1 | 4ops | GLM-5.2 | 158 |
| Qwen3.6-27B-s2 | 4ops-Extended | GLM-5.2 | 259 |
| Qwen3.6-27B-s3 | 8ops-Extended | GLM-5.2 | 406 |
| Qwen3.6-27B-s4 | 8ops-Post-balanced | GLM-5.2 | 170 |
| Qwen3.6-27B-s5 | 8ops-Pre-balanced | GLM-5.2 | 258 |
| Qwen3.6-27B-s6 | 8ops-Pre-balanced | Qwen3.6-27B | 258 |