Commit bff0a54
authored
[BugFix]fix qwen3.5+pcp+chunkprefill accuracy error (vllm-project#11508)
### What this PR does / why we need it?
Fix the precision issue in qwen3.5 with pcp and chunkprefill stacking.
Original code:
updated_state[i] = all_final_state[i] + matmul(all_final_h_update[i],
updated_state[i-1])
Missing - s0
Expanding all_final_state[i] = Φ_i·s0 + p_i:
Original code = (Φ_i·s0 + p_i) + Φ_i·correct_{i-1}
= Φ_i·s0 + p_i + Φ_i·correct_{i-1}
Correct value:
correct_i = p_i + Φ_i·correct_{i-1}
The error is Φ_i·s0—s0's contribution is counted twice (once in
all_final_state[i], and once indirectly through Φ_i·updated_state[i-1]).
Why does this only trigger in chunked prefill?
- First chunk: s0 = 0 (new prompt) → - s0 = - 0 = no-op → the original
code happens to be correct.
- Subsequent chunks: s0 ≠ 0 (carrying state from the previous chunk) →
Φ_i·s0 is recalculated → ssm_state writeback error → precision
divergence.
Thus, short prompts with a single chunk (in memory, non-MTP PCP=2
"correct") cannot detect this; it only becomes apparent when
--max-num-batched-tokens is small enough to split the prompt into
multiple chunks.
### Does this PR introduce _any_ user-facing change?
### How was this patch tested?
- vLLM version: v0.23.0
- vLLM main:
vllm-project/vllm@1f486d9
---------
Signed-off-by: weiguihua2 <weiguihua2@huawei.com>1 parent 0958c6e commit bff0a54
2 files changed
Lines changed: 102 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| |||
398 | 401 | | |
399 | 402 | | |
400 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
145 | 146 | | |
146 | | - | |
| 147 | + | |
147 | 148 | | |
148 | 149 | | |
149 | 150 | | |
| |||
0 commit comments