← Latest papers
💬 NLP

LogitSpec: Accelerating Retrieval-based Speculative Decoding via Next Next Token Speculation

LogitSpec is a training-free, plug-and-play retrieval-based speculative decoding method that accelerates LLM inference by leveraging the last token's logits to speculate the "next-next" token, thereby expanding the retrieval range to achieve up to 2.61× speedup and higher token acceptance rates.

Original authors: Tianyu Liu, Qitan Lv, Hao Li, Xing Gao, Xiao Sun, Xiaoyan Sun

Published 2026-04-30
📖 4 min read☕ Coffee break read

Original authors: Tianyu Liu, Qitan Lv, Hao Li, Xing Gao, Xiao Sun, Xiaoyan Sun

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are a master chef (the Large Language Model, or LLM) trying to write a complex recipe. The old way of doing this is very slow: you think of one word, write it down, wait for the computer to check if it's correct, then think of the next word, and so on. It's like writing a letter one letter at a time, waiting for a stamp of approval after every single letter.

Speculative Decoding is a new way to speed this up. Instead of writing one word at a time, you hire a sous-chef (a draft model) to guess the next few words for you. You then quickly check if the sous-chef was right. If they were, you accept all those words at once. If they were wrong, you just throw away the wrong guesses and try again. This saves a lot of time.

However, hiring a sous-chef has problems:

  1. You have to train them specifically for your kitchen (expensive and hard).
  2. They take up extra space in your kitchen (memory).
  3. If you change your main recipe, you have to retrain the sous-chef.

The Problem with "Retrieval" (The Library Approach)

Some researchers tried to solve this by firing the sous-chef and using a library instead. Instead of a person guessing, the computer looks at what you've already written and searches a massive database of past recipes to find a matching phrase.

The Flaw: This is like trying to find the next word in a sentence by looking at the immediately previous word.

  • Your sentence: "What is the area of the..."
  • The Library's guess: It sees "the" and thinks, "Oh, 'the' usually goes with 'triangle'!" (Because it found a past sentence: "What is the area of the triangle?").
  • The Reality: You actually wanted to say "What is the area of the circle?" or "What is the area of the field?"
  • Result: The library gets stuck on the wrong word because it's only looking at the immediate context, not the whole idea.

The Solution: LogitSpec (The "Crystal Ball" Chef)

The authors of this paper, LogitSpec, realized that the main chef (the LLM) actually has a hidden superpower it doesn't use often enough.

When the chef predicts the next word, they also have a "feeling" (mathematically called logits) about what comes after that next word. Even though the chef is only supposed to say the next word, their brain is already whispering, "And after that, it's probably 'circle'."

LogitSpec uses this whisper to fix the library search.

Here is how it works, step-by-step, using a creative analogy:

1. The "Crystal Ball" Step

Instead of just looking at the last word ("the"), LogitSpec asks the chef: "If you had to guess the word two steps ahead, what would it be?"

  • The chef looks at its internal "feelings" and says, "I bet the word after 'the' is 'circle'."
  • This is the Next-Next Token Speculation.

2. The "Super-Search" Step

Now, instead of searching the library for just "the", LogitSpec searches for the phrase "the circle".

  • Old Way (Vanilla Retrieval): Searches for "the". Finds "the triangle", "the sky", "the dog". (Wrong!)
  • LogitSpec Way: Searches for "the circle". Finds "the circle of friends", "the circle of life", "the circle of the field". (Much more accurate!)

3. The Verification

The computer takes these better guesses and checks them against the master chef. Because the guesses are now much more accurate, the master chef accepts them more often.

Why is this a big deal?

  • No Extra Training: You don't need to hire or train a new sous-chef. You just use the main chef's existing "feelings" (logits) that were already there.
  • Plug-and-Play: It works with any existing language model without changing its code or weights.
  • Speed: In their tests, this method made the computer 2.6 times faster at writing text. It also meant the computer could accept, on average, 3.28 words at a time instead of just one.

The Bottom Line

Think of LogitSpec as a detective who doesn't just look at the crime scene (the last word) to guess what happened next. Instead, the detective uses a psychic hunch (the logit) to guess the next crime scene, and then uses that hunch to find the perfect evidence in the library.

By looking two steps ahead, the system stops getting confused by similar-looking words and finds the right words much faster, making AI write text significantly quicker without needing any extra training or expensive hardware.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →