OMNIBAL: TOWARDS FAST INSTRUCT-TUNING FOR VISION-LANGUAGE MODELS VIA OMNIVERSE COMPUTATION BALANCE

## Abstract

Abstract Recently, vision-language instruct-tuning models have made significant progress due to their more comprehensive understanding of the world. In this work, we discovered that large-scale 3D parallel training on those models leads to an imbalanced computation load across different devices. The vision and language parts are inherently heterogeneous: their data distribution and model architecture differ significantly, which affects distributed training efficiency. We rebalanced the computational loads from data, model, and memory perspectives to address this issue, achieving more balanced computation across devices. These three components are not independent but are closely connected, forming an omniverse balanced training framework. Specifically, for the data, we grouped instances into new balanced mini-batches within and across devices. For the model, we employed a search-based method to achieve a more balanced partitioning. For memory optimization, we adaptively adjusted the re-computation strategy for each partition to utilize the available memory fully. We conducted extensive experiments to validate the effectiveness of our method. Compared with the open-source training code of InternVL-Chat, we significantly reduced GPU days, achieving about 1.8x speed-up. Our method’s efficacy and generalizability were further demonstrated across various models and datasets. Codes will be released at https://github.com/ModelTC/OmniBal.

## 1 Introduction

Developing large language models (LLM) has brought new possibilities to many fields. Multi-modal models, particularly Vision-Language Models (VLMs) Alayrac et al. (); Team et al. (); Reid et al. (); Liu et al. (); Bai et al. (); Chen et al. (), are advancing rapidly due to their deeper understanding of the world. The training scale of VLM models is continually growing. More texts and images with higher resolution are used on the data level. Compared with the LLaVA-1.5 model Liu et al. (), the InternVL-Chat Chen et al. () model has expanded the dataset size from 665K to 5M and increased image resolution from 336x336 to 3840x2160. On the model level, larger vision encoders are adopted. The InternVL-Chat model upgrades the visual encoder from $\sim$300M ViT-L-336px Radford et al. () to $\sim$6B InternViT-448px Chen et al. (). The scale of large models and datasets results in a time-consuming training process. Therefore, efficient training strategies are necessary for the field’s rapid development.

3D parallelism Shoeybi et al. (); Rajbhandari et al. () is a popular framework for large-scale distributed training, which allows data and models to be distributed across multiple devices. Balancing computational load across devices is crucial in 3D parallelism, as it minimizes idle times and significantly improves training efficiency.

In this work, we found that for instruct-tuning large vision-language models, the heterogeneous nature of data and model structures brings new challenges to 3D parallelism training: (1) Varying input sizes of texts and images cause fluctuating computational loads across training iterations and devices. (2) The heterogeneity of text and image encoders results in inherent differences in the computational load of their transformer blocks. Along with varying input sizes, this inevitably leads to uneven computational load and computational bubbles. (3) Input size variation and computational imbalance compel us to use the most aggressive re-computation (checkpointing) Li et al. () strategy to prevent program crashes, which significantly wastes computational resources. We refer to those issues caused by the heterogeneity in data and model structures in large multi-modal models as the Computation Imbalance problem, which significantly reduces training efficiency.

Figure: Figure 1: Left: Standard Vision-Language instruct-tuning framework. Right: Overview of the computation imbalanced problem and our proposed solution. We considered the bottleneck issues of data, model, and memory, and proposed an omniverse solution addressing these three aspects, with each providing the foundation for the next.
Refer to caption: x1.png

To address this problem, we propose a simple and efficient training framework called Omniverse Balance (OmniBal), to balance computational load across multiple devices. This framework systematically balances computation in three bottlenecks, *i.e.* data, model, and memory, as shown in Figure 1. OmniBal works in these three closely connected aspects. Data lays the groundwork for addressing model imbalances, while both data and model form the foundation for solving memory issues. Ultimately, these three aspects collaborate to achieve balanced computation.
Data: We propose the balanced dynamic mini-batch method to group instances as new mini-batches according to text length and number of images. Specifically, an iterative algorithm based on sampling and filtering combines data of different sizes into balanced groups, ensuring consistent group sizes and stable input sizes; Model: We propose balanced model partitioning to evenly spread the computational loads of text and image models across devices. Using a search-based approach, this method efficiently finds optimal partition strategies within a small search space, enabling adaptation to different model architectures and hardware platforms. Our proposed balanced dynamic mini-batch method provides feasibility for balanced model partitioning by making input sizes consistent in advance. Memory: We propose the balanced adaptive re-computation to optimize the re-computation strategy on each device, maximizing memory utilization and training speed. We calculate the memory needs of various models to adjust the re-computation strategy adaptively. Notably, our proposed balanced dynamic mini-batch and model partitioning ensures balanced computational loads on each device, making memory analysis feasible.

We performed extensive experiments on various open-source VLM models at different scales, reducing overall training times significantly. We reduced GPU days for InternVL-Chat-1.5 (6+20B) from 61.8 to 21.3 GPU days under the Megatron-DeepSpeed  microsoft () backend. Scaling up to InternVL-Chat-1.5-Plus (6+34B), we consistently observed great speed-up, from 75.4 to 30.5 GPU days. We have conducted thorough generalization experiments, including various datasets, hardware configurations, and multiple model combinations. Consistent and significant improvements were observed across all experiments, demonstrating the effectiveness and versatility of our approach.

## 2 related work

### 2.1 Large Language Model (LLM)

Large language models, such as ChatGPT OpenAI (), GPT-4 OpenAI (), Llama series  Touvron et al. (; ); AI (), and Gemini series Team et al. (); Reid et al. (), have seen significant advancements recently. These models leverage vast amounts of data to perform self-supervised learning by predicting the next token in a sequence. Large language models have demonstrated powerful generalization capabilities across various tasks, particularly in few-shot and zero-shot scenarios. Following the scaling law, the performance of these models improves with increases in model and data scale. Researchers have observed that LLMs exhibit emergent phenomena when the training scale reaches a certain threshold, showing sudden improvements in language understanding capabilities. Therefore, existing large language models are often trained at super large scales.

