From e9ec2a72d845e1f3374c6de68e361edc6258c891 Mon Sep 17 00:00:00 2001 From: Ofir Zafrir Date: Thu, 15 Jan 2026 08:39:37 +0200 Subject: [PATCH] [Bugfix] Fix stale `common_attn_metadata.max_seq_len` in speculative decoding with Eagle (#32312) Signed-off-by: Ofir Zafrir --- vllm/v1/spec_decode/eagle.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vllm/v1/spec_decode/eagle.py b/vllm/v1/spec_decode/eagle.py index 1270029c5..b7693f4f7 100644 --- a/vllm/v1/spec_decode/eagle.py +++ b/vllm/v1/spec_decode/eagle.py @@ -466,6 +466,12 @@ class EagleProposer: # For the requests that exceed the max model length, we set the # sequence length to 1 to minimize their overheads in attention. common_attn_metadata.seq_lens.masked_fill_(exceeds_max_model_len, 1) + # Increment the maximum sequence length. We increment max_seq_len + # unconditionally even though some seq_lens may have been capped above, + # as max_seq_len serves as an upper bound for sequence lengths. + common_attn_metadata.max_seq_len = min( + common_attn_metadata.max_seq_len + 1, self.max_model_len + ) # Also update the CPU-side shadow; NOTE: this is hacky and should be # removed in when common_attn_metadata.seq_lens_cpu is deprecated.