---
title: "vTrain — paper by Bang et al. (2023) — summary and ideas"
description: "vTrain uses GPU measurements to estimate training time, compare the costs of parallel training plans, and test what can fit a deadline."
canonical: "https://research.elamur.ai/free/en/papers/bang-2023-vtrain-simulation-framework-evaluating-cost/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/bang-2023-vtrain-simulation-framework-evaluating-cost/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2023](https://md.research.elamur.ai/free/en/papers/2023/) / vTrain: A Simulation Framework for Evaluating Cost-effective and Compute-optimal Large Language Model Training

# vTrain: A Simulation Framework for Evaluating Cost-effective and Compute-optimal Large Language Model Training

Paper · 2023 · Jehyeon Bang, Yujeong Choi, Myeongwoo Kim et al.

**Authors:** Jehyeon Bang, Yujeong Choi, Myeongwoo Kim, Yongdeok Kim and [Minsoo Rhu](https://md.research.elamur.ai/free/en/authors/minsoo-rhu/) · **Year:** 2023 · **Venue:** arXiv:2312.12391 · **Licence:** [CC BY-NC-ND 4.0 (arXiv)](http://creativecommons.org/licenses/by-nc-nd/4.0/)

Cited by **20** papers in our library of more than 163,000 papers whose bibliographies we read · [licence](http://creativecommons.org/licenses/by-nc-nd/4.0/)

- [PDF](https://arxiv.org/pdf/2312.12391)
- [arXiv 2312.12391](https://arxiv.org/abs/2312.12391)

## Summary

A large training run can keep a GPU cluster occupied for weeks. How the work is divided among those GPUs determines how much of that time goes into computation and how much goes into exchanging results or waiting for other devices. A poor division can raise the bill even when it uses more hardware and finishes sooner. The authors introduce vTrain, a simulator for comparing these choices before committing a cluster to a run. It measures the duration of individual GPU operations and uses their dependencies to estimate the time needed for a training iteration. Repeated layers let it reuse many of those measurements.

The authors compare their predictions with half-precision training runs on NVIDIA A100 GPUs. Across 1,440 configurations on a single server with 8 GPUs, the mean absolute percentage error in iteration time was 8.37%. On a distributed system with 512 GPUs, it was 14.73%. The authors also test whether the simulator can choose a faster plan when its timing estimates are imperfect. In comparisons on 64, 256 and 512 GPUs, every plan selected by vTrain completed a measured iteration faster than its corresponding baseline.

The paper uses the simulator to make different kinds of decisions. For Megatron-Turing NLG, a proposed configuration reduced the estimated rental bill from 9.01 to 8.62 million dollars while taking 6.3% longer. In simulations of a shared cluster, giving the existing ElasticFlow scheduler a wider choice of ways to divide training improved deadline completion and shortened the time needed to clear a workload. A final study asks how much training a cluster can do within 30 days. When the search accounts for the rate at which the GPUs can actually sustain computation, it selects a workload of 76.04 billion parameters and 1,521 billion training tokens. The workload suggested by assuming full GPU utilization would take an estimated 85 days. These cases illustrate different uses of the same timing estimate, with measured iteration times supporting some comparisons and simulation supplying the results for the larger scenarios.

## Deep dive: vTrain: A Simulation Framework for Evaluating Cost-effective and Compute-optimal Large Language Model Training

vTrain uses GPU measurements to estimate training time, compare the costs of parallel training plans, and test what can fit a deadline. · about 35 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### Why the division of work matters

A training system has to make two commitments before a long run begins. It has to decide how much work the run will contain, including the size of the network and the amount of text it will process. It also has to decide how to place that work on the available hardware. The commitments are linked. A workload that seems manageable from the cluster's advertised throughput can miss its deadline once the GPUs have to exchange partial results, wait for other stages, and synchronize before updating the weights. Conversely, a better placement can make the same workload feasible with a smaller allocation.

The distinction that motivates the paper is between peak and achieved throughput. Peak throughput describes the rate the hardware is capable of under favorable conditions. The achieved rate includes the consequences of how training uses the devices. A GPU may have a part of the network assigned to it and still have nothing ready to compute. It may be waiting for an activation from a neighboring stage, for a collective communication operation to finish, or for its next micro-batch. A long sequence of these waits matters even when each one is short relative to an entire run.

For a concrete illustration, the paper considers GPT-3 with 175B parameters on 1,024 A100 GPUs. The authors use the arithmetic required for training and vary the fraction of peak throughput that the allocation sustains. Going from 50% to 40% utilization adds an estimated 8 days. They use AWS EC2 P4d pricing to translate the projected duration into a rental cost. The illustration establishes the scale of the planning problem through an estimate for a fixed workload and GPU allocation. The execution plans studied later have the additional freedom to change the allocation. [GPT-3](https://md.research.elamur.ai/free/en/papers/brown-2020-language-models-few-shot-learners/)

A common starting point was to put communication-intensive work on fast links inside each server and distribute the remaining work across servers. The paper describes this as an empirically successful recipe used in systems such as Megatron-LM and OPT. It reflects the fact that the network inside a high-end GPU server can be much faster than the network connecting servers. It still leaves an engineer to choose how many devices to devote to each kind of work, how to slice a batch, and how to order work across stages. The paper treats this as a problem of exploring configurations under the constraints of [GPU and parallel computing](https://md.research.elamur.ai/free/en/topics/gpu-parallel-computing/). [Megatron-LM](https://md.research.elamur.ai/free/en/papers/shoeybi-2019-megatron-lm-training-multi-billion/) · [OPT](https://md.research.elamur.ai/free/en/papers/zhang-2022-opt-open-pre-trained-transformer/)

An exhaustive search on the intended cluster would require enough test time to make the search itself a costly project. The more realistic alternative had been to start with a known recipe and test a limited set of modifications. That can validate particular choices, but the feasible configurations left unexplored still matter. A plan that wins on iteration time can use too many devices to be attractive on price. A more modest allocation can make sense when a deadline has some slack. Measuring a handful of familiar layouts gives little information about where those tradeoffs lie.

#### The three ways to distribute training

The workload in the paper is a decoder-only [Transformer](https://md.research.elamur.ai/free/en/concepts/transformer/). A training iteration includes a forward pass, which computes outputs, a backward pass, which derives the gradients needed to change the weights, and an update. The parallelization strategy determines who performs these operations and when information has to move between workers. The paper distinguishes data, tensor and pipeline parallelism because each places a different part of the iteration on the network. [Attention Is All You Need](https://md.research.elamur.ai/free/en/papers/vaswani-2017-attention-all-need/)

With data parallelism, each replica works on a different part of the batch. For pure data parallelism, a worker has a copy of the whole network. In a hybrid configuration, a replica can itself span multiple GPUs. The workers compute gradients using their own inputs, then combine corresponding gradients so each replica can apply the same update. The collective operation that performs this combination is called All-Reduce. It gives the participating workers the reduced result and makes it possible to keep their copies of the weights in agreement. Earlier distributed training software such as PyTorch Distributed Data Parallel also supports starting this exchange as portions of the gradients become ready. [PyTorch Distributed](https://md.research.elamur.ai/free/en/papers/li-2020-pytorch-distributed-experiences-accelerating-data/)

Tensor parallelism divides work inside a layer. Workers process the same input while each owns part of the relevant weight matrices. In the decoder implementation described by the paper, the feedforward block splits consecutive weight matrices along different axes. The corresponding slices can do some computation independently before their results must be brought together. The attention block can also be partitioned this way. The reduction occurs repeatedly during both forward and backward passes, so the performance of the link among the participating workers matters throughout the iteration.

Pipeline parallelism assigns consecutive portions of the layer stack to different stages. A stage does its part of the forward pass and sends the resulting activations to its successor. For back-propagation, the direction reverses and the stages exchange gradients. A batch can be cut into micro-batches so the stages have work from different micro-batches at the same time. At the beginning of a pipeline schedule, later stages have to wait for work to reach them. Waiting may also occur as the pipeline drains or as a stage waits for a result in the opposite direction. The paper calls these intervals pipeline bubbles.

GPipe and PipeDream provide examples of how prior work organized this execution. GPipe divides a batch into micro-batches, with a forward phase followed by a backward phase. PipeDream's one-forward-one-backward schedule, abbreviated 1F1B, interleaves the two kinds of work after filling the pipeline. The paper describes limiting the number of micro-batches in flight as a way to reduce the memory taken up by activations awaiting their backward pass. These schedules give vTrain separate execution orders to represent even for the same placement of layers and the same batch.

Combining the three kinds of parallelism lets a configuration address the memory capacity of a GPU while still distributing input processing. The paper calls the combination 3D parallelism. Tensor groups share layer computation, pipeline stages share the depth of the network, and data replicas divide the batch. These jobs draw on different communication patterns. Frequent reductions inside tensor groups are the reason the usual recipe favors links such as NVLink for those groups. The division across nodes more often combines pipeline transfers and data-parallel reductions. The paper uses [Megatron-Turing NLG](https://md.research.elamur.ai/free/en/papers/smith-2022-using-deepspeed-megatron-train-megatron/) as a well-documented example of such a deployment.

#### What earlier performance estimates could answer

The authors situate vTrain between approaches that describe training mainly through analytic estimates and approaches that measure selected operations. ASTRA-sim focuses on distributed execution and collective communication across network topologies. The paper describes its original network simulation as cycle-level and the later ASTRA-sim2.0 network component as analytic, with the latter choice reducing simulation time. AMPeD uses an analytic approach for distributed Transformer execution and fits a factor governing compute efficiency. Calculon parameterizes the workload, training configuration and system and can report quantities including compute time and memory usage. These systems address questions about execution with different amounts of detail about the implementation that produced it.

Profiling-based approaches also existed. Tale of Two Cs profiles representative operations as a basis for studying how computation and communication scale across Transformer configurations. SeqPoint selects representative iterations of sequence workloads and uses them to estimate wider training performance. Daydream is the direct methodological precedent for associating low-level GPU tasks with the operations that launched them and predicting effects of systems changes. In vTrain, that association supports searches over distributed training layouts. Repetition across decoder layers makes it possible to measure the kernels of each needed operator shape and reuse them wherever that operator recurs, including the short operations that accompany the larger matrix multiplications.

The paper also draws on earlier work concerned with cluster-level decisions. A serverless training service can ask users to specify the workload and performance requirements while leaving GPU allocation and placement to the cluster manager. An elastic scheduler can then vary the resources assigned to jobs. ElasticFlow takes this approach and makes deadline-aware decisions using measurements of how training scales with the GPU allocation. The vTrain authors identify a restriction in the choices available to that scheduler. Scaling the data-parallel degree captures one way to use extra GPUs. A wider search can find ways to spend the same allocation on different layer or pipeline partitions.

Finally, compute-optimal training gives the hardware planning question a consequence for the choice of workload itself. The paper recounts how MT-NLG reached 530B parameters while using roughly 270B training tokens, a token count also reported for GPT-3. Hoffmann and colleagues studied how to allocate a fixed amount of computation between parameters and training tokens. The relationship they found gives the vTrain authors a way to define candidate workloads in terms of [scaling laws](https://md.research.elamur.ai/free/en/concepts/scaling-laws/). Applying it to a reservation for a fixed period depends on estimating how much arithmetic that particular reservation can deliver. [Training Compute-Optimal Large Language Models](https://md.research.elamur.ai/free/en/papers/hoffmann-2022-training-compute-optimal-large-language/)

### The method, step by step

#### From a training plan to an execution graph

The simulator starts with a description of the decoder architecture, the cluster and the parallelization plan. The cluster description includes the GPU count, the number of GPUs in a server and the communication bandwidth within and between servers. The plan gives the degrees of data, tensor and pipeline parallelism. It also supplies information relevant to the execution order, such as the pipeline scheduling policy and the gradient buckets used to organize reductions. Together, these inputs specify a candidate whose time can be estimated. The fast search consists of applying that estimation procedure to many candidates.

The architecture description gives vTrain the shapes of the operations it needs to represent. The paper writes the hidden size as `h`, the number of decoder layers as `L`, the maximum sequence length as `s`, and the number of attention heads as `n`. At the input, token and position embeddings are added. The result is a matrix containing a hidden vector for each input position. The paper describes its shape as follows.

```
s × h
```

Here `s` counts positions along the input sequence and `h` is the width of the vector at each position. The symbol `×` separates the matrix dimensions in this expression. The query, key and value matrices have this shape before they are split among `n` heads along the hidden dimension. In the paper's decoder description, the intermediate width of the feedforward block is written as follows.

```
4h
```

Here `h` again denotes the hidden width and `4` is the multiplier for the intermediate activation width. The attention and feedforward blocks recur across `L` layers. After the last layer, the language prediction head uses the transpose of the token embedding weights to produce scores for the next token at each position. The widths and partitioning are important to the simulator because they affect the sizes of both the kernels it profiles and the transfers it places in the graph.

The paper labels a parallel configuration by its tensor, data and pipeline degrees, in that order. In its example, `(4,2,3)` means 4-way tensor parallelism, 2-way data parallelism and 3-way pipeline parallelism. A tensor group performs the work of a layer slice together. A pipeline groups successive stages into a full pass through the network. Data replicas run on separate parts of the input and synchronize corresponding weights. In the full rectangular allocation in the example, the total number of devices follows from the degrees.

```
GPUs = t × d × p
```

Here `GPUs` is the device count, `t` is the tensor-parallel degree, `d` is the data-parallel degree and `p` is the pipeline depth. The product gives the size of the allocation. It does not fix the shape of the work inside each device or the bandwidth used by each group. The physical placement in the example gives the tensor group high-bandwidth links within a server and sends data-parallel reductions and pipeline transfers across servers.

vTrain first constructs a directed acyclic graph at the operator level. A vertex describes work such as the forward pass of an attention block or a reduction among workers. An edge states that a later operation needs an earlier one to have completed. For a specified training plan, the authors can determine in advance which operations are needed and establish the dependencies among them. The graph can be built before running the complete iteration because the repeated forward and backward passes have a defined order under the selected schedule.

How vTrain estimates training time The steps in order.

#### How communication enters the graph

The data-parallel portion of the graph has to represent the point at which each gradient becomes available. With gradient bucketing enabled, a bucket contains gradients from a group of operations. Its All-Reduce can begin once the required backward computations have produced the gradients for that group. Backward computation for another group can proceed while the network handles the first group, subject to the graph's dependencies. The weight update depends on the required reductions having completed. One late reduction can therefore remain visible in iteration time even if earlier reductions are largely overlapped.

The authors illustrate the mechanism by pairing layers into buckets. The backward work that produces all gradients in a pair enables the collective for that pair. An update at the end is constrained by the outstanding communication. With bucketing disabled, the graph contains a reduction after the backward pass has produced the gradients. The examples distinguish the amount of communication from the amount of its duration exposed on the iteration's completion path. Starting a transfer earlier can affect the latter even when the gradient data still has to be moved.

Tensor-parallel communications are placed at a different kind of boundary. The graph adds reductions after the relevant attention or feedforward computations in forward and backward execution. The corresponding downstream operations depend on completing those reductions. Where a layer's workers have produced partial results, the next dependent computation has to wait for the combination. This accounts for the importance of measuring local collective latency. A bias in the timing of a frequently required collective can propagate through many repeated layers.

Pipeline communication is represented by a point-to-point Send-Receive at a boundary between stages. In a forward pass, it carries the stage's activations to the next stage. In a backward pass, it carries gradients toward the previous stage. The graph must preserve both the sequence of operations on each device and the relationship between the stages processing a particular micro-batch. A downstream device may be free while its input is still in flight. Conversely, an input may already have arrived while the device is occupied with another micro-batch.

For GPipe, the local order places the forward passes before the backward passes. In 1F1B, the order changes as the stages fill and start alternating. The paper illustrates both with 2-way pipeline parallelism and 4 micro-batches. The work belonging to a micro-batch still moves through the stages in the correct direction regardless of the local interleaving. These constraints jointly determine when work becomes ready and where a pipeline bubble appears. The graph represents the schedule through those dependencies, so its eventual duration can depend on a combination of stages rather than an isolated stage's compute time.

#### Measuring the operations that actually run

An attention or feedforward operator is a description at the level of the network. Its implementation in the training framework executes a collection of GPU kernels, which are programs launched on the device. To learn that collection, vTrain executes computation operators individually on the target GPU and records their kernel traces using CUPTI, NVIDIA's CUDA profiling interface. The trace supplies low-level records such as kernel names and running times. The association between a trace event and its high-level operator comes from a mapping procedure based on Daydream.

The resulting lookup table records which kernels belong to a given operator and their measured durations. When the simulator sees that operator in another occurrence with the same profiled shape, it can use the same entry. This is how it incorporates details of the training software. For instance, a change to the attention implementation can change the kernels that appear in a profile and the amount of time they take. The paper illustrates this with a possible switch to [FlashAttention-2](https://md.research.elamur.ai/free/en/papers/dao-2023-flashattention-2-faster-attention-better/). The relevant timing for an updated implementation would come from profiling that implementation on the target device.

Profiling every occurrence would duplicate effort. With a repeated decoder stack, one attention forward operator can occur in many layers and many micro-batches. If those occurrences use the same partition and shapes, the paper treats them as instances of the same work for timing purposes. A single measured entry can then describe them all. The total number of occurrences that would otherwise require profiling scales as follows.

```
O(L × N_MB)
```

Here `O` denotes the order of growth, `L` counts decoder layers and `N_MB` counts micro-batches. The product expresses how often repeating layer work appears as the two counts grow. The paper describes the number of necessary distinct profiles for a fixed configuration in the following terms.

```
O(1)
```

Here `O` again describes the order of growth and `1` indicates a constant with respect to those repetition counts. Increasing the number of identical occurrences does not create a corresponding increase in distinct operators to measure. Different operation shapes or a different device can still call for their own measurements. The simulated graph also continues to contain the repeated work and its dependencies. The reduction concerns the set of profiling runs, so it does not imply a constant traversal cost for arbitrary graphs.

The implementation uses PyTorch 2.0.1 and integrates CUPTI from CUDA Toolkit 11.8 through a Python extension written in C++. The authors use Microsoft’s Megatron-DeepSpeed training code to represent the distributed Transformer execution. They released the simulator as vTrain. A simulation of one training configuration took 2 seconds in the reported example on an AMD EPYC 7502 32-Core CPU. The paper describes searching several thousand configurations in tens of minutes on a single server by evaluating independent candidates across CPU cores. The timing claim refers to simulation work after the relevant GPU operations have been characterized.

#### Assigning durations to communication and building the task graph

After measuring the computation operators, the simulator expands each operator into its associated kernel tasks. It carries the operator-level dependencies into the expanded graph. A transfer depending on a computation still needs that computation to reach its required completion point. The task graph therefore has finer-grained timings while retaining the ordering decisions made when constructing the operator graph. It combines those computation tasks with timed communication operations.

For communication inside a server, the authors profile NVIDIA's NCCL library on a real multi-GPU system. They measure latencies across data sizes and across different numbers of participants. The simulator uses these measurements to estimate the local communication tasks. This approach accounts for the measured behavior of the local system under the profiling conditions. The experiments examine how those conditions compare with collectives executed inside training.

For All-Reduce across servers, the authors use a bandwidth expression suggested in NCCL's documentation. They use the time implied by the amount of data and effective bandwidth, adjusted for the size of the group taking part.

```
t = (S / B) × (2(n − 1) / n)
```

Here `t` is the communication time, `S` is the size of the data being transferred, `B` is the effective communication bandwidth and `n` is the number of participating GPU workers. `2` and `1` are constants in the collective's group-size factor. The `t` in this equation is unrelated to the tensor-parallel degree and `n` here counts workers, whereas `n` in the decoder description counts attention heads. `S / B` supplies a time scale for moving the data. The factor multiplying it changes the estimate with the number of participants.

The bandwidth supplied to this equation can be adjusted from the maximum bandwidth of the interconnect.

```
B = α × B_max
```

Here `B` is the effective bandwidth used for the estimate, `α` is a dimensionless bandwidth effectiveness factor and `B_max` is the maximum interconnection bandwidth. The adjustment represents the usable share of that maximum as a single value. Since multiple collectives can share network equipment, the same factor can only approximate their behavior unless the chosen setting happens to represent the traffic in question. The paper tests this factor by comparing predicted and measured iteration times on its distributed validation system.

#### Following the tasks to the end of an iteration

The task-graph traversal starts with a timeline for each device and a queue of work whose prerequisites are satisfied. Each task has a device assignment, a duration, a start time maintained by the algorithm and a count of unfinished dependencies. Initially the per-device timelines are set to zero and the queue receives tasks with no predecessors. The simulator visits queued tasks in first-in, first-out order. That is the order in which the algorithm processes ready vertices. It can still give concurrent start times to work on different devices or to computation and communication where dependencies permit overlap.

When it visits a task, the simulator updates that device's latest completion time. The pseudocode gives this update in the following form.

```
T[i] ← max(T[i], u.start + u.duration)
```

Here `T` is the set of device timelines, `i` identifies the device assigned to task `u`, `u.start` is its scheduled start and `u.duration` is the time attributed to it. The arrow assigns the expression on the right to the timeline entry on the left. `max` keeps the later of the existing endpoint and this task's completion. Keeping the later endpoint allows the timeline to record both an overlapping transfer and a computation without adding their full elapsed times together.

The completion of a task contributes a readiness constraint to each task that depends on it. The successor may already have received a later readiness constraint from a different predecessor. The algorithm retains the later time.

```
c.start ← max(c.start, u.start + u.duration)
```

Here `c` is a successor of task `u`, `c.start` is the start time being accumulated for that successor and `u.start + u.duration` is the completion time of the predecessor just processed. `max` selects the later time and the arrow indicates reassignment. As the algorithm processes all predecessors, the resulting start constraint reflects the last required completion. It also decrements the successor's dependency count. When that count reaches zero, the successor can enter the queue.

The distinction between an execution dependency and a device timeline matters to overlap. Computations that must run in sequence are ordered through the graph. A transfer that depends on ready gradients can proceed alongside independent backward work. Its duration becomes visible at a later synchronization point if the receiving operation still has to wait for it. The finish time for the entire iteration is selected after all queued work has been processed.

```
t_iter = max_i T[i]
```

Here `t_iter` is the estimated elapsed time of one training iteration, `T[i]` is the latest task completion time on GPU `i`, and `max_i` selects the largest endpoint over the participating GPUs. The slowest completion determines the end of the iteration. Earlier completion on some GPUs has no effect on that endpoint unless it also changes the work or waiting on the path that finishes last.

#### Turning an iteration estimate into a planning decision

For a full run, the paper projects the estimated iteration time over the amount of text to be processed. The total number of training tokens and aggregate tokens consumed per iteration determine how many iterations the run needs. Written together, these quantities give the duration estimate used in the case studies.

```
t_run = t_iter × (tokens_total / tokens_per_iteration)
```

Here `t_run` is the projected end-to-end training time, `t_iter` is the simulated iteration duration, `tokens_total` is the training token budget and `tokens_per_iteration` is the token count over the entire allocation in one iteration. The quotient is the iteration count in the projection. The estimate applies the same representative duration throughout that run. Changing the number or size of micro-batches can change the schedule while the total work assigned to an iteration is held fixed for a comparison.

The decision made with this estimate depends on the case. A dedicated training run can compare time, utilization, allocation size and rental expense. A cluster scheduler can use alternative execution plans for each job size when deciding how to share GPUs. For a training deadline, candidate workloads can be built using the paper's version of the Chinchilla relationships and checked against the duration estimated with the fastest configuration found for each. The two scaling expressions are as follows.

```
N = α × C^0.5
```

Here `N` is the compute-optimal parameter count according to the scaling relationship, `C` is the amount of training computation, `^0.5` denotes a square root and `α` is the fitted coefficient `0.089`. This `α` belongs to the scaling expression and is separate from the bandwidth effectiveness factor.

```
T = β × C^0.5
```

Here `T` is the compute-optimal training token count, `β` is the fitted coefficient `1.875`, and `C^0.5` is the same square root of the compute budget. `T` here denotes tokens, whereas the algorithm used `T` for device timelines. vTrain checks the time needed to execute such a parameter and token allocation. The scaling relationship supplies the criterion for choosing candidates and the simulator supplies the timing used to decide which candidate can finish.

### Experiments and results

#### Iteration time on measured GPU systems

The validation data consist of training configurations paired with iteration times observed on real systems. The main accuracy comparison uses actual iteration time as the reference for each prediction. The authors use half precision, FP16, for these experiments. They report mean absolute percentage error, or MAPE, which takes the magnitude of each error relative to the observed duration and averages those percentages. They also report the coefficient of determination, which describes how closely the estimates account for the variation in measured times across the configurations.

The single-node experiments use an AWS EC2 p4d instance with 8 A100 GPUs connected through NVLink and NVSwitch. They cover 1,440 data points spanning different architecture and parallelization settings. NCCL communication profiles cover message sizes from 1 MB to 1024 MB. The prediction MAPE is 8.37%, with a coefficient of determination of 0.9896. The latter describes agreement across the range of iteration durations while the MAPE gives a measure of the relative error on individual estimates on average. Both are relevant because configurations can differ substantially in their absolute times.

The distributed experiments use 64 servers, each with 8 A100 GPUs, for a total of 512 GPUs. NVLink and NVSwitch serve the local communication. Between servers, the system uses four 200 Gbps Mellanox HDR InfiniBand adapters and a two-level non-blocking fat-tree topology. The authors report securing 116 observations for this validation in the main discussion. The configurations are based on earlier Megatron-LM training experiments. The training programs supply observed iteration times, while vTrain estimates them using the kernel profiles and its inter-node bandwidth expression. [Efficient Large-Scale Language Model Training Using Megatron-LM](https://md.research.elamur.ai/free/en/papers/narayanan-2021-efficient-large-scale-language-model/)

For this network, the maximum bandwidth used in the expression is 800 Gbps. The authors sweep the bandwidth factor from 0.1 to 1.0 and choose the value minimizing average prediction error for the evaluation setting. The selected factor is 1.0. With that setting the iteration-time MAPE is 14.73% and the coefficient of determination is 0.9887. A high coefficient of determination is compatible with meaningful errors for individual configurations. In a search, a useful additional test is whether the simulator correctly identifies an improvement over an established plan when those plans are both run on the hardware.

#### MT-NLG training time and cost

The first design-space study uses the 530B-parameter MT-NLG architecture. Its hidden width is 20,480, with 105 decoder layers and 128 attention heads. The training target is 270 billion tokens, with a batch of `(1,920 × 2,048)` tokens across the system per iteration and approximately 68,000 iterations in the paper's projection. The published baselines use 8-way tensor parallelism and 35-way pipeline parallelism. They change the data-parallel degree among 8, 10 and 12, for allocations of 2,240, 2,800 and 3,360 GPUs.

The broader search considers tensor degrees up to 16, data degrees up to 32 and pipeline degrees up to 105. The authors examine simulated iteration time and average GPU compute utilization. One fast configuration, `(16, 16, 105)`, uses roughly 10× more GPUs than the baseline and averages 17% utilization. It illustrates a situation in which the ability to put more work in flight at once reduces elapsed time while using the allocation less economically. For comparisons closer to the published plans, the authors focus on candidates with 8-way tensor parallelism and GPU budgets similar to the baseline allocations.

For the first comparison, the selected plan uses 2,016 GPUs against the baseline's 2,240 GPUs. The paper reports 10% fewer GPUs and 4.5% higher GPU utilization, with estimated end-to-end training taking 6.3% longer. Using AWS EC2 P4d rental as the price proxy gives a projected reduction of 5%, from 9.01 to 8.62 million dollars. The reported saving is 0.39 million dollars. The authors report that the search behind this study took less than 200 seconds. The cost numbers describe what the simulated durations and the assumed rental price imply for this workload.

Estimated MT-NLG training cost for the first plan comparison The vTrain choice has the lower projected rental bill.

**The numbers**

| System or setting | million dollars |
| --- | --- |
| Published MT-NLG plan | 9.01 |
| vTrain-selected plan (this paper) | 8.62 |

To test plan selection with actual training, the authors use scaled-down workloads of 3.6, 18.4 and 39.1 billion parameters with 64, 256 and 512 A100 GPUs, respectively. These workloads retain the decoder architecture and reduce settings such as its hidden width and layer count. For each workload, the comparison pairs a configuration from the earlier Megatron-LM study with one selected by vTrain. The authors present both predicted and measured iteration times so that the direction of the recommendation and the size of the gain can be checked separately.

Measured iteration time for scaled-down MT-NLG training on A100 systems The selected plan runs a measured iteration faster than its baseline at each allocation.

**The numbers**

| System or setting | seconds per iteration |
| --- | --- |
| Megatron-LM baseline, 64 GPUs | 3.938 |
| vTrain-selected plan, 64 GPUs (this paper) | 3.567 |
| Megatron-LM baseline, 256 GPUs | 9.928 |
| vTrain-selected plan, 256 GPUs | 9.604 |
| Megatron-LM baseline, 512 GPUs | 14.757 |
| vTrain-selected plan, 512 GPUs | 13.876 |

For the 3.6 billion-parameter workload, the predictions were 2.919 seconds for the baseline and 2.746 seconds for the selected plan. The paper reports a predicted reduction of 6% and a measured reduction of 9%. For the 18.4 billion-parameter workload, the predictions were 7.533 and 7.259 seconds, corresponding to a predicted reduction of 4% and a measured reduction of 3%. For the 39.1 billion-parameter workload, the predictions were 13.859 and 12.226 seconds, yielding a predicted reduction of 12% and a measured reduction of 6%. All comparisons concern the duration of one iteration for the specific workload and GPU allocation.

These measurements show why the authors evaluate timing accuracy and plan choice separately. For instance, vTrain estimates too short a duration for each plan on the 64-GPU system. The plan it favors still has the shorter measured duration. At the largest tested allocation in the paired comparisons, the estimated and measured advantages also have the same direction, though the projected advantage is larger. Planners can use a correct ordering to identify a candidate for testing even when the absolute estimate is too optimistic for an exact reservation or cost forecast.

#### Scheduling jobs on a shared cluster

The second case study simulates a 1,024-GPU cluster with 128 nodes and 8 A100 GPUs per node. It follows jobs from arrival to completion and includes 41 workload traces. The authors describe each trace as covering 400 hours of cluster operation and estimate that running the study on AWS would cost over 100 million dollars. The timing of job arrivals comes from Microsoft’s ITP cluster traces, released as ElasticFlow Traces. The workload generator samples consecutive arrival points from the traces to obtain the intervals between jobs. It assigns jobs to a fixed arrival period, so a workload with more arrivals puts greater pressure on the simulated cluster.

The jobs themselves are drawn from architectures with 18.4, 39.1 and 81.2 billion parameters. The associated layer counts are 40, 48 and 64, the hidden widths are 6,144, 8,192 and 10,240, and the attention head counts are 48, 64 and 80. All use a maximum sequence length of 2,048. Their batch sizes are 1,024, 1,536 and 1,792, respectively. The simulated jobs also receive a randomly selected number of training iterations. For the deadline-aware experiments, the deadline offset from arrival is generated using the rule described in the paper.

```
deadline offset = λ × duration
```

Here `deadline offset` is the interval from job arrival to the deadline, `λ` is a multiplier sampled uniformly from `[0.5, 1.5]` and `duration` is the job-duration quantity to which the paper applies that multiplier. The rule supplies a range of deadline pressures. The reported setup does not further specify how the reference duration is obtained in this expression.

Both sides of the comparison use ElasticFlow's scheduling algorithm. The baseline varies data parallelism while keeping enough tensor and pipeline parallelism to fit each workload. For the one with 39.1B parameters, for instance, the baseline uses 8-way tensor and 2-way pipeline parallelism and varies the data-parallel degree. This gives the scheduler choices about GPU count but retains the same way of partitioning the workload's layers. The vTrain-assisted scheduler can draw from plans that vary the other dimensions as well. The comparison asks whether better choices at a given resource allocation translate into better outcomes for the cluster.

In the deadline experiments, the metric is the fraction of jobs finishing on time. The authors simulate 64-job and 128-job workloads and report that vTrain improves the deadline satisfaction ratio by 1.09× and 1.23× on average, respectively, relative to the ElasticFlow baseline. Across the workloads shown, the vTrain-assisted configuration satisfies more requests. The workloads with 128 jobs exert greater pressure because the arrivals are packed into the same period. The larger relative gain occurs in that more heavily loaded setting.

Job completion time measures elapsed time from an individual job's arrival to its completion, including waiting. ElasticFlow can terminate jobs that have no prospect of finishing by their deadline, so the authors run this comparison without deadlines to avoid shortening the measured times through early termination. They generate nine traces with 32 jobs each. The vTrain-assisted scheduler produces a shorter average job completion time than the baseline in every trace, with a reported average reduction of 15.21%.

For makespan, the paper measures how long the cluster takes to finish the whole workload. It tests five synthetic workloads containing 16 to 72 jobs, submitted simultaneously in each workload. The smallest difference appears at 16 jobs, the lightest of the tested loads. As demand increases, choice of parallel configuration matters more for allocating scarce devices to the jobs. The authors report makespan reductions of up to 23.03%. That figure is the best reported reduction for this experiment, while 15.21% is an average over the separate deadline-free job completion experiment.

#### Choosing what can be trained in 30 days

The final case reserves 420 NVIDIA DGX A100 nodes, or 3,360 GPUs, for 30 days. The paper first treats those GPUs as capable of sustaining 100% utilization during the entire period. This gives a compute budget of `2.72e+24` FLOPs and a Chinchilla allocation of 145.61 billion parameters and 2,912 billion training tokens. When vTrain simulates this workload across the candidate parallel plans, the best reported plan achieves 35.56% average GPU utilization. Its projected duration is 85 days.

The authors repeat the exercise for architectures with different layer counts and hidden widths. For each, they search for the parallelization plan with the shortest iteration time and then check the projected run time for the corresponding token budget. The largest parameter count that fits in their search has 76.04 billion parameters, with 1,521 billion tokens. Its hidden width is 10,240, it contains 60 layers, and its selected plan is `(8,70,6)`. The time estimate is 30 days. The selected workload is reported as 48% smaller in parameter count than the one derived under full utilization.

The estimates show how the time constraint sorts the candidates. The workload with 82.03 billion parameters and 1,641 billion tokens has a best estimated duration of 37 days, and the one with 88.62 billion parameters and 1,772 billion tokens is estimated at 40 days. A workload with 71.83 billion parameters and 1,437 billion tokens is estimated to finish in 29 days. Under the paper's objective of choosing the largest Chinchilla candidate that fits the reservation, the 30-day plan uses the available time to accommodate a larger workload than the 29-day choice.

Estimated training time for Chinchilla candidates on 3,360 A100 GPUs The selected candidate fits the deadline that the peak-throughput choice exceeds.

**The numbers**

| System or setting | days |
| --- | --- |
| Peak-throughput choice, 145.61 billion parameters | 85 |
| Candidate, 88.62 billion parameters | 40 |
| Candidate, 82.03 billion parameters | 37 |
| Largest candidate within the deadline, 76.04 billion parameters (this paper) | 30 |
| Candidate, 71.83 billion parameters | 29 |

The chart uses days as the metric, so the shorter run finishes sooner. The star denotes the paper's selected workload under a parameter-count objective with a deadline. The experiment compares projected completion times for distinct amounts of training. Any conclusion about quality comes from the scaling criterion used to generate the workloads. The experiment itself reports performance estimates for executing them.

### What the ablations show

#### Where local communication predictions go wrong

The paper offers several controlled comparisons and diagnostic analyses. Its bucketing and pipeline diagrams explain how particular scheduling choices enter the simulator, while the quantitative tests concentrate on calibration, accuracy and plan selection. A comparison of isolated and in-training collective timings exposes one source of error. The authors find that NCCL primitives during training take on average 30% longer than the corresponding measurements made in isolation. This is a discrepancy in the communication timings supplied to the simulation, distinct from the MAPE of complete iterations.

Tensor-parallel configurations show the problem especially clearly. Frequent All-Reduce operations are part of forward and backward execution in those configurations. Where a reduction is a prerequisite for the next operation, underestimating its duration makes the dependent path finish too early in the simulation. Repetition across the decoder stack gives this error many opportunities to recur. This finding points to a particular calibration problem within the method. A graph can describe appropriate dependencies and still yield a biased time when the durations assigned to its tasks differ from the durations under training conditions.

The graph examples explain why a correction to communication timing could have different effects depending on where the communication occurs. A reduction that starts early through gradient bucketing can coincide with continued computation. Adding time to that reduction affects the overall estimate if the reduction becomes a limiting prerequisite. A repeatedly required reduction between computations in a tensor group can expose more of the added duration. The paper's figures describe these dependencies, and the measurements show why it matters that vTrain estimates them at specific positions in the iteration.

#### Selecting an effective bandwidth on the distributed system

The sweep of the bandwidth effectiveness factor holds the analytic form fixed and changes the bandwidth assigned to it. Between 0.1 and 1.0, the average iteration prediction error is smallest at 1.0 on the authors' distributed system. This supports using the full configured bandwidth as the effective input for that evaluation. The remaining 14.73% MAPE shows the variation still present after fitting the factor. The sweep provides a calibration for the studied setup, with the selected value assessed on the observed iteration times used for that comparison.

A multiplier can change the estimated time of every transfer in the same direction. The contention that matters for an individual layout can instead depend on which groups use the same switches at the same time. The paper illustrates this with data-parallel groups crossing the same network equipment. A graph with several simultaneous collectives and a graph with fewer competing collectives can call the same bandwidth expression with similar inputs for a particular operation. The resulting latency for that operation may nevertheless differ in practice. The sweep therefore addresses aggregate timing error while the communication analysis identifies a separate need to account for interacting traffic.

#### What wider searches change

The dedicated-training comparisons help separate the benefit of searching more plans from the precision of the final timing estimate. The test on 64 GPUs changes both tensor and data parallelism and changes the micro-batch size. The test on 256 GPUs retains the reported tensor, data and pipeline degrees and changes the micro-batch setting from 4 to 8. The test on 512 GPUs changes the tensor and pipeline degrees and the micro-batch size. Each pair shows that the chosen configuration can win in measured time. The 256-GPU comparison particularly illustrates that a finer execution setting can matter even when the overall division into replicas, tensor groups and stages stays fixed.

The pairs where several settings change establish a joint improvement. They leave open how much of that improvement comes from each individual setting. The gains also differ between predicted and measured times. On 512 GPUs the search points to the faster plan and projects a greater reduction than the hardware measurements show. On 64 GPUs it projects a smaller reduction. Those differences inform the interpretation of a search result. Identifying a faster candidate and estimating the gain to expect from it are two separate properties of the simulator.

The shared-cluster comparison keeps the scheduling algorithm fixed while changing the information and configurations available to it. Both systems can vary a job's allocation. The expanded profiles in the vTrain version give the scheduler additional ways to use an allocation. The deadline and makespan improvements thus show what a wider configuration space can contribute within that simulated policy. The contrast between lighter and heavier workloads also shows that the benefit depends on demand. When competition for the GPUs is light, the scheduler has more room to accommodate an inefficient allocation without delaying other jobs.

The compute-budget comparison changes the assumption about delivered work while holding the hardware reservation and target time fixed. The peak-based calculation expresses what that allocation could process if it sustained peak throughput. The vTrain search instead uses the fastest simulated plan for each concrete candidate to decide feasibility. The resulting change in parameter and token counts shows that the architecture decision depends on parallel execution as well as on the mathematical form of the scaling law. The experiment evaluates the effect of changing that systems assumption on the chosen workload. It leaves the scaling law itself fixed.

### Limitations

#### Limits identified by the authors

The authors identify a mismatch between the way the simulator measures local collectives and the conditions under which the collectives actually run. NCCL timings obtained in isolation can be too short for training, with a particularly clear effect on tensor-parallel layers. The paper leaves more accurate treatment of in-training local communication as future work. This limitation bears directly on comparisons that change the frequency of such reductions, because the resulting estimates may favor a configuration that gives the local interconnect more work.

For communication between nodes, the authors identify stragglers, kernel launch overhead and contention as factors outside their simple bandwidth expression. A slow worker can delay synchronization even when the network would otherwise transfer the data quickly. Launch overhead adds time beyond the bandwidth calculation. Concurrent transfers can share parts of a topology in ways that reduce the rate seen by individual groups. The paper suggests incorporating dynamic network behavior or using more sophisticated communication techniques to represent these effects.

The authors also describe the cost of validation at the largest scales. They use measured iterations on scaled-down versions of MT-NLG to test recommendations generated by their search. The full 530B exercise uses simulated iteration times to project training duration and rental costs. The shared-cluster experiments are fully simulated because of the estimated expense of running the workloads on a real cluster. These choices give the reader different kinds of evidence for different claims. The small-scale plan comparisons test whether chosen plans improve measured iteration time, while the larger exercises demonstrate the decisions that follow from the simulation.

#### Limits that follow from the setup

The timing validation concerns FP16 training on A100 systems and the software configuration used in the experiments. The method can profile other implementations, but the measured errors characterize the profiled hardware and the validated configurations. Changed kernels, device types, precision modes or networks would require evidence for their own timing accuracy. Similarly, the chosen inter-node bandwidth factor was selected using the evaluation measurements. Its success on those measurements gives no independent estimate of how it would perform on a different topology or traffic mix.

The paper reports different counts for the distributed validation set. The main evaluation discussion gives 116 data points, whereas the related-work comparison reports 112 multi-node points. Both places report 14.73% MAPE. The discrepancy leaves the exact count behind the cross-paper comparison unclear. The baselines cited in that related-work comparison also use different workloads, platforms and sample sizes. Their error percentages characterize their respective validation studies, so the table does not establish an accuracy ranking from a common benchmark.

The end-to-end duration is a projection formed by repeating an estimated iteration time. Its validation therefore directly concerns the representative iteration. A long run can include additional delays, such as initialization, checkpointing or interruptions. The paper does not give an end-to-end measurement of how such delays accumulate for the full MT-NLG plans it compares. The rental estimates also use a pricing proxy. The cost figures describe the consequences of the assumed rental price and reservation duration, and the measured plan-selection results concern elapsed iteration time on specific GPU allocations.

The choice of what counts as best changes across the design exercises. For dedicated training, a lower projected bill can justify a longer run. For a shared cluster, a wider set of plans is judged by completion outcomes across jobs. For the fixed reservation, the search selects the largest considered workload on the scaling relationship that fits the deadline. Each outcome depends on its workloads and comparison set. The MT-NLG measured pairs test improvements over their baselines instead of measuring the entire search space on physical systems. The Chinchilla case likewise considers a particular set of layer counts and widths.

The shared-cluster results combine arrival gaps drawn from real traces with simulated job assignments, job lengths and, in the relevant experiment, deadlines. The makespan experiment uses simultaneous arrivals. These choices let the authors study distinct kinds of cluster pressure, but they also define the scope of the numerical gains. The experiment does not measure how the scheduler responds to contention and timing errors on a live deployment. In particular, the reported improvements are conditioned on the timing information used inside the simulation and the alternative layouts made available at each allocation.

Finally, the compute-optimal study treats training loss through an existing scaling relationship and measures feasibility through simulated execution. It does not train the candidate architectures to completion and compare their losses or capabilities. The result demonstrates that assuming peak GPU throughput can admit a workload that the simulated cluster cannot complete by the deadline. The recommendation of 76.04 billion parameters follows from the candidates examined, their token allocations under the scaling rule and their simulated training durations.

### What came after

No later studies are documented here as building on vTrain. The paper itself proposes making the estimates more faithful to communication during training. For local collectives, that means accounting for the difference between isolated timings and the timings observed inside the training loop. For distributed collectives, the authors point to synchronization delays, launch overhead and interference between groups sharing a network. These are directions proposed by the authors, with any subsequent use of the framework to address them left open.

## Cite

Cite as Jehyeon Bang, Yujeong Choi, Myeongwoo Kim, Yongdeok Kim and Minsoo Rhu. 2023. vTrain: A Simulation Framework for Evaluating Cost-effective and Compute-optimal Large Language Model Training. arXiv:2312.12391.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.48550/arxiv.2312.12391](https://doi.org/10.48550/arxiv.2312.12391) · [arXiv 2312.12391](https://arxiv.org/abs/2312.12391)

```bibtex
@misc{bang2023vtrain,
  title = {{vTrain: A Simulation Framework for Evaluating Cost-effective and Compute-optimal Large Language Model Training}},
  author = {Jehyeon Bang, Yujeong Choi, Myeongwoo Kim, Yongdeok Kim and Minsoo Rhu},
  year = {2023},
  doi = {10.48550/arxiv.2312.12391},
  eprint = {2312.12391},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2312.12391}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
