This weekend, I wanted to see whether we could run RL's training and inference loop in a single kernel on a single GPU.
Generation and training run simultaneously on one H100, and generation never stops. 🧵
Last Year We Helped Build Megakernels. 🔨 This Year We Deleted Them. ❌
Check out our post and new blogs for a deepdive into how we built the Together Compiler and the lessons learned along the way!
Some key takeaways:
1. When tuned appropriately, simply using Torch Inductor performs as well as hand-written Megakernels on canonical Megakernel workloads.
2. Full-model Megakernels are the wrong target to blindly hill-climb on. Fusion can be harmful.
3. The optimal abstraction for inference optimization is neither individual kernels nor one giant megakernel.
And a bunch of interesting lessons on how agents interacted with various scaffoldings, compiler intermediate representations, and "expert guidance" we baked into the harness.
Last Year We Built Megakernels. This Year We Deleted Them.
One year ago, we helped introduce some of the first AI megakernels to the world. Since then, we’ve enjoyed seeing their wide adoption from friends and researchers. However, while whole model megakernels are a helpful abstraction, we’ve found that they overcomplicate and are not always an ideal optimization target.
Below, we discuss our journey to understand and push past these limitations. We start with a deep dive into two contrasting paradigms of ML optimization – Torch Compile and Megakernels
Introducing FlashState ⚡: an inference system that flexibly manages the prefix cache of hybrid LLMs, designed for agentic workloads.
On GLM 5.3 Flash, FlashState more than doubles vLLM's throughput and provider profit, while cutting latency by 3.7× and user cost by 2.5×.
Congratulations to @reyna_abhyankar and @dylan__lim for their >1yr effort on Together Compiler!
Their work was so incredible that I found it generalized well beyond LLMs to SciML models 🔬.
Here it is outperforming Claude on nearly every model I tried
1/n
Super excited to (officially) share Together Compiler with the world! This is our opinionated take at @togethercompute about how to scale inference in an increasingly polymorphic world (many models, archs, traffic, hardware).
Deployed across our inference fleet today 🚀 1/
A little over a year ago, I started my journey into kernels and inference optimization. Since then, the field has rapidly evolved, and many tasks like kernel writing have become increasingly obsolete. I’ve spent a lot of time reflecting on ML Systems in the agentic era, and how such systems must be designed to efficiently and thoroughly explore the optimization space. I’m proud to announce Together Compiler, a continuous optimization system for the age of polymorphic inference!
This is very exciting
Also, the paper has findings that will be of interest to much broader communities (beyond inference and compiler) -- eg. eval, as they test on real traffic, or AI for code (see the sheer effectiveness of the prompt “make this forward pass as fast as possible”)
Introducing the Together Compiler: continual compilation for AI inference! I’m super proud to finally share this work from our research team! ✨
Today’s inference is “Polymorphic” or shape-shifting, it doesn’t sit still. On OpenRouter, 80% of traffic goes to models released in the last three months and the top ten most popular open models each use a different architecture. Our customers constantly change their usage behaviors. Together Compiler leverages agents to continually optimize our deployments immediately as these changes occur.
Together Compiler research highlights include:
1. 252x better throughput: TKCC lets agents try 252x more optimization experiments per hour compared to prior agent inference optimization systems.
2. State-of-the-art TPS across InferenceX workloads we tried: TKCC outperforms the best InferenceX engine across all tested settings in just 24 hours & 2 nodes per compile. Including 1111 TPS on MiniMax M3.1 B200 and 1205 TPS on DeepSeek v4.1 Flash GB300 at batch size 1. NVIDIA, AMD, Trainium2.
3. Continuous recompilation: TKCC currently serves many trillions of production tokens per day and adapts to traffic shifts within just a few hours of recompilation.
4. Bitter lessons: TKCC’s design builds on 2+ years of building frameworks to accelerate AI Inference, starting from ThunderKittens and Megakernels. Compilers have always used abstractions and IRs, but we show that agentic compilers now reach higher performance ceilings without abstractions.
From an incredible team @reyna_abhyankar@dylan__lim@realDanFu@togethercompute!!