MindSpeed RL: Distributed Dataflow for Scalable and Efficient RL Training on Ascend NPU Cluster

Laingjun Feng, Chenyi Pan, Xinjie Guo, Fei Mei, Benzhe Ning, Jianxiang Zhang, Xinyang Liu, Beirong Zhou, Zeng Shu, Chang Liu, Guang Yang, Zhenyu Han, Jiangben Wang, Bo WangarXiv 2025 · DOI

Abstract

MindSpeed RL is an open-source framework designed to scale Reinforcement Learning (RL) training for massive Large Language Models (LLMs) on Ascend NPU clusters. By addressing sample flow bottlenecks through a "distributed transfer dock" and resharding flow redundancies via an "allgather-swap" technique, MindSpeed RL achieves up to a 3.97x throughput increase over existing state-of-the-art systems. The framework demonstrates high scalability, maintaining 81.1% linearity on 192 NPUs and enabling the training of models as large as DeepSeek-R1 (671B).

Introduction

Training Large Language Models (LLMs) with Reinforcement Learning (RL) algorithms like PPO or GRPO introduces significant complexity compared to standard supervised fine-tuning. This complexity arises from the need to coordinate multiple functional workers—including Actors, Reference models, and Reward models—that must constantly transition between generation, inference, and model update states.

Existing RLHF (Reinforcement Learning from Human Feedback) frameworks often encounter two primary performance bottlenecks:

  1. Sample Flow Bottlenecks: Centralized replay buffers become communication hubs that struggle to dispatch data as cluster sizes increase, leading to NPU idling while waiting for samples.
  2. Resharding Flow Redundancy: Switching between training and generation often requires different parallelization strategies. Standard resharding creates redundant weight copies in memory, which is prohibitive for massive models like DeepSeek-R1 (671B parameters) that already push hardware limits.

MindSpeed RL addresses these challenges by redesigning the underlying dataflow architecture, focusing on decentralized data movement and memory-efficient weight management.

Distributed Dataflow Architecture

Distributed Transfer Dock (TD)

To eliminate the bottleneck of a centralized buffer, MindSpeed RL introduces the Distributed Transfer Dock (TD). This architecture decentralizes the replay buffer into multiple "warehouses" distributed across the cluster. Each worker state (e.g., Actor Inference, Reward Inference) utilizes a dedicated "controller" to manage metadata.

The Distributed Transfer Dock (TD) architecture replaces centralized buffers with distributed warehouses and controllers to reduce communication overhead.

As shown in Figure 3, workers request and obtain metadata from the controllers and then pull or push real data directly from the distributed warehouses. This peer-to-peer approach drastically reduces dispatch overhead and allows the system to scale effectively to hundreds of NPUs by avoiding the single-point bottleneck of a master-slave buffer architecture.

Allgather-Swap Technique

Weight resharding is necessary when the optimal parallelization strategy for training (e.g., high Tensor Parallelism) differs from that of generation (e.g., high Data Parallelism). Traditional methods often leave redundant weights in NPU memory during this transition, limiting the space available for the KV cache.

MindSpeed RL employs an "Allgather-Swap" technique to reclaim this memory. During the transition from the update phase to the generation phase, the system uses a temporary buffer for the "allgather" operation to collect weight shards. Crucially, it then "swaps" the original training weights from the NPU device memory to the CPU host memory (D2H).

The Allgather-Swap technique optimizes memory by using temporary buffers and swapping training weights to host memory (D2H) during the generation phase.

As illustrated in Figure 5, this process frees approximately 8GB of redundant memory per NPU. This released memory is immediately reallocated to the KV cache, enabling the generation of significantly longer sequences without triggering out-of-memory (OOM) errors, leveraging high-bandwidth NPU-to-CPU links to minimize the performance penalty of the swap.

Evaluation and Results

The framework was evaluated using high-difficulty benchmarks including MATH500, AIME24, and GPQA Diamond, using prompt datasets like DeepScaleR. Tests were conducted on models ranging from Qwen2.5 (7B/32B) to the massive DeepSeek-R1-MoE-671B.

Performance and Scalability

MindSpeed RL demonstrated a throughput increase of 1.42x to 3.97x compared to frameworks like OpenRLHF and VeRL. In a large-scale deployment of 192 NPUs, the system achieved 81.1% linearity, significantly outperforming VeRL, which dropped to 40.4% under similar conditions.

Support for Ultra-Large Models

A key milestone was the successful training of the DeepSeek-R1-MoE-671B model on a "super pod" of 384 NPUs. The system maintained a steady throughput of 200–250 Tokens Per Second (TPS), a feat few open-source frameworks can currently match for models of this scale.

Conclusion

MindSpeed RL highlights that at extreme scales, optimizing data and weight movement is as critical as optimizing raw computation. By leveraging host memory as a high-speed buffer and decentralizing the sample flow, the framework achieves near-linear scaling on Ascend NPU clusters. Future work will focus on integrating additional engines like SGLang and FSDP2 and exploring optimizations for emerging RL algorithms.

Summary updated

BibTeX
@misc{feng2025mindspeed,
  author = {Laingjun Feng and Chenyi Pan and Xinjie Guo and Fei Mei and Benzhe Ning and Jianxiang Zhang and Xinyang Liu and Beirong Zhou and Zeng Shu and Chang Liu and Guang Yang and Zhenyu Han and Jiangben Wang and Bo Wang},
  title = {{MindSpeed RL: Distributed Dataflow for Scalable and Efficient RL Training on Ascend NPU Cluster}},
  year = {2025},
  eprint = {2507.19017},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.19017},
}
Figure