perf(qwen35): add opt-in F32 rollback checkpoints for single-GPU inference#515
Merged
davide221 merged 4 commits intoJul 16, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 11 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Contributor
|
@dusterbloom can you review this |
Contributor
There was a problem hiding this comment.
1 issue found across 4 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="server/src/common/chain_rollback_policy.h">
<violation number="1" location="server/src/common/chain_rollback_policy.h:61">
P3: `RollbackDiag::print` passes `out` directly to `std::fprintf` after only checking `policy.diagnostics`. If someone ever calls it with a null FILE* while diagnostics is enabled — say, after a failed `tmpfile()` or `fopen` — the result is UB. Since `diagnostics` already has a guard, adding `if (!out) return;` would be consistent and prevent that crash class.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Treat a null diagnostics stream as a no-op before calling fprintf, and cover the diagnostics-enabled null-stream path in the rollback policy test. Addresses the latest Cubic P3 on PR Luce-Org#515.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an experimental, default-off F32 checkpoint mode for single-chain speculative rollback on memory-constrained single-GPU Qwen deployments.
The existing behavior remains unchanged unless explicitly enabled:
DFLASH_SINGLE_CHAIN_CHECKPOINT_F32=1 DFLASH_FAST_ROLLBACK_THRESHOLD=1 # valid range: 1-5Optional diagnostics:
Without the F32 opt-in, checkpoints remain F16 and the rollback threshold remains 5.
Motivation
On a single RTX 3090 running Qwen3.6-27B Q4, replaying rejected speculative tokens can cost more than restoring a saved recurrent-state checkpoint. F32 checkpoints permit direct restoration and avoid the conversion/replay path for sufficiently deep rollbacks.
This is intentionally separate from the split/layer-sharded work in #506. It targets a different deployment: one 24 GiB GPU, with no layer split.
Implementation
Validation
Final standalone branch, based on current
main:check: 15/15 tests passedFresh A/B/A validation on the standalone build, six prompt families and three repetitions per arm:
Independent final verification rebuilt and tested the exact diagnostics-centralized candidate, then repeated the A/B/A measurement:
The broader development campaign previously found threshold 2 to be the best pooled policy, but this PR deliberately uses the 6.46% threshold-1 result from the drift-free standalone candidate as its directly reproducible point estimate. The independent rerun supports that figure while showing the honest run-to-run range above.
Limitations
Suggested test configuration