Skip to content

perf(flint): pin SDK speedups, chain constrained decode, serve at paged width - #1555

Merged
Gajesh2007 merged 6 commits into
masterfrom
claude/flint-perf
Oct 22, 2026
Merged

Gajesh2007 merged 6 commits into
masterfrom
claude/flint-perf

Conversation

@jonathan308

@jonathan308 jonathan308 commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Flint serving speedups on the paged path. Pins merged mlx-swift-lm main at 993f7060 (Layr-Labs/mlx-swift-lm#336, merged) and mlx-swift 67dc752 (current main). Independent of #1554 (paged-only defaults).

Changes

  • libs/mlx-swift-lm → 993f7060 (merged fix(coordinator): snapshot AttestationResult on store (fix -race data race) #336): decode command buffers, fewer paged decode dispatches and uploads, fused MoE FP32 expert combine, batched sliding-window prefill attention, final-layer KV-only evaluation chunks, constrained decode chaining with cached device masks. All byte-identical; details and exactness evidence in mlx-swift-lm#336.
  • FlintNativeProtocolConstraint and FlintAnswerStopConstraint opt into chained decode (allowsChainedDecode) and expose maskCacheKey. The key is the constraint state while output budget remains, because the allowed set depends only on the state: the existing per-state allowed-token cache already ignores the remaining budget (FlintNativeProtocolConstraint.allowedTokenIDs), and a scanning answer-stop state returns its base state's set. A matched stop and an exhausted budget get distinct keys.
  • RecursiveSI/flint-int4 joins the automatic paged list (EngineV2KVBackendPolicy.preferredBackend), so it serves at the legacy paged width (8 concurrent) on M5 Pro, Max and Ultra instead of the default 4. Without this, served throughput stops scaling at 4 concurrent requests.
  • Docs (inference.md Native Flint) and changelog.

Measured through a real served endpoint (darkbloom start --local, M5 Max, paged/native/native, production sampling, Flint protocol constraint on, unique prompts; old and new builds alternated with equal cool-downs):

Served endpoint Before After Change
Decode, 1 request 76.5 tok/s 101.5 tok/s +33%
Decode, 4 concurrent (sum of rows) 209 tok/s 251 tok/s +20%
Decode, 8 concurrent (sum of rows, width 8) 272 tok/s 319 tok/s +17%
Decode, 8 concurrent at the old default width 4 (end to end) 216 tok/s 239 tok/s capped by width
Prefill, 1K prompt 4,653 tok/s 4,926 tok/s +5.9%
Prefill, 4K prompt 5,360 tok/s 6,070 tok/s +13.2%
Prefill, 8K prompt 4,513 tok/s 4,960 tok/s +9.9%

Before — served request path

flowchart LR
  A["OpenAI request"] --> B["Admission: width 4<br/>(Flint not on paged list)"]
  B --> C["Prefill: 16 sliding SDPA/layer,<br/>unfused MoE combine"]
  C --> D["Decode: host builds O(vocab) mask,<br/>then waits for the GPU"]
  D --> E["~76 tok/s per request"]
  classDef input fill:#dbeafe,stroke:#1d4ed8,color:#172554
  classDef gate fill:#fef3c7,stroke:#b45309,color:#451a03
  classDef blocked fill:#fee2e2,stroke:#b91c1c,color:#450a0a
  class A input
  class B,C,D gate
  class E blocked
Loading

After — served request path

flowchart LR
  A["OpenAI request"] --> B["Admission: width 8<br/>on M5 Pro/Max/Ultra"]
  B --> C["Prefill: batched sliding SDPA,<br/>fused MoE combine"]
  C --> D["Decode: chained steps,<br/>cached device masks"]
  D --> E["~101 tok/s per request,<br/>~319 tok/s at 8 concurrent"]
  classDef input fill:#dbeafe,stroke:#1d4ed8,color:#172554
  classDef native fill:#dcfce7,stroke:#15803d,color:#052e16
  class A input
  class B,C,D,E native
Loading

Blue is input, amber is overhead on the critical path, green is the optimized path, red is the old result.

Validation (M5 Max, MLX_ENABLE_TF32=0)

Check Result
Provider suites on this pin (Flint, constraints, router, tool policy, KV backend/quantization, serving width, relay, Responses, MiMo, GLM5, Qwen4, DiffusionGemma, prompt parity, benchmark dispatch) 665 tests in 91 suites pass, plus XCTest suites (skips only)
New provider tests Equal mask keys give identical allowed sets for the protocol and answer-stop constraints; Flint gets the automatic paged width on M5 Pro/Max/Ultra and keeps the configured width on M4 Max and M5 base
SDK branch 153 Swift Testing tests in 28 suites plus XCTest suites, 0 failures (see mlx-swift-lm#336)
Served-endpoint A/B Table above; receipts in the onboarding workspace (evidence/served-*)
make changelog-check / make docs-impact-check BASE=origin/master Pass / Pass

Not in this PR: a reviewed serving performance profile for widths above 8, and runs on M1–M4 hardware (code paths are family-agnostic; see mlx-swift-lm#336).

🤖 Generated with Claude Code

…ed width

Pins mlx-swift-lm claude/flint-perf (0349802): larger decode command
buffers, fewer paged decode dispatches and host uploads, a fused MoE FP32
expert combine, batched sliding-window prefill attention, final-layer
KV-only evaluation chunks, and constrained decode chaining with cached
device masks. Every SDK change is byte-identical to the previous path.

FlintNativeProtocolConstraint and FlintAnswerStopConstraint opt into
chained decode and key their cached masks by constraint state, since the
allowed set depends only on the state while output budget remains.
RecursiveSI/flint-int4 joins the automatic paged list, so it serves at
the legacy paged width (8) on M5 Pro, Max and Ultra.

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

vercel Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
d-inference Ready Ready Preview Oct 22, 2026 10:14pm UTC
d-inference-console-ui-dev Ready Ready Preview Oct 22, 2026 10:14pm UTC
d-inference-landing Ready Ready Preview Oct 22, 2026 10:14pm UTC
darkbloom-status Ready Ready Preview Oct 22, 2026 10:14pm UTC
eigen-homepages-darkbloom Ready Ready Preview Oct 22, 2026 10:14pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Threat model review — advisory

Reviewed head 1a41bd1003e5 against base b02d39e5aac3.

Review not completed for this head. Previous findings are superseded, not confirmed resolved.
First pass completed; selected deeper review is pending

Reviewers: anthropic/claude-sonnet-5.5: first pass completed; anthropic/claude-opus-5.5: selected depth completed (9 batches); openai/gpt-6.1-sol: selected depth completed (1 batches)

Scan incomplete: 1 file(s) could not be fully read as text. Binary, Git LFS and submodule changes require manual review.
Affected files: libs/mlx-swift-lm

Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging.

Coverage: 45/45 source units; cross-file integration complete. 0 selected depth batch(es) pending. All threat definitions indexed; relevant full definitions selected. Unchanged callers are not scanned.

Cost this run: $0.0000 reported, $0.0000 reserved with unknown cost; 0 paid request(s), 0 reused batch(es), 0 provider cache-hit tokens.

Saved findings and earlier report · Historical findings are not confirmed resolved.

Bedrock: 21 request(s), 921144 uncached + 0 cache-read + 47795 cache-write input / 15224 output tokens; 0 request(s) with unknown usage. OpenRouter backup used 0 time(s). Dollar amounts above cover OpenRouter only; AWS billing is reconciled separately.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fbd2cd0d is the Flint speedup branch with mlx-swift-lm main (f77b384c,
master's previous pin) merged in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gajesh2007
Gajesh2007 merged commit 35d5d1f into master Oct 22, 2026
19 of 20 checks passed

This branch was successfully deployed

5 active deployments
Preview – d-inference — ce2d925e Deployed Oct 22, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — ce2d925e Deployed Oct 22, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — ce2d925e Deployed Oct 22, 2026 by vercel[bot]
Preview – d-inference-landing — ce2d925e Deployed Oct 22, 2026 by vercel[bot]
Preview – darkbloom-status — ce2d925e Deployed Oct 22, 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.

2 participants