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.