vllm - 💡(How to fix) Fix [RFC]: Can we implement n-gram and suffix speculative decoding in model_runner_v2? [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vllm-project/vllm#38069Fetched 2026-04-08 01:26:49
View on GitHub
Comments
2
Participants
3
Timeline
16
Reactions
2
Author
Timeline (top)
mentioned ×6subscribed ×6commented ×2labeled ×1
RAW_BUFFERClick to expand / collapse

Motivation.

I noticed that Eagle has been implemented in model_runner_v2. Can we introduce the n-gram and suffix speculative inference methods into v2? Compared with model-based methods, these two should be easier to implement.

Proposed Change.

Implement n-gram and suffix speculative decoding based on model_runner_v2.

Feedback Period.

1–2 weeks for initial feedback.

CC List.

@WoosukKwon @TheEpicDolphin

Any Other Things.

No response

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

extent analysis

Fix Plan

To introduce n-gram and suffix speculative inference methods into model_runner_v2, we will implement the following steps:

  • Modify the model_runner_v2 class to include n-gram and suffix speculative decoding methods.
  • Update the decode method to call the new n-gram and suffix speculative decoding methods.

Example Code

class ModelRunnerV2:
    def __init__(self, model):
        self.model = model

    def decode(self, input_text):
        # Call n-gram speculative decoding method
        n_gram_result = self.n_gram_speculative_decoding(input_text)
        
        # Call suffix speculative decoding method
        suffix_result = self.suffix_speculative_decoding(input_text)
        
        # Combine results
        return n_gram_result, suffix_result

    def n_gram_speculative_decoding(self, input_text):
        # Implement n-gram speculative decoding logic here
        # For example:
        n_grams = self.extract_n_grams(input_text)
        return self.model.predict(n_grams)

    def suffix_speculative_decoding(self, input_text):
        # Implement suffix speculative decoding logic here
        # For example:
        suffixes = self.extract_suffixes(input_text)
        return self.model.predict(suffixes)

    def extract_n_grams(self, input_text):
        # Implement n-gram extraction logic here
        # For example:
        n_grams = []
        for i in range(len(input_text)):
            n_grams.append(input_text[i:i+3])  # Extract 3-grams
        return n_grams

    def extract_suffixes(self, input_text):
        # Implement suffix extraction logic here
        # For example:
        suffixes = []
        for i in range(len(input_text)):
            suffixes.append(input_text[i:])  # Extract suffixes
        return suffixes

Verification

To verify that the fix worked, test the decode method with sample input text and check that the n-gram and suffix speculative decoding methods are called correctly.

Extra Tips

  • Make sure to update the documentation to reflect the new changes.
  • Test the new methods thoroughly to ensure they work as expected.
  • Consider adding unit tests to cover the new code.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

vllm - 💡(How to fix) Fix [RFC]: Can we implement n-gram and suffix speculative decoding in model_runner_v2? [2 comments, 3 participants]