HackerPapers

arXiv:2404.02258cs.LG

Mixture-of-Depths: Dynamically allocating compute in transformer-based language models

David Raposo, Sam Ritter, Blake Richards, Timothy Lillicrap, Peter Conway Humphreys, 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 require a fraction of the FLOPs per forward pass, and can be upwards of 50\% faster to step during post-training sampling.

arXiv comments
Journal reference
DOI
Subjects
cs.LGMachine Learning cs.CLComputation and Language

On Hacker News

Linked by 3 identifiable commenters in 3 comments across 3 threads, from Apr 2024 to Sep 2026. Found in 5 HN submissions from Apr 2024 to Apr 2024. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments3 threads

    • I'm kinda surprised that the mixture of depths paper didn't come up here. It approaches the other direction of sometimes dropping layers: https://arxiv.org/abs/2404.02258

      lwarfieldView on HNParent context

    • There has been some work to dynamically reduce the compute required by a network. See for example: https://arxiv.org/abs/2404.02258 They have a fixed compute budget which is lower than what the LLM need, and dynamically decide to allocate this compute budget to different part of…

      SuchAnonMuchWowView on HNParent context

    • It also feels similar to mixture of depths (https://arxiv.org/abs/2404.02258). Being able to apply this post-training is pretty cool though, makes it easier to use across a wider range of setups.

      huacView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.