training-nv-pytorch 25.04

Updated at:

These are the release notes for training-nv-pytorch 25.04.

Main features and bug fixes

Main features

  • The base image is aligned with NGC 25.03, CUDA is upgraded to 12.8.1, and TransformerEngine is upgraded to 2.1.

  • Triton is adapted and upgraded to 3.2.0, accelerate is upgraded to 1.6.0+ali, and the features and bug fixes of these versions are merged in.

  • vLLM is upgraded to the community version v0.8.5, flashinfer-python to 0.2.5, and Transformers to 4.51.2+ali, with support for Qwen3.

Bug fixes

None

Contents

Common scenarios

Training and inference

Framework

PyTorch

Requirements

NVIDIA Driver release >= 570

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.2.0

  • TransformerEngine 2.1

  • deepspeed 0.15.4+ali

  • flash-attn 2.7.2

  • flashattn-hopper 3.0.0b1

  • transformers 4.51.2+ali

  • megatron-core 0.9.0

  • grouped_gemm 1.1.4

  • accelerate 1.6.0+ali

  • 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

  • vllm 0.8.5+cu128

  • flashinfer 0.2.5

  • pytorch-dynamic-profiler 0.24.11

  • perf 5.4.30

  • gdb 15.0.50

  • peft 0.13.2

  • ray 2.43.0

Assets

25.04

  • egslingjun-registry.cn-wulanchabu.cr.aliyuncs.com/egslingjun/training-nv-pytorch:25.04-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.04-serverless image applies to ACS and Lingjun multi-tenant deployments. It does not apply to Lingjun single-tenant deployments.

  • egslingjun-registry.cn-wulanchabu.cr.aliyuncs.com/egslingjun/training-nv-pytorch:25.04 image applies to Lingjun single-tenant deployments.

Driver requirements

  • The 25.04 release aligns with the NGC PyTorch 25.03 image version update. NGC publishes its images at the end of each month, so the Golden image can be based only on the previous month's NGC version during its development month. The Golden-gpu driver therefore follows the requirements of that NGC image version. This release is based on CUDA 12.8.1.012 and requires NVIDIA driver version 570 or later. Supported alternatives on a data center GPU such as T4: NVIDIA driver 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, R555, and R560 drivers, which are not forward compatible with CUDA 12.8. For a complete list of supported drivers, see the CUDA Application Compatibility topic. For more information, see CUDA Compatibility and Upgrades.

Key features and enhancements

PyTorch compilation optimization

The compilation optimization introduced in PyTorch 2.0 often delivers significant gains for small-scale, single-GPU workloads. However, large language model (LLM) training requires GPU memory optimization. It also requires distributed frameworks such as Fully Sharded Data Parallel (FSDP) or DeepSpeed, so torch.compile() may deliver limited gains or even degrade performance:

  • Controls communication granularity in the DeepSpeed framework so that the compiler captures a more complete compute graph and applies broader compilation optimization.

  • Includes an optimized PyTorch build:

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

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

With these optimizations, 8B-parameter LLM training typically achieves an end-to-end throughput gain of about 20%.

GPU memory optimization for recomputation

A predictive model for GPU memory overhead was built. The model draws on large-scale benchmarking data: different models on different clusters with different training parameter settings, as well as system metrics such as GPU memory utilization collected during the benchmarks. It recommends the optimal number of activation recomputation layers. This capability is integrated into PyTorch, so you can benefit from GPU memory optimization with minimal effort. It is now supported in the DeepSpeed framework.

ACCL communication library

ACCL is a high-performance network communication library that Alibaba Cloud developed in-house for Lingjun. ACCL-N is the version for GPU workloads, customized from NVIDIA NCCL. It is fully compatible with NCCL, fixes some bugs in the official NCCL release, and includes performance and stability optimizations.

E2E performance gain evaluation

CNP, a cloud-native AI performance benchmarking and analysis tool, was used to run a comprehensive end-to-end performance comparison against the standard base image, with mainstream open-source models and framework configurations. Further ablation experiments quantified the contribution of each optimization component to overall model training performance.

E2E performance contribution analysis of GPU core components

The following tests use Golden-25.04 and compare E2E performance on a multi-node GPU cluster. The comparison items include:

  1. Base: NGC PyTorch Image

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

  3. ACS AI Image: AC2+ACCL: The Golden image uses AC2 BaseOS with no optimizations enabled.

  4. ACS AI Image: AC2+ACCL+CompilerOpt: The Golden image uses AC2 BaseOS with only the torch compile optimization enabled.

  5. ACS AI Image: AC2+ACCL+CompilerOpt+CkptOpt: The Golden image uses AC2 BaseOS with both the torch compile and selective gradient checkpoint optimizations enabled.

image.png

Quick start

The following examples use only Docker to pull the training-nv-pytorch image.

Note

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

1. Pull the 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 for recomputation

  • Enable compilation optimization

    Use the Transformers Trainer API:

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

    export CHECKPOINT_OPTIMIZATION=true

3. Start the container

The image includes the model training tool ljperf. The following steps show how to start a container and run a training task.

LLM

# Start and enter the container
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 benchmark --model deepspeed/llama3-8b 

4. Usage notes

  • Do not reinstall libraries such as PyTorch and DeepSpeed. The image includes changes to these libraries, which will be contributed upstream later.

  • In your DeepSpeed configuration, leave zero_optimization.stage3_prefetch_bucket_size blank or set it to auto.

Known issues

  • The image is upgraded to PyTorch 2.6. For LLM models, the performance gain from the recomputation memory optimization is lower than in earlier images. Continuous optimization is in progress.