Tutorials¶
Each tutorial covers one technique: what it does, how to attach it to a model, how to train the parameters it adds, which decoding options it supports, how to combine it with other techniques and how to serve it. All tutorials start from the same small model and prompt, so that every example runs on one GPU in a few seconds.
Drafting¶
| Technique | Summary | Lossless |
|---|---|---|
dflash |
DFlash: block drafting with a small decoder conditioned on the model's features. | yes |
dmtd |
DMTD: the late layers decode several tokens per cycle from their embeddings, and the drafts are kept. | no |
draft_model |
Speculative decoding with a separate, smaller draft LM. | yes |
draft_model_hier |
Speculative decoding with a separate draft LM that runs economize techniques of its own. | yes |
draft_with |
Self-speculative drafting with the base model as other techniques change it (see DraftWithConfig). |
yes |
eagle |
EAGLE-1 and EAGLE-2: one draft decoder layer on the model's features, with a static or dynamic draft tree. | yes |
eagle3 |
EAGLE-3 (Li et al., 2025): one draft decoder layer with its own attention and KV cache. | yes |
early_exit |
Self-speculative early exit: draft tokens run the model's first r layers and exit there. |
yes |
free |
FREE: a shallow exit model emits confident tokens, and the deep layers catch up on them in one parallel pass. | no |
frspec |
FR-Spec: the drafts of another drafter restricted to a frequent-token vocabulary. | yes |
gemma4_assistant |
Speculative decoding with the assistant model published for Gemma 4. | yes |
hidden_transfer |
Hidden Transfer: trained linear maps turn an intermediate hidden state into pseudo states of future tokens, which the upper layers decode into drafts. | yes |
hybrid |
Prompt lookup (or another primary drafter) where it finds a draft, a fallback drafter elsewhere. | yes |
hydra |
Hydra: Medusa-style draft heads that also read the tokens drafted before them. | yes |
kangaroo |
Kangaroo (Liu et al., 2024): self-speculative drafting through a shallow sub-network and an adapter. | yes |
knapspec |
KnapSpec (Cha et al., ICML 2026): self-speculative drafting with an adaptive set of skipped sublayers. | yes |
layer_skip |
Self-speculative whole-layer greedy skip: draft tokens run the model without a fixed set of whole layers. | yes |
lookahead |
Lookahead decoding: n-grams from a Jacobi window of the model itself, verified in the same exact pass. | yes |
lookup |
Prompt-lookup drafting: drafts are copied from earlier text that ended in the same n-gram. | yes |
magicdec |
MagicDec: the base model drafts on a StreamingLLM view of its own KV cache. | yes |
medusa |
Medusa: extra heads on the last hidden state draft several future tokens at once. | yes |
pard |
PARD: a separate draft model that drafts several tokens in one parallel forward pass. | yes |
placed_draft_model |
Speculative decoding with a separate draft model placed on another device. | yes |
redrafter |
ReDrafter: a recurrent draft head on the model's last hidden state. | yes |
rest |
REST: drafts retrieved from a datastore of text by the context's longest matching suffix. | yes |
suffix_decoding |
SuffixDecoding: drafts from a suffix structure over earlier responses and the row's own tokens. | yes |
triforce |
TriForce: the base model drafts on the prompt chunks its query attends to. | yes |
vendor_mtp |
The multi-token-prediction modules that DeepSeek-V3, GLM-4.5, MiMo and Qwen3.5 ship, as a drafter. | yes |
Draft compression¶
| Technique | Summary | Lossless |
|---|---|---|
draft_prune |
N:M pruning of the drafter's own modules (see DraftPruneConfig). |
yes |
draft_quant |
Round-to-nearest quantization of the drafter's own modules (see DraftQuantConfig). |
yes |
Dynamic depth¶
| Technique | Summary | Lossless |
|---|---|---|
calm |
CALM: a token exits at the first layer where a confidence measure clears a threshold. | no |
flexidepth |
FlexiDepth: a router per layer sends low-scoring tokens through a light adapter instead of the layer. | no |
gateskip |
GateSkip: trained residual gates per layer, and the tokens with the lowest gates skip the layer. | no |
loradrop |
LoRA-Drop: droppable layers run in full every few tokens, and in between reuse their last output plus a LoRA correction. | no |
mod |
Mixture-of-Depths: a router per routed layer sends only a fraction of the tokens through the layer. | no |
skipdecode |
SkipDecode: a layer budget that falls with the generated position, skipping the lowest layers. | no |
Weight compression¶
| Technique | Summary | Lossless |
|---|---|---|
depth_prune |
ShortGPT and SLEB: removal of the decoder layers that change the hidden state least. | no |
littlebit |
LittleBit binary low-rank factorization of linear maps (see LittleBitConfig). |
no |
lowrank |
SVD-LLM / truncated-SVD factorization of linear maps (see LowRankConfig). |
no |
prune |
Wanda / SparseGPT / magnitude 2:4 pruning stored as semi-structured sparse tensors (see PruneConfig). |
no |
quant |
Weight-only RTN / GPTQ / AWQ quantization to int2-8 or fp8 (see QuantConfig). |
no |
rotate |
QuaRot's Hadamard rotations (see RotateConfig), an enabler of a following weight quantization. |
yes |
slicegpt |
SliceGPT: rotate the residual stream onto its principal components and delete the trailing ones. | no |
width_prune |
Structured width pruning: delete attention head groups, FFN channels and residual channels. | no |
Activation sparsity¶
| Technique | Summary | Lossless |
|---|---|---|
cats |
Training-free threshold sparsity of the gated-MLP activations (CATS, see CatsConfig). |
no |
dejavu |
Contextual FFN-channel sparsity with a trained predictor per layer (Deja Vu, see DejaVuConfig). |
no |
teal |
Training-free magnitude activation sparsity (TEAL, see TealConfig). |
no |
KV-cache quantization¶
| Technique | Summary | Lossless |
|---|---|---|
kivi |
KIVI: the KV cache in low-bit codes, keys quantized per channel and values per token. | no |
kivi_fused |
KIVI quantization of the KV cache, attended over as packed codes (see FusedKIVIConfig). |
no |
kv_fp8 |
KV cache in 8-bit floats (see FP8KVConfig). Training-free; no parameters. |
no |
kv_fp8_fused |
KV cache in 8-bit floats, decoded inside the attention kernel (see FusedFP8KVConfig). |
no |
KV-cache eviction¶
| Technique | Summary | Lossless |
|---|---|---|
duo_attention |
DuoAttention: retrieval heads keep the full KV cache, streaming heads keep attention sinks and a recent window. | no |
kv_evict |
KV-cache eviction with StreamingLLM, H2O or SnapKV: committed entries outside the kept set are forgotten. | no |
kv_evict_fused |
One-shot KV eviction decoded on a fused kernel over compact pools (see FusedKVEvictConfig). |
no |
Sparse decoding attention¶
| Technique | Summary | Lossless |
|---|---|---|
quest |
Quest: every decoding query reads only the KV-cache pages whose keys can score high. | no |
Sparse prefill attention¶
| Technique | Summary | Lossless |
|---|---|---|
minference |
MInference: long prompts attend over a sparse pattern per head that is fitted at prefill. | no |