Token LabBuscar

← Todas las herramientas
Solo local · Sin llamadas a modelos

Laboratorio de decodificación especulativa

Explora cuándo un modelo borrador acelera o ralentiza según aceptación y latencias explícitas.

Study guide & lesson outlineLEARNING CONTRACT

Understand → implement → investigate

Goal: explain the mechanism in this lesson, reproduce one example and test a failure case. Reading alone does not mark mastery.

01Configurar

02Añadir entrada

Configura los parámetros, carga un ejemplo o pega tus datos.

03Revisar resultados

Configura los parámetros, carga un ejemplo o pega tus datos.

La vista puede estar truncada; el JSON exportado incluye todos los resultados calculados.

Cómo interpretar los resultados

Simula ciclos de propuesta y verificación. Cada ronda propone γ tokens, acepta un prefijo con probabilidad independiente constante α y emite el prefijo más un token corrector/extra. Coste: γ × latencia del borrador + verificación. La verificación es un valor introducido y puede crecer con γ en la práctica. No ejecuta modelos ni evalúa calidad; excluye KV, comunicación, lotes y planificación.

E[emitidos] = 1 + α + … + α^γ. Aceleración = E[emitidos] × latencia base / (γ × latencia borrador + verificación). Menos de 1 significa más lento que la referencia.

Referencias del método

MATHEMATICAL REVIEW · 2026-10-26

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.

Draft length γ and acceptance α → Expected emissions geometric sum → Draft + fixed verifier latency → Compare modeled speedup and samples
Mechanism map: follow the transformations from top to bottom.

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 model

Test 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 checks

Predict, 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