From e2885e5f36d4e211496cb49252a48509576481bb Mon Sep 17 00:00:00 2001 From: Gajesh Naik <26431906+Gajesh2007@users.noreply.github.com> Date: Wed, 21 Oct 2026 17:01:01 -0700 Subject: [PATCH 1/7] perf(native): fused causal SDPA for full-attention prompt chunks Bump libs/mlx-swift-lm to the CBv2 change that attends a full-attention prompt chunk with one `.causal` SDPA call whenever MLX serves the head geometry with a fused kernel (head_dim 64/72/80/96/128 on every Apple GPU; head_dim 256 on NAX from 1024 queries), instead of 128-query blocks with explicit masks. GPT-OSS full layers and the Qwen full-attention layers of M5 solo prefill stripes take the new route; Gemma 4 does not. The SDK pin moves from 19634dd8 to ff327738: SDK main (#316, #312, #315, #317, #318) plus the change. SDK main requires mlx-swift 81f58d79 (nested MLX 71271f08), so libs/mlx-swift moves from 6923a80f and libs/mlx from cb77239b; the Metal library built from the nested MLX is byte-identical. Document the SDK-read kill switch DARKBLOOM_TTFT_FUSED_CAUSAL_PREFILL=0 in the configuration reference and the prompt-chunk attention route in the inference architecture, and add a changelog fragment. Co-Authored-By: Claude Opus 5.5 --- changelog.d/fused-causal-prefill-attention.md | 5 +++++ docs/architecture/inference.md | 1 + docs/reference/configuration.md | 3 ++- libs/mlx-swift-lm | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 changelog.d/fused-causal-prefill-attention.md diff --git a/changelog.d/fused-causal-prefill-attention.md b/changelog.d/fused-causal-prefill-attention.md new file mode 100644 index 0000000000..b557d95568 --- /dev/null +++ b/changelog.d/fused-causal-prefill-attention.md @@ -0,0 +1,5 @@ +### Fused causal prompt attention + +- Attend a full-attention prompt chunk with one fused causal attention call instead of 128-query blocks when MLX serves its head geometry with a fused kernel: head_dim 64, 72, 80, 96 or 128 on every Apple GPU, and head_dim 256 on M5 (NAX) chips for chunks of at least 1024 tokens. GPT-OSS full-attention layers on every chip and the Qwen3.5/3.8 full-attention layers of M5 solo prefill stripes take the new route; sliding-window, softcapped, vision-span and Gemma 4 layers are unchanged. +- On M3 Ultra, GPT-OSS 20B cold time to first token drops from 19.5 s to 17.4 s at 32K prompt tokens and from 3.41 s to 3.30 s at 8K. On M5 Ultra, Qwen3.5-9B peak memory at 32K prompt tokens drops from 13.86 GB to 12.03 GB because its head_dim 256 layers no longer materialize attention scores. +- GPT-OSS output is bit-identical; Qwen output on M5 can differ within bf16 rounding. `DARKBLOOM_TTFT_FUSED_CAUSAL_PREFILL=0` restores the blocked path in a foreground process; the provider LaunchAgent does not receive it. diff --git a/docs/architecture/inference.md b/docs/architecture/inference.md index 2b9ac08acd..d81688bad8 100644 --- a/docs/architecture/inference.md +++ b/docs/architecture/inference.md @@ -668,6 +668,7 @@ elapsed nanoseconds. Numerics only — never tokens, text or hashes | `maxBatchedTokensPerStep` / `prefillChunkSize` / `maxWaiting` | 2048 / 512 / 64 (`CBv2SchedulerConfig` init defaults) | `CBv2Contracts.swift`, `CBv2SchedulerConfig` | | `soloPrefillStripeTokens` | 2048 (`defaultSoloPrefillStripeTokens`); 4096 for dense Qwen3.5/3.8 (`Qwen35Model`, not `Qwen35MoEModel`); `DARKBLOOM_CBV2_SOLO_PREFILL_STRIPE` | `EngineV2Factory+Configuration.swift` | | `maxConcurrentPartialPrefills` | 1; `DARKBLOOM_CBV2_MAX_PARTIAL_PREFILLS` | `EngineV2Factory+Configuration.swift`, `maxPartialPrefillsKey` | +| Prompt-chunk attention | 128-query blocks (`DARKBLOOM_CBV2_ATTN_QUERY_BLOCK`; each paged block builds an absolute mask), bounding the composed score tensor. A full-attention chunk with no window, softcap, vision span or bidirectional mask, whose head_dim MLX fuses (64/72/80/96/128; 256 on NAX from 1024 queries in bf16/fp16), is one `.causal` call on either KV backend; `DARKBLOOM_TTFT_FUSED_CAUSAL_PREFILL=0` restores blocks | `libs/mlx-swift-lm/Libraries/MLXLMCommon/ContinuousBatchingV2/AttentionV1.swift` (`usesFusedCausalPrefill`), `libs/mlx-swift-lm/Libraries/MLXLMCommon/ContinuousBatchingV2/Paged/PagedLayerCache.swift` (`prefillAttend`) | | `enablePrefixCache` | true when the slot has an effective SSD cache, enabled paged resident cache, or recurrent checkpoint-bank configuration, or complete SSD checkpoint store; engine capability gates still apply | `EngineV2Factory+Production.swift` (`assembleProductionBuild`), `EngineV2.swift` | | `requestTimeout` | 120 s legacy total wall, used only when `DARKBLOOM_CBV2_LEGACY_REQUEST_TIMEOUT` is affirmative | `EngineLoopV2.swift`, `CBv2EngineLoopConfig`; `EngineV2Factory+Configuration.swift` | | `stepTimeout` | 30 s | `CBv2EngineLoopConfig` | diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index a17df468f8..ab2ea066bc 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md @@ -1,6 +1,6 @@ # Configuration reference -> Last updated: 2026-10-20 +> Last updated: 2026-10-21 Provider CLI, native-runtime and retained-console environment variables, compiled defaults and reading symbols. Secrets are named, never valued. Unless specified otherwise, values are read at process start. @@ -310,6 +310,7 @@ and rollback are defined in the [provider configuration reference](../provider/c | `DARKBLOOM_CBV2_MIXED_PREFILL_CAP` | nonnegative tokens | reviewed profile cap; otherwise uncapped | `provider-swift/Sources/ProviderCore/Inference/Performance/MixedPrefillPolicy.swift` (`resolve`) | Caps prompt tokens in steps that also decode. Positive Gemma caps have a 128-token minimum; `0` defers prefill while decode is active. Does not change the pure-prefill stripe. Foreground/local only. | | `DARKBLOOM_CBV2_MIXED_PREFILL_CAP_BY_MODEL` | comma-separated `model-id=tokens` | unset | `provider-swift/Sources/ProviderCore/Inference/Performance/MixedPrefillPolicy.swift` (`resolve`) | Exact model-ID overrides take precedence over the global cap, then the reviewed profile. Same nonnegative parsing and Gemma minimum; malformed entries are ignored. Foreground/local only. | | `DARKBLOOM_CBV2_MAX_PARTIAL_PREFILLS` | integer (`0` = unlimited) | `1` | `provider-swift/Sources/ProviderCore/Inference/Engine/Factory/EngineV2Factory+Configuration.swift` | Maximum concurrent partial prefills. | +| `DARKBLOOM_TTFT_FUSED_CAUSAL_PREFILL` | exact `0` disables | on | `libs/mlx-swift-lm/Libraries/MLXLMCommon/ContinuousBatchingV2/AttentionV1.swift` (`CBv2AttentionV1.fusedCausalPrefillEnabled`, `usesFusedCausalPrefill`) | Full-attention prompt chunks whose head geometry MLX serves with a fused kernel take one `.causal` SDPA call on either KV backend ([eligible chunks](../architecture/inference.md#scheduler-and-loop-configuration)); `0` returns them to 128-query blocks. Read once per process; not forwarded to LaunchAgents. | | `DARKBLOOM_CBV2_LEGACY_REQUEST_TIMEOUT` | affirmative | off | `provider-swift/Sources/ProviderCore/Inference/Engine/Factory/EngineV2Factory+Configuration.swift` | Restores the legacy per-request timeout. | | `DARKBLOOM_CBV2_MTP` | negative disables | unset (beta flag decides) | `provider-swift/Sources/ProviderCore/SpecDec/SpecDecArtifactFunnel.swift`; `provider-swift/Sources/ProviderCore/Config/BetaFeatures.swift` | Kill switch for MTP speculation; beats the `provider.toml` beta flag. See [`../provider/beta-features.md`](../provider/beta-features.md). | | `DARKBLOOM_MTP_MAX_RECTANGULAR_TOKENS` | integer | policy default | `provider-swift/Sources/ProviderCore/Inference/MTP/MTPAutomaticVerificationPolicy.swift` | Tighten-only cap on rectangular MTP verification tokens. | diff --git a/libs/mlx-swift-lm b/libs/mlx-swift-lm index 19634dd8b9..ff32773834 160000 --- a/libs/mlx-swift-lm +++ b/libs/mlx-swift-lm @@ -1 +1 @@ -Subproject commit 19634dd8b9a940751679e0e17b248fd9aca0f5ff +Subproject commit ff327738347281b0a494e7d424ee448ddb4d576b From 193823342eebc67d47249556cac46436c7893851 Mon Sep 17 00:00:00 2001 From: Gajesh Naik <26431906+Gajesh2007@users.noreply.github.com> Date: Wed, 21 Oct 2026 17:01:02 -0700 Subject: [PATCH 2/7] docs(native): name the unmeasured models the fused causal route reaches Refactor pass over the fused causal prefill change. Pin libs/mlx-swift-lm to fd17d026, the head of the paired SDK branch: one refactor commit over ff327738 that changes comments and the route's test, not compiled code. The route follows layer geometry, so it also reaches the Nemotron 3.5 Lightning attention layers (head_dim 128, every chip) and the head_dim 256 full-attention layers of the other Qwen-family models in M5 solo prefill stripes. The changelog fragment now names them and says they were not measured. The inference and configuration rows note that Qwen4 QSA blocks build no absolute mask and that live packed paged KV keeps its own prompt path. Co-Authored-By: Claude Opus 5.5 --- changelog.d/fused-causal-prefill-attention.md | 4 ++-- docs/architecture/inference.md | 2 +- docs/reference/configuration.md | 2 +- libs/mlx-swift-lm | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/changelog.d/fused-causal-prefill-attention.md b/changelog.d/fused-causal-prefill-attention.md index b557d95568..91e293e4d1 100644 --- a/changelog.d/fused-causal-prefill-attention.md +++ b/changelog.d/fused-causal-prefill-attention.md @@ -1,5 +1,5 @@ ### Fused causal prompt attention -- Attend a full-attention prompt chunk with one fused causal attention call instead of 128-query blocks when MLX serves its head geometry with a fused kernel: head_dim 64, 72, 80, 96 or 128 on every Apple GPU, and head_dim 256 on M5 (NAX) chips for chunks of at least 1024 tokens. GPT-OSS full-attention layers on every chip and the Qwen3.5/3.8 full-attention layers of M5 solo prefill stripes take the new route; sliding-window, softcapped, vision-span and Gemma 4 layers are unchanged. +- Attend a full-attention prompt chunk with one fused causal attention call instead of 128-query blocks when MLX serves its head geometry with a fused kernel: head_dim 64, 72, 80, 96 or 128 on every Apple GPU, and head_dim 256 on M5 (NAX) chips for chunks of at least 1024 tokens. That includes the full-attention layers of GPT-OSS and Nemotron 3.5 Lightning on every chip and the head_dim 256 full-attention layers of Qwen-family models in M5 solo prefill stripes; sliding-window, softcapped, vision-span, live packed paged KV and Gemma 4 layers are unchanged. - On M3 Ultra, GPT-OSS 20B cold time to first token drops from 19.5 s to 17.4 s at 32K prompt tokens and from 3.41 s to 3.30 s at 8K. On M5 Ultra, Qwen3.5-9B peak memory at 32K prompt tokens drops from 13.86 GB to 12.03 GB because its head_dim 256 layers no longer materialize attention scores. -- GPT-OSS output is bit-identical; Qwen output on M5 can differ within bf16 rounding. `DARKBLOOM_TTFT_FUSED_CAUSAL_PREFILL=0` restores the blocked path in a foreground process; the provider LaunchAgent does not receive it. +- GPT-OSS teacher-forced scores are bit-identical; Qwen output on M5 can differ within bf16 rounding; Nemotron 3.5 Lightning and the other qualifying models were not measured. `DARKBLOOM_TTFT_FUSED_CAUSAL_PREFILL=0` restores the blocked path in a foreground process; the provider LaunchAgent does not receive it. diff --git a/docs/architecture/inference.md b/docs/architecture/inference.md index d81688bad8..852ab18148 100644 --- a/docs/architecture/inference.md +++ b/docs/architecture/inference.md @@ -668,7 +668,7 @@ elapsed nanoseconds. Numerics only — never tokens, text or hashes | `maxBatchedTokensPerStep` / `prefillChunkSize` / `maxWaiting` | 2048 / 512 / 64 (`CBv2SchedulerConfig` init defaults) | `CBv2Contracts.swift`, `CBv2SchedulerConfig` | | `soloPrefillStripeTokens` | 2048 (`defaultSoloPrefillStripeTokens`); 4096 for dense Qwen3.5/3.8 (`Qwen35Model`, not `Qwen35MoEModel`); `DARKBLOOM_CBV2_SOLO_PREFILL_STRIPE` | `EngineV2Factory+Configuration.swift` | | `maxConcurrentPartialPrefills` | 1; `DARKBLOOM_CBV2_MAX_PARTIAL_PREFILLS` | `EngineV2Factory+Configuration.swift`, `maxPartialPrefillsKey` | -| Prompt-chunk attention | 128-query blocks (`DARKBLOOM_CBV2_ATTN_QUERY_BLOCK`; each paged block builds an absolute mask), bounding the composed score tensor. A full-attention chunk with no window, softcap, vision span or bidirectional mask, whose head_dim MLX fuses (64/72/80/96/128; 256 on NAX from 1024 queries in bf16/fp16), is one `.causal` call on either KV backend; `DARKBLOOM_TTFT_FUSED_CAUSAL_PREFILL=0` restores blocks | `libs/mlx-swift-lm/Libraries/MLXLMCommon/ContinuousBatchingV2/AttentionV1.swift` (`usesFusedCausalPrefill`), `libs/mlx-swift-lm/Libraries/MLXLMCommon/ContinuousBatchingV2/Paged/PagedLayerCache.swift` (`prefillAttend`) | +| Prompt-chunk attention | 128-query blocks (`DARKBLOOM_CBV2_ATTN_QUERY_BLOCK`; paged blocks other than Qwen4 QSA build an absolute mask), bounding the composed score tensor. A full-attention chunk with no window, softcap, vision span or bidirectional mask, whose head_dim MLX fuses (64/72/80/96/128; 256 on NAX from 1024 queries in bf16/fp16), is one `.causal` call on either KV backend (live packed paged KV keeps its own path); `DARKBLOOM_TTFT_FUSED_CAUSAL_PREFILL=0` restores blocks | `libs/mlx-swift-lm/Libraries/MLXLMCommon/ContinuousBatchingV2/AttentionV1.swift` (`usesFusedCausalPrefill`), `libs/mlx-swift-lm/Libraries/MLXLMCommon/ContinuousBatchingV2/Paged/PagedLayerCache.swift` (`prefillAttend`) | | `enablePrefixCache` | true when the slot has an effective SSD cache, enabled paged resident cache, or recurrent checkpoint-bank configuration, or complete SSD checkpoint store; engine capability gates still apply | `EngineV2Factory+Production.swift` (`assembleProductionBuild`), `EngineV2.swift` | | `requestTimeout` | 120 s legacy total wall, used only when `DARKBLOOM_CBV2_LEGACY_REQUEST_TIMEOUT` is affirmative | `EngineLoopV2.swift`, `CBv2EngineLoopConfig`; `EngineV2Factory+Configuration.swift` | | `stepTimeout` | 30 s | `CBv2EngineLoopConfig` | diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index ab2ea066bc..6b17325135 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md @@ -310,7 +310,7 @@ and rollback are defined in the [provider configuration reference](../provider/c | `DARKBLOOM_CBV2_MIXED_PREFILL_CAP` | nonnegative tokens | reviewed profile cap; otherwise uncapped | `provider-swift/Sources/ProviderCore/Inference/Performance/MixedPrefillPolicy.swift` (`resolve`) | Caps prompt tokens in steps that also decode. Positive Gemma caps have a 128-token minimum; `0` defers prefill while decode is active. Does not change the pure-prefill stripe. Foreground/local only. | | `DARKBLOOM_CBV2_MIXED_PREFILL_CAP_BY_MODEL` | comma-separated `model-id=tokens` | unset | `provider-swift/Sources/ProviderCore/Inference/Performance/MixedPrefillPolicy.swift` (`resolve`) | Exact model-ID overrides take precedence over the global cap, then the reviewed profile. Same nonnegative parsing and Gemma minimum; malformed entries are ignored. Foreground/local only. | | `DARKBLOOM_CBV2_MAX_PARTIAL_PREFILLS` | integer (`0` = unlimited) | `1` | `provider-swift/Sources/ProviderCore/Inference/Engine/Factory/EngineV2Factory+Configuration.swift` | Maximum concurrent partial prefills. | -| `DARKBLOOM_TTFT_FUSED_CAUSAL_PREFILL` | exact `0` disables | on | `libs/mlx-swift-lm/Libraries/MLXLMCommon/ContinuousBatchingV2/AttentionV1.swift` (`CBv2AttentionV1.fusedCausalPrefillEnabled`, `usesFusedCausalPrefill`) | Full-attention prompt chunks whose head geometry MLX serves with a fused kernel take one `.causal` SDPA call on either KV backend ([eligible chunks](../architecture/inference.md#scheduler-and-loop-configuration)); `0` returns them to 128-query blocks. Read once per process; not forwarded to LaunchAgents. | +| `DARKBLOOM_TTFT_FUSED_CAUSAL_PREFILL` | exact `0` disables | on | `libs/mlx-swift-lm/Libraries/MLXLMCommon/ContinuousBatchingV2/AttentionV1.swift` (`CBv2AttentionV1.fusedCausalPrefillEnabled`, `usesFusedCausalPrefill`) | Full-attention prompt chunks whose head geometry MLX serves with a fused kernel take one `.causal` SDPA call on either KV backend, except live packed paged KV ([eligible chunks](../architecture/inference.md#scheduler-and-loop-configuration)); `0` returns them to 128-query blocks. Read once per process; not forwarded to LaunchAgents. | | `DARKBLOOM_CBV2_LEGACY_REQUEST_TIMEOUT` | affirmative | off | `provider-swift/Sources/ProviderCore/Inference/Engine/Factory/EngineV2Factory+Configuration.swift` | Restores the legacy per-request timeout. | | `DARKBLOOM_CBV2_MTP` | negative disables | unset (beta flag decides) | `provider-swift/Sources/ProviderCore/SpecDec/SpecDecArtifactFunnel.swift`; `provider-swift/Sources/ProviderCore/Config/BetaFeatures.swift` | Kill switch for MTP speculation; beats the `provider.toml` beta flag. See [`../provider/beta-features.md`](../provider/beta-features.md). | | `DARKBLOOM_MTP_MAX_RECTANGULAR_TOKENS` | integer | policy default | `provider-swift/Sources/ProviderCore/Inference/MTP/MTPAutomaticVerificationPolicy.swift` | Tighten-only cap on rectangular MTP verification tokens. | diff --git a/libs/mlx-swift-lm b/libs/mlx-swift-lm index ff32773834..fd17d026b4 160000 --- a/libs/mlx-swift-lm +++ b/libs/mlx-swift-lm @@ -1 +1 @@ -Subproject commit ff327738347281b0a494e7d424ee448ddb4d576b +Subproject commit fd17d026b4292ac237603dfdf79e58720f4835bb From 7cf28eab6e136970d70cfa20757250a88c1aad9d Mon Sep 17 00:00:00 2001 From: Gajesh Naik <26431906+Gajesh2007@users.noreply.github.com> Date: Wed, 21 Oct 2026 17:22:44 -0700 Subject: [PATCH 3/7] Pin libs/mlx-swift-lm to the SDK change on master's SDK commit The paired SDK PR branch (ttft/fused-causal-prefill) was published on SDK main 0351444e, which also carries mlx-swift-lm #323 and #325 that d-inference master does not pin yet. Pin ttft/fused-causal-prefill-pin (6d1321ce) instead: the same commits cherry-picked onto 0351444e, the SDK commit master pins, so this PR adds only this change. Co-Authored-By: Claude Opus 5.5 --- libs/mlx-swift-lm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/mlx-swift-lm b/libs/mlx-swift-lm index fd17d026b4..6d1321ce04 160000 --- a/libs/mlx-swift-lm +++ b/libs/mlx-swift-lm @@ -1 +1 @@ -Subproject commit fd17d026b4292ac237603dfdf79e58720f4835bb +Subproject commit 6d1321ce048f943907d58d7f6545919c860186ce From 0d8581ff61ad327fcb59cb74bb8bdd06326c0fb3 Mon Sep 17 00:00:00 2001 From: Gajesh Naik <26431906+Gajesh2007@users.noreply.github.com> Date: Wed, 21 Oct 2026 17:23:39 -0700 Subject: [PATCH 4/7] Revert "Pin libs/mlx-swift-lm to the SDK change on master's SDK commit" d-inference master now pins SDK main 0351444e (#1531), the base the paired SDK PR branch (ttft/fused-causal-prefill) was published on, so the PR head is already the right pin and the cherry-picked ttft/fused-causal-prefill-pin copy is redundant. Co-Authored-By: Claude Opus 5.5 --- libs/mlx-swift-lm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/mlx-swift-lm b/libs/mlx-swift-lm index 6d1321ce04..fd17d026b4 160000 --- a/libs/mlx-swift-lm +++ b/libs/mlx-swift-lm @@ -1 +1 @@ -Subproject commit 6d1321ce048f943907d58d7f6545919c860186ce +Subproject commit fd17d026b4292ac237603dfdf79e58720f4835bb From 0ee7a5b0e5652e547292d4f569a3d1a37e275f8b Mon Sep 17 00:00:00 2001 From: Gajesh Naik <26431906+Gajesh2007@users.noreply.github.com> Date: Wed, 21 Oct 2026 17:33:50 -0700 Subject: [PATCH 5/7] Re-pin libs/mlx-swift-lm to the merged SDK change (#327) Layr-Labs/mlx-swift-lm#327 squash-merged as 1bee5728 ("perf(cbv2): one fused causal SDPA per full-attention prompt chunk (#327)"). Move the gitlink from the PR branch head fd17d026 to that commit on SDK main. Co-Authored-By: Claude Opus 5.5 --- libs/mlx-swift-lm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/mlx-swift-lm b/libs/mlx-swift-lm index fd17d026b4..1bee5728dd 160000 --- a/libs/mlx-swift-lm +++ b/libs/mlx-swift-lm @@ -1 +1 @@ -Subproject commit fd17d026b4292ac237603dfdf79e58720f4835bb +Subproject commit 1bee5728dd0dcadacc5a8a06b85e7379a21cfdf3 From 8b1b589ef70b0b9303dc36e18b8950fee895772f Mon Sep 17 00:00:00 2001 From: Gajesh Naik <26431906+Gajesh2007@users.noreply.github.com> Date: Wed, 21 Oct 2026 18:16:45 -0700 Subject: [PATCH 6/7] docs(provider): document fused causal prefill memory in hardware support The fused causal prompt-attention route lowers the prefill transient (Qwen3.5-9B on M5 Ultra at 32K: 13.86 -> 12.03 GB peak) but only inference.md described it. Record in hardware-support.md what the route drops, and that the activation reserve, measured floors, minimum load KV and slot grants intentionally stay unchanged, with the reasons. Co-Authored-By: Claude Opus 5.5 --- docs/architecture/hardware-support.md | 28 ++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/architecture/hardware-support.md b/docs/architecture/hardware-support.md index cbe6b1b667..105d4db8ec 100644 --- a/docs/architecture/hardware-support.md +++ b/docs/architecture/hardware-support.md @@ -1,6 +1,6 @@ # Hardware support and the provider memory model -> Last updated: 2026-10-21 +> Last updated: 2026-10-22 What hardware the provider runs on and how it decides, in bytes, whether a model may load and how much KV cache each resident model may use. Read this to @@ -172,6 +172,32 @@ loadIsServeable(measuredLiveKVHeadroomBytes) = measuredLiveKVHeadroomBytes ≥ m `ramPrefix` is always 0 in production — there is no RAM prefix-cache carve ([`prefix-cache.md`](prefix-cache.md)). +Fused causal prompt attention changes the prefill transient, not these +constants. An eligible full-attention prompt chunk takes one `.causal` SDPA +call instead of 128-query blocks. The fused kernel materializes no scores, so +the route drops the per-block score tensors of MLX's composed path (head_dim +256), the per-block BOOL masks on paged storage and the output concat; it adds +no allocation +([eligibility](inference.md#scheduler-and-loop-configuration); `usesFusedCausalPrefill` in +`libs/mlx-swift-lm/Libraries/MLXLMCommon/ContinuousBatchingV2/AttentionV1.swift`). +On M5 Ultra, Qwen3.5-9B peak MLX memory at 32,768 prompt tokens fell from +13.86 GB to 12.03 GB because its head_dim 256 layers take the fused kernel. +`defaultActivationReserveBytes`, `measuredActivationFloorsBytes`, +`minimumLoadKVBytes` and the KV slot grants are intentionally unchanged: + +- The default reserve is sized from gemma-4, whose layers keep the blocked + path. The gpt-oss-20b floor comes from the 2026-07-10 sweep, which ran the + blocked path; the fused route only removes allocations from that path, so + the floor stays an upper bound. The Nemotron Super floor is the residue its + request and prefill-lane charges do not hold, not a prompt-attention + transient. No floor has been re-measured on the fused route, and a lower + floor needs a new measurement. +- `DARKBLOOM_TTFT_FUSED_CAUSAL_PREFILL=0` restores the blocked path that the + 2026-07-10 sweep ran. +- K/V layout and dtype do not change, so KV bytes per token, slot grants and + advertised capacity do not change. A lower live transient shows up only + through `liveKVHeadroomBytes`, which reads real MLX `active + cache`. + ### Load gate (`ModelLoadAdmission`) GLM sparse KV sizing uses the native asymmetric FP32 payload: each storage From bd6e963fb057c7e1fbbecfa422b8fa731e87c2d9 Mon Sep 17 00:00:00 2001 From: Gajesh Naik <26431906+Gajesh2007@users.noreply.github.com> Date: Wed, 21 Oct 2026 18:16:45 -0700 Subject: [PATCH 7/7] docs(provider): restamp the fused causal prefill docs inference.md and configuration.md changed for the fused causal prompt attention route; set their freshness stamps to the UTC date of the change. Co-Authored-By: Claude Opus 5.5 --- docs/architecture/inference.md | 2 +- docs/reference/configuration.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/architecture/inference.md b/docs/architecture/inference.md index eeef641f01..39e3b4943a 100644 --- a/docs/architecture/inference.md +++ b/docs/architecture/inference.md @@ -1,6 +1,6 @@ # Provider inference engine -> Last updated: 2026-10-21 +> Last updated: 2026-10-22 How a chat-completion request is served inside the `darkbloom` provider process: one in-process engine (`mlx-swift-lm` diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index a9fb383e05..742f9869a2 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md @@ -1,6 +1,6 @@ # Configuration reference -> Last updated: 2026-10-21 +> Last updated: 2026-10-22 Provider CLI, native-runtime and retained-console environment variables, compiled defaults and reading symbols. Secrets are named, never valued. Unless specified otherwise, values are read at process start.