Expand description
2026-10-02: Prompt-lookup decoding: copy proposals from a sequence’s own history (prompt and generated tokens). An index maps every n-gram of the history to the position just after its latest occurrence, so a proposal costs one hash lookup however long the history is. The proposal is the continuation of that occurrence, up to a window that doubles after a fully accepted copy and halves after a broken one. Host code only.
Owner: speculative. Invariants:
- A proposal is only ever a slice of the history it was asked about: the
ntokens before its start equal the history’s lastntokens, it is non-empty, and it never reaches past the history’s end. - The index never holds the history’s own final n-gram (it has no continuation yet), so a proposal never points at the suffix itself.
- A stale entry (left by a rewind of the history) can never produce a proposal: every hit is re-checked token by token before it is used.
CopyWindow::currentstays within[min, max].
Structs§
- Copy
Window - 2026-10-02: Copy window: how many tokens a copy may propose. It doubles after a copy is accepted in full and halves after one is cut short.
- Prompt
Lookup Config - 2026-10-02: Serve-wide prompt-lookup settings (
--prompt-lookup-*). - Prompt
Lookup Index - 2026-10-02: Per-sequence n-gram index over a token history.
- Prompt
Lookup Seq - 2026-10-02: One sequence’s prompt-lookup state: its index, its copy window, and the length of the copy now awaiting verification (0 when the pending drafts are the model drafter’s).
Constants§
- WINDOW_
START - 2026-10-02: Where a sequence’s copy window starts (capped at
--prompt-lookup-max-drafts). A short first copy bounds the verify rows an untested match can waste; a fully accepted copy doubles the window.
Functions§
- backoff_
rounds - 2026-10-02: Rounds to skip after
missescopies in a row that matched nothing:2^(misses-1), capped atcap(0 for no backoff).