Together Compiler: Continual Compilation for AI Inference

Reyna Abhyankar, Dylan Lim, Drew Wadsworth, Venkata Hasith Vattikuti, YuTong Julia Zhang, Jung Hwan Heo, Taeksang Kim, Kesavan Ramakrishnan, Evangelene Stanley, Xinyu Fang, Daniel Y. Fu, Simran AroraarXiv 2026

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":

  1. 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.
  2. 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."
The TKCC architecture showing the loop from traffic drift to cost modeling, parallel agent search, and tiered measurement.

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.
Figure 2: TKCC’s two-tiered measurement system outperforms a single slow tier, no measurement tiers, and Apple’s RSI inference bench harness on B200 GLM 5.3 optimization.

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

Abstract

Today's AI workloads are rapidly changing: new models are released more often, model architectures are increasingly diverse, and traffic distributions change frequently. The challenge we face at Together AI is continual optimization for these changing workloads. Compiling a deployment into an optimized forward pass is a challenge that is well-suited for agent hill-climbing. Existing systems struggle with continual compilation due to a tradeoff between measurement throughput and fidelity. Many systems use agents to optimize individual kernels from the inference forward pass using offline benchmarks, but timings are low-fidelity because of data-dependent behavior in primitives like mixture-of-experts (MoE). On the other hand, systems use agents to directly optimize end-to-end engines but suffer from slow engine launch times. To address these challenges, we build Together Compiler (TKCC), the first truly continual agent loop designed for AI inference optimization. To address the throughput-fidelity tradeoff, we propose: (1) a Tiered Persistent Engine that decouples engine launch overheads from forward pass computation; (2) a cost model to select the parallelism configurations that seed the optimization process. We also conduct extensive ablations on agent context management and present our insights on deploying TKCC in production. TKCC outperforms highly-optimized hand-written Megakernels on the Llama 1B workhorse workload by up to 1.7x and the best open source engines on the latest frontier models (Kimi K3, GLM 5.3, MiniMax M3.1 Flash, DeepSeek v4.1 Flash) across hardware platforms by up to 2.6x higher TPS on the InferenceX benchmark. TKCC also sets the state-of-the-art performance at batch size 1, with 1111 TPS on M3.1 Flash and 1205 TPS on DeepSeek v4.1 Flash. Finally, TKCC generalizes beyond frontier language model inference. TKCC serves trillions of tokens across our production fleet.
BibTeX
@misc{abhyankar2026together,
  author = {Reyna Abhyankar and Dylan Lim and Drew Wadsworth and Venkata Hasith Vattikuti and YuTong Julia Zhang and Jung Hwan Heo and Taeksang Kim and Kesavan Ramakrishnan and Evangelene Stanley and Xinyu Fang and Daniel Y. Fu and Simran Arora},
  title = {{Together Compiler: Continual Compilation for AI Inference}},
  year = {2026},
  eprint = {2611.14681},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.14681},
}
Figure