Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
76419b4
Provider: memory_only cache policy and token-free checkpoint storage
jonathan308 Nov 23, 2026
aea7ab8
Docs: memory_only cache policy, token-free checkpoints and the fixed TTL
jonathan308 Nov 23, 2026
616da8d
Provider: tidy the memory_only cache policy change
jonathan308 Nov 23, 2026
1013650
Provider: memory_only media requests on Nemotron Super keep the prefi…
jonathan308 Nov 23, 2026
4935e47
Docs: the usage records a request leaves outside the cache
jonathan308 Nov 23, 2026
34ae910
Merge dev into feat/zdr-cache-policy
jonathan308 Nov 23, 2026
e1c6ebb
Cluster: a shared-history prefix record restores for a shorter prompt
jonathan308 Nov 23, 2026
780e6df
Provider: pair members report cache_policy_v1; memory-only receipts k…
jonathan308 Nov 23, 2026
d3ee65b
Docs: every file a request leaves on disk, and when old records go
jonathan308 Nov 23, 2026
6009e53
Merge dev into feat/zdr-cache-policy
jonathan308 Nov 23, 2026
52badee
Cluster: a running rank deletes its expired prefix records every 60 s
jonathan308 Nov 23, 2026
3dd2a1d
Provider: delete a pair's expired records while the provider runs
jonathan308 Nov 23, 2026
3b58529
Docs: when a pair's records go, and what a pair member reports
jonathan308 Nov 23, 2026
f41e281
Changelog: a pair deletes its expired cache records while running
jonathan308 Nov 23, 2026
f1429b1
Cluster: expiry never loses a use or a write, and honours a running plan
jonathan308 Nov 23, 2026
8887b4e
Provider: sweep a pair's expired records at the root and TTL its rank…
jonathan308 Nov 23, 2026
12270ef
Docs: where and with which TTL a pair's expired records go
jonathan308 Nov 23, 2026
bb13a64
Pair cache: keep replacement and expiry work with the writer and its …
jonathan308 Nov 23, 2026
f9e5f17
Pair cache: retain staging and retry when a plan cannot be inspected
jonathan308 Nov 23, 2026
1e3daa0
Pair cache: bind unpair retries to the original volume and finish int…
jonathan308 Nov 23, 2026
cd71d2b
Member cache: atomically publish the reclaim intent and bind the firs…
jonathan308 Nov 23, 2026
18dffd7
Pair cache cleanup: recover states that an interrupted removal or wri…
jonathan308 Nov 23, 2026
8de2e82
Docs: a TTL ends reuse; file removal is conditional and has no deadline
jonathan308 Nov 23, 2026
1342b58
SSD cache: maintenance still removes a model's due files after an epo…
jonathan308 Nov 23, 2026
3fa5bde
SSD cache: an entry past its TTL is not reused or advertised before a…
jonathan308 Nov 23, 2026
fb16aba
Merge the single-Mac SSD cache fixes into the cache-policy branch
jonathan308 Nov 23, 2026
a6d123e
Docs: single-Mac reuse checks and an epoch wipe that stopped early
jonathan308 Nov 23, 2026
8f2a14e
Tests: the attention TTL boundary holds before the expiry sweep
jonathan308 Nov 23, 2026
b5f5a43
Docs: one-Mac cleanup limits and fixed age after a mode switch
jonathan308 Nov 23, 2026
4e72bd8
Tests: read the kept marker before the expectation
jonathan308 Nov 23, 2026
6298939
Docs: re-donation checks the entry; an unreadable marker on a new unpair
jonathan308 Nov 23, 2026
7459c63
Merge the attention TTL test update into the cache-policy branch
jonathan308 Nov 23, 2026
d7510a0
Tests: a new plan at a retired name is kept while a rank shares the root
jonathan308 Nov 23, 2026
8a9dcf3
Keep an idle slot's decode rate while the coordinator decays stale rates
jonathan308 Nov 24, 2026
b66917a
Docs: another build's checkpoint files are not reused and wait for ma…
jonathan308 Nov 24, 2026
9165c35
Docs: an earlier build's pair records are not reused and expire by TTL
jonathan308 Nov 24, 2026
16c318d
Merge dev at 86ac4a774e into the cache-policy branch
jonathan308 Nov 24, 2026
810d2bd
Merge D8 86ac4a774e into feat/coordinator-decode-rate-age-decay
jonathan308 Nov 24, 2026
0ef471c
Merge the coordinator decode-rate decay change (810d2bd688) into the …
jonathan308 Nov 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions changelog.d/coordinator-decode-rate-age-decay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### An idle Mac keeps its decode rate when the coordinator decays stale rates

