Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions changelog.d/nemotron-super-ssd-checkpoints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Nemotron Super durable prefix checkpoints

- The managed Nemotron 3.5 Super slot keeps its exact text prefix reuse as complete encrypted SSD checkpoints by default, like the other cache-enabled models: KV, Mamba conv/SSM state and the MTP assistant's prompt history at native precision, bound to the published artifact and prompt-contract identity. Checkpoints survive provider restarts within the store's TTL, the slot advertises a durable capability (`prefix_cache_v2_models`) so the coordinator can keep durable holders, and the coordinator's repeat hint gates writes against the daily SSD write budget. The 16 GiB resident bank is no longer reserved by default; `DARKBLOOM_PREFIX_CACHE_MEMORY=1` selects it instead (it remains the only tier that reuses image turns), and `DARKBLOOM_PREFIX_CACHE=0` turns both off.
46 changes: 31 additions & 15 deletions docs/architecture/inference.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,10 @@ configured request (below). The builder refuses a KV grant that
cannot hold every configured request's fixed bytes plus the minimum KV with
`UnserviceableGrant`, which names the grant, the smallest serviceable grant and
the fixed bytes per request.
`NemotronSuperLocalPrefixCache` gives either owner exact text prefix reuse when
`DARKBLOOM_PREFIX_CACHE_MEMORY=1`. For the pinned checkpoint
`NemotronSuperLocalPrefixCache` gives either owner exact text prefix reuse. By
default the managed slot keeps it as complete encrypted SSD checkpoints (see
below); `DARKBLOOM_PREFIX_CACHE_MEMORY=1` selects the resident bank instead.
For the pinned checkpoint
`NemotronSuperServingPolicy.defaultPrefixBankBytes` sizes the SDK's resident
recurrent checkpoint bank from the KV grant and the machine:
`serving = grant - admissionKVBytes(requests, speculates) - lane bound(chunk) - one image's media charge`,
Expand Down Expand Up @@ -457,9 +459,10 @@ requests (`off` or `DARKBLOOM_CBV2_MTP=0`
serves the plain owner); eight requests unless `engine_v2_max_concurrent` or its
per-model entry is explicit, which then bounds it (at most eight with
speculation). The depth, verification, prefill chunk and decode-step keys above
keep an operator's value. The plain owner turns exact text prefix reuse on when
the grant holds every request's fixed bytes beside the bank, unless the
operator set `DARKBLOOM_PREFIX_CACHE_MEMORY` or a cache kill switch.
keep an operator's value. Either owner's exact text prefix reuse is complete SSD
checkpoints, which take no grant; the resident bank is reserved only when the
operator sets `DARKBLOOM_PREFIX_CACHE_MEMORY=1`, and a cache kill switch turns
both off.

On NAX GPUs (M5 and later) prompt processing runs the routed NVFP4 experts
on dedicated NAX kernels behind one fused expert route
Expand Down Expand Up @@ -530,16 +533,29 @@ channel, tool and structured-output validation, cancellation and usage are the
hook's. A JSON response format may come with tools: a turn that calls tools
returns its calls, and only an answer without calls is validated as JSON.
Coordinator text prefix reuse is partitioned by the authenticated cache
scope and off without one. When the owner has a bank, the managed load binds it
to the aggregate it published for the checkpoint and the checkpoint's
`PromptContractIdentity` (`NemotronSuperLocalPrefixCache.RoutingIdentity`), so
the slot advertises a resident capability (`prefix_cache_memory_models`) and
the coordinator can send it a cache scope. A request then reports its lookup
and ready receipts, `prompt_tokens_details.cached_tokens` and its cache usage
through the request's own usage signal, as on the generic engine; a load whose
post-load artifact hash differs from the published one advertises nothing. A
cancelled stream bills delivered output and the reference prompt length, and
reports cache usage only when the native terminal already recorded it. Inline JPEG and PNG images (`data:` URIs, within the
scope and off without one. The managed load binds the owner's checkpoints to
the aggregate it published for the checkpoint and the checkpoint's
`PromptContractIdentity` (`NemotronSuperLocalPrefixCache.RoutingIdentity`).
Without a bank (the default) the builder keeps them in an
`SSDHybridCheckpointStore` (`NemotronSuperLocalPrefixCache.durableIdentity`):
the SDK's complete codec writes each chunk checkpoint's KV, conv/SSM state and
the assistant's prompt history encrypted under the provider's cache root, at
native KV precision whatever `engine_v2_kv_checkpoint_quantization` says. The
slot then advertises a durable capability (`prefix_cache_v2_models`), its
checkpoints survive restarts within the store's TTL, and the coordinator's
repeat hint gates their writes as for every other model. A durable checkpoint
outlives the process, so its identity rests on this load: every shard was
staged against its pinned SHA-256, and the prompt contract hashes the prompt
files the load read. A load whose post-load artifact hash differs from the
published one is refused. With the bank the slot advertises a resident
capability (`prefix_cache_memory_models`), and such a load advertises nothing.
Either way the coordinator can send the slot a cache scope, and a request
reports its lookup and ready receipts, `prompt_tokens_details.cached_tokens`
and its cache usage through the request's own usage signal, as on the generic
engine. Image checkpoints have no durable layout, so only the bank reuses
image turns. A cancelled stream bills delivered output and the reference
prompt length, and reports cache usage only when the native terminal already
recorded it. Inline JPEG and PNG images (`data:` URIs, within the
[image format reference](../reference/nemotron-super-image-formats.md) limits)
run on the owner's image binding. On the default speculating owner every image
request is target-only for its whole lifetime: the engine prefills and decodes
Expand Down
9 changes: 7 additions & 2 deletions docs/architecture/prefix-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ production-key restart checks remain subject to the
[acceptance criteria](https://github.com/Layr-Labs/d-inference/blob/4230fa03ddbc84e34e2de150c89431744d6f1c55/docs/design/release-090-acceptance.md).
This selection change is not a release or deployment claim. SSD prefix reuse
defaults on for the exact Qwen, Nemotron Lightning and Bonsai 2 IDs above,
`gemma-4-26b-qat-4bit`, `gpt-oss-20b` and the exact MiMo identities below.
`gemma-4-26b-qat-4bit`, `gpt-oss-20b`, the exact MiMo identities below and the
managed `nvidia-nemotron-3.5-super` slot, whose complete checkpoints replace
its resident bank unless the operator selects the bank (see
[`inference.md`](inference.md#managed-nemotron-super-slot)).
GPT-OSS 20B and Gemma QAT normally use paged historical-attention checkpoints;
eligible native contiguous fallback uses a distinct complete layout rather than
reinterpreting the paged file. Gemma automatic MTP resolves its catalog
Expand Down Expand Up @@ -409,7 +412,9 @@ It requires verified weight and prompt-contract identities to advertise
`prefix_cache_memory_models`; local reuse can operate without the attested
weight hash because entries never cross loaded model instances. The managed
Nemotron Super owner supplies them from its own load
(`NemotronSuperLocalPrefixCache.RoutingIdentity`, see [`inference.md`](inference.md)). Paged resident
(`NemotronSuperLocalPrefixCache.RoutingIdentity`, see
[`inference.md`](inference.md)), and binds its default complete SSD
checkpoints to the same identity. Paged resident
hits report the memory tier locally but do not yet publish coordinator holder
anchors. Resident and durable SSD routing evidence remain separate; see
[cache-aware-routing.md](https://github.com/Layr-Labs/darkbloom-platform/blob/48a198c71a2d30feec5597bacf1101120f7f955d/docs/architecture/cache-aware-routing.md).
Expand Down
10 changes: 6 additions & 4 deletions docs/provider/direct-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,12 @@ In unified mode, chat completions for `nvidia-nemotron-3.5-super` load the
managed slot through the ordinary local acquisition and run on its owner
(`provider-swift/Sources/ProviderCore/Server/NemotronSuperLocalEndpointEngine.swift`):
the controls in the table below apply, prefix reuse uses one partition per
local endpoint (an image turn reuses only checkpoints of the same images at the
same positions), a text response's `usage.prompt_tokens_details.cached_tokens`
counts the prompt tokens it restored, and inline images are served as described
below, target-only on the default speculating owner. Other routes for that id
local endpoint (text checkpoints are complete SSD checkpoints by default; an
image turn reuses only with the resident bank, `DARKBLOOM_PREFIX_CACHE_MEMORY=1`,
and only checkpoints of the same images at the same positions), a text
response's `usage.prompt_tokens_details.cached_tokens` counts the prompt tokens
it restored, and inline images are served as described below, target-only on
the default speculating owner. Other routes for that id
(`/v1/completions`, `/v1/responses`) are refused; the generic engine never
serves Super. Standalone mode (`darkbloom start --local`) does not list it.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ actor NemotronSuperLocalBinding {
/// Internal fixture seam; production uses the bridge's real retirement barrier
/// below. The `String?` is the request's prefix-cache scope (nil: no reuse).
typealias Execute = @Sendable (EngineV2Bridge, [Int], ChatCompletionRequest, String, String?,
EngineV2RequestUsageSignal?,
EngineV2RequestUsageSignal?, SSDCheckpointDonationDemand?,
@escaping @Sendable (GenerationEvent) async -> Void) async throws -> Void

/// The id requests must name and the acquired bridge must serve.
Expand All @@ -32,10 +32,10 @@ actor NemotronSuperLocalBinding {
reusesTextPrefixes: Bool = false) {
self.modelID = modelID
self.acquire = acquire
self.execute = { bridge, tokens, request, requestID, cacheScope, usageSignal, onEvent in
self.execute = { bridge, tokens, request, requestID, cacheScope, usageSignal, donationDemand, onEvent in
try await Self.executeBridge(bridge: bridge, tokens: tokens, request: request,
requestID: requestID, cacheScope: reusesTextPrefixes ? cacheScope : nil,
usageSignal: usageSignal, onEvent: onEvent)
usageSignal: usageSignal, donationDemand: donationDemand, onEvent: onEvent)
}
}

Expand All @@ -54,10 +54,13 @@ actor NemotronSuperLocalBinding {
/// reuse only as the owner configured it at construction, partitioned by
/// `cacheScope` (an authenticated tenant scope, or the local application's;
/// nil disables reuse for this request). `usageSignal`, one per request,
/// receives the engine's prefix-cache outcome and drives its receipts.
/// receives the engine's prefix-cache outcome and drives its receipts;
/// `donationDemand` is the coordinator's fleet repeat hint for a durable
/// checkpoint write (nil: write).
func run(request: ChatCompletionRequest, promptTokens: [Int],
hasMedia: Bool = false, cacheScope: String? = "",
usageSignal: EngineV2RequestUsageSignal? = nil,
donationDemand: SSDCheckpointDonationDemand? = nil,
onEvent: @escaping @Sendable (GenerationEvent) async -> Void) async throws {
guard !draining else { throw Failure.drained }
guard request.model == modelID else { throw Failure.wrongModel }
Expand All @@ -76,7 +79,7 @@ actor NemotronSuperLocalBinding {
let acquired = try await acquire(modelID)
try await Self.runAcquired(acquired, modelID: modelID, execute: execute, tokens: promptTokens,
request: request, requestID: id.uuidString, cacheScope: cacheScope,
usageSignal: usageSignal, onEvent: onEvent)
usageSignal: usageSignal, donationDemand: donationDemand, onEvent: onEvent)
}
active[id] = task
defer { active.removeValue(forKey: id) }
Expand All @@ -100,12 +103,13 @@ actor NemotronSuperLocalBinding {
_ acquired: consuming MultiModelBatchSchedulerEngine.AcquiredModel, modelID: String,
execute: @escaping Execute, tokens: [Int], request: ChatCompletionRequest,
requestID: String, cacheScope: String?, usageSignal: EngineV2RequestUsageSignal?,
donationDemand: SSDCheckpointDonationDemand?,
onEvent: @escaping @Sendable (GenerationEvent) async -> Void
) async throws {
guard let lease = acquired.nativeConsumerLease else {
return try await executeAcquired(acquired, modelID: modelID, execute: execute, tokens: tokens,
request: request, requestID: requestID, cacheScope: cacheScope,
usageSignal: usageSignal, onEvent: onEvent)
usageSignal: usageSignal, donationDemand: donationDemand, onEvent: onEvent)
}
let release = acquired.releaseToken
guard release.nativeBindingAccepted else { throw NativeLocalConsumerOwnershipError.invalidBinding }
Expand All @@ -122,7 +126,7 @@ actor NemotronSuperLocalBinding {
}
try await executeAcquired(acquired, modelID: modelID, execute: execute, tokens: tokens,
request: request, requestID: requestID, cacheScope: cacheScope,
usageSignal: usageSignal, onEvent: onEvent)
usageSignal: usageSignal, donationDemand: donationDemand, onEvent: onEvent)
}
} catch {
payload.discard()
Expand All @@ -148,13 +152,14 @@ actor NemotronSuperLocalBinding {
_ acquired: consuming MultiModelBatchSchedulerEngine.AcquiredModel, modelID: String,
execute: Execute, tokens: [Int], request: ChatCompletionRequest,
requestID: String, cacheScope: String?, usageSignal: EngineV2RequestUsageSignal?,
donationDemand: SSDCheckpointDonationDemand?,
onEvent: @escaping @Sendable (GenerationEvent) async -> Void
) async throws {
do {
try Task.checkCancellation()
guard let bridge = acquired.engineV2Bridge else { throw Failure.missingBridge }
guard bridge.modelId == modelID else { throw Failure.wrongModel }
try await execute(bridge, tokens, request, requestID, cacheScope, usageSignal, onEvent)
try await execute(bridge, tokens, request, requestID, cacheScope, usageSignal, donationDemand, onEvent)
await acquired.releaseToken.fire()
} catch {
await acquired.releaseToken.fire()
Expand All @@ -165,13 +170,15 @@ actor NemotronSuperLocalBinding {
private static func executeBridge(
bridge: EngineV2Bridge, tokens: [Int], request: ChatCompletionRequest, requestID: String,
cacheScope: String?, usageSignal: EngineV2RequestUsageSignal?,
donationDemand: SSDCheckpointDonationDemand?,
onEvent: @escaping @Sendable (GenerationEvent) async -> Void
) async throws {
let usage = usageSignal ?? EngineV2RequestUsageSignal()
await withTaskCancellationHandler {
let stream = await bridge.submitTokenized(
promptTokens: tokens, request: request, requestId: requestID,
cacheScope: cacheScope ?? "", cacheEnabled: cacheScope != nil, usageSignal: usage)
cacheScope: cacheScope ?? "", cacheEnabled: cacheScope != nil, usageSignal: usage,
donationDemand: donationDemand)
for await event in stream {
if Task.isCancelled { break }
await onEvent(event)
Expand Down
Loading
Loading