Skip to content

CBv2: Nemotron 3.5 plain decode commits by operation count; complete checkpoints stay native - #378

Merged
jonathan308 merged 8 commits into
mainfrom
perf/nemotron-decode-command-buffers
Nov 10, 2026
Merged

jonathan308 merged 8 commits into
mainfrom
perf/nemotron-decode-command-buffers

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 1, 2026 •

Copy link
Copy Markdown

Proposed changes

Two changes for Nemotron 3.5 (nemotron_h), which the provider PR needs together:

  1. Plain decode steps commit a Metal command buffer every 100 operations, with no input-size bound, through CBv2DecodeCommandBufferLimitsProviding. MTP rounds keep MLX's defaults. Results do not depend on the partitioning.
  2. Complete checkpoints store native rows by default (PagedKVQuantizationPolicy.nativeCheckpointModelTypes). Beside its MTP head Lightning's checkpoints stay native because the head's persistent state requires it. Served without the head they would become eligible for balanced rows, and a cache hit's output would move: 40 of 55 requests differed on a frozen conversation, 0 of 55 with native rows. A saved global balanced is the old default, not a choice; k4v4, a per-model setting and the process switch still are.

Provider side and evidence: Layr-Labs/d-inference#1714. Target: 0.10.7. It conflicts textually with a possible native-checkpoint default for other models only on the one set literal.

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes (not run)
  • I have added tests that prove my fix is effective or that my feature works (NemotronH35DecodeCommandBufferTests; the checkpoint rule is pinned by the provider's EngineV2KVQuantizationPolicyTests)
  • I have updated the necessary documentation (if needed) (the provider PR carries the docs)

AI usage

  • I have read this PR description in full and approve it as my own, and it
    accurately describes the code changes.
  • AI usage disclosure: the code, tests, measurements and this description were produced by Claude (Claude Code, Opus 5.5). The agent opened this draft at the repository owner's request. A human has not yet reviewed the code or this description.

🤖 Generated with Claude Code

jonathan308 and others added 4 commits October 31, 2026 18:28
MLX's defaults commit every 40-50 operations or 40-50 M distinct input elements. A step's inputs include the expert banks and each 64 MiB KV segment the history reads, so decode committed after almost every MoE layer, reached MLX's limit of ten command buffers in flight, and waited inside evaluation. Plain decode steps now commit every 100 operations with no input bound, as Nemotron Super, Flint and GLM do. Prefill chunks and MTP rounds keep the defaults. Results do not depend on the partitioning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The earlier test named a private oracle from another file and did not compile. Tests only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CONTRIBUTING gives each new test one type; the kernel tests live in KernelTests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Beside its MTP head Lightning's checkpoints stay native, because the head's persistent state requires it. Served without the head they would become eligible for balanced rows, and a cache hit's output would move: 40 of 55 requests differed on a frozen conversation, 0 of 55 with native rows.

A saved provider.toml spells out the previous default, so the global word balanced is not a choice; k4v4, a per-model setting and the process switch still are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings #378 up to the SDK the provider pins for 0.10.12. No conflicts.

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

Copy link
Copy Markdown
Author

Merged main (093563be, the SDK the 0.10.12 provider candidate pins) into this branch with no conflicts: head 2b522f5b. Layr-Labs/d-inference#1969 pins it to serve Nemotron 3.5 Lightning with plain decode under auto for 0.10.12 (production evidence there). Needs a GPU run before either merges.

jonathan308 and others added 3 commits November 10, 2026 10:19
No conflicts: #398 touches none of #378's files.

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

The rule's tests lived only in the provider; SDK CI now guards it. Swift logic
only (UnitTests). A standalone harness of the same cases passes on this
branch's policy and fails 6 on main 093563b's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jonathan308
jonathan308 marked this pull request as ready for review November 10, 2026 19:11
@jonathan308
jonathan308 merged commit a6599fd into main Nov 10, 2026
22 checks passed
jonathan308 added a commit that referenced this pull request Nov 10, 2026
#378 (Nemotron 3.5 Lightning: plain decode commits by operation count;
complete checkpoints stay native) merged at 19:11Z. Its four files are
disjoint from this branch's; Lightning's checkpoints now stay native, so they
do not take the coded path this branch changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308 added a commit that referenced this pull request Nov 10, 2026
…row-reads

CBv2: a lossy checkpoint export reads rows in batches and codes them on several cores (same bytes). Merged by an agent with the owner's approval (11-10) after the independent review (review-stream-tail.md: approve, merge after #378 as a merge commit); Fork Tests 42882853010 on 781c382: success, all 10 shards.
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.

1 participant