[Bugfix] Fix stale common_attn_metadata.max_seq_len in speculative decoding with Eagle (#32312)

Signed-off-by: Ofir Zafrir <ofir.zafrir@intel.com>
This commit is contained in:
Ofir Zafrir
2026-01-15 08:39:37 +02:00
committed by GitHub
parent 2c9b4cf5bf
commit e9ec2a72d8

View File

@@ -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.