Repository navigation
fix(provider): stop Qwen 3.5/3.6 looping to max_tokens on omitted sampling - #1652
Conversation
Requests that omit sampling fields decoded Qwen3.5-9B greedily with no presence penalty, and the model repeated itself until max_tokens (Layr-Labs#1530). The catalog build ships no generation_config.json, so omitted knobs now take its model card's thinking-mode values: temperature 1.0, top_p 0.95, top_k 20, presence_penalty 1.5. Explicit request values still win; every other model keeps its defaults. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
qwen3.5-35b-a3b and qwen3.6-35b-a3b-vl-mtp-mxfp8 loop the same way on omitted sampling and their model cards recommend the same thinking-mode values. A table of exact catalog builds, each bound to its model_type, replaces the single 9B check and shares qwen35CardDefaults. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@javiech1 is attempting to deploy a commit to the EigenLabs Team on Vercel. A member of the Team first needs to authorize it. |
Threat model review — advisoryReviewed head Review not completed for this head. Previous findings are superseded, not confirmed resolved. Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging. Human review required: CI did not complete the security review. A maintainer must review the saved findings and remaining scope. A green advisory job is not security clearance; do not manually rerun the paid scan. Failure diagnostics: Coverage: 17/33 source units; cross-file integration pending. 0 selected depth batch(es) pending. All threat definitions indexed; relevant full definitions selected. Unchanged callers are not scanned. Cost this run: $0.4934 reported, $0.0000 reserved with unknown cost; 6 paid request(s), 0 reused batch(es), 64925 provider cache-hit tokens. Saved findings and earlier report · Historical findings are not confirmed resolved. |
|
Production data point from my own provider (M5 Max, BloomGauge earnings history, 18–28 Oct): of 680 paid |
The merge adds #1566, #1591, #1602, #1605, #1606, #1607, #1612, #1621, #1622, #1623, #1625, #1629, #1630, #1631, #1632 (provider 0.10.4), #1633, #1644, #1652 and #1653 to this branch. Conflicts and resolutions: - CoordinatorClient+Connection.swift: #1606 moves the transport setup out of connectAndRun into the static function connectionParameters(for:), and puts the connectAndRun header below it. This branch adds the session parameter to the same header. The merge keeps the layout of master. The moved header has the signature of this branch: connectAndRun(_ session: CoordinatorSessionRecorder). Git merged the other changes without a conflict: the bounded handshake of master (CoordinatorConnectionHandshake.start) and the session recorder of this branch (markOpened after register, the session parameter of sessionLoop and receiveLoop, and the close-code read). - docs/provider/cli-reference.md: the runtime constants table. The merge keeps the three reconnect rows and the ping/pong row of this branch. It adds the handshake deadline row of master after the ping/pong row, where master has it. - docs/provider/troubleshooting.md: only the "Last updated" stamp had a conflict (2026-10-26 on this branch, 2026-10-27 on master). The merge keeps one stamp, 2026-10-27. Git merged the rows: the backoff citation of this branch and the new rows of master. Each decision has one owner after the merge: - CoordinatorReconnectPolicy chooses the wait before the next connection attempt, after each end of a session or of an attempt. - CoordinatorConnectionHandshake (#1606) cancels a handshake that does not complete in 30 s. runLoop catches the timeout error. That attempt did not send register, so the policy gives the next backoff range, as on master. - UnauthorizedConnectionRecovery (#1607, #1633) decides when to start a re-registration of a connection that the coordinator refuses. Its retry backoff counts re-registrations, not connection attempts, and an authorized verdict sets that count to zero. The re-registration closes the session. Then the policy chooses the wait, as for each other end. Checks: against master, the merge has only the changes of this branch, in its 15 files. The troubleshooting stamp is the one exception: it has the date of master. Against this branch, the merge has only the changes of master, in 651 files. The one exception is the connectAndRun header, which has the session parameter. The gitlinks do not change: libs/mlx 31f550af, libs/mlx-swift 4926d3d9, libs/mlx-swift-lm aee6ebb6. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Summary
Requests that omit sampling fields decode the catalog Qwen 3.5/3.6 builds greedily with no presence penalty (
temperature 0,presence_penalty 0), and the model then repeats itself untilmax_tokens. That is the 15–40 minute "stuck" request in #1530 and in #providers (49,986 and ~64,000 completion tokens for a few cents). None of them ships ageneration_config.json, so they never got the artifact defaults other families use. Omitted knobs now take their model cards' thinking-mode values (identical on all three cards):temperature 1.0,top_p 0.95,top_k 20,presence_penalty 1.5. Each card says the presence penalty is there "to reduce endless repetitions".Linked issue
Closes #1530
Test plan
swift build --build-tests(provider-swift)swift test --skip-build --filter "Sampling|Translation|Bridge|Qwen35|Bonsai": 251 tests in 60 suites pass, including the newqwen35CatalogBuildsUseTheirModelCardDefaults.make changelog-check,make docs-impact-check BASE=origin/master,make docs-check: OK.darkbloom start --localdev build, four concurrent requests, thinking on, the same 20 prompts per model:max_tokens8,192max_tokens, omittedQwen3.5-9Bqwen3.5-35b-a3bqwen3.6-35b-a3b-vl-mtp-mxfp8Decode speed is unchanged (9B, requests that ran to the cap: 61.9 tok/s greedy, 62.4 tok/s with card values).
Qwen3.5-9Blooping prompts,max_tokens32,768"Runaway repetition" means the last 3,000 characters end in a 40–160-character span repeated four or more times. The detector's only card-values hit, on each model, was the song prompt, whose chorus repeats by design; it stopped on its own.
Components touched
Protocol / interface changes
Documentation impact
docs/architecture/inference.md: sampling table and the artifact-defaults paragraph)Changelog
changelog.d/qwen35-9b-sampling-defaults.mdand ranmake changelog-check.Notes for reviewers
model_type(EngineV2SamplingDefaults.qwen35CardModelTypes), likeToolChoiceEnforcementPolicy.structuredForcedToolModelTypes. Other Qwen 3.5 builds stay legacy.presence_penalty, which no family did before. The Bonsai 9B note ininference.mddeliberately leaves it to qualification requests; here the card value is what stops the loops, so it is a default.temperature; the provider logs do not record it. If most do, this fixes fewer real requests than the test suggests.Before And After
flowchart LR subgraph Before B1["request omits temperature<br/>and presence_penalty"] --> B2["catalog Qwen 3.5/3.6: legacy<br/>temperature 0, presence 0"] B2 --> B3["greedy loop until max_tokens<br/>(up to 65,536 tokens)"] end subgraph After A1["request omits temperature<br/>and presence_penalty"] --> A2["EngineV2SamplingDefaults.resolve<br/>qwen35CardModelTypes match"] A2 --> A3["temperature 1.0, top_p 0.95,<br/>top_k 20, presence 1.5"] A3 --> A4["stops on its own"] A5["explicit request values"] --> A6["always win"] endRefactor Pass
Reviewed the diff for reuse and scope: the card values are one constant next to
.legacyshared by the three builds,resolvechecks the identity table before the artifact-file gate, and the translation adds one fallback. Nothing else to remove or merge. Focused suites above re-run green after the review.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.