Skip to main content
QUICK REVIEW

[Paper Review] Automatic Cross-Replica Sharding of Weight Update in Data-Parallel Training

Yuanzhong Xu, HyoukJoong Lee|arXiv (Cornell University)|Apr 28, 2020
Advanced Neural Network ApplicationsComputer Science19 references19 citations
TL;DR

This paper proposes automatic cross-replica sharding of weight update computation in data-parallel training to reduce performance bottlenecks caused by repeated, non-partitioned updates on all replicas. Using static analysis and graph transformations in XLA, it efficiently shards weight and optimizer auxiliary variables across replicas with optimized communication, achieving up to 45% speedup on large-scale models like Transformer without code changes or extra hardware.

ABSTRACT

In data-parallel synchronous training of deep neural networks, different devices (replicas) run the same program with different partitions of the training batch, but weight update computation is repeated on all replicas, because the weights do not have a batch dimension to partition. This can be a bottleneck for performance and scalability in typical language models with large weights, and models with small per-replica batch size which is typical in large-scale training. This paper presents an approach to automatically shard the weight update computation across replicas with efficient communication primitives and data formatting, using static analysis and transformations on the training computation graph. We show this technique achieves substantial speedups on typical image and language models on Cloud TPUs, requiring no change to model code. This technique helps close the gap between traditionally expensive (ADAM) and cheap (SGD) optimizers, as they will only take a small part of training step time and have similar peak memory usage. It helped us to achieve state-of-the-art training performance in Google's MLPerf 0.6 submission.

Motivation & Objective

  • To address the performance bottleneck caused by repeated, non-partitioned weight update computations in data-parallel training.
  • To reduce the runtime of expensive optimizers like ADAM, which otherwise dominate training time due to full-weight updates on all replicas.
  • To enable efficient sharding of weight and auxiliary variables (e.g., momentum, variance) across existing replicas without adding extra devices.
  • To minimize communication and data formatting overhead through intelligent sharding strategies and communication pattern selection.
  • To maintain compatibility with existing model code while achieving significant speedups and memory savings on large-scale models.

Proposed method

  • Applying static analysis on the XLA computation graph to identify repeated operations (e.g., weight updates) suitable for sharding.
  • Using control-flow analysis to determine optimal communication points and estimate performance gains for sharding candidate operations.
  • Transforming the computation graph to insert sharded operations and communication primitives (e.g., all-gather, all-reduce) at strategic locations.
  • Designing data sharding formats that align with accelerator memory layouts (e.g., tiled memory) to minimize communication and memory access costs.
  • Employing different sharding strategies for small-scale (minimize shard size) and large-scale (minimize communication latency) training scenarios.
  • Leveraging XLA’s functional IR with minimal side effects to simplify analysis and enable advanced optimizations like reduced live ranges of weight tensors.

Experimental results

Research questions

  • RQ1Can weight update computation in data-parallel training be automatically sharded across replicas without modifying model code?
  • RQ2What are the performance and communication overhead trade-offs of sharding weight and auxiliary variables across replicas?
  • RQ3How does automatic sharding affect memory usage, particularly peak memory, through reduced live ranges of weight and auxiliary tensors?
  • RQ4To what extent can sharding reduce the runtime of expensive optimizers like ADAM relative to SGD in large-scale training?
  • RQ5How do sharding strategies differ in effectiveness across models with varying weight sizes and batch sizes?

Key findings

  • The technique achieved a 45% reduction in step time for the Transformer model on 1024 TPUv3 chips, dropping from 46.5ms to 25.6ms.
  • Even for smaller models like ResNet-50, a 6% speedup was observed at scale (1024 chips), demonstrating broad applicability.
  • Language models such as Transformer saw a 9% improvement at small scale (16 chips), highlighting the impact on large-weight models.
  • The optimization reduced peak memory usage by enabling reuse of buffers for auxiliary variables, especially benefiting models like NCF with large auxiliary variable overhead.
  • The method achieved similar peak memory usage between ADAM and SGD, effectively closing the memory gap between expensive and cheap optimizers.
  • The approach required no changes to model code and used only existing replicas, avoiding additional hardware or infrastructure.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.