### 2.2 Multi-Modal Large Language Model(MLLM)

Although LLM can be applied to various NLP tasks, they are typically built on textual data and can only accept text inputs. However, real-world scenarios often involve rich multi-modal information, typically images. It has driven the development of large vision language models (VLMs). Visual encoders like Vision Transformer (ViT) Dosovitskiy et al. () are usually used to incorporate vision information. A cross-modal connector is also required to align the vision encoder outputs to the language models. LLaVA Touvron et al. () use the simplest MLP, BLIP series  Li et al. (; ); Dai et al. () use Q-former, Qwen-VL-Chat Bai et al. () use a cross-attention module. VLMs significantly expand large models’ capabilities and application scenarios by instruct-tuning with text and image data. However, introducing multi-modal data and heterogeneous encoders also brings new challenges to the model training process.

### 2.3 Large-Scale Distributed Training

Distributed training is essential for efficiently utilizing multiple GPUs to train large language models. It is achieved through 3D parallelism Shoeybi et al. (); Rajbhandari et al. (): data, tensor, and pipeline parallelism. Data Parallelism splits the entire dataset into mini-batches and assigns them to multiple devices, each with a model replica. This approach maximizes the use of GPU power for large datasets. DeepSpeed Zero Rajbhandari et al. () enhances it by reducing weight redundancy. However, it can still be challenged by the memory limits of individual devices when handling huge models. Tensor Parallelism distributes a model’s weight matrices across multiple devices, enabling parallel matrix operations Shoeybi et al. () and reducing per-device memory requirements. This method accelerates computation but requires dense inter-device communication, typically restricted to single-node deployments to minimize latency. Pipeline Parallelism divides a deep learning model into segments and assigns them to different devices, creating a computation flow like a production line. This technique facilitates larger model scaling across nodes. GPipe Huang et al. () proposes micro-batching. PipeDream Narayanan et al. () further proposes a one-forward-one-backward (1F1B) scheme to optimize memory usage. In pipeline parallelism, uneven layer partitioning can cause significant pipeline bubbles. DreamPipe Narayanan et al. () and AdaPipe Sun et al. () optimize model partitioning and re-computation strategies based on profiling and dynamic programming, respectively. However, these advancements are primarily tested in text-based models and may require adaptation for large multi-modal scenarios.

## 3 Computation Imbalance

In this section, we explore the unique challenges of large-scale distributed training for vision-language models, focusing on three key aspects: data, model, and memory.

Data Imbalance: LLMs are trained on pure text data using next-token prediction as the objective. This allows arbitrary extraction of text sub-strings for batch training, ensuring consistent input lengths. In contrast, VLMs are trained on texts and images, requiring data integrity to be maintained without arbitrary truncation. The varying number of images, their resolutions, and text lengths in different samples lead to significantly different input sizes between mini-batches (see Figure 2 left part). We can see that when combining individual training samples into a mini-batch, the input sizes on different data-parallel ranks *i.e.* DP0 and DP1 vary significantly. This variation leads to imbalanced computational loads among devices compared to pure LLM training, increasing GPU idle time. Furthermore, input size variations impact the model and memory.

Figure: Figure 2: Left: Conventional mini-batch construction method. It has a severe imbalance problem, including within-device (excessive padding) and cross-device (varying data sizes) aspects. Right: Our proposed ISF is to build balanced mini-batches dynamically.
Refer to caption: x2.png

Figure: Figure 3: Illustration of the model imbalance problem. (a) In pure LLM, a balanced parameter partition cross devices (stages) means balanced computation time. (b) In LLM+Vision, a balanced parameter partition may result in significant computation time differences. (c) Our method achieves more balanced computation time, taking into account the characteristics of the language and the vision model.
Refer to caption: x3.png

Model Imbalance: LLMs use identical transformer modules with the same computational loads. Evenly dividing these layers in pipeline parallelism distributes the load effectively. However, VLMs require additional image pre-processing, necessitating an image encoder like ViT-L Dosovitskiy et al. () before using text encoders like Llama Touvron et al. (). Structural differences between image and text encoders result in varying computational demands. For example, for the InternVL-Chat-1.5 structure Chen et al. (), the image encoder has 45 layers and 6B parameters, and the text encoder has 48 layers and 20B parameters. When using 9 images and 4K text input, the image encoder’s computation time can account for almost 40% of the total. As a result, partitioning the model based on layers or parameters can lead to imbalanced loads and increased pipeline bubbles, as shown in Figure 3. More importantly, varying text and image input sizes in VLM training make it difficult to estimate the computational demands of image and text encoders precisely, further complicating model partitioning.

Memory Imbalance: LLMs require significant GPU memory due to their large parameter size. When memory is insufficient, re-computation Li et al. () techniques discard some intermediate activation values and recompute them during backward propagation to save memory. VLM encounters significant memory challenges due to the variable scales of data inputs and the heterogeneity between vision and language models. Sometimes, many images or long texts that appear occasionally can demand excessive GPU memory, so we have to use the most aggressive re-computation configuration to prevent the program from crashing. However, excessive re-computation can significantly slow down the training process.

## 4 method

This section presents our computation-balanced framework OmniBal for training large vision-language models. To address imbalanced computational loads across devices, we first manage the large variations in data input sizes, which is the most fundamental issue in the computation imbalance problem. This enables the possibility of balanced model partitioning. Finally, we optimize the re-computation strategy for each partition.

Figure: Figure 4: Illustration of imbalanced data problem in both language and vision part. The ISF makes the data distribution more concentrated.
Refer to caption: x4.png

### 4.1 Balanced Dynamic Mini-Batch

