Skip to content

Route Nemotron Super prefix reuse through the coordinator (resident capability, receipts, cached-token usage) - #1586

Closed
jonathan308 wants to merge 2 commits into
masterfrom
feat/nemotron-super-prefix-cache
Closed

jonathan308 wants to merge 2 commits into
masterfrom
feat/nemotron-super-prefix-cache

Conversation

@jonathan308

@jonathan308 jonathan308 commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Nemotron 3.5 Super never took part in coordinator prefix caching. The managed slot reserves a resident checkpoint bank (up to 16 GiB of its KV grant), but it advertised no prefix-cache capability, so the coordinator never prepared a cache attempt and never sent a cache_scope: the bank served no coordinator request. The Super route also submitted under its own usage signal, so it sent no lookup/ready receipts, no cached_tokens, and cached tokens were never billed at cache_read_price.

With this PR the bank advertises a resident capability (prefix_cache_memory_models). The capability is bound to the aggregate the provider published for the loaded checkpoint and to the checkpoint's PromptContractIdentity, which is the identity the prompt sidecar plans with. The Super text route now runs under the coordinator request's usage signal.

Before:

sequenceDiagram
    participant C as Coordinator
    participant P as Provider (Super slot)
    participant B as Resident bank
    P->>C: heartbeat (no Super prefix-cache capability)
    Note over C: no capability, so no cache attempt
    C->>P: inference_request (no cache_scope, no receipt nonce)
    P->>B: submit, cacheEnabled = false
    Note over B: reserved, never consulted
    P-->>C: inference_complete (no cache usage)
    Note over C: every prompt token billed at the input price
Loading

After:

sequenceDiagram
    participant C as Coordinator
    participant P as Provider (Super slot)
    participant B as Resident bank
    P->>C: heartbeat: prefix_cache_memory_models[super] = {aggregate, prompt_contract_id, epoch}
    C->>P: inference_request + cache_scope + receipt nonce (sent to the holder)
    P->>B: lookup / restore under the request's usage signal
    P-->>C: prefix_cache_lookup_v2, prefix_cache_ready_v2
    P-->>C: inference_complete usage {hit, memory, cached_tokens, prefill_tokens_saved}
    Note over C: cached tokens billed at cache_read_price; repeats go to the holder
Loading
 ProviderLoop.handleInferenceRequest
   superOwner.chatEngine(body:, cacheScope:, trustsSchemaMetadata:,
+                        usageSignal: v2UsageSignal)
     SuperHTTPEngine (text route)
       NemotronSuperLocalBinding.run(..., cacheScope:,
+                                    usageSignal:)
         executeBridge
-          usage = EngineV2RequestUsageSignal()
+          usage = usageSignal ?? EngineV2RequestUsageSignal()
       SuperImageHTTPRelay
-        cachedPromptTokens: 0
+        cachedPromptTokens: usage.prefixCacheHitTokens
 NemotronSuperSlotLoader.load
+  RoutingIdentity.resolve(modelAggregateHash: published hash, directory:)
   NemotronSuperLocalBridgeBuilder.make
     EngineV2Factory.makeBridge(
+      residentPrefixCacheEvidence: bank built ? identity.evidence(modelID:) : nil)
 ProviderLoop+NemotronSuper (publication)
+  post-load artifact hash != published hash  ->  close the evidence (local reuse continues)

No protocol, coordinator or persistent-format change. Media requests carry no coordinator cache scope, so they are unchanged.

Evidence

Before (master): the managed-slot test asserted that a coordinator request on Super reports no cache use (usage.cacheOutcome == nil && usage.cachedTokens == nil), and owner.bridge.residentPrefixCacheEvidence was always nil. On a coordinator this means memory_ready_models is 0 for Super, so no request gets a cache_scope.

