TL;DR
Phantora is a hybrid GPU cluster simulator that estimates machine learning (ML) training performance by running unmodified frameworks (like DeepSpeed and TorchTitan) on a single GPU. By intercepting low-level runtime calls and utilizing a novel network time-rollback mechanism, it eliminates the need to manually reimplement fast-evolving framework logic or collect expensive real-cluster traces.
What Problem Does This Paper Address?
Optimizing large-scale ML training requires carefully choosing parallelization strategies (e.g., tensor, pipeline, or data parallelism) and cluster configurations. To pick the best setup, system engineers rely on performance estimation.
However, existing simulation methods suffer from a severe maintenance and resource burden:
- Trace-based simulators require running workloads on a real, massive GPU cluster first just to collect execution traces. If you want to test a different parallelization strategy, you often have to re-collect the traces because the scheduling logic changes.
- Mock-based simulators (like SimAI) avoid trace collection but require developers to manually reimplement the complex scheduling logic of the ML frameworks. Because frameworks evolve rapidly, these simulators quickly become outdated and fail to support new features out-of-the-box.
Phantora addresses this gap by asking: Can we directly reuse the actual ML framework source code during simulation?
Methods
Phantora introduces hybrid simulation, combining real system execution with event-driven simulation. Instead of mocking a framework, Phantora runs the actual, unmodified training scripts inside a distributed, containerized environment on a single machine.
Key components of the architecture include:
- Interception Layers (Phantora Tracer, NCCL, and CUDA Runtime): Phantora intercepts PyTorch operators, collective communication calls (like
allreduce), and CUDA runtime events. - Single-GPU Profiling & Caching: GPU computation kernels are executed and profiled on a single local GPU. Because kernel execution time depends on tensor shapes rather than actual tensor values, Phantora caches these timings. Future identical calls simply look up the duration from the cache, bypassing redundant execution.
- Loose Time Synchronization with Rollback: A major challenge in hybrid simulation is that real containers execute continuously, while network simulators move in discrete time steps. If a container injects a network event that logically happened in the "past" relative to the network simulator's current virtual time, the simulation becomes inaccurate. Phantora solves this by allowing the network simulator to "time travel"—rolling back its state to accommodate past events dynamically.
- Scalability Tricks: To simulate dozens of GPUs on a single host without running out of RAM or causing CPU thrashing, Phantora implements transparent CPU memory sharing for model weights across containers and tracks actual CPU process time rather than wall-clock time.
Datasets / Workloads
As a systems paper, evaluation is performed using standard production-grade ML workloads and models rather than static datasets:
- LLM Workloads: Llama2 (7B, 13B, 70B) and Llama3 (8B, 70B) configurations.
- ML Frameworks Supported: Megatron-LM, DeepSpeed, and TorchTitan.
- Non-LLM Workloads: ResNet-50 (computer vision), Stable Diffusion (image generation), and Graph Attention Networks (GAT).
Key Insights and Ideas
- Value-Independence of Kernels: The core realization that allows single-GPU simulation is that an ML framework's control flow and kernel execution times rarely depend on the actual numbers inside the tensors. This allows Phantora to run the real code using "junk" data values safely.
- Optimistic Synchronization: Instead of slowing down simulation by forcing tight, lock-step synchronization between the real code execution and the network simulator at every tiny time quantum, Phantora runs them loosely and relies on a robust rollback mechanism to fix discrepancies.
- Zero-Code-Modification via Runtime Patching: By leveraging Python's dynamic nature to patch underlying dependencies (like replacing
time.perf_counterwith a virtual timer), frameworks can be installed directly viapip installand simulated without modifying their source code.
Key Results
- High Accuracy: Phantora achieves an average simulation error of just 2.9% compared to public large-scale cluster reports (up to 128 GPUs) and 3.7% compared to real small-scale hardware testbeds.
- Out-of-the-Box Generality: It successfully ran Megatron-LM, DeepSpeed, and TorchTitan with zero modifications to the framework source code. It is currently the only simulator capable of supporting TorchTitan out-of-the-box.
- Fast Simulation Speed: Phantora simulated a 128-GPU Llama3-8B training workload in roughly 15 seconds per iteration. It can scale to simulate approximately 240 GPUs on a single machine within a 1-minute-per-iteration threshold.
- Massive Memory Savings: Without parameter sharing, a host machine could only simulate 9 GPUs before exhausting 256GB of RAM. With Phantora's CPU memory sharing, simulating 64 GPUs required less than 64GB of RAM.
Limitations and Future Work
- JIT-Compiled Kernels: Phantora does not currently support Just-In-Time (JIT) compiled kernels out-of-the-box, as intercepting them requires deeper integration with ML compilers.
- Value-Dependent Performance: Workloads where control flow does depend on data values—such as Mixture-of-Experts (MoE) with severe load imbalance or Reinforcement Learning (RL) with variable sequence generation lengths—cannot be perfectly modeled without manual annotations.
- Hardware Resource Contention: The simulator does not currently model the internal hardware resource degradation that occurs when computation and communication overlap heavily on the same physical device.
Summary updated