大模型為什麼可以又大又快
Why big models can still be fast
一顆巨大的 AI 腦袋,在任何一個瞬間,大部分都在睡覺—— 而且是故意設計成這樣的。
A giant AI brain where almost all of it is asleep at any given moment — on purpose.
問題
The problem
傳統的密集模型(dense model)沒有選擇:你打進去的每一個 token, 都得穿過全部的參數走一遍。模型愈大,每個字就愈貴。 稀疏混合專家換掉的就是這條規則——同樣的知識量留在箱子裡,但一次只點亮其中一小片。
A dense model has no choice: every token you type must push through all of the parameters. The bigger the model, the more every word costs. Sparse MoE changes that rule — the same knowledge stays in the box, but only a sliver of it lights up at a time.
零件
The parts
一個字進來。一個很小的 router(路由器,也叫 gate) 幫每一位專家打分數,然後只把這個字交給分數最高的兩位。 其他人繼續睡。點點看下面的字。
A word arrives. A tiny router (also called the gate) scores every expert, then hands the word to just the best two. The rest keep sleeping. Tap a word below.
真正的專家沒有職稱。它們學到的是「數字後面通常接什麼」這類沒有名字的模式, 不是「化學」「歷史」這種人看得懂的分類。上面這些標籤是個善意的謊—— 它讓機制看得見,但別把它當成模型內部真正的樣子。
Real experts have no job titles. They specialise in patterns nobody named — "what usually follows a number" — not human categories like "chemistry" or "history". The tidy labels above are a kind lie: they make the mechanism visible, but don't mistake them for what is really inside.
意外的地方
The surprise
專家不是一個「你去拜訪一次」的房間。模型的每一層都有自己的一組專家, 也都有自己的 router。同一個字往上走,每一層被送去的地方都可能不一樣。
The experts aren't a room you visit once. Every layer of the model has its own set and its own router. The same word travels upward, and each floor can send it somewhere different.
代價
The catch
睡著的專家還是佔位子。它們全部都得待在記憶體裡,隨時可能被叫到。 所以 MoE 換來的不是「變小」,而是記憶體照樣大、但每個字的計算量變小。
Sleeping experts still take up space. All of them must sit in memory, ready to be called. So MoE doesn't make the model smaller — it keeps memory large while the compute per word gets small.
100%
記憶體 — 不管醒著還是睡著,每一位專家都得放在 RAM/VRAM 裡
Memory — every expert sits in RAM/VRAM, awake or not
12.5%
計算 — 只有被選中的專家真的做乘法
Compute — only the chosen experts actually multiply anything
這就是整個交易:跑起來便宜,放起來昂貴。 也因此 MoE 在資料中心的大卡上非常划算,在你的筆電上卻很尷尬—— 算力用不完,記憶體先爆掉。
That's the whole trade: cheap to run, expensive to hold. Which is why MoE is a bargain on datacentre cards and awkward on your laptop — you run out of memory long before you run out of compute.
12.9 / 46.7B
活躍 / 總參數
active / total
Mixtral 8×7B 8 位專家選 2,把 MoE 帶進開源主流的那一個。
Mixtral 8×7B — 8 experts, pick 2. The one that brought MoE into the open-source mainstream.
37 / 671B
活躍 / 總參數
active / total
DeepSeek-V3 每個字只動用 5.5%。極端到讓人重新算成本。
DeepSeek-V3 — just 5.5% per word. Extreme enough to make people redo their cost maths.
22 / 235B
活躍 / 總參數
active / total
Qwen3-235B-A22B 名字裡的 A22B 就是「活躍 22B」的意思。
Qwen3-235B-A22B — the A22B in the name literally means 22B active.
會出錯的地方
What goes wrong
沒有人管的話,router 會一直把東西丟給它已經信任的那一位。 那位專家被操到爆,其他人則因為從來沒拿到題目,永遠學不會—— 於是你花錢養的參數,有一大半是死的。
Left alone, the router keeps sending everything to the expert it already trusts. That one drowns, and the others never learn because they never get any work — so half the parameters you paid for sit dead.
一句話
In one breath
蓋一顆很大的腦袋,然後每個字只打開它需要的那一小片。
Build a huge brain, then switch on only the sliver each word needs.
會聽到的幾個詞
Words you'll hear
哪裡看得到
Where you'll find it
三個值得知道的簡化。第一,專家不是獨立的模型,你沒辦法把「化學專家」單獨拆出來用—— 它只是某一層裡的一塊權重。第二,不是每一層都是 MoE:多數模型是 dense 層和 MoE 層交錯。 第三,有些設計會放共享專家(shared expert),對每個 token 都保持開啟, 專門吃掉共通的部分,讓其他專家可以更專心地分工;DeepSeek 系列就是這樣做的。 另外 router 的選擇是離散的(挑了就是挑了),沒辦法直接微分—— 怎麼把梯度傳回 router,本身就是這個領域一大半論文在處理的事。
Three simplifications worth knowing. First, experts are not standalone models — you cannot pull "the chemistry expert" out and run it; it is just a block of weights inside one layer. Second, not every layer is MoE: most models interleave dense layers with MoE layers. Third, some designs add a shared expert that stays on for every token, absorbing the common work so the others can specialise harder — the DeepSeek family does this. And the router's choice is discrete, so it can't be differentiated directly; how to get gradients back to the router is what a good half of the papers in this area are about.