After:

  • New tests on tiny synthetic Super installs, plain and speculating (MTP) owner:

    • NemotronSuperPrefixCacheEvidenceTests:
      • capability identity
      • lookup/ready receipts on the coordinator's 256-token chain
      • cached_tokens
      • scope isolation, with restored text equal to cold text
      • no capability without an identity or without a bank
    • NemotronSuperManagedSlotTests.coordinatorRequestsReportTheBanksReuse: an encrypted coordinator request → v2 receipts, inference_complete usage hit/memory/512, SSE cached_tokens: 512, and a miss for another tenant.
    • The existing managed-slot assertion now expects miss_absent/memory/0 for a prompt shorter than one chunk.
    • All 262 tests in the 35 Super and prefix-cache suites pass. The broader filter InferenceHandler|PrefixCache|NemotronSuper|UsageSignal|Receipt|LocalInferenceHTTP|ResidentPrefix also passes: 480 Swift Testing tests in 77 suites, plus 7 XCTest cases.
  • Real hardware, M3 Ultra. Pinned checkpoint 2026-10-20-nvfp4-r2 through the production loader and the encrypted coordinator path, using the gated NemotronSuperManagedSlotLiveTests+PrefixCache test. The advertised capability is nvidia-nemotron-3.5-super / 56a1f05e…dceca6 / ed2891bc…eb885; the prompt sidecar computes the same identity from the published manifest.

    8,693-token prompt MTP owner plain owner
    TTFT cold → identical repeat 18.39 s → 1.36 s (8,192 cached) 18.26 s → 1.40 s
    next turn: cold → warm 16.76 s → 1.85 s 16.83 s → 1.84 s
    other tenant (same prompt) miss, 16.64 s, identical text miss, identical text
    4 concurrent repeats, 2 tenants all hit, identical text all hit, identical text
    MTP during the run 38 rounds, 92 accepted drafts n/a

    Greedy output is identical between restored and cold runs, with and without MTP.

  • Local coordinator end to end. Real Go coordinator, real prompt sidecar, cache routing on, an allowlist containing only the Super tuple. Two real providers (M3 Ultra, M5 Ultra) run this branch's release binary.

    • Default phase: 3 conversations of about 8.26k tokens. Each repeat and next turn went to the holder: cached 8,192, TTFT about 3.4 s → 0.4–1.0 s, identical text. The other account got cached 0. 12 holders added, 0 removed, 0 proof mismatches.
    • Affinity phase:
      • With M5 (the faster provider) held out of routing for the cold turn only, the cold turn ran on M3 (4,251 tokens, 8.59 s).
      • With M5 routable again, the repeat still chose the holder M3 (4,096 cached, 0.68 s), and so did the next turn.
      • The other account's identical prompt went cold to M5.
    • Billing: a 20,747-token prompt cost 1,247 µUSD cold and 223 µUSD on repeat (20,480 cached). Every turn's charge equals Rates{60000, 350000, 10000}.CostWithMinimum(billed tokens). Short warm prompts hit the 100 µUSD request minimum.
    • Neither provider log contains prompt content.

Limitations

  • Resident tier only. The coordinator keeps a resident holder for min(TTL, 30 s). Turns spaced further apart lose routing affinity, although the bank still restores if the turn lands on the same provider. Durable SSD checkpoints (25-minute holders, restart survival) are the stacked follow-up, Keep Nemotron Super prefix reuse as durable SSD checkpoints (stacked on #1586) #1588.
  • Reuse granularity. Restores happen only at multiples of the 2,048-token prefill chunk, which is what keeps them exact. For example, 8,192 of 8,693 prompt tokens are cached.
  • Images and video. Media requests get no coordinator cache scope, and local-endpoint image turns still report cached_tokens: 0.
  • Cancelled streams report cache usage only if the native terminal already recorded it. This can under-bill cache reads but never over-bills.
  • Hash drift. If the post-load artifact hash differs from the published one, the evidence closes. The provider then advertises nothing, and local reuse continues.

Rollout

  • Coordinator config. With the production allowlist (EIGENINFERENCE_CACHE_ROUTING_ALLOWED_ARTIFACTS, see the platform cache-routing rollout runbook), this release changes nothing on coordinator traffic until an operator appends the tuple (procedure: Layr-Labs/darkbloom-platform#463). No coordinator code change is needed. A coordinator with no allowlist (unrestricted eligibility) admits Super as soon as providers run this release. Tuple:

    {"model_id":"nvidia-nemotron-3.5-super","model_aggregate_sha256":"56a1f05e980a602ebc09a64203689a656198069e1c9dd4c6698af833f2dceca6","prompt_contract_id":"ed2891bc3bbe767c3b8a73bcf15bc3b5833948bf4a1e2aa972f21c55468eb885"}
  • Overlaps.

  • Refactor pass: done, no change; see Refactor pass.

Refactor pass

Done: no change. The head stays 9e627ae8f, and nothing was pushed. A dedicated refactor pass reviewed this PR's whole diff against master (9034a5a0f): runtime code, tests and docs.

Reviewed and kept:

  • Per-request parameter threading. usageSignal runs NemotronSuperLocalBinding.run → runAcquired → executeAcquired → Execute → executeBridge, the same path cacheScope already took. Keep Nemotron Super prefix reuse as durable SSD checkpoints (stacked on #1586) #1588 adds donationDemand along it, and Logprobs follow-up: GLM-5.3-Flash and Nemotron 3.5 Super #1564 adds logprobs. One per-request value would read better, but it would rewrite the binding's fixture seam (Execute), which Logprobs follow-up: GLM-5.3-Flash and Nemotron 3.5 Super #1564 also changes, and the morning conflict would stop being mechanical. That cleanup belongs after both land, as its own change.
  • Two signal defaults. SuperHTTPEngine always hands the binding a signal (self.usageSignal ?? EngineV2RequestUsageSignal()) so that the relay can read prefixCacheHitTokens. The binding keeps its own fallback for direct callers (the tests). Both are needed.
  • RoutingIdentity. Resolving the identity and making one evidence source per bridge is small, and it lives with the prefix-cache type. Closing the evidence on hash drift is one line at publication.
  • Tests. NemotronSuperPrefixCacheEvidenceTests.memoryKey repeats PrefixCachePolicy.memoryEnvironmentFlag, as the neighbouring master suite NemotronSuperLocalPrefixCacheTests does. It is kept for consistency.
  • Docs. Two over-long lines in inference.md and prefix-cache.md come from this PR, but Keep Nemotron Super prefix reuse as durable SSD checkpoints (stacked on #1586) #1588 rewrites those paragraphs, so they are rewrapped there.

Validation: nothing changed here, so this PR's own evidence and green CI on 9e627ae8f stand. Its code also runs in #1588's refactor-pass validation (515 Swift tests and the real checkpoint) and in the local morning integration below.

Merge readiness (git merge-tree on master 9034a5a0f):

Pair Result
#1586 + #1585, #1586 + #1587 clean (docs auto-merge)
#1586 + #1564 content conflicts in NemotronSuperLocalBinding.swift, NemotronSuperSlotOwner.swift, ProviderLoop+InferenceHandler.swift and NemotronSuperLocalImageHTTP.swift. Keep both parameters, logprobs then usageSignal, at every hop and in SuperImageHTTPRelay.init.

There is also one semantic conflict that git does not flag. Both PRs change the two fixtureExecution: { _, … in } closures in NemotronSuperLocalBindingTests.swift to 7 arguments, so that hunk merges cleanly, but the merged Execute takes 8, so the closures need an eighth _. A local, signed integration (not pushed) of master + #1585 + #1564 + #1586 + #1588 + #1587 with exactly this resolution builds and passes. The results and the full order are in #1588.

Merge Danger

Door: two-way

Reverting stops the capability. Coordinators then stop sending Super a cache scope, which is today's behavior. No persistent state or protocol field is added.

Blast Radius: Super-only

This affects routing and billing for nvidia-nemotron-3.5-super once a coordinator admits its tuple: cached tokens bill at cache_read_price, and repeats prefer the holder. Other models and the generic engine are untouched.

Components touched

  • provider-swift (Swift CLI)
  • docs

Protocol / interface changes

  • No protocol/interface changes. Super now emits the existing prefix_cache_lookup_v2 / prefix_cache_ready_v2 receipts and inference_complete cache usage.

Documentation impact

  • Canonical documentation updated: docs/architecture/inference.md (managed Super slot), docs/architecture/prefix-cache.md (resident evidence), docs/provider/direct-mode.md (local cached_tokens), and the changelog fragment changelog.d/nemotron-super-prefix-cache-routing.md. make docs-check and make docs-impact-check BASE=origin/master pass.

…ator

The managed Super owner's resident checkpoint bank now advertises a
protocol-v2 resident capability (prefix_cache_memory_models) bound to the
aggregate the provider published for the loaded checkpoint and the
checkpoint's PromptContractIdentity, the identity the prompt sidecar plans
with. Coordinator requests on the Super route submit under the request's
own usage signal, so lookup and ready receipts, prompt_tokens_details
cached_tokens and inference_complete cache usage now reach the coordinator
as on the generic engine, and the local endpoint reports the reused tokens.

Without a capability the coordinator never prepared a cache attempt for
Super, so no request carried a cache scope and the reserved bank served no
coordinator hit. A publication whose post-load artifact hash differs from
the advertised one closes the evidence; local reuse is unchanged.
Document the managed Super slot's resident capability, receipts and cached
token usage, the local endpoint's cached_tokens, and add the changelog
fragment.
@vercel

vercel Bot commented Oct 24, 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 24, 2026 6:43am UTC
d-inference-console-ui-dev Ready Ready Preview Oct 24, 2026 6:43am UTC
d-inference-landing Ready Ready Preview Oct 24, 2026 6:43am UTC
darkbloom-status Ready Ready Preview Oct 24, 2026 6:43am UTC
eigen-homepages-darkbloom Ready Ready Preview Oct 24, 2026 6:43am UTC

Request Review

@jonathan308

Copy link
Copy Markdown
Collaborator Author

Superseded by #1592; consolidated per owner request

@jonathan308 jonathan308 mentioned this pull request Oct 24, 2026
6 of 10 tasks
jonathan308 added a commit that referenced this pull request Oct 25, 2026
Set ProviderCore.version to 0.10.2 and render the v0.10.2 changelog
entry from the 27 fragments added since v0.10.1, ordered by theme behind
an upgrade and rollout section: Nemotron 3.5 Super prefix caching
(#1586, #1588); GLM-5.3-Flash prefix caching (#1587, #1589, #1590);
4-bit SSD checkpoints and the SSD prefix cache on every model (#1592
(mlx-swift-lm#363), #1584, #1592); Logprobs on Nemotron 3.5 Super and
GLM-5.3-Flash (#1564); OpenRouter compatibility: GLM-5.3-Flash and
MiMo-V2.6-Flash requests no longer refused (#1585, #1592); Speed: MTP
and throughput (#1592 (mlx-swift-lm#360), #1593 (mlx-swift-lm#357),
#1595 (mlx-swift-lm#359), #1594, #1595, #1598 (mlx-swift-lm#362),
#1594); Provider diagnostics: refusal reasons and load memory (#1592,
#1603); MLX stack (#1596); Desktop release workflow (#1580). Apply 12
corrections reviewed against the code. #1580 is already in the v0.10.1
tag but merged after the 0.10.1 preparation, so its fragment is rendered
here.

Mark v0.10.1 as published on 2026-10-24. Record in the provider release
runbook the SDK pin check, the enablement order (darkbloom-platform#464
before any catalog logprobs change, the GLM allowlist tuple, then both
models' logprobs after the rollout and Super's tuple after a signed
restart check), the platform evidence and the published history. No tag,
registration, upload, deployment or enablement is performed.
jonathan308 added a commit that referenced this pull request Oct 25, 2026
Set ProviderCore.version to 0.10.2 and render the v0.10.2 changelog
entry from the 27 fragments added since v0.10.1, ordered by theme behind
an upgrade and rollout section: Nemotron 3.5 Super prefix caching
(#1586, #1588); GLM-5.3-Flash prefix caching (#1587, #1589, #1590);
4-bit SSD checkpoints and the SSD prefix cache on every model (#1592
(mlx-swift-lm#363), #1584, #1592); Logprobs on Nemotron 3.5 Super and
GLM-5.3-Flash (#1564); OpenRouter compatibility: GLM-5.3-Flash and
MiMo-V2.6-Flash requests no longer refused (#1585, #1592); Speed: MTP
and throughput (#1592 (mlx-swift-lm#360), #1593 (mlx-swift-lm#357),
#1595 (mlx-swift-lm#359), #1594, #1595, #1598 (mlx-swift-lm#362),
#1594); Provider diagnostics: refusal reasons and load memory (#1592,
#1603); MLX stack (#1596); Desktop release workflow (#1580). Apply 14
corrections reviewed against the code. #1580 is already in the v0.10.1
tag but merged after the 0.10.1 preparation, so its fragment is rendered
here.

Mark v0.10.1 as published on 2026-10-24. Record in the provider release
runbook the SDK pin check, the enablement order (darkbloom-platform#464
before any catalog logprobs change, the GLM allowlist tuple, then both
models' logprobs after the rollout and Super's tuple after a signed
restart check), the platform evidence and the published history. No tag,
registration, upload, deployment or enablement is performed.
Gajesh2007 pushed a commit that referenced this pull request Oct 25, 2026
Set ProviderCore.version to 0.10.2 and render the v0.10.2 changelog
entry from the 20 fragments added since v0.10.1, ordered by theme behind
an upgrade and rollout section: Nemotron 3.5 Super prefix caching
(#1586, #1588); GLM-5.3-Flash prefix caching (#1587, #1589, #1590);
4-bit SSD checkpoints and the SSD prefix cache on every model (#1592
(mlx-swift-lm#363), #1584, #1592); Logprobs on Nemotron 3.5 Super and
GLM-5.3-Flash (#1564); GLM-5.3-Flash OpenRouter request controls (#1585,
#1592); Speed: MTP and throughput (#1592 (mlx-swift-lm#360), #1593 (mlx-
swift-lm#357), #1595 (mlx-swift-lm#359), #1594, #1595, #1598 (mlx-swift-
lm#362), #1594); Provider diagnostics (#1592); MLX stack (#1596);
Desktop release workflow (#1580). Apply 12 corrections reviewed against
the code. #1580 is already in the v0.10.1 tag but merged after the
0.10.1 preparation, so its fragment is rendered here.

Mark v0.10.1 as published on 2026-10-24. Record in the provider release
runbook the SDK pin check, the enablement order (darkbloom-platform#464
before any catalog logprobs change, the GLM allowlist tuple, then both
models' logprobs after the rollout and Super's tuple after a signed
restart check), the platform evidence and the published history. No tag,
registration, upload, deployment or enablement is performed.

Co-authored-by: Jonathan Spangler <5055076+jonathan308@users.noreply.github.com>

This branch was successfully deployed

5 active deployments
Preview – d-inference-console-ui-dev — 9e627ae8 Deployed Oct 24, 2026 by vercel[bot]
Preview – d-inference — 9e627ae8 Deployed Oct 24, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — 9e627ae8 Deployed Oct 24, 2026 by vercel[bot]
Preview – d-inference-landing — 9e627ae8 Deployed Oct 24, 2026 by vercel[bot]
Preview – darkbloom-status — 9e627ae8 Deployed Oct 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentation work specific to a component or feature area:provider Provider (Rust, runs on Apple Silicon)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant