How Mixture-of-Depths speeds up transformer models
Transformers By What The Future Newsroom · April 7, 2024 · 3 min read

How Mixture-of-Depths speeds up transformer models

Google Deepmind researchers introduced Mixture-of-Depths, a method that lets transformer models spend more computation on important tokens and less on others. The approach can reduce FLOPs while maintaining or exceeding baseline performance, with queries up to 50 percent faster.

Google Deepmind researchers have introduced Mixture-of-Depths, or MoD, as a way to make transformer models use computing power more selectively. Instead of treating every token in a sequence as equally demanding, the method lets the model decide which tokens should receive the more expensive parts of computation.

The result is a shift in how model efficiency is approached. MoD does not simply shrink the model or remove the transformer structure. It changes how much work is assigned inside the model, so resources can follow the tokens that matter most for a given pass.

Why equal computation can be wasteful

Traditional transformer models apply the same amount of computing power to each token in a sequence. That design is simple and predictable, but it assumes that every token needs the same level of processing at every stage.

Mixture-of-Depths challenges that assumption. In the approach described by Google Deepmind researchers, some tokens can move through parts of the model without receiving the full set of computationally intensive calculations. Other tokens, judged more important for the current step, receive deeper processing.

This matters because transformer models often operate under tight limits on time, computing resources, and hardware. If a model can avoid unnecessary work while preserving performance, the saved computation can become valuable in several ways: faster responses, larger training runs, or lower resource requirements.

How Mixture-of-Depths routes tokens

MoD works by placing a fixed upper limit on computation for each pass. The source gives one example: a maximum of 50% of the tokens are allowed to enter the more computationally intensive calculations.

Within each block, the model uses a router. This router assigns a weight value to each token. Tokens with higher weights are selected for additional computation, while tokens with lower weights skip those heavier steps.

During training, the set of tokens with the highest weights is chosen for computation. The remaining tokens continue through the model unchanged. Over time, the model learns which tokens are likely to need more processing and which can safely receive less.

That makes MoD a dynamic allocation method. It does not use one static rule for every token in every context. Instead, the model learns a pattern for distributing its computation across the sequence.

Performance remains the key test

The central question for any efficiency method is whether it saves compute at the expense of useful output. According to the source, MoD models were able to maintain or exceed the performance of the baseline models after training, despite a significant reduction in FLOPs required per prediction.

That finding points to a practical insight: the usual distribution of computational resources inside transformer models is not always optimal. If a model can spend less work on some tokens and more on others, it may preserve performance while using less total computation.

The speed impact is also notable. A query to the fully trained AI model requires only a fraction of the computing power and can be up to 50 percent faster. For applications with high demands on computing time and resources, that kind of efficiency can change how feasible a model is to run.

How MoD fits with Mixture-of-Experts

Mixture-of-Depths can also be combined with the widely used Mixture-of-Experts architecture. The two approaches are described as complementary because they optimize different dimensions of the model.

In plain terms, MoD focuses on how deeply tokens are processed. Mixture-of-Experts, or MoE, is another efficiency-oriented architecture. Used together, the approaches can target more than one source of computational waste.

This is important because scaling AI models is not only about adding more computation. It is also about deciding where that computation should go. MoD adds another mechanism for making that decision inside transformer models.

Why this could matter for larger models

The source notes that dynamically allocating computing power could be especially valuable in application areas with high demands on computing time and resources. If a system can skip expensive work for tokens that do not need it, the same computing budget can go further.

The saved FLOPs could also be used for training larger models. According to the researchers, this direction can also bring memory savings. Some MoD variants require fewer accelerators, which suggests that the efficiency gains could matter when scaling to larger models.

That does not mean MoD removes the need for powerful hardware. The method still operates inside transformer models and still depends on training. But it suggests that the path to better models may include smarter allocation of computation, not only more computation overall.

Mixture-of-Depths is therefore a useful signal for where transformer research is heading. The model does not need to treat every token as equally expensive. By prioritizing key tokens, it can keep performance close to or above a baseline while using computing power more efficiently.

AITransformersGoogle DeepmindModel Efficiency
← Back to the wire

Read next