Due to the inherently paired nature of the data used for training VL models, each sample contains various images and text segments, resulting in non-fixed input sizes. We evaluated input imbalance from two perspectives: within-device samples and cross-device mini-batches.

Pad ratio (within-device): When combining samples of different sizes into a mini-batch, smaller samples need to be padded to ensure uniform input sizes. The pad ratio is calculated as follows:

$$ $PadRatio=\frac{\sum_{i}^{N}(nt_{max}-nt_{i})}{nt_{max}\times B}$ (1) $$

Where $nt_{max}$ represents the maximum number of tokens in a mini-batch of size $B$, and $nt_{i}$ denotes the number of tokens for sample $i$ within that mini-batch.

Dist ratio (cross-device): Even after padding, the sizes of mini-batches on different devices may vary, leading to different input scales across devices. The distribution ratio is calculated as follows:

$$ $DistRaito=\frac{\sum_{i}^{ND}(NT_{max}-NT_{i})}{NT_{max}\times ND}$ (2) $$

Where $ND$ represents the number of devices, $NT_{max}$ denotes the maximum number of mini-batch tokens across all devices, and $NT_{i}$ refers to the number of mini-batch tokens on the $i^{th}$ device. Non-fixed input sizes in VLMs have a larger pad ratio and dist ratio, as shown in Table 4 (row 1). A high pad ratio wastes computational resources, while a high dist ratio causes device idle time. They significantly impact training throughput efficiency.

To address this issue, we adaptively group multiple samples to ensure that the new samples have image and text sizes within a relatively fixed range, which we refer to as a Balanced Dynamic Mini-Batch, as illustrated in Figure 2. However, determining the optimal grouping strategy is a challenging problem. We have designed an iterative method using sampling and filtering to select an optimal grouping strategy. As illustrated in Algorithm 1 and Algorithm 2, our method Iterative Sampling and Filtering (ISF) involves the following steps:

1.Sampling Stage: For current dataset $\mathcal{D}=\{(x_{i},y_{i})\mid i\}$, we randomly add samples $d_{i}$ consisted of images $x_{i}$, text $y_{i}$ to current group $\mathcal{G}$. If the total number of images $I_{v}=\sum_{x_{i}\in\mathcal{G}}|x_{i}|$ or the total text length $I_{t}=\sum_{y_{i}\in\mathcal{G}}|y_{i}|$ reaches the predefined maximum number of images $Q_{v}$ or text $Q_{t}$, we add this group to the candidate set $\mathcal{P}$ and create a new group containing $(x_{i},y_{i})$ for the subsequent samples. Otherwise, we will continue adding samples to the current group. At the end of the sampling stage, we will have a candidate set $\mathcal{P}=\{\mathcal{G}_{i}|i=1,2,3..\}$.

2.Filtering Stage: We first define the target number of images $Q^{\prime}_{v}$ and text $Q^{\prime}_{t}$. For each group $\mathcal{G}_{i}$ in candidate set $\mathcal{P}$, we filter $\mathcal{G}$ whose image number $I_{v}$ or text length $I_{t}$ do not satisfy $I_{v}>=Q^{\prime}_{v}$ or $I_{t}>=Q^{\prime}_{t}$. We update the dataset $\mathcal{D}$ by removing all satisfying samples $(x_{i},y_{i})$ of the filtered group $\mathcal{G}_{i}$ in $\mathcal{P}$ from $\mathcal{D}$, and removing all non-satisfying samples within $\mathcal{P}$. Ultimately, $\mathcal{P}$ becomes our final target set.

We repeat the sampling and filtering stages alternately for a maximum of $T$ times. We acquire the candidate set $\mathcal{P}$ each time, which includes more valid sample groups $\mathcal{G}$. Meanwhile, we have the updated dataset $\mathcal{D}$ consisting of unselected samples, which is used for sampling and filtering in the next iteration. To ensure that the mini-batches constructed by the ISF method achieve lower pad ratio and dist ratio, we need to determine appropriate values for $Q_{v}$ or text $Q_{t}$. The optimal values for $Q_{v}$ or text $Q_{t}$ vary across different datasets. In practice, we use a statistical approach described in Section 5.1 to determine these values. As shown in Figure 4, we can see that with ISF, the data distribution becomes more concentrated, indicating more balanced input sizes.

Figure: Algorithm 1 ISF: Sampling Stage

### 4.2 Balanced Model Partitioning

With the input data sizes fixed, we carefully divide the model parameters across devices. Given the number of layers $L$ in the model and the pipeline parallel size $N$, our goal is to find an optimal partition strategy $P=$ $(P^{(1)},P^{(2)},P^{(3)},\ldots,P^{(N-1)})$ such that the training speed of the model is maximized. Here, $P^{(1)}<P^{(2)}<P^{(3)}<\ldots<P^{(N-1)}$, and the $i^{th}$ partition $M_{i}$ consists of layers $L_{k}$, where $P^{(i-1)}\leq L_{k}<P^{(i)}$, with $P^{(0)}=1$ and $P^{(N)}=L+1$. For example, given a model with $L=20$ layers and pipeline size $N=4$, assume that we have an optimal partition $P=(5,10,15)$. The first partition $M_{i}$ consists of layers $L_{1},L_{2},...L_{4}$ since $P^{(0)}=1,P^{(1)}=5$.

However, achieving balanced pipeline partitioning for VLMs is a more challenging task compared to LLMs. We must consider: (1) Model Heterogeneity: The structural differences between visual and language models make simple parameter-based or layer-based partition strategies unsuitable. (2) Communication Overheads: Different partition strategies have different communication volumes since the activation number of each layer may vary significantly in VLMs. (3) Hardware Variability: Different platforms have varying capabilities. Some platforms could have negligible communication overhead due to high network bandwidth. We designed a heuristic search algorithm based on the above analysis to find the optimal partition. We first identified a set of partitions that possibly contain the optimal solution $\{P_{k}=(P_{k}^{(1)},P_{k}^{(2)},P_{k}^{(3)},\ldots,P_{k}^{(N-1)})\mid k=1,2,3
,\ldots\}$. Then, we select the optimal partition $P^{*}$ based on actual running time:

$$ $P^{*}=\operatorname*{arg\,min}_{P_{i}}f(P_{i})$ (3) $$

Here, $f(P_{i})$ is the average running time obtained from training the model for 20 iterations under partition $f(P_{i})$.

Partition Candidates: We start by profiling each layer’s computation time $\text{FWD}(L_{i})$. A greedy algorithm is employed to compute the anchor partition $P^{+}$, where the computation time of sub-model $M_{i}$ is close. Around anchor partition $P^{+}$, we create a set of partition candidates by jittering $P^{(1)},P^{(2)},P^{(3)},\ldots$ within a radius of $r$ layers. There are total $3\times 3\times 3=27$ partition candidates when $r=1,N=4$.

Partition Metrics: When $r$ and $N$ are very large, there will be a significant number of partition candidates, making it inefficient to run and evaluate the time for each one. Therefore, we designed two metrics to rank these candidates.

The first metric is the difference in running time between different pipeline stages. Smaller differences generally result in fewer bubbles and, therefore, faster execution. We use the variance of the running times of different pipeline stages to measure this difference.

$$ $\text{VAR(fwd_time)}=\sum_{i=1}^{N}(\text{FWD}(M_{i})-\overline{\text{FWD}(M_ {i})})^{2}$ (4) $$

The second metric is the total point-to-point communication volume of the partition strategy $P_{i}$. It depends on $P_{i}$ consisting of $(P^{(1)},P^{(2)},P^{(3)},\ldots)$

$$ $\text{SUM(comm)}=\sum_{i=1}^{N-1}\text{ACTIV}(L_{pi})$ (5) $$

Where $L_{pi}$ is the last layer of partition strategy $P^{(i)}$ and $\text{ACTIV}(L_{pi})$ is the activation number of layer $L_{pi}$, indicating the point-to-point communication of this partition strategy $P^{(i)}$.
We use the sum of VAR(fwd_time) and SUM(comm) as the metric for the partition and rank them to select the top $K$ candidates for speed evaluation.

### 4.3 Balanced Adaptive Re-Computation

Thanks to our proposed balanced dynamic mini-batch and balanced model partition, we have balanced computational loads for each partition. The memory requirements are also fixed because the computational demand has been fixed. Therefore, we can adjust the optimal re-computation strategy based on memory needs instead of using the most aggressive strategy to prevent crashes. Fewer re-computations accelerate the model’s backward step, significantly improving the training speed.

Additionally, we found that heterogeneous architectures have different memory requirements. For example, the vision model in InternVL-Chat-1.5 requires more GPU memory than the language model under the same computational load. Therefore, we need to individually analyze the memory requirements for each layer of vision and language models and adaptively set the optimal re-computation strategy for each layer. Specifically, we first calculate the memory required for each layer of vision or language models through profiling. Next, according to the remaining memory of each device, we determine the number of layers in a sub-model $M_{i}$ where the re-computation strategy can be canceled.

## 5 Experiments

In this section, we first introduce the models and datasets. Then, we demonstrate the acceleration achieved compared to current state-of-the-art VL models. Following that, we provide a detailed comparison of each component proposed in our method and its contribution to training acceleration. Finally, we conduct extensive experimental analysis.

### 5.1 Experimental setup

Model & Dataset setting: We conduct experiments following the open-source InternVL-Chat-1.5 setting. Our vision and language models are InternViT-6B and InternLM2-20B, respectively. We employ two configurations: InternVL-Chat-1.5 (6+20B) and InternVL-Chat-1.5-Plus (6+34B). As the InternVL-Chat-1.5 dataset is not yet available, we utilize the InternVL-Chat-1.2 dataset, which comprises approximately 1.2 million samples, as an alternative. All other training settings remain unchanged. We use GPU Days as our evaluation metric to estimate the total computing time. Specifically, we report GPU Days based on A100 GPU usage to evaluate the speed-up performance.

Implementation Details: We determine $Q_{v}$ or text $Q_{t}$ by using use statistics of datasets. First, we traverse the entire dataset and collect the summation of the lengths of all text tokens and the number of images. Then, We calculate the average number of text tokens per image. We set $Q_{t}=$4K as the length of the longest text token in the dataset and use the calculated text-to-image ratio to determine $Q_{v}=9$. For images, we set $Q^{\prime}_{v}=Q_{v}$, and for text, we set $Q^{\prime}_{t}=Q_{t}-128$.

### 5.2 Main Results

We demonstrate the superiority of our method under various settings in Table 1. Our baseline model is InternVL-Chat-1.5 (6+20B) Chen et al. (), and we follow their setting, using DeepSpeed ZeRO-3 as the training backend. Our proposed method reduced GPU days from 38.9 to 25.3, achieving a 1.54x speedup. Simultaneously, we consistently maintained comparable performance across commonly used datasets, such as MMB-EN/CN  Liu et al. (), ChartQA  Masry et al. (), AI2D  Kembhavi et al. (), MMVet  Yu et al. (), and MME  Fu et al. ().

We conducted experiments using another advanced training framework, Megatron-DeepSpeed. Unlike DeepSpeed, Megatron-DeepSpeed integrates tensor and pipeline parallelism alongside data parallelism, enhancing its suitability for larger-scale models. However, directly applying 3D parallelism can slow down training due to the heterogeneous nature of VLM models, which complicates balanced partitioning and leads to computational inefficiencies. The table shows that switching to Megatron-DeepSpeed increased GPU days from 38.9 to 61.8. Our method addresses this issue by achieving computational balance across data, model, and memory. Utilizing our approach, we significantly reduced GPU days from 61.8 to 21.3, demonstrating that computational balance is crucial for effective 3D parallelism. Notably, our method also outperformed DeepSpeed, reducing GPU days from 25.3 to 21.3, highlighting the superiority of 3D parallelism when balanced computation is achieved.

