# Przewidywanie wielu tokenów naraz (multi-token prediction)

EN: **Multi-token prediction** · id `multitoken` · aliases: multi-token prediction, MTP, predykcja wielu tokenów, n-token prediction

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Trenowanie i dostrajanie](https://aiatlasgraph.com/t/training.md) › [Trening od zera / pretraining](https://aiatlasgraph.com/t/pretraining.md) › Przewidywanie wielu tokenów naraz (multi-token prediction)

## Description

- PL: Pomocniczy cel pretrainingu: z każdej pozycji model przewiduje kilka kolejnych tokenów osobnymi głowicami.
- EN: An auxiliary pretraining objective: from each position the model predicts several upcoming tokens with separate heads.

## In one sentence

- PL: Trening, w którym model zgaduje nie tylko następne słowo, ale od razu kilka kolejnych, co uczy go patrzeć dalej do przodu.
- EN: Training in which the model guesses not just the next word but several at once, teaching it to look further ahead.

## Problem it solves

- PL: Przewidywanie jednego słowa naraz uczy krótkowzroczności i każe generować tekst powoli, słowo po słowie.
- EN: Predicting one word at a time encourages short-sightedness and forces slow, word-by-word generation.

## What it does

- PL: Jak kierowca, który patrzy kilka samochodów przed siebie, a nie tylko na zderzak tego tuż przed nim.
- EN: Like a driver who watches several cars ahead rather than just the bumper in front.

## Everyday example

- PL: Podpowiadacz w edytorze kodu szybciej proponuje całe linijki, bo model przewiduje kilka elementów naprzód jednocześnie.
- EN: A code editor's autocomplete suggests whole lines faster because the model predicts several pieces ahead at once.

## This concerns you if you…

- PL: ciekawi cię, czym nowsze modele różnią się od starszych
- PL: zależy ci na szybszym generowaniu tekstu
- EN: wonder how newer models differ from older ones
- EN: care about faster text generation

## Keywords

MTP · auxiliary loss · self-speculative decoding · Medusa heads · DeepSeek-V3 MTP · sample efficiency

## How it works

- PL: Na wspólnym trzonie sieci umieszcza się n głowic wyjściowych; k-ta przewiduje token na pozycji t+k, a straty się sumuje. Po treningu dodatkowe głowice można pominąć albo użyć do samospekulatywnego dekodowania, przyspieszając inferencję.
- EN: n output heads sit on a shared trunk; head k predicts the token at position t+k, and the losses are summed. After training the extra heads can be dropped or used for self-speculative decoding to speed up inference.

## Limits

- PL: Korzyści raportowano głównie dla dużych modeli i kodu; w małych modelach bywają słabe lub ujemne. Dodatkowe głowice zwiększają pamięć w treningu, a liczba przewidywanych tokenów to kolejny hiperparametr.
- EN: Gains were reported mainly for large models and code; in small models they can be weak or negative. Extra heads add training memory, and the number of predicted tokens is another hyperparameter.

## Key terms

- PL: **głowica wyjściowa**: Końcowa warstwa zamieniająca stan modelu na rozkład nad tokenami.
- PL: **samospekulatywne dekodowanie**: Model sam proponuje kilka tokenów i sam je sprawdza w jednym kroku.
- EN: **output head**: A final layer turning the model's state into a distribution over tokens.
- EN: **self-speculative decoding**: The model drafts several tokens and verifies them itself in one step.

## Know first

- [Przewidywanie następnego tokenu (modele autoregresyjne) (Next-token prediction objective)](https://aiatlasgraph.com/t/nexttoken.md)
- [Funkcje straty (entropia krzyżowa, MSE) (Loss functions (cross-entropy, MSE))](https://aiatlasgraph.com/t/lossfunctions.md)

## Sources

- [Better & Faster Large Language Models via Multi-token Prediction](<https://arxiv.org/abs/2404.19737>) `gloeckle-2024-mtp` · by Fabian Gloeckle, Badr Youbi Idrissi, Baptiste Rozière, David Lopez-Paz, Gabriel Synnaeve

---

AI Atlas revision 122 (2026-10-30) · HTML: https://aiatlasgraph.com/t/multitoken · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-10-30
