TL;DR
Together Compiler (TKCC) is the first "continual" optimization loop for AI inference that uses AI agents to constantly re-compile and tune models as traffic patterns shift. By introducing a "Tiered Persistent Engine" that allows for near-instantaneous code hot-reloading, TKCC achieves state-of-the-art performance—outperforming hand-tuned kernels by up to 1.7× and setting new records for low-latency inference on frontier models like DeepSeek v4.1 and MiniMax M3.1.
What Problem Does This Paper Address?
In the real world, AI workloads are moving targets. New models drop weekly, architectures are diversifying (e.g., Mixture-of-Experts, sparse attention), and user traffic is "polymorphic"—shifting between short chat bursts and long-context agentic tasks.
Traditional optimization faces a "throughput-fidelity tradeoff":
- Low Fidelity, High Throughput: Optimizing individual kernels in isolation is fast, but it misses system-level effects. For example, a kernel that looks fast on random data might crawl on real data due to expert imbalance in Mixture-of-Experts (MoE) models.
- High Fidelity, Low Throughput: Testing optimizations in a full inference engine provides accurate results but is painfully slow. Launching a modern engine can take over 10 minutes, leaving expensive GPUs idle while agents wait for feedback.
TKCC aims to break this tradeoff, enabling high-speed, high-accuracy optimization that keeps pace with live production traffic.
Methods
The authors propose a system architecture designed for a "continual agent loop":
- Tiered Persistent Engine: Instead of restarting the engine for every test, TKCC keeps the engine running and "hot-reloads" agent-generated forward passes. It uses a Fast Tier (measuring a subset of layers for quick filtering) and a Slow Tier (measuring all layers for high-fidelity signal). This approach allows TKCC to process 252× more experiments than systems that restart the engine.
- Parallelism Cost Model: Before the agents start coding, a cost model ranks the best parallelism strategies (Tensor, Expert, Data, or Context Parallelism) based on the specific model architecture and current traffic SLAs.
- Agentic Hill-Climbing: Multiple parallel agents (using Claude Code) communicate with each other to explore the optimization space. Surprisingly, the authors found that giving agents unrestricted access to raw source code outperformed using specialized intermediate representations (IRs) or expert-curated "knowledge hubs."
Datasets
The system was evaluated across a wide range of frontier and scientific models:
- Frontier LLMs: Llama 3.2-1B, DeepSeek v4.1 Flash, MiniMax M3.1 Flash, Z.ai GLM 5.3, and Moonshot Kimi K3.
- Benchmarks: SemiAnalysis’ InferenceX (specifically the AgentX workload) was used to measure end-to-end serving performance.
- Scientific ML: Models for weather forecasting (AIFS, Aurora), biology (Boltz-2, Evo 2), time series (Chronos-2, Panda-72M), and physics simulations (Walrus, Poseidon-T).
Key Insights and Ideas
- The "Bitter Lesson" Re-Learned: One of the most striking findings is that human-engineered abstractions often got in the way. Agents provided with raw CUDA/C++ source code achieved higher performance ceilings than those constrained by custom IRs or expert-written strategies.
- Communication is Key: High-frequency communication between parallel agents improved optimization speed by 2.3×. Agents that "talk" to each other avoid redundant tasks and build on each other's successes.
- Data Matters for Fidelity: Randomly initialized data for MoE models activates 13-38% more experts than real traffic. This discrepancy can lead agents to choose "optimal" kernels that actually cause a 15% slowdown in production.
- Hot-Reloading is the Enabler: Decoupling engine startup from execution is the technical lynchpin. By replacing function pointers and re-capturing CUDA graphs on the fly, the system turns a 10-minute wait into a few seconds of measurement.
Key Results
TKCC demonstrates significant gains across hardware (H100, B200, B300, MI355X, Trainium2):
- Vs. Hand-Tuned Kernels: Outperforms highly optimized "Megakernels" (like ThunderKittens) on Llama 1B by up to 1.7×.
- Throughput: Achieves up to 2.6× higher tokens per second (TPS) compared to the best open-source engine configurations on the InferenceX benchmark.
- Low Latency SOTA: Sets new records for batch size 1 inference, hitting 1111 TPS on MiniMax M3.1 Flash (B200) and 1205 TPS on DeepSeek v4.1 Flash (GB300).
- Generalization: Beyond LLMs, it provided speedups of 1.5× to 6.4× on scientific models, enabling more accurate weather ensembles and faster biological simulations.
Limitations and Future Work
- Safety and Stability: Agent-generated code can occasionally cause illegal memory accesses that crash GPUs. While TKCC uses its tiered system to "weed out" these candidates, the authors note that 2 machines were removed from a cluster during testing due to driver errors.
- Verification: While raw code access is powerful, it makes formal verification difficult. The authors suggest future work should focus on designing IRs specifically for verifying agent-generated kernels without restricting the optimization search space.
- Wait Times: Even with hot-reloading, agents still spend over 50% of their time waiting for measurement feedback. Further parallelization or better predictive models of kernel performance could reduce this bottleneck.
Summary updated