{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/gshard-scaling-giant-models-with-conditional","title":"GShard: Scaling Giant Models with Conditional Computation and Automatic Sharding","arxiv_id":"2006.16668","date":"2020-06-30","proceeding":"ICLR 2021 1","authors":["Dmitry Lepikhin","HyoukJoong Lee","Yuanzhong Xu","Dehao Chen","Orhan Firat","Yanping Huang","Maxim Krikun","Noam Shazeer","Zhifeng Chen"],"abstract":"Neural network scaling has been critical for improving the model quality in many real-world machine learning applications with vast amounts of training data and compute. Although this trend of scaling is affirmed to be a sure-fire approach for better model quality, there are challenges on the path such as the computation cost, ease of programming, and efficient implementation on parallel devices. GShard is a module composed of a set of lightweight annotation APIs and an extension to the XLA compiler. It provides an elegant way to express a wide range of parallel computation patterns with minimal changes to the existing model code. GShard enabled us to scale up multilingual neural machine translation Transformer model with Sparsely-Gated Mixture-of-Experts beyond 600 billion parameters using automatic sharding. We demonstrate that such a giant model can efficiently be trained on 2048 TPU v3 accelerators in 4 days to achieve far superior quality for translation from 100 languages to English compared to the prior art.","url_abs":"https://arxiv.org/abs/2006.16668v1","url_pdf":"https://arxiv.org/pdf/2006.16668v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"gshard-scaling-giant-models-with-conditional","repo_url":"https://github.com/facebookresearch/fairscale","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"gshard-scaling-giant-models-with-conditional","repo_url":"https://github.com/lucidrains/mixture-of-experts","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"machine-translation","task_name":"Machine Translation"},{"task_slug":"mixture-of-experts","task_name":"Mixture-of-Experts"},{"task_slug":"2048","task_name":"Playing the Game of 2048"},{"task_slug":"translation","task_name":"Translation"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"gshard","method_name":"GShard"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"relu","method_name":"ReLU"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[{"slug":"gshard","name":"GShard","full_name":"GShard"}],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2006.16668","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2006.16668"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lucidrains/mixture-of-experts","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/facebookresearch/fairscale","reach":null}],"summary":{"ran":3,"ran_violates":1,"ran_fixture":2,"ran_draft_wrong":3,"unverified":1},"by_repo_kind":{"listed":{"samples":9,"ran":8,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":1,"samples":[{"code_sha256_prefix":"64ff1d169e3d5d58","entry":"Experts","repo":"lucidrains/mixture-of-experts","repo_kind":"listed","path":"mixture_of_experts/mixture_of_experts.py","file_url":"https://github.com/lucidrains/mixture-of-experts/blob/HEAD/mixture_of_experts/mixture_of_experts.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"64ff1d169e3d5d58"}},{"code_sha256_prefix":"2e0378380cff133f","entry":"GELU_","repo":"lucidrains/mixture-of-experts","repo_kind":"listed","path":"mixture_of_experts/mixture_of_experts.py","file_url":"https://github.com/lucidrains/mixture-of-experts/blob/HEAD/mixture_of_experts/mixture_of_experts.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2e0378380cff133f"}},{"code_sha256_prefix":"ed3578e7dda0ec22","entry":"Top2Gating","repo":"lucidrains/mixture-of-experts","repo_kind":"listed","path":"mixture_of_experts/mixture_of_experts.py","file_url":"https://github.com/lucidrains/mixture-of-experts/blob/HEAD/mixture_of_experts/mixture_of_experts.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ed3578e7dda0ec22"}},{"code_sha256_prefix":"369eced62e96d690","entry":"cast_tuple","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"369eced62e96d690"}},{"code_sha256_prefix":"2458c57b5f0bfa20","entry":"cumsum_exclusive","repo":"lucidrains/mixture-of-experts","repo_kind":"listed","path":"mixture_of_experts/mixture_of_experts.py","file_url":"https://github.com/lucidrains/mixture-of-experts/blob/HEAD/mixture_of_experts/mixture_of_experts.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2458c57b5f0bfa20"}},{"code_sha256_prefix":"dc9f7b2b73cab379","entry":"default","repo":"lucidrains/mixture-of-experts","repo_kind":"listed","path":"mixture_of_experts/mixture_of_experts.py","file_url":"https://github.com/lucidrains/mixture-of-experts/blob/HEAD/mixture_of_experts/mixture_of_experts.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"dc9f7b2b73cab379"}},{"code_sha256_prefix":"2aa1ea9fba4dce15","entry":"init_","repo":"lucidrains/mixture-of-experts","repo_kind":"listed","path":"mixture_of_experts/mixture_of_experts.py","file_url":"https://github.com/lucidrains/mixture-of-experts/blob/HEAD/mixture_of_experts/mixture_of_experts.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2aa1ea9fba4dce15"}},{"code_sha256_prefix":"d082003bd635a9de","entry":"safe_one_hot","repo":"lucidrains/mixture-of-experts","repo_kind":"listed","path":"mixture_of_experts/mixture_of_experts.py","file_url":"https://github.com/lucidrains/mixture-of-experts/blob/HEAD/mixture_of_experts/mixture_of_experts.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d082003bd635a9de"}},{"code_sha256_prefix":"213bf6a36ff4baa6","entry":"top1","repo":"lucidrains/mixture-of-experts","repo_kind":"listed","path":"mixture_of_experts/mixture_of_experts.py","file_url":"https://github.com/lucidrains/mixture-of-experts/blob/HEAD/mixture_of_experts/mixture_of_experts.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"213bf6a36ff4baa6"}},{"code_sha256_prefix":"928216f4fee84bf9","entry":"MoE","repo":"lucidrains/mixture-of-experts","repo_kind":"listed","path":"mixture_of_experts/mixture_of_experts.py","file_url":"https://github.com/lucidrains/mixture-of-experts/blob/HEAD/mixture_of_experts/mixture_of_experts.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"928216f4fee84bf9"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}