We also report results under a larger-scale setting (InternVL-Chat-1.5-Plus) to verify the generalizability of our method. The larger model consistently improved, accelerating the training process while maintaining model performance. Specifically, we achieved speedups of 1.53x with the DeepSpeed backend and 1.8x with the Megatron-DeepSpeed backend.

**Table 1: Main Results. We use open-source InternVL-Chat-1.5 6+20B and 6+34B as the models with either DeepSpeed (ZeRO-3) or Megatron-Deepspeed backend. We report GPUS Days in the InvernVL-Chat-1.2 1.2M training dataset to show the speed-up ratio. Models are also evaluated on five commonly used benchmarks.**
| Model | Balance? | Backend | MMB-EN/CN | ChartQA | AI2D | MMVet | MME | GPU Days (speed-up) |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 6+20B | $\times$ | DeepSpeed | 78.2/77.4 | 86.2 | 71.3 | 48.9 | 1901.2 | 38.9 (1x) |
| $\checkmark$ | DeepSpeed | 78.7/77.6 | 86.5 | 71.4 | 50 | 1969.4 | 25.3 (1.54x) |  |
| $\times$ | Megatron | 79.5/77.7 | 87.3 | 71.6 | 45.0 | 1957.7 | 61.8 (0.63x) |  |
| ✓ | Megatron | 78.6/77.5 | 86.7 | 70.9 | 48.5 | 1956.3 | 21.3 (1.83x) |  |
| 6+34B | $\times$ | DeepSpeed | 80.0/79.2 | 86.6 | 73.4 | 45.9 | 2015.8 | 54.3 (1x) |
| $\checkmark$ | DeepSpeed | 80.9/79.0 | 89.1 | 73.3 | 47.0 | 2153.6 | 35.5 (1.53x) |  |
| $\times$ | Megatron | 80.2/79.3 | 88.9 | 73.7 | 44.2 | 2111.9 | 75.4 (0.72x) |  |
| ✓ | Megatron | 80.1/78.0 | 89.3 | 73.5 | 45.4 | 2072.7 | 30.5 (1.8x) |  |

**Table 2: Training time of different settings**
| data balance | model balance | memory balance | GPU Days |
| --- | --- | --- | --- |
|  |  |  | 61.8 |
| ✓ |  |  | 51.9 |
| ✓ | ✓ |  | 29.0 |
| ✓ | ✓ | ✓ | 21.3 |

### 5.3 Ablation Analysis

In this section, we conduct ablation experiments on each component of our method, using InternVL-Chat-1.5 as the baseline model with a 3D parallel Megatron-DeepSpeed backend. Table 3 illustrates the impact of each part of our method.
Due to computational imbalance, the baseline model’s training speed is very slow, requiring 61.8 GPU days. By achieving data balance, GPU days are reduced from 61.8 to 51.9. This improvement enables us to achieve a more balanced model partition, further reducing the training time to 29 GPU days. Finally, optimizing memory usage with an adaptive re-computation strategy reduces GPU days from 29.0 to 21.3. These results demonstrate that a holistic balance encompassing data, model, and memory is crucial for ensuring efficient training speed in VLM training. Below, we provide a more detailed analysis of each component.

**Table 4: Importance of data balance. AVE-BS indicates the average batch size in each iteration. We report results with Model Balance (MB) and without MB.**
| Method | AVE-BS | Max-Seq-Len | Pad Ratio | Dist Ratio | Balanced | GPU Days |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| VIT | LLM | VIT | LLM | w/o MB | w MB |  |  |  |  |
| baseline | 4 | 20K | 16K | 0.31 | 0.34 | 0.30 | $\times$ | 61.8 | 42.2 |
| sorted | 4 | 20K | 16K | 0.014 | 0.47 | 0.40 | $\times$ | 54.0 | 40.0 |
| device-group | 4 | 20K | 16K | 0.378 | 0.125 | 0.228 | $\times$ | 54.5 | 43.6 |
| ISF(ours) | 4.6 | 9K | 4K | 0 | 0.02 | 0.14 | ✓ | 51.9 | 29.0 |

**Table 5: Importance of model balance. VAR indicates variance. SUM(comm) is the summation of commutation volume (MByte)**
| Method | VAR(param) | VAR(num_layer) | VAR(fwd_time) | $\Delta$ SUM(comm) | GPU days |
| --- | --- | --- | --- | --- | --- |
| (1) parameter-based | 0.03 | 13.4 | 93.6 | +0.0 | 42.2 |
| (2) layer-based | 0.64 | 1.2 | 20.1 | +8.2 | 30.6 |
| (3) profile-based | 0.85 | 2.1 | 6.5 | +16.6 | 30.9 |
| (4) BMP (ours) | 0.83 | 1.5 | 12.2 | -21.0 | 29.0 |

**Table 6: Importance of memory balance. VRAMi denotes remaining VRAM(G) in parallel stage $i$. For the baseline model, the metric varies as minimum $\sim$ maximum.**
| Method | V-Seq-Len | L-Seq-Len | VRAM1 | VRAM2 | VRAM3 | VRAM4 | GPU Days |
| --- | --- | --- | --- | --- | --- | --- | --- |
| baseline | 4K$\sim$20K | 1K$\sim$16K | 13$\sim$50.2 | 7.3$\sim$40.5 | 7.3$\sim$40.5 | 7.3$\sim$40.5 | 61.8 |
| + data & model balance | 9K | 4K | 58.2 | 56.2 | 32.5 | 32.7 | 29.0 |
| + memory balance | 9K | 4K | 12.3 | 21.7 | 24.7 | 30.0 | 21.3 |

