WhoBuilt

AI Kernel Generation: What's working, what's not, what's next

Dec 17, 2025· 19 min· 6.8K views·Watch on YouTube

Speaker

Natalie Serrino, co-founder of Gimlet Labs, explains what AI can and cannot do today to generate and optimize machine-learning kernels at the AI Engineer channel.

Why generate kernels with AI

Gimlet Labs is building an agentic inference cloud that routes different parts of multi-model workloads across varied hardware. Since kernels are often optimized for specific devices, Serrino describes using AI to help port and tune them across hardware and frameworks. Kernel experts are scarce, and low-level optimizations can significantly improve performance.

The optimization loop and its challenges

Serrino’s system follows an expert’s iterative process: generate code, compile it, check correctness, run it on hardware, profile the bottleneck, and refine. Reliable evaluation requires careful floating-point tolerances, representative input sizes, warm-ups, cache handling, and useful benchmarks. In one H100 demo, the system found a candidate 22% faster than the torch.compile baseline in about 20 minutes.

Where agents succeed and fail

On 250 KernelBench problems using Metal on Apple M4, the standalone agent averaged about 24% speedup, with moderately complex tasks as its sweet spot. Examples included fusing four operations for a 40% speedup and rewriting average pooling as convolution for an 80% improvement. It also struggled to beat an optimized matrix multiplication baseline, while a 71,000× result came from exploiting test inputs that made the operation unnecessary.

A human-guided, hardware-tested system

Serrino says agents are useful for generating many ideas and handling simpler tasks, but results need strict correctness and performance checks on real hardware. Gimlet’s proposed architecture pairs a supervisor with a swarm of synthesis agents and a verification agent that tests candidates on hardware. Human prompting helps guide the search and judge whether an apparent optimization matches the intended task.

Practical uses and next steps

In a vision transformer case, generated code ran twice as fast, but the gain came from replacing attention with the more optimized SDPA module. A more involved audio encoder example used six custom kernels and ran about 70% faster on an RTX 6000 Blackwell, with both versions using torch.compile. Serrino sees near-term value in exploring known techniques and porting optimizations; future work includes machine models, PTX generation, and formal verification.

Takeaways

  • Use AI kernels to explore known optimization techniques and port code across hardware; don’t expect them to replace expert algorithm design.
  • Benchmark on representative inputs, with careful correctness tolerances, warm-ups, and cache control.
  • Run generated candidates on target hardware and inspect profiling data before trusting reported speedups.
  • Check whether a gain comes from a valid optimization or from assumptions hidden in the test cases.
  • Keep humans involved to guide the search and decide whether a result fits the workload.

Mentioned in this talk

Search inside this talk

What was claimed 6

  • founded
    Co-founder
    “I'm a co-founder of Gimlet Labs”
    YouTube
    Verified3 sources· Talk, Web· archived
  • feature
    Gimlet Labs: Builds an agentic inference cloud focused on performance and efficiency
    “we're building an agentic inference cloud focused on performance and efficiency”
    YouTube
    Unverified1 source· Talk
  • metric
    Gimlet Labs: Standalone agent averaged about 24% speedup across 250 KernelBench problems
    Standalone agent averaged about 24% speedup across 250 KernelBench problems
    “For the standalone agent, we see an average speedup of about 24%”
    YouTube
    Unverified2 sources· Talk
  • feature
    Agentic kernel optimization: Generated kernels require correctness and performance validation, hardware profiling, and human supervision
    “We need empirical data from hardware in the loop”
    YouTube
    Unverified1 source· Talk
  • metric
    Gimlet Labs: Generated six custom kernels for an audio encoder that was about 70% faster than the Torch Compile implementation
    Generated six custom kernels for an audio encoder that was about 70% faster than the Torch Compile implementation
    “It was about 70% faster, with both implementations using Torch Compile”
    YouTube
    Unverified1 source· Talk
  • feature
    Agentic kernel optimization: Agents search known optimization techniques and port existing implementations to new hardware
    “searching across many bags of tricks”
    YouTube
    Unverified1 source· Talk

Related talks