Mixture-of-Depths: Dynamically allocating compute in transformer-based language models
David Raposo Sam Ritter Google DeepMind Blake Richards Google DeepMind McGill University、Mila Timothy Lillicrap Google DeepMind Peter Conway Humphreys Google DeepMind Adam Santoro
Abstract
Transformer-based language models spread FLOPs uniformly across input sequences. In this work we demonstrate that transformers can instead learn to dynamically allocate FLOPs (or compute) to specific positions in a sequence, optimising the allocation along the sequence for different layers across the model depth. Our method enforces a total compute budget by capping the number of tokens ( $k$ ) that can participate in the self-attention and MLP computations at a given layer. The tokens to be processed are determined by the network using a top- $k$ routing mechanism. Since $k$ is defined a priori, this simple procedure uses a static computation graph with known tensor sizes, unlike other conditional computation techniques. Nevertheless, since the identities of the $k$ tokens are fluid, this method can expend FLOPs non-uniformly across the time and model depth dimensions. Thus, compute expenditure is entirely predictable in sum total, but dynamic and context-sensitive at the token-level. Not only do models trained in this way learn to dynamically allocate compute, they do so efficiently. These models match baseline performance for equivalent FLOPS and wall-clock times to train, but r
原文 arXiv:2404.02258;中英对照 + 大白话阅读 https://aha.fim.ai/paper/2404.02258v1