Skip to main content
QUICK REVIEW

[Paper Review] Better & Faster Large Language Models via Multi-token Prediction

Fabian Gloeckle, Badr Youbi Idrissi|arXiv (Cornell University)|Apr 30, 2024
Natural Language Processing TechniquesComputer Science8 citations
TL;DR

The paper trains language models to predict multiple future tokens simultaneously, improving sample efficiency and enabling faster inference with self-speculative decoding, with notable gains on code tasks and scaling benefits up to 13B parameters.

ABSTRACT

Large language models such as GPT and Llama are trained with a next-token prediction loss. In this work, we suggest that training language models to predict multiple future tokens at once results in higher sample efficiency. More specifically, at each position in the training corpus, we ask the model to predict the following n tokens using n independent output heads, operating on top of a shared model trunk. Considering multi-token prediction as an auxiliary training task, we measure improved downstream capabilities with no overhead in training time for both code and natural language models. The method is increasingly useful for larger model sizes, and keeps its appeal when training for multiple epochs. Gains are especially pronounced on generative benchmarks like coding, where our models consistently outperform strong baselines by several percentage points. Our 13B parameter models solves 12 % more problems on HumanEval and 17 % more on MBPP than comparable next-token models. Experiments on small algorithmic tasks demonstrate that multi-token prediction is favorable for the development of induction heads and algorithmic reasoning capabilities. As an additional benefit, models trained with 4-token prediction are up to 3 times faster at inference, even with large batch sizes.

Motivation & Objective

  • Motivate multi-token prediction as a more sample-efficient training objective for LLMs beyond next-token prediction.
  • Propose a memory-efficient multi-token prediction architecture with a shared trunk and multiple heads.
  • Demonstrate scaling benefits and faster inference when using multi-token prediction, especially for code tasks.
  • Show that multi-token prediction preserves or improves performance on natural language generation and downstream tasks after fine-tuning.

Proposed method

  • Introduce a multi-token prediction objective where the model predicts n future tokens at each position using n independent heads on a shared trunk.
  • Derive a tractable cross-entropy loss L_n that factorizes over the shared representation and per-head predictions.
  • Describe a memory-efficient forward/backward scheme that reduces peak memory from O(nV+d) to O(V+d).
  • Use self-speculative decoding to speed up inference by leveraging additional heads without extra draft models.
  • Evaluate across code and natural language benchmarks with varying model sizes (up to 13B parameters) and data scales, including byte-level tokenization.
Figure 1 : Overview of multi-token prediction. (Top) During training, the model predicts $4$ future tokens at once, by means of a shared trunk and $4$ dedicated output heads. During inference, we employ only the next-token output head. Optionally, the other three heads may be used to speed-up infere
Figure 1 : Overview of multi-token prediction. (Top) During training, the model predicts $4$ future tokens at once, by means of a shared trunk and $4$ dedicated output heads. During inference, we employ only the next-token output head. Optionally, the other three heads may be used to speed-up infere

Experimental results

Research questions

  • RQ1Does predicting multiple future tokens at training time improve downstream performance compared to standard next-token prediction?
  • RQ2How does multi-token prediction scale with model size and training data for code and natural language tasks?
  • RQ3Can multi-token training enable faster inference via speculative decoding without extra computational cost?
  • RQ4What are the effects of different prediction window sizes (n) on performance across tasks and data regimes?

Key findings

  • Multi-token prediction yields higher sample efficiency, with 13B-parameter models solving about 12% more problems on HumanEval and 17% more on MBPP than next-token baselines.
  • Training with 4-token prediction achieves substantial gains and enables up to 3x faster inference via self-speculative decoding, especially on code benchmarks.
  • The benefits scale with model size and persist under multiple epochs, with notable improvements on code tasks and byte-level modeling.
  • 2-token prediction often matches next-token baselines on standard NLP benchmarks, while 4-token prediction can degrade performance on some language tasks, indicating task- and data-dependent effects.
  • Finetuning pretrained multi-token models on CodeContests improves pass@k across settings, with next-token finetuning on top of a 4-token pretraining sometimes being the strongest overall.
Figure 2 : Order of the forward/backward in an $n$ -token prediction model with $n=2$ heads. By performing the forward/backward on the heads in sequential order, we avoid materializing all unembedding layer gradients in memory simultaneously and reduce peak GPU memory usage.
Figure 2 : Order of the forward/backward in an $n$ -token prediction model with $n=2$ heads. By performing the forward/backward on the heads in sequential order, we avoid materializing all unembedding layer gradients in memory simultaneously and reduce peak GPU memory usage.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.