추측 디코딩 실험
수락률과 지연 가정을 명시해 초안 모델의 가속 및 감속 조건을 살펴봅니다.
Study guide & lesson outline
LEARNING CONTRACTUnderstand → implement → investigate
Goal: explain the mechanism in this lesson, reproduce one example and test a failure case. Reading alone does not mark mastery.
- Understand: state assumptions, shapes/units and a counterexample.
- Implement: reproduce a numerical example and inspect boundaries.
- Investigate: compare one alternative under a matched budget.
01설정
02입력 추가
설정 후 예제를 불러오거나 입력을 붙여 넣으세요.
03결과 확인
설정 후 예제를 불러오거나 입력을 붙여 넣으세요.
화면은 일부만 표시할 수 있으며 JSON 보고서는 전체 계산 결과를 포함합니다.
결과 해석
표준 초안/검증 주기 모형입니다. 매번 γ토큰을 제안하고 독립적인 일정 수락률 α에 따라 접두사를 수락한 뒤 수정/추가 토큰 하나를 출력합니다. 비용은 γ×초안 지연+검증 지연입니다. 검증 비용은 입력값이며 실제로 γ와 함께 증가할 수 있습니다. 실제 모델 실행이나 품질 평가가 아니며 KV, 통신, 배치, 스케줄링을 제외합니다.
E[출력] = 1 + α + … + α^γ. 가속비 = E[출력] × 기준 지연 / (γ × 초안 지연 + 검증 지연). 1 미만은 기준보다 느림을 뜻합니다.
방법 참고 자료
Assumptions, implementation & acceptance
Expected emissions 1+α+…+α^γ assume independent identical acceptance and a fixed verifier latency. This latency simulator is distinct from exact rejection-sampling correctness.
Reviewed counting units, statistical assumptions and numerical examples. Provider accounting and actual GPU allocation still require external measurement.
Before running: predict a boundary case
Expected emissions 1+α+…+α^γ assume independent identical acceptance and a fixed verifier latency. This latency simulator is distinct from exact rejection-sampling correctness.
Hint: isolate the assumption
Keep the baseline input fixed, change one parameter or boundary, and compare both the numerical result and the claimed units. A passing example verifies this fixture only.
Minimal executable example
Save the example and linked modules in one folder. Use Node.js 22 or newer, then run node speculative-decoding.mjs. npm install gpt-tokenizer@4.1.0
import {encode as rawEncode} from 'gpt-tokenizer/encoding/cl100k_base';
import {promptDiff,inspectDataset,chunkDocument,compareScores,estimateVRAM,samplingLab,speculativeLab} from './research-core.mjs';
const encode=s=>rawEncode(s,{disallowedSpecial:new Set()});
const result=speculativeLab(4,1,3,40,30,100,42);
console.log(result.expected,result.observed); // 5 5, under independent acceptance modelTest and transfer
Expected emissions 1+α+…+α^γ assume independent identical acceptance and a fixed verifier latency. This latency simulator is distinct from exact rejection-sampling correctness.
Record input, code version, expected result and observed result in the notebook below. Then construct a counterexample that violates the assumption above and explain why the original conclusion no longer follows.
Download complete kit (.tar.gz) · Complete reference kit and regression checksPredict, test and keep evidence
Before revealing an answer, predict one result. After the exercise, record the discrepancy and a transfer test. Saved locally across language editions.
Open notebook / export / clear →The mathematical review scope is recorded per lesson. It does not establish empirical paper reproduction; report suspected errors in your notes. Review scope