**Table 7: Results on different Model Size**
| Vision-Model | Language-Model | TP PP DP | Stages-Layer-Num (V+L) | Re-computation | GPU Days(speed up) |
| --- | --- | --- | --- | --- | --- |
| InternVL-6B | Llama3-8B | (1,4,8) | [16,17,20,24] | [8,7,10,24] | 27.7 $\rightarrow$ 13.8(2.0x) |
| InternVL-6B | InternLM2-20B | (2,4,4) | [22,23,24,24] | [0,0,0,0] | 61.8 $\rightarrow$ 21.3(2.9x) |
| InternVL-6B | Yi-34B | (4,4,2) | [28,29,24,24] | [3,2,0,0] | 75.4 $\rightarrow$ 30.5(2.5x) |
| InternVL-6B | Llama3-70B | (4,8,2) | [22,23,13,14,14,14,13,12] | [11,12,8,5,3,2,0,0] | 129 $\rightarrow$ 52.5(2.4x) |
| InternVL-6B | Qwen1.5-110B | (8,8,1) | [21,22,13,13,14,14,14,14] | [6,9,1,3,0,0,0,0] | 243 $\rightarrow$ 75.2(3.2x) |
| EVA-CLIP-1B | InternLM2-20B | (2,4,4) | [43,16,15,14] | [0,0,0,0] | 23.6 $\rightarrow$ 12.2(1.9x) |
| EVA-CLIP-4B | InternLM2-20B | (2,4,4) | [39,22,21,20] | [10,8,1,3] | 38.1 $\rightarrow$ 17.0(2.2x) |
| EVA-CLIP-8B | InternLM2-20B | (2,4,4) | [17,18,23,22] | [5,5,8,10] | 41.8 $\rightarrow$ 20.3(2.0x) |
| EVA-CLIP-18B | InternLM2-20B | (4,4,4) | [18,19,25,34] | [2,2,0,0] | 63.6 $\rightarrow$ 33.8(1.9x) |

Figure: Figure 5: ISF convergence testing. We tested the convergence of ISF in various scenarios, including (a) different datasets, (b) different patch sizes, and (c) different image resolutions.
Refer to caption: x5.png

**Table 8: Results on Different Dynamic High-Resolution Setting**
| Model | Max-Patch-Num | AVE-BS | Max-Seq-Len | Dist Ratio | GPU Days |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- |
| VIT | LLM | VIT | LLM |  |  |  |  |
| InternVL-6B-20B | 1 | 7.6 | 9K | 4K | 0.06 | 0.05 | 28.6 $\rightarrow$ 13.7 |
| 4 | 4.6 | 9K | 4K | 0.02 | 0.14 | 61.8$\rightarrow$ 21.3 |  |
| 6 | 2.7 | 14K | 5K | 0.019 | 0.136 | 147 $\rightarrow$72 |  |
| 12 | 1.9 | 14K | 5K | 0.03 | 0.12 | 209 $\rightarrow$105 |  |

**Table 9: Results on Pretrain Setting**
| Model | Dataset | Trainable Module | AVE-BS | Dist Ratio | GPU Days |  |
| --- | --- | --- | --- | --- | --- | --- |
| VIT | LLM |  |  |  |  |  |
| InternVL-6B-20B | LCS-558K | ViT+MLP | 5.8 | 0 | 0.03 | 9.9 $\rightarrow$ 6.0 |
| InternVL-6B-34B | LCS-558K | MLP | 5.1 | 0 | 0.031 | 8.3 $\rightarrow$ 4.9 |
| InternVL-6B-70B | LCS-558K | MLP | 5.2 | 0 | 0.029 | 16.8 $\rightarrow$ 9.6 |

**Table 10: Results on Different Resolutions**
| Resolution | AVE-BS | Dist Ratio | GPU Days |  |
| --- | --- | --- | --- | --- |
| VIT | LLM |  |  |  |
| 224 | 4.8 | 0.009 | 0.068 | 32.0 $\rightarrow$ 20 |
| 336 | 3.3 | 0.005 | 0.07 | 62.0 $\rightarrow$ 33 |
| 448 | 4.6 | 0.02 | 0.14 | 61.8 $\rightarrow$ 21.3 |

The Importance of Data Balance: In Table 4, we investigate the importance of maintaining data balance in large-scale distributed training. We compared four methods: (1) Baseline Method: Randomly combining data into a mini-batch and padding according to the longest input in the mini-batch. (2) Sorted Method: Combining samples with similar text and image sizes into a mini-batch to minimize padding within devices. (3) Device-group Method: Grouping samples with similar text and image sizes across devices to minimize idle times. (4) Our Balanced Dynamic Mini-batch Method: Using Iterative Sampling and Filtering (ISF) to combine mini-batches dynamically. This comparison highlights the effectiveness of our Balanced Dynamic Mini-batch method in achieving superior data balance and optimizing training efficiency.

From the table, we can observe the following: (1) Baseline Approach: The baseline approach is the slowest due to the completely random combination of different-sized samples, which causes significant size variation within a mini-batch. This leads to excessive padding, with a padding ratio of 0.31. Additionally, there is considerable variation in mini-batch sizes across different devices, as evidenced by the Dist Ratio of 0.34 for ViT and 0.30 for LLM. This results in significant computation disparities between devices, causing many devices to idle and wait, thereby severely impacting the model’s throughput efficiency.
(2) Sorted Method: This method enhances throughput efficiency by pre-grouping samples of similar sizes into mini-batches, thus reducing the internal padding ratio to 0.014. Minimizing the number of redundant tokens within mini-batches effectively lowers the GPU days required to 54.0. (3) Device-Group Method: This method aims to reduce device idle time by ensuring consistent input sizes across devices. It significantly improves the Dist Ratio for ViT and LLM, reducing them to 0.125 and 0.228, respectively. However, this approach only balances input sizes between devices and neglects the balance within mini-batches on each device. As a result, excessive padding occurs, with a padding ratio of 0.378, wasting substantial computational resources. (4) Our Approach: Our approach balances input sizes within mini-batches on each device and across devices simultaneously. As shown in the table, it reduces both padding and the Dist Ratio, achieving a padding ratio of 0 while maintaining very low Dist Ratios of 0.02 and 0.14. Consequently, our method outperforms all other methods.

