Skip to content

fix(provider): Qwen 3.8 27B drafts with exact MTP acceptance on a single Mac; every other model keeps its rule (stacked on #1974) - #1999

Merged
jonathan308 merged 9 commits into
devfrom
fix/mtp-exact-acceptance-qwen38
Nov 12, 2026
Merged

jonathan308 merged 9 commits into
devfrom
fix/mtp-exact-acceptance-qwen38

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

For 0.10.12 candidate (c) (#1970). Stacked on #1974 (already folded into (c)). The diff against #1974 is the last four commits. Approved in an independent review (review-1999.md); the fold waits on the 45-minute GPU smoke. The Qwen 3.8 counterpart of #1974: exact MTP acceptance for Qwen 3.8 27B only, on a single Mac. The broad #1973 (exact for every model) stays held for 0.10.13.

MTPAcceptancePolicy.builtInIsExact adds every concrete Qwen 3.8 27B build (ModelRuntimeRequirements.qwen38ConcreteModelIDs: the catalog EigenLabs/Qwen3.8-27B-4bit-mtp and its head-less target EigenLabs/Qwen3.8-27B-4bit) to the Bonsai 9B candidate, Qwen3.5-9B (#1961) and gemma-4-26b-qat-4bit (#1974).

  • Every other model keeps its built-in rule.
  • Precedence is unchanged (per model → global → built-in), and an unknown value still resolves to exact. mtp_acceptance_by_model with "EigenLabs/Qwen3.8-27B-4bit-mtp" = "typical" restores the old rule.
  • The catalog has no public alias for Qwen 3.8 (/v1/models/catalog?include_aliases=1: the only alias is gemma-4-26b). The Flash-Next artifact (qwen3.8-flash-next, DarkBloom/Qwen3.8-Flash-Next-Q4-mtp) and the Qwen 3.8-derived Bonsai 2 27B are other models and stay typical.
(c) today (#1961 + #1974) This PR #1973 (held)
Gemma 4 26B QAT, Qwen3.5-9B, Bonsai 9B candidate exact exact exact
Qwen 3.8 27B, single Mac typical exact exact
Qwen 3.8 27B pairs (TP / pipeline) exact (never read this rule) exact exact
GLM single Mac, 35B Qwen penalty-0 callers, Lightning with MTP on, 8-bit Gemma with MTP on typical typical exact

Paths. The rule is resolved only in EngineV2SlotFactory.makeProductionBundle, so this reaches every single-Mac path:

  • the network daemon's load (ProviderLoop+EngineV2.swift:789, through makeEngineV2BundleForSlot), its MTP upgrade (ProviderLoop+MTPUpgrade.swift:167) and its liveness rebuild (ProviderLoop+EngineV2Liveness.swift:262, :310);
  • Only me / --local (StandaloneServer.swift:1303) and its MTP upgrade (StandaloneServer+MTPUpgrade.swift:166).

Each passes the operator's keys. The cluster runtime never consults MTPAcceptancePolicy; the benchmark session keeps its own exact default.

Why Qwen 3.8

  • On one Mac a lone Qwen 3.8 request drafts (Qwen4ExpMTP.maximumSpeculativeBatch is 1). Lone drafting rows decode about half to 71 % of Qwen 3.8's Mac output (11-09/10).
  • The GPU pool has served nothing since 11-09, so OpenRouter's GPQA re-runs of Qwen 3.8 land on Macs, where those lone requests draft under typical acceptance, which changes the output distribution.
  • Controlled evidence: on Qwen3.5-9B typical made long answers loop to the cap (13 of 31 draws, against 0 of 31 under exact).
  • Qwen 3.8's own production records (observational, review-1999.md §4):
    • On the fleet's 0.9.17 (exact) → 0.9.18 (typical) overlap, on the same OpenRouter traffic, Macs on typical ran long Qwen 3.8 answers to their max_tokens about 3.6× as often (Mantel-Haenszel over 12-hour windows and chips). The version step also carries an SDK change, so this is not proof.
    • Since 11-09, all 229 single-Mac answers of ≥ 8,192 tokens that ended at their cap had drafted; 0 of 33 long answers that never drafted did.
  • Qwen 3.8's GPQA sits in a 1-point band of 25 endpoints, so a few capped answers move its rank.
  • Exact keeps the model's output distribution (exact in distribution; not bit-identical to MTP off).
  • Cost: about 4–5 % slower on single Macs, all of it while a Mac serves one request at a time. A lone request decodes at about 0.93× of typical (2026-10-07 report, B = 1: 73.5 against 79.4 tok/s), and lone requests decode about half of Qwen 3.8's Mac output. A Mac serving several requests at once is unchanged: those rows never draft. (The earlier "−1 to −2 %" weighted by requests, not tokens.)

Validation

CPU only (sandbox without GPU clients), prod identity, after wait-build-slot.sh with MIN_FREE=22. Run on candidate (c)'s head (abf82ca9ce, the same policy and tests as #1974's head), with this PR's commits applied:

Tree Result
Red 7441d6dae2 (tests only) on (c) MTPAcceptanceConfigTests fails with 3 issues in 2 of 9 tests: absentKeys (the catalog id) and qwen38DefaultsToExact (both ids), each a Qwen 3.8 id resolving to typical. Bonsai9BMTPPolicyTests 3/3
Green 82322d55f2 on (c) MTPAcceptanceConfigTests 9/9, Bonsai9BMTPPolicyTests 3/3, EngineV2SamplingDefaultsTests 16/16, Bonsai9BRequestPolicyTests 3/3, BenchmarkProductionInputTests 8/8, EngineV2TranslationTests 12/12
Green again on (c)'s current head 9963cbee7d merged with cfcd9c5903 (tree 9f35fbbcb5) the same six suites pass
Mutants (each on (c) + this PR, rebuilt) killed: the Qwen 3.8 entry dropped (3 issues); the catalog id only (1: the head-less target); any id containing "Qwen3.8" (1: the Flash-Next artifact); a case-insensitive match (1: the lower-case variant)
Refactor pass cfcd9c5903 comments and docs only; swiftc -parse, changelog.py check (70), docs-impact-check --base f859266760 (7 files) and --base dev (12), git diff --check
Review fixes 0d5dfdeeb9 changelog fragment and one doc comment only (the speed cost by tokens; the evidence; every path); swiftc -parse, changelog.py check (70), git diff --check
Independent review (review-1999.md) approved; on (c) 93752d4c28 + this PR: build rc 0 and 7 suites pass (52 tests); its mutants: the brief's (killed) and "settings checked after the built-in rule" (killed)

What the tests pin (qwen38DefaultsToExact, absentKeys):

  • exact for EigenLabs/Qwen3.8-27B-4bit-mtp and EigenLabs/Qwen3.8-27B-4bit;
  • typical for qwen3.8-flash-next, DarkBloom/Qwen3.8-Flash-Next-Q4-mtp, ternary-bonsai-2-27b, a lower-case variant of the catalog id, gemma-4-26b, gemma-4-26b-8bit, qwen3.5-35b-a3b, qwen3.6-35b-a3b-vl-mtp-mxfp8, nvidia-nemotron-3.5-lightning and glm-5.3-flash;
  • exact still for Gemma QAT and Qwen3.5-9B;
  • a per-model or global typical still wins for Qwen 3.8.

Not run here: the Metal suites (CI) and a GPU smoke. A 45-minute smoke on the dev M5 Ultra pair's Mac A (exact against typical on long Qwen 3.8 answers, the decode ratio, the acceptance rate) is planned for 07:00–08:00Z, and gates the fold.

Folding

Contracts and documentation

  • No protocol or interface change.
  • inference.md (the acceptance paragraph), configuration.md, cli-reference.md, ProviderConfig.mtpAcceptance's comment.
  • changelog.d/mtp-exact-acceptance-qwen38.md.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

jonathan308 and others added 8 commits November 10, 2026 06:26
…MTP; the 35B builds keep 1.5 (red)

The 0.10.12 gate on the signed 0.10.11 (temperature 1, top_p 0.95,
top_k 20; Studio M3 Ultra for the 9B, M5 Ultra for qwen3.5-35b-a3b) decided
each catalog Qwen 3.5/3.6 build's defaults:
- qwen3.5-35b-a3b without the cards' presence_penalty 1.5 looped under typical
  and under exact MTP acceptance, so it and qwen3.6-35b-a3b-vl-mtp-mxfp8 (the
  same architecture) keep 1.5;
- Qwen3.5-9B looped under typical acceptance (13 of 31 draws with MTP running)
  and not under exact (0 of 31), and without the penalty its rows stage prefix
  checkpoints (8,192 cached tokens on the 2nd send).

Tests:
- qwen35OmittedPresencePenaltyFollowsEachBuildsGate: a bare body and the
  coordinator's body (temperature 1, top_p 0.95, top_k 20) get presence
  penalty 0 on the 9B and 1.5 on the two 35B builds; a request's own 0 or 1.5
  wins on every build.
- qwen35CatalogBuildsUseTheirModelCardDefaults: the 9B resolves to the card
  values without the penalty.
- MTPAcceptanceConfigTests: Qwen3.5-9B's built-in rule is exact; the 35B
  builds and other Qwen ids stay typical; a per-model or global value still
  wins.

Red on dev 2474f3d: EngineV2SamplingDefaultsTests 4 issues (the 9B gets
1.5), MTPAcceptanceConfigTests 1 issue (the 9B resolves to typical); the 35B
rows and the explicit-penalty rows already pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…acceptance; the 35B Qwen builds keep 1.5

Per the 0.10.12 gate (signed 0.10.11; temperature 1, top_p 0.95, top_k 20;
#1652's loopers and tool transcripts at 32,768, everyday prompts at 8,192):
- qwen3.5-35b-a3b without the cards' presence_penalty 1.5 ran away under
  typical MTP acceptance (8/12 loopers, 5/19 everyday prompts at
  concurrency 1) and under exact (2/12 loopers), so it and
  qwen3.6-35b-a3b-vl-mtp-mxfp8 (one architecture) keep qwen35CardDefaults;
- Qwen3.5-9B ran away on 13/31 draws under typical acceptance and 0/31
  under exact, MTP running; its penalty-free body cached 8,192 tokens on the
  2nd send, the penalty body none.

So:
- EngineV2SamplingDefaults: qwen35NineBCardDefaults (temperature 1.0,
  top_p 0.95, top_k 20, no penalty) for Qwen3.5-9B; the 35B builds keep
  qwen35CardDefaults with presencePenalty 1.5. The table and the model_type
  binding are unchanged.
- MTPAcceptancePolicy.builtInIsExact: exact for the Bonsai 9B candidate and
  Qwen3.5-9B; typical otherwise. Precedence is unchanged: a per-model or
  global mtp_acceptance still wins.
- A request's own presence_penalty always wins: 0 on a 35B build lets it
  speculate (typical) and donate checkpoints; a nonzero value on the 9B
  turns its MTP and cache donation off for that request.
- Docs: inference.md (a per-build table with the gate numbers, the request
  override, the acceptance default), prefix-cache.md (invariant 9 and a
  failure-mode row on the MTP-history coupling), configuration.md and
  cli-reference.md (the built-in exact models); a changelog fragment.

Green (CPU-only, GPU denied): EngineV2SamplingDefaultsTests 16/16,
MTPAcceptanceConfigTests 7/7, Bonsai9BMTPPolicyTests 3/3,
Bonsai9BRequestPolicyTests 3/3, BenchmarkProductionInputTests 8/8,
EngineV2TranslationTests 11/11; changelog check (68), docs-impact (9 files),
docs-check (211).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g table, a platform citation, wording

From the review-only refactor pass (refactor-pass-1961, opencode session;
report earnings/refactor-1961.md), comments and docs only:
- inference.md: the sampling-parameters table said presence_penalty takes a
  model-card default on "catalog Qwen 3.5/3.6"; it now names the 35B builds
  and says Qwen3.5-9B has none.
- inference.md: the coordinator claim now cites darkbloom-platform's
  requestRuntimeDefaultKeys at master c69380d91f and states what the registry
  sets for these builds (checked read-only in production on 11-10: temperature
  1, top_p 0.95, top_k 20, no presence_penalty).
- inference.md: "Typical acceptance:" reads as one sentence after the new
  exception; prefix-cache.md invariant 9 links #sampling-parameters;
  MTPAcceptancePolicy's doc comment and a test comment reflowed and reworded.

Checked: EngineV2SamplingDefaultsTests 16/16, MTPAcceptanceConfigTests 7/7,
Bonsai9BMTPPolicyTests 3/3, Bonsai9BRequestPolicyTests 3/3,
BenchmarkProductionInputTests 8/8, EngineV2TranslationTests 11/11 (CPU-only);
changelog check (68), docs-impact (9), docs-check (211).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ry other model keeps its rule (red)

The narrow fallback to #1973: only the catalog Gemma QAT build changes. absentKeys
now expects exact for gemma-4-26b-qat-4bit, and gemmaQATDefaultsToExact pins
exact for that id, typical for its 8-bit siblings, the 35B Qwen builds, Qwen 3.8,
Lightning and GLM, exact for Qwen3.5-9B (#1961), and that a per-model or global
"typical" still wins.

On #1961's head (ca8697d) two tests fail, each on gemma-4-26b-qat-4bit
resolving to typical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y other model keeps its rule

The narrow fallback to #1973 for 0.10.12. MTPAcceptancePolicy.builtInIsExact
adds the catalog gemma-4-26b-qat-4bit to the Bonsai 9B candidate and
Qwen3.5-9B (#1961); every other model keeps typical as its built-in rule, and
the per-model -> global -> built-in precedence and the unknown-value -> exact
rule are unchanged.

Why Gemma: its assistant drafts most of its rows (11,863 of 14,211 on 11-09),
and on OpenRouter's GPQA run of 10-31 every Gemma answer drafted under typical
acceptance and 30 % (52 of 173) ended at the 32,768-token cap with no answer.
Exact keeps the model's output distribution (not bit-identical to MTP off);
it gives back some of #1376's decode gain (10-07, one request: 0.957x).
GLM-5.3-Flash and Qwen 3.8, which #1973 would also move and which are
unmeasured, stay typical.

Docs: inference.md (the acceptance paragraph), configuration.md,
cli-reference.md, ProviderConfig's comment. Fragment:
changelog.d/mtp-exact-acceptance-gemma-qat.md.

Tested (CPU only, sandbox without GPU clients, prod identity, after
wait-build-slot.sh with MIN_FREE=22): red fce36b0 fails
MTPAcceptanceConfigTests with 2 issues (absentKeys and gemmaQATDefaultsToExact,
both gemma-4-26b-qat-4bit resolving to typical); here MTPAcceptanceConfigTests
8/8, Bonsai9BMTPPolicyTests 3/3, EngineV2SamplingDefaultsTests 16/16,
Bonsai9BRequestPolicyTests 3/3, BenchmarkProductionInputTests 8/8,
EngineV2TranslationTests 11/11; changelog.py check (69), docs-impact-check
--base ca8697d (7 files), docs-check.sh (211), git diff --check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…other model keeps its rule (red)

The Qwen 3.8 counterpart of #1974, for 0.10.12. absentKeys now also expects
exact for the catalog EigenLabs/Qwen3.8-27B-4bit-mtp, and qwen38DefaultsToExact
pins exact for it and for the same target without its inline head
(EigenLabs/Qwen3.8-27B-4bit); typical for the Flash-Next artifact, the
Qwen 3.8-derived Bonsai 2 27B, a case variant, Gemma's 8-bit builds, the 35B
Qwen builds, Lightning and GLM; exact still for Gemma QAT and Qwen3.5-9B; and
that a per-model or global "typical" still wins. gemmaQATDefaultsToExact no
longer lists Qwen 3.8 among the typical models.

On candidate (c)'s head (#1970, abf82ca; the same MTPAcceptancePolicy and
tests as #1974's head) MTPAcceptanceConfigTests fails with 3 issues in 2 of
its 9 tests (absentKeys on EigenLabs/Qwen3.8-27B-4bit-mtp,
qwen38DefaultsToExact on both Qwen 3.8 ids), each a Qwen 3.8 id resolving to
typical; Bonsai9BMTPPolicyTests passes 3/3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gle Mac; every other model keeps its rule

The Qwen 3.8 counterpart of #1974 for 0.10.12. MTPAcceptancePolicy.builtInIsExact
adds every concrete Qwen 3.8 27B build (ModelRuntimeRequirements.qwen38ConcreteModelIDs:
the catalog EigenLabs/Qwen3.8-27B-4bit-mtp and its head-less target
EigenLabs/Qwen3.8-27B-4bit) to the Bonsai 9B candidate, Qwen3.5-9B and Gemma QAT.
Every other model keeps its built-in rule, and the per-model -> global ->
built-in precedence and the unknown-value -> exact rule are unchanged.

Scope: the rule is resolved only in EngineV2SlotFactory.makeProductionBundle,
so this reaches the single-Mac paths (network serving, Only me / --local, the
mid-session MTP upgrade). Qwen 3.8 pairs never read it and were already exact;
the benchmark session keeps its own exact default.

Why: on a single Mac a lone Qwen 3.8 request drafts (Qwen4ExpMTP speculates for
one row; 105 of 443 Mac requests drafted in a half hour of 11-09), and while
its GPU pool is down OpenRouter's GPQA runs land on Macs. Typical acceptance
keeps drafts the model would rarely have sampled; on Qwen3.5-9B and Gemma QAT
that made long answers loop to the output cap. Exact keeps the model's output
distribution (exact in distribution, not bit-identical to MTP off). Cost: a
lone drafting request decodes at about 0.93x of typical (10-07, B=1), about
1-2 % of Qwen 3.8's decode on Macs overall (review-1973).

Docs: inference.md (the acceptance paragraph), configuration.md,
cli-reference.md, ProviderConfig's comment. Fragment:
changelog.d/mtp-exact-acceptance-qwen38.md.

Tested (CPU only, sandbox without GPU clients, prod identity, after
wait-build-slot.sh with MIN_FREE=22) on candidate (c) abf82ca + this
change: MTPAcceptanceConfigTests 9/9, Bonsai9BMTPPolicyTests 3/3,
EngineV2SamplingDefaultsTests 16/16, Bonsai9BRequestPolicyTests 3/3,
BenchmarkProductionInputTests 8/8, EngineV2TranslationTests 12/12. Mutants
killed by MTPAcceptanceConfigTests: the Qwen 3.8 entry dropped (3 issues),
the catalog id only (1: the head-less target), any id containing "Qwen3.8"
(1: the Flash-Next artifact).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uilt-in list, plain sentences

Text only. MTPAcceptancePolicy.builtInIsExact's comment lists the four exact
builds one per line and drops the operational note about the GPU pool (it
stays in the PR and the changelog's reasoning); the type comment is rewrapped.
inference.md's acceptance paragraph names each exact build with its reason in
one sentence each instead of one parenthesis. The changelog fragment drops the
pool sentence.

Checked: swiftc -parse of the policy and its tests, changelog.py check (70),
git diff --check; no non-comment Swift line changed.

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

vercel Bot commented Nov 11, 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 11, 2026 4:17am UTC
darkbloom-status Ready Ready Preview Nov 11, 2026 4:17am UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 11, 2026 4:17am UTC

Request Review

…peed cost by tokens, the evidence

Text only (review-1999's must-fix items 1-2 and its doc-comment should-fix).

- The speed line weighted by requests (105 of 443 profiled in one half
  hour). By tokens, lone drafting rows decode about half to 71 % of Qwen 3.8's
  Mac output, so the fragment now says about 4-5 % slower on single Macs,
  all of it while a Mac serves one request at a time (a lone request ~0.93x),
  and unchanged when a Mac serves several.
- The fragment no longer says typical made Gemma QAT loop (window 6 found no
  significant difference). It cites the 9B's controlled 13 of 31 against 0 of
  31, and Qwen 3.8's own production records (observational): on the 0.9.17
  (exact) -> 0.9.18 (typical) overlap, ~3.6x as many long answers ran to
  max_tokens on typical; since 11-09 all 229 capped long single-Mac answers
  had drafted, 0 of 33 that never drafted.
- It names every single-Mac path, including the daemon's MTP upgrade.
- builtInIsExact's comment drops the dated 11-09 statistic.

Checked: swiftc -parse, changelog.py check (70), git diff --check; no
non-comment Swift line changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jonathan308
jonathan308 marked this pull request as ready for review November 11, 2026 04:38
jonathan308 added a commit that referenced this pull request Nov 11, 2026
…y and typical MTP acceptance

NO-GO (2026-11-11): under two or more batched penalty-free 9B rows, live Metal shared events grow
about one per decode step until the provider crashes (10-60 min of sustained concurrency). The 9B
returns to 0.10.11's behaviour (presence_penalty 1.5, typical acceptance).

Reverses #1961's code, tests and docs (76ea981, 194be63, ca8697d) against the candidate:
EngineV2SamplingDefaults drops qwen35NineBCardDefaults; MTPAcceptancePolicy.builtInIsExact drops the
9B (Bonsai 9B, Gemma QAT and Qwen 3.8 stay exact); the tests expect typical for the 9B; the docs
(inference.md's defaults table, prefix-cache.md, cli-reference, configuration, ProviderConfig) name
the 9B with the 35B builds. Its changelog fragment is removed, and #1965's fragment says the penalty is
still these builds' default. #1965 (prompt-history checkpoints for rows that cannot speculate), #1974
and #1999 stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308 added a commit that referenced this pull request Nov 11, 2026
…ct again

The revert (17627f1) also undid #1961's call-site change in MTPAcceptancePolicy.resolve, so the
built-in rule read only Bonsai 9B again and Gemma 4 QAT (#1974) and Qwen 3.8 (#1999) lost their exact
default (MTPAcceptanceConfigTests: 6 issues in CI run 43098442611). resolve calls builtInIsExact again;
the 9B stays typical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jonathan308
jonathan308 merged commit 1f6a274 into dev Nov 12, 2026
19 checks passed

This branch was successfully deployed

3 active deployments
Preview – eigen-homepages-darkbloom — 0d5dfdee Deployed Nov 11, 2026 by vercel[bot]
Preview – d-inference-landing — 0d5dfdee Deployed Nov 11, 2026 by vercel[bot]
Preview – darkbloom-status — 0d5dfdee Deployed Nov 11, 2026 by vercel[bot]
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.

1 participant