# Dekodowanie spekulatywne

EN: **Speculative decoding** · id `specdec`

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Inferencja i infrastruktura](https://aiatlasgraph.com/t/systems.md) › [Serwowanie i dekodowanie](https://aiatlasgraph.com/t/serving.md) › Dekodowanie spekulatywne

## Description

- PL: Tani model zgaduje kilka tokenów naprzód, duży tylko je sprawdza.
- EN: A cheap model guesses several tokens ahead; the big one only verifies them.

## In one sentence

- PL: To przyspieszanie odpowiedzi przez przygotowanie kilku fragmentów z wyprzedzeniem i sprawdzenie ich przez docelowy model.
- EN: This accelerates responses by drafting several elements ahead and having the target model verify them.

## Problem it solves

- PL: Duży model generuje tekst po jednym kawałku, choć wiele kolejnych fragmentów jest łatwych do przewidzenia.
- EN: A large model generates text one piece at a time, even when many upcoming elements are easy to predict.

## What it does

- PL: Tańszy model proponuje ciąg dalszy, a docelowy sprawdza kilka propozycji razem i odrzuca niepasującą część zgodnie z regułą wyboru.
- EN: A cheaper model drafts continuations, while the target checks proposals together and rejects unsuitable portions according to the sampling rule.

## Everyday example

- PL: Asystent szybciej przygotowuje rutynową odpowiedź, gdy większy model przyjmuje wiele fragmentów szkicu z jednej wspólnej kontroli.
- EN: An assistant produces a routine response faster when the larger model accepts several draft elements in one shared check.

## This concerns you if you…

- PL: chcesz skrócić czas generowania
- PL: możesz sprawdzać szkice tańszego modelu
- EN: want to shorten generation time
- EN: can verify drafts from a cheaper model

## Keywords

draft model · Medusa · EAGLE · rejection sampling · token acceptance rate · parallel verification

## How it works

- PL: Tańszy mechanizm proponuje kilka tokenów, które model docelowy ocenia w jednym przebiegu. Reguła akceptacji oraz korekta po odrzuceniu wybierają zachowany prefiks; poprawne próbkowanie pozwala zachować rozkład modelu docelowego.
- EN: A cheaper mechanism proposes several tokens that the target model scores in one pass. Acceptance rules and rejection correction select the retained prefix; correct sampling can preserve the target model's distribution.

## Limits

- PL: Niska zgodność propozycji zmniejsza zysk, a dodatkowy model zużywa pamięć i obliczenia. Dokładność rozkładu zależy od właściwej reguły akceptacji; przybliżone warianty mogą zmieniać zachowanie.
- EN: Poor proposal agreement reduces gains, and extra models consume memory and computation. Distribution fidelity depends on correct acceptance rules; approximate variants can change behaviour.

## Key terms

- PL: **draft model**: Tańszy model lub mechanizm proponujący kandydackie tokeny.
- PL: **próbkowanie odrzucające**: Reguła akceptacji i korekty zachowująca określony rozkład docelowy.
- EN: **draft model**: A cheaper model or mechanism proposing candidate tokens.
- EN: **rejection sampling**: An acceptance and correction rule preserving a specified target distribution.

## Know first

- [Statystyka i niepewność (Statistics and uncertainty)](https://aiatlasgraph.com/t/probability.md)
- [Enkoder, dekoder i enkoder–dekoder (BERT, GPT, T5) (Encoder-only, decoder-only and encoder–decoder models)](https://aiatlasgraph.com/t/transformerfamilies.md)

## Examples

- PL: Medusa · EAGLE · model szkicowy
- EN: Medusa · EAGLE · draft model

## Sources

- [Performance Engineering for AI Infra — learning guide](<https://github.com/wafer-ai/gpu-perf-engineering-resources>) `wafer-gpu` · GitHub repository · tiered curriculum (Tier 1–3) · MIT licence · by Wafer (wafer-ai): Company material with a hiring note, but the evidence is mostly primary sources. Table of contents sieved: only topics became nodes; tiers kept as link labels.

---

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