Beyond the Trial-and-Error Loop: Hybrid Projection and Automated Tuning for Distributed Training

Anshu Raina, Peyman Razaghi, Yuankai Chen, Cheng Yao, Yao Fu, Vidushi Goyal, Devang Patel, Wen Xie, Zhenyu Gu, Emad BarsoumNeurIPS 2026

TL;DR

Configuring a massive AI training run across hundreds of GPUs currently feels like playing a multi-million-dollar game of Minesweeper: tweak a knob, wait in the cluster queue, hit an out-of-memory crash, and repeat. The authors introduce Primus Projection and the Primus Tuning Agent, a hybrid system that predicts massive multi-node performance using tiny single-node microbenchmarks, then uses an LLM agent to hunt down optimal training configurations in minutes rather than days.

What Problem Does This Paper Address?

Training a 100B+ parameter Large Language Model (LLM) requires choreographing a dizzying number of choices simultaneously: how to slice matrices across GPUs (tensor parallelism), how to stagger layers assembly-line style (pipeline parallelism), how to distribute specialized sub-networks in Mixture-of-Experts (MoE) models, plus batch sizes, precision (FP8 vs. BF16), and activation recomputation.

This creates tens of thousands of valid combinations where the margin for error is razor-thin—miscounting activation memory by just four bytes per element across dozens of layers can flip a high-speed run into an instant out-of-memory (OOM) crash. Purely mathematical ("roofline") models fail here because real GPUs throttle their clocks under sustained load and software libraries behave unpredictably. Full-system simulators are accurate, but require traces from the target cluster itself. Teams are stuck burning expensive multi-node GPU hours on brute-force trial and error.

Methods

The authors live by a pragmatic motto: measure what you can, simulate what you can’t. Their framework couples two components:

Figure 1: Primus Projection architecture. Modeling components consume model card, hardware profile, and cluster spec; the projection oracle returns a memory and throughput estimate that drives both multi-node projection and the Primus Tuning Agent’s iterative search.
  1. Primus Projection (The Oracle): Instead of renting 1,024 GPUs to see how fast a config runs, the engine uses a downscale $\rightarrow$ measure $\rightarrow$ upscale workflow on as few as 1 to 8 GPUs.
  2. Downscale: It shrinks parallelism dimensions in a strict fidelity order. Pipeline Parallelism (PP) drops to 1 first because pipeline bubbles follow deterministic math; Expert Parallelism (EP) shrinks next while keeping the experts-per-GPU constant so compute kernels stay identical; Tensor Parallelism (TP) shrinks last.
  3. Measure: It runs actual compute kernels and intra-node communication for just one representative layer per layer type on real hardware, automatically capturing clock throttling and software-stack quirks. (A pure CPU simulation mode also exists for pre-silicon planning.)
  4. Upscale: Analytical models restore inter-node communication collectives, pipeline schedules, and memory sharding at the full target scale.
  5. Primus Tuning Agent (The Searcher): Treating the projection engine as a fast scoring oracle, search happens in two phases. First, a deterministic seed planner sweeps individual knobs one at a time to map out baselines. Next, an LLM investigation loop (built in DSPy using ReAct-style reasoning) reads the ledger of trials and proposes clever cross-axis combinations. Crucially, an analytical memory pre-filter instantly rejects OOM-doomed configs before touching a single GPU.

Datasets

Because this paper measures hardware throughput (tokens/second/GPU) and memory consumption rather than model accuracy or loss convergence, traditional text datasets are not discussed in the paper (for MoE benchmarking, synthetic forced-balanced routing is used alongside validation against a natively trained model's routing statistics). Instead, the system is evaluated across production LLM architectures—dense Llama 3.1 (8B, 70B), Llama 2 (7B), and sparse MoE models including Mixtral 8$\times$22B, Qwen3-235B-A22B, GPT-OSS-120B, and DeepSeek V3 671B—running on AMD Instinct MI300X, MI325X, and MI355X GPUs.

Key Insights and Ideas

  • Rank preservation matters more than zero error: Isolated microbenchmarks naturally carry a small calibration offset (~10%) compared to sustained cluster runs. Surprisingly, Mixtral had an optimistic offset while Qwen3 had a pessimistic one—yet both achieved a perfect 1.000 Spearman rank correlation. As long as the oracle orders candidates A > B > C accurately, the agent picks the true winner with 0% regret.
  • Activations—not weights—are the silent MoE killer: On Mixtral 8$\times$22B without recomputation, in-flight activation memory hits 198 GB per GPU—more than double the parameters and optimizer states combined (79 GB). That explains why the analytical memory pre-filter is such a massive time-saver.
  • LLMs bridge isolated search axes: Simple grid or single-axis sweeps get stuck in local optima because knobs interact nonlinearly (e.g., shrinking micro-batch size frees up memory to turn off recomputation while switching MoE communication backends). The LLM agent spotted this exact three-way synergy on its very first proposal.
Tuning Agent search trajectory on Mixtral 8x22B showing the LLM jumping past the deterministic seed planner on its first cross-axis proposal.

Key Results

  • High Fidelity Across Scales: Sub-node benchmarks (1 to 8 GPUs) projected 32- and 64-GPU throughput within ~10% of measured hardware across all 16 dense and MoE test cells. At massive production scale, projections landed within 4.7% error on DeepSeek V3 671B (1,024 GPUs) and 1.9% on Qwen3-235B (256 GPUs).
  • Automated Speedups in Minutes: On a 4-node Mixtral 8$\times$22B task, the Tuning Agent discovered an FP8/DeepEP recipe delivering +27% measured throughput (4,402 vs. 3,475 tok/s/GPU) over the published AMD BF16 reference—completed in under 30 minutes on a single node, with the pre-filter catching 7 OOM configs at zero GPU cost.
  • Beating Analytical Baselines: Primus cut Calculon's average error on Llama-70B from 28.9% down to 6.6%, and beat an exhaustive 530-trial Galvatron-style simulation sweep by +28% projected throughput thanks to real-hardware kernel anchoring.

Limitations and Future Work

  • Vendor Validation: While the architecture relies on generic YAML hardware profiles, all empirical validation so far is on AMD Instinct GPUs and ROCm. Porting to NVIDIA GPUs requires a hardware YAML and running the 8-GPU benchmark; Google TPUs would additionally require modeling XLA collectives.
  • Unmodeled Network Contention: The analytical upscaler assumes idealized link performance without multi-job network contention. While contention stayed second-order in their tests (since heavy MoE All-to-All traffic stayed intra-node), inter-node EP setups on congested networks could introduce extra error.
  • Training Dynamics: ZeRO-2 sharding is currently excluded, and when the agent switches precision (like BF16 to FP8) for speed, humans still need to verify that training loss converges cleanly.

Summary updated

Abstract

Configuring distributed large language model (LLM) training across hundreds of graphics processing units (GPUs) requires jointly optimizing tensor, pipeline, expert, context, and data parallelism alongside micro-batch size, recomputation, sharding, and overlap, a combinatorial space where the boundary between memorylegal and out-of-memory (OOM) can hinge on a single byte of per-element activation accounting. Today, teams navigate it through expensive multi-node trial and error, burning GPU-hours on crashes and suboptimal recipes. We present Primus Projection, which closes this loop with two coupled components. First, a hybrid projection engine that measures what it can and simulates what it cannot: GPU microbenchmarks on as few as a single device capture compute kernels and any in-scope communication; a sub-node downscale–measure–upscale workflow analytically restores out-of-scope collectives, fully sharded data parallel (FSDP) overlap, and the full pipeline schedule at the multi-node target. A pure simulation mode runs entirely on a central processing unit (CPU), enabling pre-silicon planning without any GPU. Second, the Primus Tuning Agent treats the projection engine as a fast scoring oracle (seconds per candidate instead of tens of minutes) and uses it to drive an intelligent search over the configuration space. A deterministic seed planner sweeps single axes; an LLM investigation loop proposes cross-axis combinations the planner cannot reach, with an analytic memory pre-filter that rejects infeasible candidates before any GPU time is spent. Validated on dense Llama 3.1 and mixture-of-experts (MoE) Mixtral 8×22B across two GPU generations, all projections stay within ∼10% of measured multi-node throughput, and fidelity holds at production scale: 4.7% error on DeepSeek V3 671B at 1,024 GPUs and 1.9% on Qwen3-235B-A22B at 256 GPUs. In a Mixtral 8×22B case study, the Primus Tuning Agent discovers a configuration delivering +27% throughput over the published 4-node bfloat16 (BF16) reference at the same scale, in under 30 minutes of single-node exploration, with no hand-written configs and no full-cluster profiling pass.
BibTeX
@inproceedings{raina2026beyond,
  author = {Anshu Raina and Peyman Razaghi and Yuankai Chen and Cheng Yao and Yao Fu and Vidushi Goyal and Devang Patel and Wen Xie and Zhenyu Gu and Emad Barsoum},
  title = {{Beyond the Trial-and-Error Loop: Hybrid Projection and Automated Tuning for Distributed Training}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=guQo7FnJYI},
}
Figure