guruswami.ai
Understand AI · Lesson 5 of 8 · 4 min

One big network, or many experts

Two ways to build a large model, and why the largest ones only use part of themselves at a time.

Not all language models are built the same way. The biggest difference is how much of the model works on each token.

Dense models

In a dense model, every parameter takes part in every token. It is one large network, and all of it runs each time.

This is simple and predictable. Speed is steady. The cost is also simple: double the parameters and you double the work for each token.

Mixture of experts

A mixture-of-experts model is built differently. Inside it are many smaller networks called experts. For each token, a small part of the model called the router chooses a few experts to do the work. The others wait.

Over training, experts come to specialise in different kinds of pattern. Nobody assigns the specialities. They emerge.

This is how the largest models are possible at all. One model in our lab has about a trillion parameters. For each token it uses only a small fraction of them, so it runs at a practical speed.

The trade

A mixture-of-experts model gives you more total knowledge for the same amount of work on each token. That is a good deal, with one catch.

Every expert must be loaded into memory, because the router may call any of them for the next token. So the model needs memory for all its parameters and computing power for only some of them.

A dense model is one generalist who reads everything. A mixture of experts is a large staff where only a few are in the room at once. You still have to pay for the whole building.

Why this matters to you

When you compare models, the headline number can mislead.

  • For a dense model, the parameter count tells you both its memory need and its work for each token.
  • For a mixture of experts, look for two numbers: total parameters, which sets the memory, and active parameters, which sets the speed.

A model with a huge total and a small active count can be faster than a dense model a fraction of its size.

Check yourself

Close the page in your mind, then answer

Do not scroll up. Pulling the answer out of your own head is the step that makes it stay.