training-nv-pytorch 25.03

Updated at:

Version 25.03 of the training-nv-pytorch image upgrades core components and adds performance optimizations that you can enable to improve training throughput.

Main features and bug fixes

Main features

  • The base image is aligned with NVIDIA GPU Cloud (NGC) 25.02.

  • PyTorch and its related components are upgraded to 2.6.0.7, TransformerEngine to 2.1, and accelerate to 1.5.2, including the features and bug fixes from those releases.

  • ACCL-N, the high-performance communication library for GPU workloads, is upgraded to 2.23.4.12, including the features and bug fixes from that release.

  • vLLM is upgraded to 0.8.2.dev0, and ray is upgraded accordingly to 2.44. The image also adds support for flashinfer 0.2.3. Transformers is upgraded to 4.49.0+ali, and flash_attn is upgraded to 2.7.2. These changes include the features and bug fixes from those releases.

Bug fixes

vLLM is upgraded to 0.8.2.dev0 to fix the issue reported in Illegal memory access for MoE On H20 #13693.

Contents

Use cases

Training and inference

Framework

PyTorch

Requirements

NVIDIA driver version 570 or later

Core components

  • Ubuntu 24.04

  • Python 3.12.7+gc

  • Torch 2.6.0.7

  • CUDA 12.8.0

  • ACCL-N 2.23.4.12

  • triton 3.1.0

  • TransformerEngine 2.1

  • deepspeed 0.15.4+ali

  • flash-attn 2.7.2

  • flashattn-hopper 3.0.0b1

  • transformers 4.49.0+ali

  • megatron-core 0.9.0

  • grouped_gemm 1.1.4

  • accelerate 1.5.2

  • diffusers 0.31.0

  • openmim 0.3.9

  • mmengine 0.10.3

  • mmcv 2.1.0

  • mmdet 3.3.0

  • opencv-python-headless 4.10.0.84

  • ultralytics 8.2.74

  • timm 1.0.13

  • mmdet 3.3.0

  • vllm 0.8.2.dev0+g61c7a1b8.d20250325.cu128

  • flashinfer 0.2.3

  • pytorch-dynamic-profiler 0.24.11

  • perf 5.4.30

  • gdb 15.0.50

  • peft 0.13.2

  • ray 2.44.0

Assets

25.03 public image

  • egslingjun-registry.cn-wulanchabu.cr.aliyuncs.com/egslingjun/training-nv-pytorch:25.03-serverless 

VPC image

acs-registry-vpc.{region-id}.cr.aliyuncs.com/egslingjun/{image:tag}
Replace {region-id} with the region where your Alibaba Cloud Container Compute Service (ACS) is activated (for example, cn-beijing or cn-wulanchabu).
Replace {image:tag} with the name and tag of the image.
Note

The inference-nv-pytorch:25.03-vllm0.8.2-pytorch2.6-cu124-20250328-serverless and inference-nv-pytorch:25.03-sglang0.4.4.post1-pytorch2.5-cu124-20250327-serverless images are compatible with ACS and Lingjun multi-tenant deployments only. It is not compatible with Lingjun single-tenant deployments.

Note
  • egslingjun-registry.cn-wulanchabu.cr.aliyuncs.com/egslingjun/training-nv-pytorch:25.03-serverless applies to the ACS product form and the Lingjun multi-tenant product form. This image does not apply to the Lingjun single-tenant product form.

  • egslingjun-registry.cn-wulanchabu.cr.aliyuncs.com/egslingjun/training-nv-pytorch:25.03 applies to the Lingjun single-tenant product form.

Driver requirements

  • The 25.03 release aligns with the NGC PyTorch 25.02 image version. NGC publishes its images at the end of each month, so during its development month the Golden image can be based only on the previous month's NGC version. The driver requirements of the Golden image therefore follow those of the matching NGC image version. The release is based on CUDA 12.8.0.38 and requires NVIDIA driver version 570 or later. However, if you run the image on a data center GPU such as T4, you can use NVIDIA driver version 470.57 (or later R470), 525.85 (or later R525), 535.86 (or later R535), or 545.23 (or later R545).

  • The CUDA driver compatibility package supports only specific drivers. Therefore, upgrade from all R418, R440, R450, R460, R510, R520, R530, R545, and R555 drivers, which are not forward compatible with CUDA 12.8. For the complete list of supported drivers, see CUDA application compatibility. For more information, see CUDA compatibility and upgrades.

Key features and enhancements

PyTorch compilation optimization

The compilation optimization introduced in PyTorch 2.0 usually delivers significant gains on a single GPU at a small scale. However, large language model (LLM) training requires GPU memory optimization and distributed frameworks such as Fully Sharded Data Parallel (FSDP) and DeepSpeed, which means that torch.compile()does not deliver gains automatically and may even reduce performance. This release addresses these limitations:

  • Controls the communication granularity in the DeepSpeed framework so that the compiler can capture a more complete computation graph and apply compilation optimization over a broader scope.

  • Provides an optimized version of PyTorch:

    • Optimizes the PyTorch compiler frontend so that compilation still succeeds when any graph break occurs in the computation graph.

    • Strengthens pattern matching and dynamic shape support to improve the performance of the compiled code.

With these optimizations, 8B LLM training typically gains about 20% in end-to-end (E2E) throughput.

GPU memory optimization through activation recomputation

We built a predictive model of GPU memory overhead from extensive performance benchmark data. The data covers various models, clusters, and training parameter settings, along with system metrics such as GPU memory utilization collected during the benchmarks. From this model, we recommend the optimal number of activation recomputation layers and integrate the recommendation into PyTorch. The performance gains from GPU memory optimization are then available with minimal effort. This feature is adapted to the DeepSpeed framework.

ACCL communication library

ACCL is a high-performance network communication library that Alibaba developed in-house for Lingjun. ACCL-N is the version for GPU workloads. Alibaba Cloud built ACCL-N by customizing NVIDIA Collective Communications Library (NCCL). ACCL-N is fully compatible with NCCL, fixes several bugs in the official NCCL releases, and adds performance and stability optimizations.

E2E performance gain evaluation

Using CNP, the cloud-native AI performance benchmarking and analysis tool, we ran a comprehensive E2E performance comparison against the standard base image with mainstream open-source models and framework configurations. We also ran ablation experiments to evaluate how much each optimized component contributes to overall model training performance.

E2E performance contribution analysis of GPU core components

The following tests are based on the 25.03 release and compare E2E performance on a multi-node GPU cluster. The configurations under comparison are:

  1. Base: the NGC PyTorch image

  2. ACS AI Image: Base+ACCL: the ACS AI image with the ACCL communication library

  3. ACS AI Image: AC2+ACCL: the ACS AI image with AC2 BaseOS and no optimizations enabled

  4. ACS AI Image: AC2+ACCL+CompilerOpt: the ACS AI image with AC2 BaseOS and only compilation optimization enabled

  5. ACS AI Image: AC2+ACCL+CompilerOpt+CkptOpt: the ACS AI image with AC2 BaseOS and both compilation optimization and selective recomputation enabled

image.png

Quick start

The following examples cover only how to pull the training-nv-pytorch image with Docker.

Note

To use the training-nv-pytorch image in ACS, select it on the Artifact Center page of the Create Workload interface in the console, or specify the image reference in a YAML file.

1. Select an image

docker pull egslingjun-registry.cn-wulanchabu.cr.aliyuncs.com/egslingjun/training-nv-pytorch:[tag]

2. Call the API to enable compilation optimization and GPU memory optimization through activation recomputation

  • Enable compilation optimization

    Use the transformers Trainer API:

    training_args = TrainingArguments(
        bf16=True,
        gradient_checkpointing=True,
        torch_compile=True
    )
  • Enable GPU memory optimization through activation recomputation

    export CHECKPOINT_OPTIMIZATION=true

3. Start the container

The image has the model training tool ljperf built in. The following steps use it to show how to start the container and run a training job.

LLM

# Start the container and enter it
docker run --rm -it --ipc=host --net=host  --privileged egslingjun-registry.cn-wulanchabu.cr.aliyuncs.com/egslingjun/training-nv-pytorch:[tag]
# Run the training demo
ljperf --action train --model_name deepspeed/llama3-8b 

4. Usage recommendations

  • The changes in the image affect libraries such as PyTorch and DeepSpeed, which will be upstreamed later. Do not reinstall these libraries.

  • In the DeepSpeed configuration, leave zero_optimization.stage3_prefetch_bucket_size empty or set it to auto.

Known issues

None.