The coordinator can now say, in `trust_status.coordinator_features`, that it
decays a stale `observed_decode_tps` by its `observed_decode_tps_age_ms`
(`decode_rate_age_decay`). While the connected coordinator says so, an idle
slot keeps publishing its decode rate and its age after
`DARKBLOOM_DECODE_RATE_IDLE_MAX_AGE_SECONDS`, instead of omitting it; the
coordinator moves an old rate toward the fleet median, so the slot keeps its
rank instead of alternating between no rate and an old one. Without the field
(every coordinator before it), with any other list, and after a disconnect, the
heartbeat is unchanged.
9 changes: 9 additions & 0 deletions changelog.d/memory-only-cache-policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### A request can keep its prompt off the SSD cache, and cached prompts no longer store token IDs

- A coordinator request whose sealed cache settings say `memory_only` is served with its prompt cache off: nothing it sends is read from, staged on or written to the Mac's encrypted SSD cache, on one Mac or a pair. Any value but `default` counts as `memory_only`. Providers, and each Mac of a pair, report `cache_policy_v1` in their registration and attestation so the coordinator can route such requests.
- Complete checkpoints now store a keyed digest of the prompt prefix instead of its token IDs, and a speculative head's token history as zeros; a restore rebuilds both from the request's own prompt. A pair's prefix records store their history tokens the same way. Each build keeps its complete-checkpoint files in its own directory and never reads another build's files. After an update or a rollback, the other build's files are not reused. They become eligible for removal once unused (unmodified) for `DARKBLOOM_PREFIX_CACHE_SSD_TTL_SECONDS` (1,800 s by default and at most). While the provider runs on its own (not as a pair member) and its cache volume has been available since it started, maintenance (every 60 s, and once each time a model's cache opens) removes them after that, or earlier if the disk budget needs the space. Otherwise they remain on disk: while the provider isn't running, serves as a pair member or started without its cache volume, until it next runs on its own with that volume available; after the cache location changed, because another location isn't walked, until that location is selected again; and when a file or directory can't be read (a malformed header, an unreadable or foreign cache record, a symbolic link or a misnamed entry), until the cache is cleared or the provider is uninstalled. Empty directories stay. Files written by builds before this change can contain prompt token IDs until removed. Requests with `cache_policy` `memory_only` are unaffected: they never write cache files.
- A pair stops offering an SSD record for reuse when its TTL expires. Periodic maintenance can now remove due, unpinned records on the accessible selected volume even while the pair is idle; previously cleanup waited for a write or load. It also cleans a plan whose lock file an earlier version's interrupted removal lost, once no rank uses that cache root, and reads an empty or malformed TTL stamp as this Mac's TTL. A new unpair replaces a reclaim record an earlier version left unreadable. Removal is best effort: a held or unverifiable plan, a missing or different volume, or an earlier unpair still waiting for its original selection postpones it.
- `DARKBLOOM_SSD_KV_TTL_MODE=fixed` stops reusing every cache entry 30 minutes (or the configured TTL) after it was written, however often it is hit. Its file is removed later, by maintenance that can reach it on the selected volume, with no fixed time. `DARKBLOOM_LOCAL_CACHE_POLICY=memory_only` serves this Mac's local API the same way as a `memory_only` request. Both are forwarded to the background service.
- An SSD cache entry past its TTL is no longer reused before maintenance removes its file: attention blocks count only blocks within their TTL, and a complete checkpoint's delta and ready message check every link of its chain; a re-donation of an expired checkpoint writes it again. Under `DARKBLOOM_SSD_KV_TTL_MODE=fixed`, a turn writes a complete checkpoint when its parent chain has less than half a TTL of reuse left.
- If a model's one-time cache wipe after this update stops early (the provider quits, or an entry can't be removed), maintenance keeps removing that model's files once they are past their TTL or over the budget; the model's next load repeats the wipe.
- The local `/metrics` counts requests by cache policy and the SSD cache's refusals of `memory_only` requests.
60 changes: 55 additions & 5 deletions docs/architecture/inference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2728,6 +2728,25 @@ cannot advertise a successor's prompt. Ready anchors describe actual input
checkpoints, and billing retains the engine's actual matched/saved token counts
(`EngineV2Bridge+PrefixCache.swift`, `ResidentPrefixCacheEvidence.swift`).

### A request's cache policy

