[Feature][Spec] Support disabling trailing prefix-cache block dropping (#53388)
Signed-off-by: Ziming Huang <zelda.huanghuang@gmail.com> Signed-off-by: Ziming Huang <48115868+ZeldaHuang@users.noreply.github.com> Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
co-authored by
OpenAI Codex
parent
9e905f7450
commit
481839ad9e
@@ -255,6 +255,7 @@ class Scheduler(SchedulerInterface):
|
||||
)
|
||||
speculative_config = vllm_config.speculative_config
|
||||
self.use_eagle = False
|
||||
self.use_eagle_block_drop = False
|
||||
self.num_spec_tokens = vllm_config.num_speculative_tokens
|
||||
self.num_lookahead_tokens = vllm_config.num_lookahead_tokens
|
||||
# Positions past the computed tokens that the drafter reads mid-prefill.
|
||||
@@ -279,6 +280,13 @@ class Scheduler(SchedulerInterface):
|
||||
if speculative_config.use_multi_module_mtp()
|
||||
else 1
|
||||
)
|
||||
self.use_eagle_block_drop = speculative_config.use_eagle_block_drop()
|
||||
if self.use_eagle and not self.use_eagle_block_drop:
|
||||
logger.warning(
|
||||
"EAGLE trailing prefix-cache block dropping is disabled. "
|
||||
"This is experimental and may affect speculative-token "
|
||||
"acceptance rates."
|
||||
)
|
||||
|
||||
# Create the KV cache manager.
|
||||
if hash_block_size is None:
|
||||
@@ -289,7 +297,7 @@ class Scheduler(SchedulerInterface):
|
||||
max_model_len=self.max_model_len,
|
||||
max_in_flight_tokens=vllm_config.max_in_flight_tokens,
|
||||
enable_caching=self.cache_config.enable_prefix_caching,
|
||||
use_eagle=self.use_eagle,
|
||||
use_eagle=self.use_eagle_block_drop,
|
||||
num_prefill_lookahead=self.num_prefill_lookahead,
|
||||
log_stats=self.log_stats,
|
||||
enable_kv_cache_events=self.enable_kv_cache_events,
|
||||
@@ -414,7 +422,7 @@ class Scheduler(SchedulerInterface):
|
||||
# Eagle, FullAttn prunes the last matching block, so back off one
|
||||
# block to avoid a Mamba cache miss.
|
||||
last_cache_position = request.num_tokens - request.num_tokens % block_size
|
||||
if self.use_eagle:
|
||||
if self.use_eagle_block_drop:
|
||||
last_cache_position = max(last_cache_position - block_size, 0)
|
||||
|
||||
end = start + num_new_tokens
|
||||
|
||||
Reference in New Issue
Block a user