A benchmark framework for evaluating LLM-generated Triton GPU kernels. TritonGym measures how well large language models can produce correct and performant GPU code by comparing their outputs against reference PyTorch implementations and oracle Triton kernels.
π Live leaderboard: https://tritongym.picasso-lab.com
TritonGym provides:
-
164 benchmark operators across three categories:
- Standard (139 ops): Common GPU kernels including matmul, attention, normalization, activation functions, quantization, and more
- Out-of-Distribution (13 ops): Novel operators not commonly seen in training data
- DSL (12 ops): Operators specified using domain-specific languages (Gluon, TLX)
-
Four code generation agents:
- OneShot: Single-pass code generation from the operator specification
- AlphaEvolve: Iterative refinement using evaluator feedback (up to 5 attempts)
- Geak: Multi-agent pipeline with generator, compiler, verifier, optimizer, and reflector
- Leader: Diff-based iterative agent that modifies code incrementally
-
Multi-provider LLM support: OpenAI (GPT-4o, GPT-5), Anthropic (Claude), Google (Gemini), DeepSeek, Meta (Llama via Together AI)
-
Automated evaluation: Correctness verification (max absolute error β€ 0.01) and performance benchmarking (latency comparison against oracle Triton implementations)
docker build -t tritongym -f Dockerfile .
docker run --name tritongym --gpus all -it -v "$(pwd)":/workspace tritongympip install -r requirements.txtRequires: Python 3.10+, PyTorch 2.5+, Triton 3.1, CUDA 12.4+
# Choose one:
export OPENAI_API_KEY=<your-key>
export ANTHROPIC_API_KEY=<your-key>
export GOOGLE_API_KEY=<your-key>
export DEEPSEEK_API_KEY=<your-key>
export TOGETHER_API_KEY=<your-key># OneShot with DeepSeek on the "add" operator
python -m benchmark.cli \
--model deepseek-chat \
--agent oneshot \
--operator add \
--benchmark-json benchmark/data_v2/benchmark.json \
--json --logs logs
# AlphaEvolve with GPT-4o on the "matmul" operator
python -m benchmark.cli \
--model gpt-4o \
--agent alphaevolve \
--operator matmul \
--benchmark-json benchmark/data_v2/benchmark.json \
--json --logs logsbash run_all.shpython summarize_results.py --logs logs/deepseek-chatOutput (Table 1 style):
Agent | Standard Samples | OOD Samples | DSL Samples
| Pass@1 Perf@1 | Pass@1 Perf@1 | Pass@1 Perf@1
------------------------------------------------------------------------------------------
alphaevolve | 48.2% 0.870 | 0.0% 0.000 | 50.0% 0.369
geak | 37.4% 0.966 | 23.1% 0.027 | 50.0% 0.410
oneshot | 33.8% 0.518 | 7.7% 0.000 | 41.7% 0.141
TritonGym/
βββ benchmark/
β βββ cli.py # Main CLI entry point
β βββ eval/
β β βββ runner.py # Core evaluator (GenericEvaluator, TaskSpec, RunResult)
β β βββ tools.py # Tool functions (evaluator, verifier, compiler)
β βββ agents/
β β βββ base.py # Abstract CodeGenAgent
β β βββ oneshot_agent.py # Single-pass generation
β β βββ alphaevolve_agent.py # Iterative refinement agent
β β βββ geak_agent.py # Multi-agent pipeline
β β βββ leader_agent.py # Diff-based iterative agent
β β βββ clients/ # LLM provider clients
β β βββ base.py # Abstract LLM client
β β βββ openai_client.py
β β βββ anthropic_client.py
β β βββ google_client.py
β β βββ deepseek_client.py
β β βββ meta_client.py
β βββ data_v2/ # Standard benchmark (139 operators)
β β βββ benchmark.json # Operator specs (torch_operator, triton_operator, input_shapes)
β β βββ torch/ # Reference PyTorch implementations
β β βββ triton/ # Oracle Triton implementations
β β βββ tests/ # Standalone test scripts
β βββ data_ood_v2/ # Out-of-distribution benchmark (13 operators)
β βββ data_dsl_v2/ # DSL benchmark (12 operators)
βββ scripts/
β βββ sync_torch.py # Sync torch/*.py files into benchmark.json
β βββ sync_oracles.py # Sync triton/*.py files into benchmark.json
βββ run_all.sh # Full benchmark runner
βββ run_perlmutter.sh # NERSC Perlmutter HPC runner
βββ summarize_results.py # Results analysis (Table 1 style)
βββ Dockerfile
βββ requirements.txt
βββ README.md
Each operator in benchmark.json contains:
{
"operator_name": {
"torch_operator": "import torch\n\ndef torch_operator_name(x):\n ...",
"triton_operator": "import triton\n\ndef triton_operator_name(x):\n ...",
"input_shapes": [[[128, 128], [128, 128]], [[256, 256], [256, 256]]]
}
}torch_operator: Reference PyTorch implementation (ground truth)triton_operator: Oracle Triton implementation (performance baseline)input_shapes: List of test cases, each containing shapes for input tensors
- Pass@1: Fraction of operators where the generated kernel produces correct output (max absolute error β€ 0.01 vs. the PyTorch reference)
- Perf@1: Average ratio of oracle Triton latency to generated kernel latency across all operators (0 for failed operators)
- Create
torch/<op_name>.pywith functiontorch_<op_name>(...) - Create
triton/<op_name>.pywith functiontriton_<op_name>(...) - Optionally create
tests/<op_name>.pyfor standalone testing - Run
python scripts/sync_torch.pyandpython scripts/sync_oracles.pyto updatebenchmark.json
- Create a new client in
benchmark/agents/clients/inheriting fromBaseLLMClient - Implement the
chat()method - Register the client in the client factory
export DEEPSEEK_API_KEY=<your-key>
shifter --image=docker:yil384/tritongym:latest --volume=$PWD:/workspace /bin/bash
cd /workspace
bash run_perlmutter.shIf you use TritonGym in your research, please cite:
@article{tritongym2025,
title={TritonGym: A Benchmark for Evaluating LLM-Generated GPU Kernels},
author={...},
year={2025}
}A swebench-style leaderboard lives in web/. To run it locally:
pip install -r web/backend/requirements.txt
python3 web/scripts/aggregate_logs.py # generates web/frontend/public/data/leaderboard.json
PORT=7843 python3 web/backend/main.py # http://127.0.0.1:7843To deploy it (mirrors the picasso-lab pattern: uvicorn + nginx + certbot):
cd web
DOMAIN=tritongym.picasso-lab.com bash deploy/deploy.shSee web/README.md for details.
MIT β see LICENSE.