A coordinator request's sealed `cache_policy`
([protocol](../reference/protocol-messages.md#sealed-cache-policy)) reaches the
bridge with the scope (`ProviderLoop.handleInferenceRequest`, the scheduler
engine and the Nemotron Super owner pass it on), and
`PrefixCacheSubmissionPolicy` decides there what it changes
(`provider-swift/Sources/ProviderCore/Inference/Engine/Bridge/EngineV2Bridge+CachePolicy.swift`).
A `memory_only` request runs with `prefixCacheEnabled` off, on one Mac and on a
pair alike: the engine then makes no prefix lookup, capture or donation, the
bridge stages nothing and registers no SSD ready receipt or donation demand,
the scheduler skips the prompt-token piece cache, and a pair's ranks get
`ClusterWorkerPrefixCache.disabled`. Its receipt, were its cache on, would be
minted in the memory-only range, which every SSD store refuses
(`MemoryOnlyReceipt`). Its answer and usage are otherwise those of an
uncached request. The local API serves its requests under
`DARKBLOOM_LOCAL_CACHE_POLICY` instead ([local
API](../provider/direct-mode.md#cache-policy-of-local-requests)).

### `CBv2RequestTiming`

Stamped by the engine thread only; instants are nanoseconds from the enqueue
Expand Down Expand Up @@ -3054,8 +3073,12 @@ measured
`0` restores publishing the last rate however old). The heartbeat also sends
the published rate's own age, `observed_decode_tps_age_ms`: the time since the
newest sample that moved it, which a short reply does not reset
(`DecodeRateIdleAge.publishedAgeMilliseconds`); it changes nothing the provider
decides. The published rate moves
(`DecodeRateIdleAge.publishedAgeMilliseconds`). While the connected
coordinator's latest `trust_status` lists `decode_rate_age_decay` in
`coordinator_features`, the coordinator decays a stale rate by that age itself,
and the provider stops omitting an idle slot's rate
(`DecodeRateIdleAge.effectiveMaximum`); without it, and after a disconnect, the
heartbeat is unchanged. The published rate moves
only on a request that generated at least 32 tokens
(`EngineV2Bridge.minimumPublishedDecodeTokens`, the coordinator's
`completion_tokens >= 32` convention; `updatePublishedDecodeTps` keeps the same
Expand Down Expand Up @@ -7317,6 +7340,33 @@ ceremony, which stores a new record set for the current key
answers it, so it offers **Start over** (or **Pair again** when its
own key changed too).

Before a member removes a pair cache it saves the selected root, volume UUID
and, when available, root inode in its private pending-reclaim record. One
rename publishes a synced, single-link marker. A retry rechecks the marker
and syncs its directory before removing files. If unpair began with the pinned
volume detached, the first root confirmed at that path on the original volume
is bound by inode before cleanup. This identifies the first root observed on
return, not a directory that could not be observed while detached. A retry
does not act on a subsequently substituted directory or volume. A missing
pinned volume or an unverifiable lease leaves cleanup unresolved; shared
staging stays in place. A marker that cannot be used (an earlier format,
malformed, extra links or unsafe metadata) authorizes no removal and leaves a
retry unresolved; the next unpair replaces it, in one rename, with its own
intent for the current selection (a second `.cluster-*.tmp` link that an
earlier version's interrupted publication left is removed first). So does a
marker the next unpair cannot read because of an I/O error: an earlier
selection's pending cleanup is then dropped, and its files fall under the limit
for previously selected disks. While an
earlier unpair's cleanup waits for its original cache selection, a later
unpair on that Mac does not remove the current selection's pair cache; those
files follow ordinary TTL cleanup. A plan that lost its `in-use` file gets a
new one only while the member holds the cache root exclusively, so no rank is
starting there. An idle plan moves to
an inode-qualified `.retiring-…` name before its lock file goes. A later reclaim
can finish removing that identified empty directory after interruption without
treating a missing `in-use` in an ordinary plan as permission to delete it
(`ClusterMemberCacheControl.Store`, `ClusterPrefixPlanReclaim`).

Sources: `provider-swift/Sources/ProviderCore/Inference/Distributed/Onboarding/ClusterOnboardingFlow.swift`
(`ClusterOnboardingDriver.pairAgain`, `startOver`, `otherMacSilentLine`, `member`, `pairScreen`),
`provider-swift/Sources/ProviderCore/Inference/Distributed/Onboarding/ClusterOnboardingLive.swift`
Expand Down Expand Up @@ -11262,9 +11312,9 @@ types them ([fields](../reference/configuration.md#cluster-runtime-facts),
([Qwen27 resident assistant](#qwen27-tensor-parallel-resident-assistant));
without one the digest is the five-field formula as before.
4. Every model carries a pair-serving grant when the build qualifies it. A
pair member reports only hardware capabilities
(`DistributedServingEligibility.memberCapabilities`: `apple_m5` on an M5,
never `mlx_nax` or `glm5_next_v1`), and a coordinator holds each member of a
pair member reports its hardware capabilities and `cache_policy_v1`
(`DistributedServingEligibility.memberRegistrationCapabilities`: `apple_m5`
on an M5, never `mlx_nax` or `glm5_next_v1`), and a coordinator holds each member of a
pair without a grant to the model's single-Mac requirements
([`providerMeetsServingRequirementsLocked`](https://github.com/Layr-Labs/darkbloom-platform/blob/2847f27dda8e4caf9e2441d554067f42a88c9e1f/coordinator/registry/cluster_pair_serving_grant.go)),
so no pair of GLM-5.3-Flash or Qwen3.8-27B forms without one. For a
Expand Down
5 changes: 3 additions & 2 deletions docs/architecture/prefix-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -874,8 +874,9 @@ enough, so N concurrent recurrent donors stage at most N × 3 copies, plus
one transient copy while a donor rolls its latest (the new copy is reserved
before the old latest retires). Revisit if state sizes grow. Window copies finish
before successor writes and remain owned until their captured stream drains.
The encrypted manifest binds exact input token IDs, scope, checkpoint position,
codec/layout and tensor descriptors. DBK3 writes bounded tensor segments into
The encrypted manifest binds the exact input prefix through a keyed digest (its
token IDs are never stored; a restore takes them from the request's prompt),
scope, checkpoint position, codec/layout and tensor descriptors. DBK3 writes bounded tensor segments into
one atomically published file; failed/cancelled exports grant no ready evidence.
After commit, the engine retires donor/export aliases before publishing the
actual ready anchor and DONE. The default path keeps only metadata between
Expand Down
10 changes: 8 additions & 2 deletions docs/architecture/security/encryption.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Provider Encryption And Privacy

> Last updated: 2026-11-20
> Last updated: 2026-11-23

This page describes the provider's plaintext boundary, encrypted network traffic
and local cache storage. Backend cryptographic implementation and consumer
Expand Down Expand Up @@ -181,7 +181,13 @@ contain this path. Lookup names remain keyed HMACs. Some operational
metadata (sizes, model/layout binding and times) remains visible; the precise
[format and observable fields](../../reference/ssd-kv-cache.md#dbk3-file-format)
list it. A delta checkpoint names its parent only through a keyed commitment, so
files of one conversation stay unlinkable without the cache key. TTL checks on reuse, tenant binding and authentication remain in
files of one conversation stay unlinkable without the cache key. Inside the
encryption no file holds a token ID: a complete checkpoint keeps a keyed digest
of its prefix under `K_lookup` and an MTP token tensor as zeros, both rebuilt
from the request's prompt on restore, and a pair's records keep their history
tokens as zeros ([format](../../reference/ssd-kv-cache.md#no-token-ids-in-complete-checkpoints)).
A request whose sealed `cache_policy` is `memory_only` writes, reads and touches
nothing in the cache ([files a request can leave](../../reference/ssd-kv-cache.md#what-one-request-can-leave-on-disk)). TTL checks on reuse, tenant binding and authentication remain in
force. Switching locations leaves earlier ciphertext in its old location; the
new location's maintenance does not sweep the old one or securely erase a disk.
TTL limits ordinary cache reuse, not physical retention: detached or inaccessible
Expand Down
8 changes: 7 additions & 1 deletion docs/developer/serving-performance-qualification.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ either: it is informational and changes no rate, admission or profile. Nor does
the decode rate a slot uses before its first completed request (the slowest
delivered cadence of requests decoding on it, charged per row; see
[deadlines](../architecture/inference.md#deadlines)): a request carrying a
reviewed calibration never takes it.
reviewed calibration never takes it. Nor does the coordinator's
`decode_rate_age_decay` advertisement (`trust_status.coordinator_features`;
shared wire cases in
`provider-swift/Tests/ProviderCoreTests/Fixtures/Protocol/coordinator_features_wire.json`,
checked by `CoordinatorDecodeRateDecayTests` and
`provider-swift/Tests/test_protocol_fixture_resources.py`): it decides only
whether an idle slot keeps advertising its rate to routing.
Profile qualification is separate work required to introduce a measured
prediction-error envelope.

Expand Down
9 changes: 8 additions & 1 deletion docs/provider/cache-storage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Set provider cache writes and storage

> Last updated: 2026-11-18
> Last updated: 2026-11-23

Set a persistent write limit and optionally store encrypted inference caches on
a separate disk. These commands affect cache payloads; use
Expand Down Expand Up @@ -51,6 +51,13 @@ a separate disk. These commands affect cache payloads; use
previously selected disks. Cleanup needs the selected volume mounted and accessible;
see the [retention limits](../architecture/security/encryption.md#provider-cache-storage).

To stop a cache hit from extending an entry's 30 minutes of reuse, set
`DARKBLOOM_SSD_KV_TTL_MODE=fixed` in the provider's environment: no entry is
then reused more than 30 minutes (or the configured TTL) after it was written.
Its file is removed later, by maintenance that can reach it on the selected
volume, so removal has no fixed time
([TTL](../reference/ssd-kv-cache.md#size-and-eviction-rules)).

3. Restart the provider to load the saved settings:

```sh
Expand Down
23 changes: 21 additions & 2 deletions docs/provider/direct-mode.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The local API: an OpenAI-compatible server on your Mac

> Last updated: 2026-11-22
> Last updated: 2026-11-23

Your Mac's models as an OpenAI-compatible HTTP server for your own tools,
served two ways: **Both**, the default (`darkbloom start`: beside the Darkbloom
Expand Down Expand Up @@ -463,7 +463,7 @@ chat-upload interception → the upstream `MLXLMServer` router
|---|---|---|
| GET | `/health`, `/v1/health` | Unauthenticated |
| GET | `/models`, `/v1/models` | Advertised catalog, not just resident models, merged by the [local router](#when-this-mac-cant-take-a-request-the-local-router) |
| GET | `/props`, `/metrics` | `/metrics` adds per-slot MTP and serving-posture lines (`provider-swift/Sources/ProviderCore/Server/LocalMetricsResponder.swift`); see [SSD cache observations](../reference/ssd-kv-cache.md#verification) for `prefix_cache_status` |
| GET | `/props`, `/metrics` | `/metrics` adds per-slot MTP and serving-posture lines (`provider-swift/Sources/ProviderCore/Server/LocalMetricsResponder.swift`), and the [cache policy counters](#cache-policy-of-local-requests); see [SSD cache observations](../reference/ssd-kv-cache.md#verification) for `prefix_cache_status` |
| POST | `/v1/chat/completions`, `/chat/completions` | Streaming and non-streaming; inline media; body capped at `localInferenceMaxUploadBytes` |
| POST | `/v1/chat/completions/batch` | Same cap; at most 64 requests ([refused request shapes](#refused-request-shapes)) |
| POST | `/v1/completions`, `/completions`, `/completion` | Text; upstream 2 MiB body ceiling |
Expand Down Expand Up @@ -507,6 +507,25 @@ while it runs ends instead with that refusal's error chunk, after the tokens
already sent: `code` `request_exceeds_node_budget` and the busy memory 503's words
([refused request shapes](#refused-request-shapes)).

### Cache policy of local requests

`DARKBLOOM_LOCAL_CACHE_POLICY=memory_only` serves every request on this API
with its prefix cache off, as a coordinator request whose sealed
[`cache_policy`](../reference/protocol-messages.md#sealed-cache-policy) is
`memory_only`: nothing it sends is read from, staged on or written to the SSD
tier (`RequestCachePolicy.localServing`,
`provider-swift/Sources/ProviderCore/Inference/PrefixCache/RequestCachePolicy.swift`).
Unset, empty or `default` keeps the cache; any other value is `memory_only`.
Coordinator requests never read it. `/metrics` counts the coordinator's
requests by policy (`darkbloom_cache_policy_requests_total{policy}`), the SSD
tier's refusals of a `memory_only` request's engine calls
(`darkbloom_memory_only_ssd_refusals_total`) and every time one reached an SSD
read, write or index path, each refused there
(`darkbloom_memory_only_ssd_tier_touches_total`, which stays 0)
(`RequestCachePolicyCounters`). Both SSD counts stay 0 while `memory_only`
requests run with their cache off; they would count only for a memory-only
request run with a cache on, as by a RAM-only tier.

### A long prompt's progress

A long prompt takes minutes before its first token: a 255K-token prompt took 9
Expand Down
Loading
Loading