ModelBlaster: Closing the Performance Gap through Learning-Augmented Agents Across Models, Kernels and Hardware Backends
Organizations: NVIDIA · University of California, Berkeley
Abstract
Optimizing accelerator code across hardware architectures is difficult. ML compilers search predefined spaces of schedules and micro-kernels, while LLM-guided optimization can explore alternative algorithms, operator decompositions, and hardware-specific techniques. However, existing LLM agents typically target a single programming interface, toolchain, or accelerator family, focus on kernel-level optimization without model-level transforms, and offer limited reuse of experience across hardware targets. We present ModelBlaster, a Memory-Augmented In-Context Reinforcement Learning (MAIC-RL) framework for optimizing data-parallel kernels and whole models across heterogeneous SIMD and SIMT accelerators. Its mutable policy is a persistent knowledge base updated at inference time by Actor-Critic Textual Gradient Descent (AC-TGD). The knowledge base maps performance states to actions, outcomes, and constraints, enabling experience reuse across kernels, models, and hardware targets. A model-level optimizer uses kernel-level knowledge to inform whole-model decisions. The same optimization loop and knowledge schema support CUDA on NVIDIA GPUs, OpenCL on Qualcomm GPUs, and RVV intrinsics on RISC-V vector cores, with only lowering and measurement layers specific to each target. Compared with PyTorch, ModelBlaster achieves geometric-mean speedups of 1.85x, 5.58x, and 5.18x on KernelBench Levels 1, 2, and 3, and 1.69x on SOL-ExecBench Levels 1 and 2 on a B200 GPU. On Qualcomm Adreno GPUs, it achieves 5.8x over the vendor SDK and 1.7x over Apache TVM; on RISC-V vector cores, it achieves 2.7x over ExecuTorch with XNNPACK across 70 KernelBench problems.
Figures & tables
| Component | Definition |
| Task | , where is the input program or model fragment, is a reference implementation, is the backend, and is the measurement interface. |
| State | , where is the current implementation, is compiler and validation feedback, is timing or profiling evidence, and is rollout history. |
| Actor action | , where is a code transformation or implementation plan and is the set of retrieved Knowledge Base entries. |
| Reward signal | , where is the correctness-gated scalar performance reward and is the text-based reward signal. |
| Memory update | , where the critic incorporates rollout outcomes into persistent long-term memory. |
| Component | RL counterpart | Functionality |
| Knowledge Base | Parameters | Store of states, techniques, hypotheses, claims, outcomes, and verified implementations; with the prompt it forms the policy parameters. |
| Operator Selector | Picks the next kernel slot by time share, stall decay, and exploration. | |
| State Classifier | State | Assigns the deepest matching performance state from the profiling signature, with the program, feedback, and rollout history. |
| Technique Selector | Policy | Picks a technique for the state with a UCB rule over reward statistics. |
| Actor CodeGen Agent | Action | Rewrites the selected slot using claims, similar kernels, and past attempts. |
| Fix Agent | Repairs candidates that fail the correctness check, revising the action. |
| Hardware / Benchmark | Level | Method | Share | Mean | GeoM | Med | Min | Max | % 1x | % 1x |
| NVIDIA L40S KernelBench | 1 | AI CUDA Engineer | 82% | 1.728 | 1.101 | 1.202 | 0.0659 | 32.35 | 74.39% | 25.61% |
| StitchCUDA | 98% | 1.718 | 1.335 | 1.116 | 0.0250 | 9.77 | 86.73% | 11.22% | ||
| Ours | 96% | 3.972 | 1.850 | 1.758 | 0.2621 | 158.51 | 85.42% | 14.58% | ||
| 2 | AI CUDA Engineer | 83% | 3.865 | 1.695 | 1.574 | 0.328 | 123.39 | 79.52% | 20.48% | |
| StitchCUDA | 79% | 2.888 | 2.177 | 1.665 | 0.296 | 9.48 | 94.94% | 5.06% | ||
| Ours | 100% | 22.823 | 5.576 | 4.934 | 0.8084 | 314.64 | 85.00% | 15.00% |
| System | Language | Agent’s Models | Hardware Setup | Dataset | Hyperparameter | Test Harness |
| ModelBlaster (Ours) | CUDA | GPT-5.0-mini, GPT-4.1, GPT-5.0, Sonnet 4.6, Opus 4.6 | NVIDIA A6000, A100, H100, L40S; RISC-V Vector core (Saturn) | KernelBench L1–3, SOL-ExecBench | 10 iterations, 10 rollout steps per iteration | Functionality Check : passing kernels are compiled and executed on GPUs; outputs are compared to PyTorch baselines with multiple randomized seeds to ensure correctness and prevent overfitting. |
| AI CUDA Engineer | CUDA | O4-mini, Sonnet 3.7, Gemini 2.5 Pro, GPT-4.1, O3 | NVIDIA H100 | KernelBench L1–2 | 10 generations; 10 proposals/generation; top 4 evaluated | LLM Soft-Verification : an LLM scans each kernel for likely compilation, memory, or numerical errors, filtering bad code before GPU execution. |
| StitchCUDA | CUDA | Opus 4.6 (our run) | NVIDIA L40S (our run) | KernelBench L1–2 | 15 attempts per problem with 2 replans | Verifier agent : checks correctness and profiles with Nsys and NCU; speedup over PyTorch is measured as wall-clock time in its own harness. |
| QNN SDK Compiler | OpenCL | N/A | Qualcomm Adreno 650 | KernelBench L1 | N/A | (SDK-internal validation) |
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
| Comparison | All overlapping | Compute-bound |
| ModelBlaster over TVM | 1.69 ( ) | 2.30 ( ) |
| ModelBlaster over TVM, optimized pipeline only | 1.50 ( ) | |
| ModelBlaster over QNN | 5.80 ( ) | |
| TVM over QNN | 3.36 ( ) | 1.21 ( ) |
| Operator class | ModelBlaster faster | Speedup |
| Matrix multiplication | 14 of 16 | 3.13 |
| Reductions | 6 of 6 | 251.7 |
| Normalizations | 8 of 8 | 47.2 |
| Activations | 11 of 13 | 10.0 |
| Conv2d | 1 of 11 | 0.09 |
| Conv1d | 0 of 5 | 0.06 |
| Arm | vs eager | vs CUDA graph |
| A0 baseline | 2.79 | 1.59 |
| A1 round controller | 2.79 | 1.59 |
| A2 graph-first round | 3.46 | 1.97 |
| A3 sibling-conv merge | 3.47 | 1.98 |
| A4 region windows | 4.08 | 2.33 |
| A5 region loop | 2.90 | 1.65 |
| Model | Speedup |
| LeNet5 | 10.58 |
| SwinMLP | 4.07 |
| ResNetBasicBlock | 3.19 |
| DenseNet121DenseBlock | 2.72 |
| SqueezeNetFireModule | 2.41 |
| MLP | 1.07 |
GPU Kernel Optimization
GPU kernel optimization improves the speed and memory efficiency of computations by tailoring code to GPU hardware and workloads.
See all 227 papers