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.
Figures & tables
Figure 1: Together Compiler architecture. As input, TKCC takes in a server launch command, traffic profile, and hardware configuration. It uses a cost model to select the starting parallelism configuration for optimization, spawns parallel agents that are constantly communicating, and measures generated optimizations with a persistent engine. The final source code is directly integrated into the serving engine. As the traffic profile shifts over time, TKCC continually adapts.
Table 1: MiniMax-M3.1-Flash on TensorRT-LLM. We break down the startup time of an inference engine and showcase differences between tiers in the persistent engine.
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.
Figure 4: Cost Model Crossover Points. As decode TPS increases, the best configuration uses TP instead of EP for MoE layers and higher degrees of TP for the attention and dense weights.
Figure 5: Ablating techniques for agent strategies during search on MiniMax-M3 layer 3, B200 TP4, batch size 1 with TensorRT-LLM.
Figure 6: TKCC outperforms existing systems on Llama-3.2-1B-Instruct, Batch Size 1, ISL 32
Figure 7: TKCC improves highly-optimized open-source baselines in under 24 hours of compilation, using at most 2 nodes per model. For these runs, we re-purpose the parallelism strategy proposed by the prior best InferenceX engine baseline as a starting point for our runs. The workloads and images used for these experiments are in Appendix A .
Figure 8: For these runs, we use our cost model to select the parallelism configurations that TKCC ’s optimization loop focuses on, enabling state-of-the-art TPS in the low concurrency regime in under 24 hours of optimization.
Model
Parameters
Evaluation
TKCC
Claude Code
AIFS-ENS 2.0
230M
36-case forecast eval
3.5×
Invalid
Aurora 1.5
1.3B
ERA5: 54 cases
3.7×
3.0×
Boltz-2 (Anthropic)
521M
7-size residue eval
1.5×
1.2×
Evo 2 (Anthropic)
7B
16,000-token generation
1.6×
1.6×
Chronos-2
120M
Chronos: 27 datasets
2.6×
2.2×
Panda-72M
72M
Chaotic ODEs
1.9×
1.9×
Table 2: TKCC and Claude Code ( /goal ) speedups over baseline implementations on the respective evaluation datasets for each model. On AIFS-ENS 2.0, Claude Code fails to find a correct solution.
Model
Run
Samples
Temperature RMSE ↓
CRPS ↓
AIFS
Baseline
4
0.97 K
0.50
TKCC
13
0.94 K
0.46
Aurora
Baseline
4
0.60 K
0.25
TKCC
14
0.55 K
0.21
Table 3: TKCC enables more sampling in a fixed wall-clock time than the baseline implementation, corresponding to reductions in Root Mean Squared Error (RMSE) and Continuous Ranked Probability Score (CRPS) for temperature measurements.
Appendix figures & tables8 assets
Supplementary material from the paper’s appendix.
Appendix
Precision
Parallelism
Model
Engine
Hardware
Chips
Conc.
Base
Experts
DP
Attention
MoE
DeepSeekv4.1-Flash
SGLang
B200
—
1–256
FP4
FP4
{1, 4}
{TP4, TP4 + DPA}
{TP4, EP4}
GLM-5.3
SGLang
B200
—
1–48
FP4
FP4
{1, 8}
{TP4, DPA}
TP4
Kimi K3
vLLM
B300
—
1–70
FP4
FP4
—
TP, DCP8
TP
MiniMax-M3.1-Flash
vLLM
B200
—
1–56
FP4
FP4
—
TP4
TP4
GLM-5.3
vLLM
MI355X
—
1–16
—
—
—
—
—
Appendix
Table 4: Engines, hardware, precision, and parallelism configurations used to seed TKCC .
Figure 9: TKCC improves median TPS across production workloads.
Figure 10: TKCC achieves over 1,299 TPS and 1,266 Median TPS on MiniMax-M3.1-Flash and DeepSeek-v4.1-Flash respectively.
Model
Evaluation coverage
Reference
TKCC
Claude Code
AIFS-ENS 2.0
36 forecast cases: three initialization times, four members, two rollout states; 24 single-member and 12 paired-member cases. Matched Baseline-noise protocol.
Baseline
Passed
Failed
Aurora 1.5 Ensemble
54 ERA5 forecast cases: six initializations, lead times of 1–6 hours; 36 cases at batch size 1 and 18 at batch size 2. Matched per-member RNG.
Baseline
Passed
Passed
Boltz-2
Seven residue sizes, 200–1,400, using constructed barnase/barstar inputs with empty MSAs; 10 recycles, 200 diffusion steps, and 5 samples.
Anthropic exact
Passed
Passed
Evo 2
Evo 2-7B generation from a 3,000-base rCRS prompt: 16,000-token warmup and measured generation in each of three matched repetitions.
Anthropic exact
Passed
Passed
Chronos-2
Forward panel from 27 dataset configurations: 357 strata representing 5,973 original calls.
Baseline
Passed
Passed
Panda-72M
Chaotic-ODE forward panel: 154 strata representing 4,628 original calls.
Baseline
Passed
Passed
Appendix
Table 5: Verified bit-exact agreement with the designated reference on the tested workloads. Boltz-2 and Evo 2 use Anthropic’s shipped exact baselines rather than unmodified Baseline.
Figure 11: Best model-forward speedup found versus time for TKCC and Claude Code, with gaps between sessions removed, and final speedup of optimization marked by solid diamond. The significant time it took for Claude Code to obtain a candidate optimization is explained by the fact that it had to develop its own tooling/adapter for the model based off the context given to it by the codebase. TKCC and Claude Code performances are very similar for Panda, but we see a clear advantage in using TKCC over Claude Code for the other three models in terms of time and performance.
Figure 13: Copy engine outperforms a production-grade MoE megakernel (MoK [ 49 ] ) in imbalanced routing.
Figure 14: Examples of the experiment graph data structure that existed in earlier versions of Together Compiler . Above , we show nodes of the parallel agent experiment graph where blue dots represent new agent hypotheses, red dots indicate optimizations that led to slower performance, and green dots indicate optimizations that led to faster performance. The left panel shows a chart of the model’s layer timing across optimization trials; the table below the chart shows the dollars spent per trial. Below , we show the trace viewer for the baseline kernel sequence and the TKCC -generated kernel sequence. On the right panel, we can see the hypotheses, findings, and experiments that the agents run.
Model (platform)
Waiting for gate (%)
Thinking and writing code (%)
Other (%)
GLM-5.3 (AMD MI350X)
57.0
36.9
6.1
GLM-5.3 (NVIDIA B200)
55.0
35.7
9.3
MiniMax M3.1 Flash (NVIDIA B200)
52.7
40.4
6.9
Appendix
Table 6: How Together Compiler agents spent their time. “Other” covers reading and editing files, compiling kernels, profiling and bookkeeping.
Transformer inference increasingly relies on specialized compiler and runtime support, while recent LLMs can generate nontrivial CUDA kernels. However, unconstrained generation guarantees neither correctness nor performance. We present AgentCompile, an LLM-guided CUDA inference compiler that combines two complementary uses of LLMs. First, the LLM provides advisory metadata for compiler-derived region summaries and bounded candidate spaces. The compiler then instantiates template-based CUDA candidates, validates correctness, selects implementations by measured latency, and falls back when specialization is unsupported or unprofitable. Second, under compiler-defined contracts, the LLM directly generates five classes of decode-critical kernels to accelerate inference, prompted by distilled optimization principles. AgentCompile integrates these kernels into a serving runtime with paged KV cache, continuous batching, preemption, chunked prefill, and bucketed full-step CUDA Graph replay. Across six evaluated model families, AgentCompile achieves speedups of \textbf{2.23--6.98×} over PyTorch eager for single-request generation, and \textbf{1.04--1.16×} over vLLM for both single-request generation and multi-request serving. Our code is publicly available at https://github.com/veneno1213822/AgentCompile.
Xuanzhe Li, Ziyan Weng, Zhiyu Zhu +1
City University of Hong Kong (Dongguan) · City University of Hong Kong
Deep learning inference and training performance depends critically on GPU kernel efficiency. Modern compilers such as PyTorch Inductor automatically generate GPU kernels from high-level model code, but frequently underperform expert-written implementations by wide margins. Recent LLM-assisted optimizers explore these opportunities through kernel generation and refinement; yet translating isolated kernel improvements into model-level gains remains a challenge. We present KernelOPT, a profiling-guided multi-agent system for GPU kernel optimization. It inspects generated Triton kernels and external library calls in compiler artifacts to guide synthesis and refinement, then assembles and evaluates the resulting model. Four stages of validation combine execution checks, multi-seed numerical comparison, model-level checking with a float64 fallback and end-to-end performance gating (γ=1.03). The system supports PyTorch nn.Modules, standalone Triton kernels, and Helion kernels. It is evaluated on all 250 KernelBench problems on NVIDIA H200 which includes 100 single-operator problems (Level1), 100 composite operators (Level2), and 50 model architectures (Level3). KernelOPT achieves geometric mean speedups over torch.compile of 1.40×, 1.15× and 1.07× respectively across L1, L2 and L3. Among problems exceeding 1.03× speedup, the geomeans are 2.54× (36 L1), 1.84× (23 L2), and 1.37× (11 L3). These gains include arithmetic-precision changes and task-specific algebraic simplifications under the evaluated numerical tolerances. The evaluation also reveals discrepancies between isolated kernel improvements and end-to-end performance, motivating model-level measurement alongside kernel-level optimization. Code is available at https://github.com/TorchedHat/KernelOPT.
Compiler backends are expensive to build and maintain as programming models, workloads, and accelerators evolve. We investigate whether large language models can replace the conventional optimizing and lowering pipeline, a process that we call AI lowering. We study AI lowering from Triton to NVIDIA PTX: an LLM agent translates Triton kernels directly into PTX. We build an environment that evaluates candidate PTX, and an agentic harness in which an LLM translates Triton kernels into PTX. Across twelve common kernels on Ada, Hopper, and Blackwell GPUs and ten kernels from recent ML papers, AI lowering achieves 0.83x-3.34x the performance of autotuned Triton. The largest gains come from transformations that Triton's lowering pipeline does not perform, such as decoding packed binary weights directly into Tensor Core operands (3.34x on BitDelta), assigning each thread a complete softmax row in tensor memory (1.37x on FlashAttention), and reusing overlapping convolution windows (up to 2.23x). These results rely on a robust evaluation harness with comprehensive verification support. We build on Volta, an existing PTX verifier, and substantially extend it to support modern GPU architectures by introducing support for Blackwell's tcgen05 Tensor Core interface. This requires modeling three architectural features: managed tensor memory, descriptor-based operand layouts, and asynchronous execution coordinated through commits, waits, memory barriers, and proxy fences. We discuss the challenges involved in formalizing them, as well as the current limitations. Our results suggest an emerging future in which AI compilers replace custom-written intermediate representations and checkers, reducing the time and engineering effort required to bring up software for new general-purpose and custom chips.