train_performance.md

February 24, 2025 · View on GitHub

Training Performance

InternEvo deeply integrates Flash-Attention, Apex, and other high-performance model operators to improve training efficiency. It achieves efficient overlap of computation and communication, significantly reducing cross-node communication traffic during training by building the Hybrid Zero technique. InternEvo supports expanding the 7B model from 8 GPUs to 1024 GPUs, with an acceleration efficiency of up to 90% at the thousand-card scale, a training throughput of over 180 TFLOPS, and an average of over 3600 tokens per GPU per second. The following table shows InternEvo's scalability test data at different configurations:

GPU Number81632641282565121024
TGS (Tokens/GPU/Second)40783939391939443928392038353625
TFLOPS193191188188187185186184

We tested the performance of training the 7B model in InternEvo using various parallel configurations on a GPU cluster. In each test group, the number of tokens processed per GPU in a single iteration remained consistent. The hardware and parameter configurations used in the tests are shown in the table below:

HardwareModel
GPUnvidia_a100-sxm4-80gb
Memory2TB
Inter-machine bandwidth4 * 100Gb RoCE
CPU128 core Intel(R) Xeon(R) CPU
Hyperparameterstp=1tp=2
micro_num44
micro_bsz24
seq_len20482048

The configuration of zero1 in InternEvo determines the allocation range of optimizer states.

  • zero1=-1 indicates that optimizer states are distributed across all data-parallel nodes (equivalent to Deepspeed Zero-1).
  • In the case of zero1=8, tp=1, optimizer states are distributed within 8 GPUs in a single node, and the optimizer states remain consistent across different nodes.

Throughput Measurement

Throughput is defined as TGS, the average number of tokens processed per GPU per second. In this test, the training configuration had pack_sample_into_one=False and checkpoint=False. The test results are shown in the following table. When using zero1=8, tp=1, InternEvo achieves an acceleration efficiency of 88% for training the 7B model with a thousand cards.

Parallel Configuration8 GPUs16 GPUs32 GPUs64 GPUs128 GPUs256 GPUs512 GPUs1024 GPUs
(tp=1, zero1=-1)40623842375236903571320928612271
(tp=1, zero1=8)40783939391939443928392038353625
(tp=2, zero1=-1)38223595347534383308309429922785
(tp=2, zero1=4)37613658365536503651365335893486

FLOPS Testing

The computational workload of model training is based on the FLOPS calculation method described in the Megatron paper. To ensure constant FLOPS during training, the test configuration had pack_sample_into_one=True, dtype=torch.bfloat16.

When Activation Ckpt is enabled,the test results are shown in the table below. InternEvo can achieve >180 TFLOPS for 7B model training with 1024 GPUs.

  • TGS: Tokens per GPU per Second

  • Global Bsz: The total number of processed tokens with all GPUs in a step

TPZero1Pack Sample Into OneActivation CkptGPU NumSeq LenMicro BszMicro NumGlobal BszTGSTFLOPS
18TRUETRUE82048810.125M3314193
18TRUETRUE162048810.25M3268191
18TRUETRUE322048810.5M3323188
18TRUETRUE642048811M3217188
18TRUETRUE1282048812M3260187
18TRUETRUE2562048814M3215187
18TRUETRUE5122048818M3199186
18TRUETRUE102420488116M3163184
18TRUETRUE5122048414M2963173
18TRUETRUE10242048214M2341136
18TRUETRUE10242048418M2796160

When Activation Ckpt is turned off, the test results are as shown in the table below:

TPZero1Pack Sample Into OneActivation CkptGPU NumSeq LenMicro BszMicro NumGlobal BszTGSTFLOPS
18TRUEFALSE82048240.125M4103183
18TRUEFALSE162048240.25M3939177
18TRUEFALSE322048240.5M3919176
18TRUEFALSE642048241M3944174
18TRUEFALSE1282048242M3928173
18TRUEFALSE2562048244M3920173
18TRUEFALSE5122048248M3900173
18TRUEFALSE102420482416M3625160
18TRUEFALSE5122048224M3084139
18TRUEFALSE10242048214M2346105
18TRUEFALSE10242048228M2817124

GPU Memory Usage Test

Test configuration:

ConfigurationDescription
branchdevelop
tagv0.2.1dev20231121
GPUA800
CheckpointTrue
micro_bsz1
micro_num4
dtypebfloat16
# InternEvo/configs/7B_sft.py
data = dict(
    # micro_num means the number of micro_batch contained in one gradient update
    micro_num=4,
    # packed_length = micro_bsz * SEQ_LEN
    micro_bsz=1,
    ...
)

model = dict(
    checkpoint=True,
    dtype="torch.bfloat16",
    ...
)

parallel = dict(
    zero1=dict(size=8),
    tensor=1,
    pipeline=dict(size=1, interleaved_overlap=True),
    sequence_parallel=False,
)

Pre-training & Fine-tuning test:

modelNumber of GPUzero1tpppfsdpGPU Memory (GB)
7B3-113False75
7B3-111True72
7B4-141True52
7B4-141False61
7B4-114False69
7B4-111True56
7B5-111True49
7B5-115False62
7B6-111True39
7B6-121True38
7B6-116False56
20B8-111True78
20B8-181True71
20B16-111True40
20B16-181True39
20B16-1116False52

Web_demo test:

modelGPUGPU Memory (GB)System Memory (MB)
7BA80014.52465
20BA800399547