COSMIC: Enabling Full-Stack Co-Design and Optimization of Distributed Machine Learning Systems

Aditi Raju, Jared Ni, William Won, Changhai Man, Srivatsan Krishnan, Srinivas Sridharan, Amir Yazdanbakhsh, Tushar Krishna, Vijay Janapa ReddiarXiv 2025 · DOI

Introduction

Training state-of-the-art large language models (LLMs) and vision transformers requires massive computational resources, often involving thousands of specialized processors (NPUs/GPUs). As model sizes grow, the complexity of designing efficient distributed systems increases exponentially. Traditionally, system design is siloed: workload parallelization, communication algorithms, and network topologies are optimized independently. However, these layers are deeply coupled; a decision in one layer significantly impacts the performance and traffic patterns of the others.

The Challenge of Coupled Design

The design space for a distributed ML system is vast, estimated at approximately 77 trillion configurations. Manual search or isolated optimization often leads to "local optima"—solutions that appear efficient for a single layer but degrade overall system performance. For instance, a specific parallelization strategy might minimize computation time but create network congestion that outweighs those gains. Navigating this $10^{13}$ design space requires a holistic, full-stack approach.

Parallelization strategies (DP, TP, PP, SP) for training data and model layers.

The COSMIC Framework

COSMIC addresses these challenges through two primary innovations: the Parameter Set Architecture (PSA) and a co-design execution engine.

Parameter Set Architecture (PSA)

Inspired by the Instruction Set Architecture (ISA) used in traditional computing, PSA provides a standardized abstraction layer. It allows domain experts to define a schema of searchable parameters—such as parallelization dimensions (Data, Tensor, Pipeline, and Sequence Parallelism), network bandwidth, and topology constraints—without needing to understand the internal mechanics of the search agents. Conversely, AI agents can explore the design space through this interface without requiring deep knowledge of the underlying hardware or ML workloads.

Execution Engine

The COSMIC framework integrates ASTRA-sim, a cycle-accurate distributed ML simulator, with ArchGym, a suite of machine learning-based search agents (e.g., Bayesian Optimization, Genetic Algorithms). A Workload Trace Generator (WTG) dynamically produces simulation traces based on the agent's selected parameters, allowing for rapid evaluation of complex system configurations.

Common communication collectives optimized within the COSMIC framework.

Evaluation and Key Results

The framework was evaluated using industry-standard Transformer workloads, including GPT3-175B, GPT3-13B, and Vision Transformers (ViT-Large/Base), across simulated clusters of 512 to 2,048 NPUs.

Performance Gains

Full-stack co-design delivered substantial performance improvements, ranging from 1.50× to 48.41× higher throughput compared to optimizing the workload layer in isolation. COSMIC often identified non-obvious configurations, such as specific combinations of Tensor Parallelism and fully connected network topologies that effectively mitigated congestion.

Cost and Scalability

When optimizing for performance per network dollar, COSMIC achieved improvements between 3.4× and 127.17× over baseline setups. Notably, the benefits of this co-design approach scaled with the system size; the performance gap between isolated and full-stack optimization widened significantly as the number of NPUs increased to 2,048.

Conclusion

COSMIC demonstrates that breaking the silos between workload, communication, and network design is essential for the next generation of AI infrastructure. By providing a structured abstraction through PSA and leveraging automated search agents, the framework enables the discovery of highly efficient, counter-intuitive system configurations that human intuition might overlook. Future work will focus on expanding the scope to emerging architectures like State Space Models and reducing simulation overhead to enable the use of Reinforcement Learning agents.

Summary updated

BibTeX
@misc{raju2025cosmic,
  author = {Aditi Raju and Jared Ni and William Won and Changhai Man and Srivatsan Krishnan and Srinivas Sridharan and Amir Yazdanbakhsh and Tushar Krishna and Vijay Janapa Reddi},
  title = {{COSMIC: Enabling Full-Stack Co-Design and Optimization of Distributed Machine Learning Systems}},
  year = {2025},
  eprint = {2505.15020},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.15020},
}
Figure