-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[TRTLLM-12958][feat] Enable speculative decoding for dis-agg gen-only requests #14546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -178,11 +178,16 @@ def _create_kv_slice( | |
| groups.append(np.array([], dtype=np.int64)) | ||
| continue | ||
| block_ids = adapter.get_block_ids(req, idx, lg) | ||
| # Limit to prompt_len blocks, matching C++ cacheFormatter behavior. | ||
| # Extra blocks from num_extra_kv_tokens (speculative decoding) have | ||
| # uninitialized KV data and must not be transferred. | ||
| total_blocks = (req.prompt_len + tpb - 1) // tpb | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here, along with token_range, the requirement is to only transfer blocks for prompt_len. However, in practice, prompt + num_extra_kv_tokens blocks are allocated. If MTP is enabled for both the context phase and the generation phase, then the current modification will only transfer prompt_len
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chuangz0 these changes fix the accuracy issue with py-transceiver + eagle3. Without them,accuracy drops even if enable eagle3 for both ctx and gen.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Merge first |
||
| if block_ids.size > total_blocks: | ||
| block_ids = block_ids[:total_blocks] | ||
| window_size = lg.sliding_window_size | ||
|
|
||
| if window_size is not None: | ||
| # Drop stale blocks the manager may still expose (V1 pre-eviction). | ||
| total_blocks = (req.prompt_len + tpb - 1) // tpb | ||
| stale_end = max(0, (req.prompt_len + 1 - window_size) // tpb) | ||
| expected_valid = max(0, total_blocks - stale_end) | ||
| if block_ids.size > expected_valid: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.