Repository navigation
Conversation
…ic mode In deterministic inference mode with mamba extra buffer, Decode-produced states were being saved and reused by other requests. However, these states are not numerically identical to Prefill-produced states, causing different logprobs for the same request depending on cache state. Fixed by disabling tracking masks and lazy preallocation in deterministic mode, preventing Decode from overwriting the reusable Prefill checkpoint. Normal generation continues unaffected; only cache reuse behavior changes. Fixes sgl-project#47213
|
Required checks failed on 03be2f3; this PR cannot be merged until they pass. PR title (run)
Lint (run) |
|
Thanks for working on #47213. The checkpoint policy matches the intended fix, but I noticed two implementation issues in 1.
|
Summary
Fix non-deterministic logprobs when prefix cache is reused across requests in deterministic inference mode with mamba extra buffer.
Problem
With deterministic inference enabled, Qwen3.5-9B (and other GDN/SSM models) returned different logprobs for identical requests depending on whether an earlier request had populated the prefix cache. The issue:
The root cause is that floating-point computations in decode mode (one token at a time) differ from prefill mode (chunked processing), making their states incompatible for deterministic reuse.
Solution
In deterministic inference mode with mamba extra buffer enabled, prevent Decode from overwriting or advancing the reusable Prefill checkpoint by:
mamba_track_mask_cpuandmamba_track_mask_next_cpu)This ensures that only prefill-produced checkpoints are reused, maintaining deterministic logprobs across requests.
Key changes in
prepare_for_decodemethod:enable_deterministic_inferenceflagTesting
Impact
Related Work
This fix complements existing deterministic inference improvements:
Fixes #47213
CI States
Latest PR Test (Base): ❌ Run #41164608101
Latest PR Test (Extra): ❌ Run #41164608081
Latest PR Test (AMD ROCm 10): ❌ Run #41164608156