Repository navigation
Conversation
|
/bot review |
|
❌ Code review failed. |
@pwilkin Thanks! The bot review hit HTTP 429. Could you please retry /bot review and rerun the failed jobs? |
|
/bot review |
Automated code reviewFull review below. Note: the previous bot review on this PR errored out with HTTP 429 and produced no findings, so this is a full pass over the diff rather than a delta review. Scope: Scope gate: clean. This is a targeted bug fix (MTP had no Security / correctness of the new state hooks (
No blocking issues found. Findings below. Will slow the review (point 1) (point 2) The magic (point 3) The test's save/pollute/restore/re-draft sequencing is hard to follow: (point 4) Memory cost per checkpoint: Nits (point 5) (point 6) (point 7) The bound Style: clean. ASCII only, comments concise, naming and formatting match the surrounding file; the test follows the existing This review was generated automatically by pi coding agent using |
|
Could you rebase on latest @ruixiang63 I wonder, was there any reason to not implement get/set state for MTP? I see we've added it for eagle3 and not sure why we skipped MTP then. |
Assisted-by: Codex
a8c96d7 to
2505fa4
Compare
@ggerganov Rebased onto master at 62a6f74. |
|
I don’t think there was an intentional reason to skip MTP. My read is that EAGLE3’s deferred-boundary state made the need for The motiveation of adding state functions for eagle3 is here: #24593. @ggerganov @renewboy Could you share some data showing the impact of this change? For example, speed-bench results comparing acceptance rate and speedup before and after the patch, ideally on a hybrid target model with a multi-turn workload that actually triggers checkpoint restores. |
| @@ -0,0 +1,151 @@ | |||
| #include "arg.h" | |||
There was a problem hiding this comment.
I don't think we need a test for this. The test model doesn't trigger a hybrid model checkpoint restore, so the state restore path is never exercised.
|
@ruixiang63 I ran the requested comparison on a hybrid target with actual server checkpoint restores. Local environment
Settings
Benchmark resultsThese results cover second-turn requests only: four requests per workload/configuration, all confirmed to restore a checkpoint. “Before” and “after” both enable MTP.
Patched/unpatched MTP inputs, histories, acceptance counts and response text matched. AR (Autoregressive) ratios are workload references, since one AR first-turn response differed. No performance improvement was measured from the patch. The small timing differences do not establish a precise performance cost. Restore-state and draft-logit diagnosticI separately used the same instrumented binary in two modes, differing only in whether The first replayed token’s hidden input was compared against the checkpoint’s saved boundary vector:
All 32/32 raw draft-logit vector checksums differed, while 0/32 top-1 tokens changed. For example, one recorded top-1 candidate probability changed from MTP catch-up consumes ConclusionThe evidence supports a restore-state consistency issue affecting draft logits. It does not demonstrate a target-output correctness bug, acceptance improvement or server speedup. The original motivation was checkpoint resumption in a direct llama-common integration. I also agree that the standalone test does not cover the server’s hybrid checkpoint-restore path. |
Overview
MTP does not implement
get_state/set_state, so restoring target and draft KV checkpoints leaves the later batch's hidden state in the speculative driver.Save and restore
pending_hand the verification hidden rows through the existing hooks. Validate the model width, row count and payload size before changing state, and clear transient batch data after a successful restore.Validation
test-speculative-mtp-state.08246a2: fails withMTP hidden state was not saved.Requirements