Although our method achieves more balanced input sizes, model partitioning still constrained the training speed. Therefore, we also report results using model balancing (MB). With MB, the improvement is even greater, reducing GPU days from 42.2 to 29.0, a gain of 13.2, compared to a 9.9 improvement without MB (from 61.8 to 51.9 GPU days). This further underscores the importance of a holistic balance approach.

The Importance of Model Balance: In Table 5
, we examine the impact of balanced model partitioning, particularly in the context of determining partition strategies for pipeline parallelism. For large language model (LLM) training, common partitioning methods include (1) parameter-based partitioning and (2) layer-based partitioning. Additionally, (3) profile-based methods such as DreamPipe Narayanan et al. () estimate the computation time for each layer and use this information to partition the model effectively. Finally, (4) our search-based Balanced Model Partition method identifies the optimal partition strategy from a small set of partition candidates.

(1) Parameter-based and (2) layer-based methods split the model based on parameters or the number of layers, respectively. As shown in Table 5, these methods achieve the lowest variation in parameters (VAR(param)) and the number of layers (VAR(num_layer)) across devices, indicating balance in these metrics. However, due to the heterogeneous nature of vision and language models (VLMs), balancing parameters or layers does not equate to balanced computational loads. The variation in forward time (VAR(fwd_time)) for each stage remains high, at 93.6 and 20.1, respectively, leading to significant computational inefficiencies in the pipeline.
The (3) profile-based method ensures the optimal VAR(fwd_time) with the lowest value of 6.5. However, this partitioning occurs before the vision model’s token sub-sampling operation, significantly increasing communication overhead by 16.6 compared to the baseline (1), thereby affecting training speed. Our proposed Balanced Model Partition (BMP) method searches within a high-quality partition space to find the optimal strategy. As shown in Table 5, our method achieves the best results, with 29.0 GPU days, outperforming the parameter-based method by 13.2 days. Notably, our method does not achieve low VAR(param) and VAR(num_layer), indicating that parameters and the number of layers are ineffective metrics for evaluating model balance in VLM scenarios.

The Importance of Memory Balance: We examine the significance of memory balance, with the results presented in Table 6. In the baseline model, the input sizes for both the vision and language components are not fixed, with vision token lengths ranging from 4K to 20K and language token lengths ranging from 1K to 16K. As a result, the memory demand on each GPU varies. Even with the most aggressive re-computation strategy, the remaining memory on an 80G A100 GPU can be as low as 7.3G in extreme cases. We achieved balance at both the data and model levels by implementing our proposed balanced dynamic mini-batch and model partition methods. This approach controls the computational load on each device and maintains relative balance, significantly improving training speed from 61.8 to 29.0 GPU days. However, due to inherent differences between vision and language models, their memory demands differ even under the same computational load, resulting in GPUs 3 and 4 having relatively low remaining memory. Our method further improves training speed by adaptive adjusting the re-computation strategy to utilize the remaining memory fully. As shown in the third row of Table 6, our method reduces GPU days from 29.0 to 21.3.

### 5.4 Component Analysis

Convergence of ISF: We study the convergence performance of ISF, and the results are shown in Figure 5. On LLava-665K  Liu et al. (), we observed that the dist ratio in both the vision and language data was sufficiently low after just one iteration. After five iterations, the dist ratio stabilized significantly. In practice, we iterate ten times for stable results, which takes less than 1 minute. The computation cost is negligible compared to the overall runtime. We also tested our method on two additional datasets, InternVl-1.2M  Chen et al. () and LCS558K Liu et al. (), and observed consistent convergence speeds. These findings demonstrate the effectiveness and generalizability of our method.

Generalization Capability: We studied the generalization capability of our method from multiple aspects: (1) Different Datasets: We conducted experiments on three different datasets. As shown in Table 3, we achieved consistently low dist ratios on LLava-665K, InternVL-1.2M, and LCS558K and significantly improved training speed. (2) Different Models: We tested various combinations of vision and language models. For vision models, in addition to InternVL-6B, we used the open-source EVA-CLIP models, ranging from 1B Sun et al. () to 18B Sun et al. (). For language models, we employed Llama3-8B, 70B AI (), Yi-34B NousResearch (), and the large-scale Qwen1.5-110B Bai et al. (). Table 7 shows our method greatly reduces GPU days for model training. Notably, we achieved a 3.2x speedup for the largest model, Qwen1.5-110B, demonstrating the advantages of our approach for large-scale VLM model training. (3) Different Tasks: Besides SFT tasks, we also tested pretraining tasks, as shown in Table 9. For models ranging from 6B to 20B, we trained both ViT and MLP components, and for larger models like 6B-34B and 6B-70B, we trained only the MLP component. We observed consistent improvements across all settings, especially for the largest model, where we reduced GPU days from 16.8 to 9.6. (4) Different Image Resolutions: We also test our method with different image resolutions input; from Table  11, it can be observed that our method also achieves a very satisfactory acceleration effect. (5) Different Model-series: We also validated our method using another popular open-source model, LLava-1.6, with the DeepSpeed backend, as shown in Table 11. These results highlight the effectiveness and robustness of our method across various datasets, models, and tasks.

## 6 Conclusion

