← Latest papers
💬 NLP

When Speculation Spills Secrets: Side Channels via Speculative Decoding In LLMs

This paper reveals that speculative decoding in large language models creates a new side-channel vulnerability where adversaries can infer user queries and leak confidential data by monitoring token counts or packet sizes, while also proposing and evaluating effective countermeasures such as packet padding and token aggregation.

Original authors: Jiankun Wei, Abdulrahman Abdulrazzag, Tianchen Zhang, Adel Muursepp, Gururaj Saileshwar

Published 2026-02-12
📖 4 min read☕ Coffee break read

Original authors: Jiankun Wei, Abdulrahman Abdulrazzag, Tianchen Zhang, Adel Muursepp, Gururaj Saileshwar

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 at a busy restaurant. You order a complex meal, and the chef (the AI) starts cooking. To save time, the chef has a sous-chef who guesses what the next few ingredients you'll need and preps them in advance.

  • If the sous-chef guesses right, the chef grabs a whole tray of prepped ingredients at once.
  • If the sous-chef guesses wrong, the chef has to stop, throw the tray away, and start chopping one ingredient at a time, one by one.

This "guessing ahead" technique is called Speculative Decoding. It makes AI chatbots much faster.

The Problem:
The paper "When Speculation Spills Secrets" reveals a sneaky way hackers can eavesdrop on your private conversations with these AI chatbots, not by breaking the encryption, but by watching the size of the delivery packages.

The "Package Size" Leak

Think of the AI's response as a stream of digital packages being sent to your phone.

  • Big Package: The AI guessed right! It sent 5 words at once. The package is big.
  • Small Package: The AI guessed wrong! It sent only 1 word. The package is tiny.

Even though the content of the message is locked in a secure vault (encrypted), the size of the box is visible to anyone watching the delivery truck (a hacker on your Wi-Fi or internet provider).

The Attack: "The Secret Code of Sizes"

The researchers discovered that the pattern of big and small packages is unique to every single question you ask. It's like a fingerprint made of box sizes.

  1. The Setup: A hacker pretends to be a customer. They ask the AI 50 different questions (e.g., "What are the symptoms of the flu?" vs. "What are the symptoms of a broken leg?").
  2. The Fingerprinting: They record the pattern of package sizes for each question.
    • Question A might look like: Big, Big, Small, Big, Big.
    • Question B might look like: Small, Small, Big, Small.
  3. The Eavesdrop: Later, they watch a real user talking to the AI. They see the user's package sizes: Big, Big, Small, Big, Big.
  4. The Result: The hacker matches the pattern and instantly knows, "Ah! That user is asking about the flu!"

In their tests, this worked incredibly well. For some AI systems, they could guess the user's question with over 90% accuracy, even if the user was asking about sensitive medical issues or private insurance details.

The "Data Heist"

It gets worse. Some AI systems use a "library" of past conversations to make better guesses. The researchers showed that a hacker could trick the AI into revealing the contents of this secret library. By asking specific questions and watching which guesses were "correct" (big packages) and which were "wrong" (small packages), they could slowly steal the entire library of private data the AI was using, leaking about 25 words per second.

The Solution: "Padding the Boxes"

How do we stop this? The paper suggests two main fixes, using the restaurant analogy:

  1. The "Uniform Box" Strategy (Padding):
    Imagine the restaurant decides that every delivery, whether it's 1 word or 10 words, must go in a giant, identical box. If the AI only has 1 word, they stuff the box with fake, empty paper until it's the same size as the biggest box.

    • Pros: The hacker can no longer tell how many words were sent. The secret is safe.
    • Cons: It's wasteful. You are shipping a lot of empty paper, which slows down the delivery and costs more money.
  2. The "Batch Delivery" Strategy (Aggregation):
    Instead of sending a package every time the AI thinks of a word, the restaurant waits until the AI has thought of, say, 10 words, and then sends them all in one big batch.

    • Pros: It hides the pattern of "guessing right" vs. "guessing wrong."
    • Cons: The user has to wait longer to see the first word of the answer, making the chat feel sluggish.

The Takeaway

This paper is a wake-up call. We often think that if our data is encrypted, we are safe. But this research shows that how fast and in what chunks data is sent can leak just as much information as the data itself.

As AI gets faster and smarter, we need to make sure we don't accidentally leave the "back door" open by letting the size of our digital packages give away our secrets.

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 →