Skip to content

llama : enable recurrent-state rollback for qwen3next / qwen4exp - #28120

Closed
vahpetr wants to merge 1 commit into
ggml-org:masterfrom
vahpetr:rs-rollback-qwen4exp
Closed

llama : enable recurrent-state rollback for qwen3next / qwen4exp#28120
vahpetr wants to merge 1 commit into
ggml-org:masterfrom
vahpetr:rs-rollback-qwen4exp

Conversation

@vahpetr

@vahpetr vahpetr commented Aug 31, 2026

Copy link
Copy Markdown

qwen3next and qwen4exp use the same GDN recurrent state as qwen35 / qwen35moe,
which are already in llm_arch_supports_rs_rollback. They were just missing from
that list, so speculative decoding fell back to SEQ_RM_TYPE_FULL and
checkpointed the whole recurrent state to host on every round.

Adding the two arches lets the recurrent memory roll back natively (via
n_rs_seq), so no checkpointing is needed.

Numbers on a Strix Halo (gfx1151, Vulkan/RADV), Qwen3.8-Flash-Next Q4_K_M,
temp 0, -np 1, MTP draft head:

decode
no draft 32 t/s
MTP, full checkpoint (before) 6 t/s
MTP, this change (rollback) 44 t/s

Greedy output matches the no-draft run. This came out of the discussion in
#28118, where @ggerganov pointed out that rollback is the right fix instead of
speeding up the checkpoint.

I only tested -np 1 with short/medium generations, so an extra look at the
qwen4exp graph for deep rejections, long context and multiple slots would be
good.

qwen3next and qwen4exp are GDN-based hybrids with the same recurrent-state
design as qwen35 / qwen35moe, which already support rollback. Adding them to
llm_arch_supports_rs_rollback lets speculative decoding roll back the recurrent
state natively (n_rs_seq widens the state to 1 + n_rs_seq groups) instead of
falling back to SEQ_RM_TYPE_FULL, which serializes the whole recurrent state to
host on every speculative round.

Measured on AMD Strix Halo gfx1151 / Vulkan+RADV, Qwen3.8-Flash-Next Q4_K_M,
-ctk q8_0 -ctv q8_0, temp 0, -np 1, MTP draft:

  no draft:              32.4 t/s
  MTP, SEQ_RM_TYPE_FULL:  6.2 t/s   (host checkpoint every round, 5x loss)
  MTP, this change (RS): 43.6 t/s   (+35% over no-draft; acceptance 0.89)

Output stays greedy-equivalent to no-draft. Validated with -np 1 and
short/medium generations; the widened-state rollback across deep rejections,
long context and multi-slot could use a maintainer eye on the qwen4exp graph.
@ggml-gh-bot

ggml-gh-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

Hi @vahpetr, thanks for your contribution!

Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:

  • PR Template not respected: Please respect the template when creating a new pull request. Make sure to fill out all required sections.

  • Multiple open PRs from a new contributor: We limit new contributors (those without a previously merged PR) to 1 open PR at a time. You currently have 2 open PRs.


Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below.

@ggml-gh-bot ggml-gh-bot Bot added the draft PR will be changed to draft by github-actions bot label Aug 31, 2026
@github-actions
github-actions Bot marked this pull request as draft August 31, 2026 20:46
@github-actions github-actions Bot removed the draft PR will be changed to draft by github-actions bot label Aug 31, 2026
@vahpetr
vahpetr marked this pull request as ready for review August 31, 2026 21:29
@CISC

CISC commented Aug 31, 2026

Copy link
Copy Markdown
Member

See #28123

@CISC CISC closed this Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants