Skip to content

[superseded by #1961] fix(provider): no default presence penalty on Qwen 3.5/3.6 - #1946

Draft
jonathan308 wants to merge 4 commits into
devfrom
fix/qwen35-card-defaults-keep-mtp-cache
Draft

jonathan308 wants to merge 4 commits into
devfrom
fix/qwen35-card-defaults-keep-mtp-cache

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Superseded by #1961. The 0.10.12 gate showed that dropping the default penalty is safe only for Qwen3.5-9B, and only with exact MTP acceptance. The 35B builds loop without it under either rule. #1961 makes that per-build change. Do not merge this PR; it can be closed.

Summary

Since provider 0.10.5, the catalog Qwen3.5-9B, qwen3.5-35b-a3b and qwen3.6-35b-a3b-vl-mtp-mxfp8 builds get a default presence_penalty of 1.5 when a request omits it (#1652). That default turns off two things on these builds:

  • MTP. The engine never drafts a row with a penalty.
  • Prefix-cache donation. These builds' MTP heads keep the prompt history, so a row that can't speculate also stages no resident or SSD checkpoint.

The coordinator adds only the registry's temperature, top_p and top_k, so this hit every hosted request that didn't send its own penalty. OpenRouter's cached share of prompt tokens on the two 35B builds fell from 27–42 % on 10-30 to 0 % from 10-31, the day 0.10.5 reached the fleet. On 11-09 production had no cache holders for either build.

This PR keeps the cards' temperature 1.0, top_p 0.95 and top_k 20 as defaults and drops the default penalty. A request's own presence_penalty still applies. Draft until the GPU checks in Notes pass.

Linked issue

Regression from #1652 (fix for #1530). Found by the OpenRouter gap analysis (cache 0 % on Qwen3.6 and Qwen3.5-35B).

Root cause

Code at dev 0f11fbe01a; SDK mlx-swift-lm 67110e7b, the pin on both dev and master.

  1. The default penalty. EngineV2SamplingDefaults.qwen35CardDefaults sets presencePenalty: 1.5 (EngineV2SamplingDefaults.swift:68-69). EngineV2Translation.samplingParams applies it to any request that omits the field (EngineV2Bridge+Translation.swift:127).
  2. Coordinator requests omit it unless the client sends one. Since platform chore(attestation): retire the hypervisor_active stub — field, entitlement, and false UI claims #492 (in production from aa9ea29f4, 10-29 19:51), the coordinator forwards these builds' registry temperature 1, top_p 0.95 and top_k 20. Its allowlist of forwarded keys has no presence_penalty (coordinator/api/inference/request/model_runtime_defaults.go:24-31). In production, fix(provider): stop Qwen 3.5/3.6 looping to max_tokens on omitted sampling #1652's only effective change was therefore the 1.5 penalty.
  3. A penalty row never speculates. EngineLoopV2.mtpBasicEligible requires presencePenalty == 0 (EngineLoopV2+MTPPlanning.swift:34). Under mtp_mode = "auto" the embedded heads are on for qwen3_5 and qwen3_5_moe (MTPMode.automaticEmbeddedModelTypes, ProviderConfig.swift:86).
  4. A row that can't speculate stages no checkpoint.
    • The heads keep the prompt history (tracksPersistentHistory), so the complete-checkpoint codec carries the assistant (EngineV2.swift:949).
    • mtpTakeHistoryState returns no state for an ineligible row (EngineLoopV2+MTPExecution.swift:642).
    • Every capture path then refuses:
      • CompleteCheckpointCapture.capture throws incompatibleCheckpoint (CompleteCheckpointCapture.swift:238-242);
      • the resident bank skips it (EngineLoopV2+HybridPrefix.swift:93);
      • the historical path skips it (EngineLoopV2+HistoricalCheckpoint.swift:306).
    • No donation intent forms, so no outcome is counted either: the gap was silent in /v1/cache/status.
  5. Result. No ready receipts, so no coordinator holders, so nothing routes to a hit. Restores still work (the lookup path has no eligibility gate), which is why a few hits remain from clients that send presence_penalty: 0 themselves.

Bisect 0.10.4 → 0.10.5

By code: 23 commits, plus the SDK pin move aee6ebb6 → 2beb401f.

Candidate Verdict
#1652 Qwen card defaults The cause. The only change to what a default request on these three builds looks like to the engine
#1643 + SDK #368 (dense-Qwen latest checkpoint) Gated by isDenseQwen35 (model is Qwen35Model && !(model is Qwen35MoEModel)), so the MoE builds are untouched
#1641, #1642, #1647, #1648, #1649, #1651, #1657 (SSD store mechanics), #1639 (prompt-token cache) Shared by every model. Gemma, GPT-OSS, Qwen3.8, Lightning, MiMo and GLM kept their holders
SDK #369 (stop-string scope) GPT-OSS only
SDK cluster merges (#308, #352) Unchanged code: mtpBasicEligible, mtpTakeHistoryState and the capture requirement are identical at aee6ebb6, 2beb401f and 67110e7b
Cache identity: allowlist, prompt contract, normalization Not the cause. v9 contracts recomputed from the public registry manifests (identity.ContractID) are all listed in production's EIGENINFERENCE_CACHE_ROUTING_ALLOWED_ARTIFACTS: Qwen3.6 4b92f730…, Qwen3.5-35B 507d6d7a…, Qwen3.5-9B d3816f9f…. The same method reproduces GLM's listed e49c4d35…. /v1/cache/status shows stale_models: 0

Production evidence (read-only, 11-09).

  • OpenRouter's cached share, 14:00Z each day:

    Model 10-29 10-30 10-31 → 11-09
    Qwen3.6 30.8 % 42.4 % 0–1.5 %
    Qwen3.5-35B 54.7 % 26.6 % 0–7 % (one 59.8 % hour)

    Gemma was unchanged (2.7 % on 10-30, 11.0 % on 10-31). No coordinator deploy fell between those two samples.

  • cache_routing_holders: none for either 35B build; 4 for Qwen3.5-9B, against Qwen3.8's 109. Qwen3.8 is a dense inline-MTP Qwen without the penalty.

  • MTP accepted, 13:00–13:30Z: Qwen3.6 2 of 125 requests, Qwen3.5-9B 4 of 149, Qwen3.5-35B 0 of 49. Qwen3.8 on Macs: 105 of 443.

  • The artifacts' own generation_config.json for both 35B builds declares exactly temperature 1.0, top_p 0.95 and top_k 20, with no presence penalty (models.darkbloom.ai/<r2_prefix>/generation_config.json).

Test plan

  • Red first. 5c7d5a73d3 adds qwen35CardDefaultsLeaveDefaultRequestsSpeculativeAndCacheable. On dev 0f11fbe01a it fails with 6 issues: the bare and the coordinator-shaped request get presence_penalty 1.5 on all three builds. The suite's other 15 tests pass.
  • Green. 937161efe1 passes the whole EngineV2SamplingDefaultsTests suite (16/16).
  • Related suites pass: Bonsai9BRequestPolicyTests (3), BenchmarkProductionInputTests (8), MTPAcceptanceConfigTests (6).
  • How they ran: swift build --build-tests (provider-swift, prod identity), then swift test --skip-build in a sandbox that denies the GPU user clients. These are CPU-only.
  • Review doc fix, ac2b5c89a2 (comments, docs and the changelog only): changelog.py check (68 fragments), docs-impact-check --base dev and docs-check.sh (211 files) OK; both Swift files parse (swiftc -parse).
  • CI (dev) green at 937161efe1, at f73bbc5d39 (after the refactor pass) and at ac2b5c89a2 (after the review's doc fix): build, Provider Unit Tests shards 1–2 and Provider Tests. That includes EngineV2BridgeTests, which needs a Metal device and so was not run on the build Mac (a production machine).
  • Checks: python3 scripts/changelog.py check OK; scripts/docs-impact-check.py --base dev coverage OK; ./scripts/docs-check.sh 211 files OK.
  • GPU, before ready-for-review: the loop and cache checks in Notes.

Components touched

  • provider-swift (Swift CLI)
  • docs

Protocol / interface changes

Documentation impact

  • Canonical documentation updated:
    • docs/architecture/inference.md: the sampling table and a separate paragraph for the Qwen catalog builds, moved out of the Bonsai 9B paragraph. After the review it says that only the 9B lacks a generation_config.json, and that a client may send its own penalty;
    • docs/architecture/prefix-cache.md: invariant 9 (the MTP-eligibility coupling) and a failure-mode row.

Changelog

  • Added changelog.d/qwen35-default-penalty-keeps-mtp-and-cache.md and ran python3 scripts/changelog.py check.

Notes for reviewers

  • Loop risk, and the GPU gate before ready-for-review. The independent review tightened the gate (OR-FIX.md §1.5, rewritten 21:40Z).
    • Why a gate: fix(provider): stop Qwen 3.5/3.6 looping to max_tokens on omitted sampling #1652's 20-prompt table measured all four card values together, with MTP effectively off. That was the penalty's doing.
    • What production has seen:
      • Production served these builds at temperature 1 / top_p 0.95 / top_k 20 without a penalty only from chore(attestation): retire the hypervisor_active stub — field, entitlement, and false UI claims #492's deploy (10-29 19:51) until Macs moved to 0.10.5. That is the window in which Qwen3.6 cached 42 % on 10-30.
      • Those Macs ran 0.10.4's MTP code; 0.10.5+'s differs.
      • In the same hours on 10-30 and 10-31, the 9B's long-cap requests hit their cap 6.0 % of the time on penalty-free 0.10.4 Macs, against 1.9 % with the penalty on 0.10.5 (z ≈ 6.8). The Qwen3.8 control shows no version effect.
    • The gate, per build, on the signed 0.10.11: arms today (penalty), typical (presence_penalty: 0, the built-in acceptance) and exact. The typical arm decides, because it is what every 0.10.5–0.10.11 Mac runs after the registry write (darkbloom-platform [bug] Qwen won’t load on a 48 GB Mac despite enough RAM, false memory check after restart #743).
      • Each arm makes 103 draws: fix(provider): stop Qwen 3.5/3.6 looping to max_tokens on omitted sampling #1652's 19 prompts × 3 seeds at 8,192 (the bar); the four loopers × 3 seeds and 5 long tool transcripts × 3 seeds at 32,768; and 19 draws with thinking off.
      • Pass: at most 2 runaways in 57, and at most today's + 1; no sentinel loop that today doesn't share; cap hits at 32,768 at most today's + 2.
      • False-pass rate: 7 % at a true 10 % runaway rate (2 % if today is clean), against 39 % for the old "≤ 1 of 20".
    • Cache check: on all three builds, signed 0.10.11 with an explicit presence_penalty: 0. The 2nd send of an ~9K-token prompt must log a complete-checkpoint capture, and the 3rd must report cached_tokens ≥ 8,192.
    • Time: about 3 h on the Studio (9B) and about 6 h on an M5 Ultra (the 35B builds).
    • If a build fails: typical fails but exact passes → ship this PR with exact as that build's acceptance. Both fail → keep that build's 1.5 here.
  • MTP acceptance interplay.
  • Root fix, owner's. The coupling between speculation eligibility and history capture sits in mlx-swift-lm. History observation could follow cache eligibility instead of speculation eligibility (mtpTakeHistoryState). Then a penalty, stop string, logprobs or logit_bias row on these builds would still donate. That needs a mlx-swift-lm PR (the owner's), and is not part of this PR.
  • Fast path without a provider release: darkbloom-platform [bug] Qwen won’t load on a 48 GB Mac despite enough RAM, false memory check after restart #743 (draft) forwards a registry presence_penalty when the caller omits it. With a build's runtime_parameters set to 0, every 0.10.5–0.10.11 Mac gets this PR's behaviour for that build without updating. Older providers, and this PR, already treat 0 as their default.
    • The writes are owner admin calls, staged one build at a time after the gate and watched for a rollback trigger (OR-FIX.md §1.5).
    • Once this PR ships, roll back with a registry 1.5, not null: null leaves 0.10.12+ Macs on this PR's 0.
  • Not here: Nemotron Super's missing allowlist tuple is an owner env change (see OR-FIX.md).

Before And After

flowchart LR
  subgraph Before["Before (0.10.5 to 0.10.11)"]
    B1["coordinator body: temperature 1, top_p 0.95, top_k 20, no penalty"] --> B2["provider default presence_penalty 1.5"]
    B2 --> B3["mtpBasicEligible false: no MTP"]
    B3 --> B4["mtpTakeHistoryState nil: no assistant history"]
    B4 --> B5["capture refused: no checkpoint, no receipt, 0 holders, 0% cached"]
  end
  subgraph After
    A1["coordinator body: temperature 1, top_p 0.95, top_k 20, no penalty"] --> A2["provider adds no penalty"]
    A2 --> A3["row speculates and observes history"]
    A3 --> A4["checkpoint staged, donated and published: holders, cache hits"]
    A5["request's own presence_penalty"] --> A6["still applies: no MTP, no donation for that row"]
  end
Loading

Refactor Pass

  • Reviewer: an independent review-only opencode run session (refactor-pass-1946, Claude Opus 5.5), 19:54–19:57Z, in its own detached worktree at 937161efe1. It made no builds, commits or GitHub writes. Report: earnings/refactor-1946.md.
  • Verdict: CHANGED, wording only. No must-fix. It re-verified the causal chain in the SDK, and confirmed the removed field has no other user (provider-swift, the cluster libs, scripts and benchmarks).
  • Applied as f73bbc5d39, signed:
    • should-fix: prefix-cache.md invariant 9 named "the Qwen inline heads under mtp_mode = "auto"" as if that defined it. tracksPersistentHistory covers any request-stateful drafter, under on too, so the Qwen 3.5/3.6 heads are now an example.
    • nit: the qwen35CardDefaults doc comment states the invariant ("would turn off … omits"), not history.
  • Kept, with reasons: the overlapping 9B assertion in the old card test (removing it would weaken that test); the rationale comments; the failure-mode row.
  • Combined tree re-run green (CPU-only): EngineV2SamplingDefaultsTests 16/16, Bonsai9BRequestPolicyTests 3, BenchmarkProductionInputTests 8, MTPAcceptanceConfigTests 6. Changelog, docs-impact and docs-check (211 files) OK.

Independent Review

  • Reviewer: an independent review session, 20:38–21:25Z. It was review-only: no push, comment or production call. Report: earnings/review-1946-743.md.
  • Verdict: approve the code. No must-fix and no should-fix.
    • The only behaviour change is the omitted-penalty default, on exactly the three builds.
    • samplingParams is byte-identical to v0.10.4's.
    • Explicit penalties still apply.
    • The new test fails on dev's sources: 7 issues.
  • Two doc statements fixed in ac2b5c89a2 (signed, pushed fast-forward):
    • "the builds ship no generation_config.json": only the 9B ships none. The 35B builds' files declare the same three values, and none of the three is admitted to artifact defaults, so no file is read.
    • "coordinator requests never carry a penalty": the coordinator adds only the registry's temperature, top_p and top_k, and no penalty unless the registry sets one. A client can send its own.
    • Fixed in inference.md, the EngineV2SamplingDefaults.swift header, two test comments and the changelog fragment.
  • Not run by the review: mutation S2 (the translation ignoring the request's penalty). Its rebuild queued behind the build slot while free disk dipped to 13 GiB. By reading, three assertions would catch it (EngineV2SamplingDefaultsTests:131 (at ac2b5c89a2), Bonsai9BRequestPolicyTests:43,50, EngineV2BridgeTests:597).
  • The gate is the review's worst finding. It is now the stricter one in Notes.

…cheable (red)

The catalog Qwen3.5-9B, qwen3.5-35b-a3b and qwen3.6-35b-a3b-vl-mtp-mxfp8 builds
run an embedded MTP head that keeps the prompt history (mtp_mode auto). The
engine captures their resident and SSD checkpoints only from rows that can
speculate (mtpTakeHistoryState, CompleteCheckpointCapture.capture), and it
never speculates a row with a repetition, frequency or presence penalty
(EngineLoopV2.mtpBasicEligible). Since 0.10.5 (#1652) a request that omits
presence_penalty gets 1.5 on these builds, so it neither speculates nor
donates a checkpoint. Coordinator bodies carry the registry's temperature,
top_p and top_k, never a penalty, so this applies to every hosted request.

Fails on dev 0f11fbe: the bare and the coordinator-shaped request get
presence_penalty 1.5.
…, so they speculate and cache again

#1652 (0.10.5) gave a request to the catalog Qwen3.5-9B, qwen3.5-35b-a3b or
qwen3.6-35b-a3b-vl-mtp-mxfp8 build that omitted presence_penalty the model
card's 1.5. The engine drafts no row with a penalty
(EngineLoopV2.mtpBasicEligible), and these builds' MTP heads keep the prompt
history, so such a row observes no assistant history and stages no resident
or SSD checkpoint (mtpTakeHistoryState; CompleteCheckpointCapture.capture
throws incompatibleCheckpoint without it). Coordinator requests never carry a
penalty: since platform #492 the coordinator sends these builds' registry
temperature 1, top_p 0.95 and top_k 20 only. So every hosted request ran
without MTP and donated nothing. On 11-09 production had no cache holders for
the two 35B builds, and OpenRouter's cached share of their prompt tokens fell
from 27-42% on 10-30 to 0% from 10-31, the day 0.10.5 reached the fleet.

Omitted knobs now take only the cards' temperature 1.0, top_p 0.95 and top_k
20, which still replace the greedy decoding that looped to max_tokens (#1530).
A request's own presence_penalty still applies. The presence-penalty default
plumbing #1652 added has no other user and goes. Docs: the sampling table and
paragraph (inference.md), and prefix-cache.md invariant 9 and a failure-mode
row for the MTP-eligibility coupling.

Tests: the red test from the previous commit passes; the 9B card test now
expects presence_penalty 0.
@jonathan308 jonathan308 added the area:provider Provider (Rust, runs on Apple Silicon) label Nov 9, 2026
@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference-landing Ready Ready Preview Nov 9, 2026 9:29pm UTC
darkbloom-status Ready Ready Preview Nov 9, 2026 9:29pm UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 9, 2026 9:29pm UTC

Request Review

…ctor pass)

The independent refactor pass for #1946 (session refactor-pass-1946,
earnings/refactor-1946.md) found no must-fix issue and two wording fixes:

- prefix-cache.md invariant 9 named "the Qwen inline heads under
  mtp_mode = auto" as if it were the definition. tracksPersistentHistory
  applies to any request-stateful drafter, under `on` as well as `auto`,
  so the Qwen 3.5/3.6 heads are now an example.
- The qwen35CardDefaults doc comment states the invariant in the
  conditional ("would turn off ... omits"), as inference.md does, not as
  history.

No behavior change. Combined tree: EngineV2SamplingDefaultsTests 16/16,
Bonsai9BRequestPolicyTests 3, BenchmarkProductionInputTests 8,
MTPAcceptanceConfigTests 6 (CPU-only); changelog, docs-impact and
docs-check (211 files) OK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y send its own penalty (review)

The independent review of #1946 found two overstated statements:
- "the builds ship no generation_config.json": only Qwen3.5-9B ships none. The
  35B builds' files declare the same temperature 1.0 / top_p 0.95 / top_k 20;
  none of the three is admitted to artifact defaults, so no file is read.
- "coordinator requests never carry a penalty": the coordinator adds only the
  registry's temperature, top_p and top_k, and no penalty unless the registry
  sets one; a client can still send its own.

Comments, docs and the changelog fragment only; no code change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

3 active deployments
Preview – eigen-homepages-darkbloom — ac2b5c89 Deployed Nov 9, 2026 by vercel[bot]
Preview – d-inference-landing — ac2b5c89 Deployed Nov 9, 2026 by vercel[bot]
Preview – darkbloom-status — ac2b5c89 Deployed Nov 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:provider Provider (Rust, runs on Apple Silicon)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant