Skip to content

fix: decode rope_theta from nested rope_parameters (#121) - #124

Merged
solderzzc merged 1 commit into
mainfrom
claude/fix-121-rope-parameters
Aug 7, 2026
Merged

solderzzc merged 1 commit into
mainfrom
claude/fix-121-rope-parameters

Conversation

@solderzzc

Copy link
Copy Markdown
Member

Fixes #121 — the sole cause of the permanently red dflash-speculative-decoding CI job.

Cause

z-lab/Qwen3.5-4B-DFlash ships no top-level rope_theta; the value lives under rope_parameters.rope_theta (transformers' rope-settings migration):

"rope_parameters": { "rope_theta": 10000000, "rope_type": "default" }

DFlashDraftConfiguration relied on synthesized Codable, which treats every listed key as required — the property defaults (var ropeTheta: Float = 1_000_000.0) never apply to synthesized decoding. So the entire config decode failed with keyNotFound("rope_theta") and the draft model never loaded.

Fix

A custom init(from:) restores the intended optional-with-default semantics for every field, and resolves rope_theta as: flat key first (older checkpoints) → rope_parameters.rope_theta → the 1e6 default.

Verification

  • New tests/SwiftLMTests/DFlashConfigDecodingTests.swift decodes the verbatim z-lab/Qwen3.5-4B-DFlash config (embedded in the test): ropeTheta = 10_000_000, layers/blockSize/targetLayers all correct.
  • Flat-key precedence and the all-defaults case are pinned.
  • Verified red: with the decoder reverted, all three tests fail on the original keyNotFound.

Sources/SwiftLM/DeepseekV3DFlash.swift:74 declares the same flat key and may need the same treatment if a nested-form DeepSeek DFlash checkpoint appears; left out of scope since no such checkpoint is in CI.

🤖 Generated with Claude Code

z-lab/Qwen3.5-4B-DFlash ships no top-level rope_theta; the value lives under
rope_parameters.rope_theta, following transformers' rope-settings migration.
DFlashDraftConfiguration relied on synthesized Codable, which treats every
listed key as required — the property defaults never apply — so the whole
decode failed with keyNotFound("rope_theta") and the draft model never
loaded. This is the sole cause of the permanently red
dflash-speculative-decoding CI job.

A custom init(from:) now restores the intended optional-with-default
semantics for every field, and resolves rope_theta as: flat key first (older
checkpoints), then rope_parameters.rope_theta, then the 1e6 default.

Tests decode the verbatim z-lab/Qwen3.5-4B-DFlash config (embedded), pin
flat-key precedence, and cover the all-defaults case. Verified red: without
the decoder all three fail on the original keyNotFound.

Co-Authored-By: Claude Opus 5 <[email protected]>
@solderzzc
solderzzc merged commit 502ee94 into main Aug 7, 2026
10 of 11 checks passed
@solderzzc
solderzzc deleted the claude/fix-121-rope-parameters branch August 7, 2026 04:02
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.

DFlash draft model fails to load: rope_theta moved into rope_parameters

1 participant