Together AI’s hand-written GPU programs delivered speed, but months of engineering left them serving just one model, one batch size and one customer. In research published November 16, the company describes a different approach: AI agents that rewrite GPU code. It says Together Compiler beat its hand-written megakernels by 28% in a Llama 3.2 1B test on B200.
The new account explains both the performance gains and the engineering reversal behind them. Together Compiler uses agents to rewrite and combine kernels—the small GPU programs that perform a model’s calculations. The target is the forward pass: the sequence of computations used to run a model, rather than train a new one.
Together’s earlier megakernels placed an entire forward pass inside one heavily combined GPU program. That gave researchers control over execution, but proved difficult to deploy. The team then asked how much of the speed depended on that elaborate design, and how much could be recovered with simpler building blocks.
Its answer was striking: applying CUDA Graphs and a feature called PDL to default Torch Inductor kernels recovered 98% of megakernel performance without writing a kernel. Adding what Together calls “multi-kernels” and agent loops then exceeded its old megakernels by up to 1.7 times on H100, reaching more than 1,100 tokens per second on Llama 1B.
Together’s investigation also challenges the rules used by Torch Inductor, the code-generating component behind Torch Compile. The researchers found problems in configuration choices, measurements and decisions about which operations to combine. Each could leave performance unused even before agents began searching for better code.
A setting can help one workload and hurt another. Enabling Inductor’s “freezing” setting improved throughput 10–26% at larger batch sizes, but slowed single-item inference by 49%. Together traced the slowdown to weights left in a larger, 32-bit format.
Test inputs can create artificial speed. In an embedding lookup test, setting every token ID to zero repeatedly accessed the same vector. For a 64,000-token sequence, that ran 2.1 times faster than using random token IDs.
Combining operations can help without saving memory traffic. Together found two kernels that Inductor kept separate because they shared no memory accesses. One used only a small fraction of the GPU; combining their work could improve utilization.
The measurement problem had a concrete consequence. Together found that a kernel selected by Inductor ran slower inside the model than an alternative. For Llama 1B’s output projection, the chosen Triton implementation took 7.4 microseconds, versus 6.4 microseconds for cuBLAS—a 15% slowdown, according to the company.
Together’s accompanying paper, submitted November 10, describes the underlying tradeoff. Agents can rapidly optimize individual kernels using offline tests, but those measurements may misrepresent data-dependent operations. Testing complete inference engines offers a more faithful setting, yet slow engine launches limit how quickly agents can try changes.
Reader comments
Newest comments first. Replies stay oldest first.