BLOGLLM Logo
Go Pro
Guest
Not signed in
All BlogsCoursesPracticeInterview prepSeriesTagsBookmarksPricing
Log in
All BlogsCoursesPracticeTagsBookmarksPricing
BlogsCourses
Practice
My PrepProblemsStudy PlansResearch PapersRoadmapInterviewContestsLeaderboardGames
Articles
Practice / Research papers
Transformers and LLMs · 2021

Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity

William Fedus, Barret Zoph, Noam Shazeer

JMLR 2022 · arXiv 2101.03961 · Read the paper ↗

Mixture of experts with one expert per token: many more parameters, the same compute per token.

3 steps + 1 beyond the paper · 0 solved

Start: Total versus active parameters →
  1. 1Total versus active parametersWhy sparse models are cheap to run.Count total and active parameters of an MoE layerEasy
  2. 2Expert capacityCap each expert and drop the overflow.Route tokens with expert capacity and drop the overflowMediumPro
  3. 3Load-balancing lossThe auxiliary loss that keeps experts busy.Compute the Switch Transformer load-balancing lossHardPro

Beyond the paper

Follow-up ideas that build on this paper. Each blurb names the follow-up work.

  1. 4Top-2 routingExtension: send each token to two experts instead of one.Route each token to its top 2 experts in a mixture of expertsMediumPro

More transformers and llms papers

  • Attention Is All You Need 2017
  • LoRA: Low-Rank Adaptation of Large Language Models 2021
  • FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness 2022
  • RoFormer: Enhanced Transformer with Rotary Position Embedding 2021
  • Direct Preference Optimization: Your Language Model is Secretly a Reward Model 2023
  • Fast Inference from Transformers via Speculative Decoding 2022
  • LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale 2022
Goal
Route tokens to experts
0 / 4 solved
Start: Total versus active parameters →
How it works

Solve the steps in order. Each one is a small function with tests that run in your browser. Later steps reuse ideas from earlier ones.

© BlogLLM, Bengaluru, IndiaAboutTermsPrivacyRefundsDMCAContactRSS