Custom Kernels for All from Codex and Claude
- Claude
- Codex
- PyTorch
- Hugging Face Kernel Hub
- Nix
AI Summary
Hugging Face developed an agent skill designed to teach coding agents like Claude and Codex how to write production-ready CUDA kernels complete with PyTorch bindings, build scripts, and benchmarks. By packaging specialized knowledge about NVIDIA GPU architectures (such as H100, A100, and T4) and library integration pitfalls into an on-demand context skill, agents successfully generated optimized RMSNorm, RoPE 3D, GEGLU, and AdaLN kernels for real targets like LTX-Video and Qwen3-8B. The resulting kernels achieved significant speedups, such as a 1.94x isolated speedup for RMSNorm on Qwen3-8B, which can then be compiled across multiple matrix variants via Nix and shared publicly through the Hugging Face Kernel Hub for zero-compilation loading.
Key Takeaways
- The agent skill is approximately 550 tokens of structured guidance paired with reference scripts and templates for GPU optimization.
- Tested on LTX-Video (diffusers pipeline) and Qwen3-8B (transformers model), producing working kernels with correctness checks and benchmarks.
- Integration with Hugging Face Kernel Hub and Nix allows compiled binary variants to be shared and loaded using a simple single-line command.
Why it matters
Writing custom CUDA kernels requires deep expertise in hardware-specific optimization, memory access patterns, and integration plumbing, which acts as a major bottleneck for engineers. This approach demonstrates how packaging domain expertise into agent skills enables LLMs to autonomously handle complex systems programming tasks, bridging the gap between high-level AI applications and low-level hardware performance.
Conversation0
What would you add from your experience?
Checking your session…
Every good conversation starts with one perspective.