In this work, we effectively addressed the issue of imbalanced computation loads in large-scale 3D parallel training of vision-language models by rebalancing across data, model, and memory dimensions. Experimental results demonstrate that our method can significantly reduce GPU days on many open-source models. The effectiveness and generalizability of our approach were also validated across various models, datasets, and hardware platforms. Our method can accelerate the development of this field by enabling more efficient training.

## Peer Reviews

confidence: 4
contribution: 2
initial_rating: 3
presentation: 2
questions: This paper propose OmniBal, which improves efficiency by balancing data, model, and memory across devices. It achieves significant improvements over baselines. However, I have following questions/concerns:

1. The data partitioning approach in this paper appears to offer limited novelty. Numerous adaptive data batching methods, such as [1] and [2], have already addressed similar issues, albeit without specific evaluations on VLMs. However, applying these techniques to VLMs does not seem particularly challenging, given that (i) the primary goal—balancing computation both within and across batches—is quite similar, and (ii) the methodology, which involves batching based on profiled or predicted latency, closely resembles the existing works. Could the authors clarify the unique contributions of their data partitioning method in comparison to these established batching approaches?

2.  The novelty of the model partitioning and re-computation strategies also seems limited. The AdaPipe framework, as referenced in the paper, performs layer-wise partitioning and adaptive re-computation based on computation and memory costs. Since the information needed for partitioning VLMs can also be easily profiled, could the authors explain the specific advantages of their approach over extending AdaPipe for VLMs?

3. The motivation for addressing data imbalance would be stronger with quantitative results from real datasets illustrating variation in sample sizes or computational demands. The simplified example in Figure 2 does not adequately demonstrate the scope of the issue.

4. The section on memory imbalance in Section 3 lacks clarity. While it states the need for aggressive re-computation, it would benefit from a discussion on potential opportunities to mitigate memory imbalance.

5. The figure in Appendix A.1.2 does not clearly illustrate how computation is balanced, making it difficult to assess the efficacy of the approach.

6. Section 4 introduces Q'v and Q't to reduce Pad Ratio and Dist Ratio, but the paper lacks a clear formula or explanation of how these values affect the ratios. This makes it challenging to understand how Q values are chosen to achieve the intended balance.

7. In Section 5, Q′v is set equal to Qv, while Q′t is defined as Qt − 128. Could the authors provide an intuition or rationale behind these choices?

8. The partitioning approach begins with an anchor partition strategy. What is the computational overhead for generating this anchor partition, and how close is it to the optimal partition? If it is far from optimal, what steps are taken to improve upon it? Conversely, if it is close, is it necessary to generate multiple new candidate partitions?

minor point(s):
1. The fonts in some figures are too small, particularly in Figure 3, where the axis labels and legends are difficult to read.


[1] Yu, Gyeong-In, Joo Seong Jeong, Geon-Woo Kim, Soojeong Kim, and Byung-Gon Chun. "Orca: A distributed serving system for {Transformer-Based} generative models." In 16th USENIX Symposium on Operating Systems Design and Implementation (OSDI 22), pp. 521-538. 2022.

[2] Choi, Yujeong, Yunseong Kim, and Minsoo Rhu. "Lazy batching: An sla-aware batching system for cloud machine learning inference." In 2021 IEEE International Symposium on High-Performance Computer Architecture (HPCA), pp. 493-506. IEEE, 2021.
soundness: 2
strengths: 1. This paper addresses a critical issue: accelerating distributed training for large-scale vision-language models (VLMs).

2. The authors present a comprehensive optimization framework that targets VLM distributed training from three perspectives: data, model, and memory balance.
summary: This paper introduces OmniBal, a training framework that addresses computational imbalances in large-scale Vision-Language Models (VLMs) during 3D parallel distributed training. OmniBal improves efficiency by balancing data, model, and memory across devices. For data, the framework forms balanced mini-batches that reduce padding and minimize computational idle times. For the model, a search-based method is used to optimally partition vision and language components, addressing their inherent structural differences. For memory, adaptive re-computation maximizes memory utilization, enhancing training speed. Experiments show OmniBal reduces training time significantly.
weaknesses: 1. The paper lacks sufficient motivation data to illustrate the imbalance problem quantitatively.

2. The contributions of this paper seems incremental.

3. Some figures have fonts that are too small, making them challenging to read and interpret.

Please see my comments for details.

---

confidence: 3
contribution: 3
initial_rating: 6
presentation: 3
questions: See weaknesses.
soundness: 3
strengths: + The paper centers on the efficient parallel training of MLLMs particularly focusing on balancing the computational load concerning data, model, and memory distribution both in-device and cross-device. 

+ The multi-modal sample balancing strategy stands out for its simplicity, offering a straightforward approach to load management. Despite its simplicity, the method proves to be effective, yielding significant reductions in training GPU hours while preserving the model’s capabilities. TItmakes the approach both accessible for large-scale applications.

+ It is comprehensively validated across different datasets, tasks, resolutions and hardware archs etc
summary: This paper focuses on the 3D parallel training of MLLMs. The approach to balancing the computational load concerning data, model, and memory distribution both in-device and cross-device is straightforward yet effective. The proposed method demonstrates significant time reduction while maintaining the model's capabilities.
weaknesses: - Results on other MLLM architectures, especially those commonly used in the community such as the LLaVA series, are expected in a technical report style work.

---

confidence: 3
contribution: 3
initial_rating: 6
presentation: 3
questions: N/A
soundness: 3
strengths: Strength：

1. Extensive experiments demonstrate the approach's effectiveness for rebalancing computation for MLLMs.
2. The motivation is clear and the in-depth analysis and ablations are convincing.
3. This paper is well-organized and clearly-written.
summary: This paper aims at addressing the issue of imbalanced computation loads in large-scale 3D parallel training of vision-language models. It rebalances across data, model, and memory dimensions. Experimental results demonstrate that this method can effectively speed up training on many open-source models.
weaknesses: N/A