Repository navigation
fix: decode rope_theta from nested rope_parameters (#121) - #124
Merged
Merged
Conversation
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]>
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.
Fixes #121 — the sole cause of the permanently red
dflash-speculative-decodingCI job.Cause
z-lab/Qwen3.5-4B-DFlashships no top-levelrope_theta; the value lives underrope_parameters.rope_theta(transformers' rope-settings migration):DFlashDraftConfigurationrelied on synthesizedCodable, 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 withkeyNotFound("rope_theta")and the draft model never loaded.Fix
A custom
init(from:)restores the intended optional-with-default semantics for every field, and resolvesrope_thetaas: flat key first (older checkpoints) →rope_parameters.rope_theta→ the 1e6 default.Verification
tests/SwiftLMTests/DFlashConfigDecodingTests.swiftdecodes the verbatimz-lab/Qwen3.5-4B-DFlashconfig (embedded in the test):ropeTheta = 10_000_000, layers/blockSize/targetLayers all correct.keyNotFound.Sources/SwiftLM/DeepseekV3DFlash.swift:74declares 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