GShard

GShard connects sparse MoE Transformer architecture with compiler-supported automatic sharding, making conditional computation practical at very large scale.

Metadata

FieldValue
PaperGShard: Scaling Giant Models with Conditional Computation and Automatic Sharding
AuthorsDmitry Lepikhin, HyoukJoong Lee, Yuanzhong Xu, Dehao Chen, Orhan Firat, Yanping Huang, Maxim Krikun, Noam Shazeer, Zhifeng Chen
Year2020 preprint; 2021 conference
VenueICLR 2021
arXiv2006.16668
OpenReviewqrwe7XHTmYb
Statusfull note started

Question

Sparsely-Gated MoE shows how to increase model capacity with sparse expert activation. But a layer design alone does not solve the systems problem:

GShard asks:

The answer combines a sparsely-gated MoE Transformer with compiler/runtime support for sharding tensor computation across many devices.

Main Claim

GShard is both an architecture and systems paper. The reusable architecture claim is:

The systems claim is:

Architecture Contract

ComponentContract
Base modelTransformer sequence-to-sequence model
Sparse layerMoE feed-forward block inside Transformer
Routertoken-level sparse gate over experts
Expert activationtop-2 style expert routing
Expert computationselected feed-forward expert networks
Sharding layerannotations plus XLA/compiler partitioning
Primary workloadmultilingual neural machine translation
Main boundaryarchitecture quality and systems scalability are coupled

The important modeling contract is:

The important systems contract is:

MoE Transformer Layer

For token representation:

a dense Transformer FFN is:

An MoE layer replaces that single FFN with expert networks:

The router computes expert probabilities:

The selected expert set is sparse:

The output is:

where is the selected expert gate weight.

This keeps active expert compute small relative to total expert capacity:

Why Automatic Sharding Matters

MoE creates a distribution problem. Expert weights and routed tokens must be partitioned across devices. If the user has to manually rewrite every tensor operation for a device mesh, the architecture is hard to use.

GShard’s systems contribution is to let the model code stay close to ordinary TensorFlow/XLA style while adding sharding annotations to key tensors.

The conceptual flow is:

This is why GShard belongs in architecture reading even though it is systems-heavy: the architecture only works at the claimed scale if the sharding mechanism is part of the design.

Capacity and Communication

Sparse experts change the bottleneck:

AxisDense TransformerGShard MoE Transformer
FFN capacityone dense FFN per layermany expert FFNs per sparse layer
active expertsall dense FFN weights usedonly selected experts used per token
parameter memorydense layer parametersexpert pool distributed across devices
communicationmostly parallel training collectivesrouting, dispatch, combine, and sharded expert computation
scaling riskcompute/memory grows directlyload balance and communication can dominate

The claim is not simply “more parameters are better.” The claim is:

Relation to MoE Lineage

PaperMain Role
Sparsely-Gated MoEdefines sparse expert routing as a reusable neural layer
GShardscales MoE Transformer with automatic sharding
Switch Transformersimplifies routing to top-1 for sparse Transformer scaling
GLaMapplies sparse expert scaling to large autoregressive language models

The reading order is:

Evidence

Evidence TypeWhat It Supports
multilingual translation experimentssparse MoE Transformer can improve large-scale sequence-to-sequence quality
scaling measurementsGShard can train very large MoE models across many accelerators
sharding API designmodel developers can express partitioning with relatively light annotations
efficiency and memory measurementssystems constraints are central to the architecture’s feasibility

Evaluation Risks

  • Architecture gains are entangled with data scale, translation task setup, accelerator count, and compiler/runtime implementation.
  • Total parameter count should not be read as active per-token compute.
  • A systems result on a large TPU setup may not transfer to smaller or different hardware.
  • Sparse expert routing introduces load balance and communication costs that simple FLOP estimates can hide.
  • Translation quality claims should be read with task, language-pair, data, and baseline boundaries.

Why It Belongs in Architecture Papers

GShard changes how an architecture can be scaled:

For this wiki, GShard is a canonical paper for reading sparse expert architectures when the real question is not just “what is the layer?” but:

  • how are experts routed;
  • how are experts distributed;
  • what computation is active per token;
  • where does communication happen;
  • which claims are architecture claims versus systems claims?

Concepts