You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DeepSeek V4.1: validate the R5-A loop adapter on the host - #6149
Add an offline host check for the 1017 R5-A sidecar. It validates the pinned manifest and tensor payloads, uses the base TP partition for each projection, and computes the additional resident memory per rank and slot. It defines the loop state key and supplies a serial FP32 entry and projection reference at the BF16 rounding points.
The adapter constructs the result in place. Each successful file open registers cleanup on that field, and a host test rejects a bundle after all three opens with the leak-checking allocator.
The entry command reads both inputs into explicitly aligned allocations before taking their BF16 views. The six captured token rows still produce the same output bytes. Synthena’s review
Depth one means a single backbone pass with zero loop residency. The loader still checks the entire sidecar before reporting either depth.
The entry command validates whole tokens before taking BF16 views, then indexes the input as token, stream, hidden. The recipe now spells out the packing order. The two six-token fixtures matched the previous bytes, and a partial-token fixture failed with BadLoopReferenceRows. Synthena’s follow-up
On this head, the three field-level errdefer statements are in the same function scope as try result.checkWeights(cfg). The allocator-backed fixture exercises that failure after opening all three files. The entry command guards equal lengths and whole-token multiples before taking the BF16 views, and the truncated fixture exercises the guard. Latest review · Cleanup · Row validation
Checks on this head
Head 4a863f03c8da496b918a215aaedd46823e235376. The focused zig build test-dsv41-assets-host dsv41-assets --summary all passed 21 build steps and 17 executed tests. Changed-file formatting and diff checks passed.
The pinned R5-A bundle reported the same budgets at depths one and two. Both captured entry fixtures still produced SHA-256 c9cb75ad086270e82679a4213543a61ff723c36da6d6425bd7ffcfea3e13181b. The partial-token fixture produced no output file.
Lean checker reported 88 inherited findings on base and head, with zero new findings. The scoped ATC checks found zero conflicts and the branch test-merged with upstream 4e232d7c91.
The full host suite and GPU receipts below are from the original head. This follow-up used focused host verification.
Original host and device evidence
Original head c7a412abfd2eb07d00967ab4a69e3f63d1610ec6.
Lean checker reported 88 inherited findings on both base and head, zero new findings, and zero new import-cycle edges.
zig build dsv41-assets test-dsv41-assets-host passed 28 tests on Linux x86-64. The installed tool accepted the pinned step-300 sidecar and rejected an unsupported depth, a mismatched hash, incorrect layer coverage, a corrupt weight payload, and a correctly rehashed nonfinite weight.
The broad zig build test run and the ordered native suite on upstream main stopped at the same CUDA disk staging-permit test. The test passed in isolation on upstream main. Both long runs were ended after reproducing the stall.
Original-head CI passed verify, format, Zig, Python, and benchmark-client checks. Device inference checks apply to the serving slice.
Receipt
N/A for inference. This PR adds a CPU-only tool and its host reference. The standalone GB10 entry and TP2 projection receipts are recorded in #5938. The state key and byte accounting here are inputs for the serving integration.
The depth-two host result was 88,113,152 adapter bytes and 1,794,048 extra SWA bytes per slot on each rank. Depth one reported zero additional device bytes. The reference uses the published MIT-licensed sidecar for the experiment. Pinned R5-A checkpoint
Checklist
The title and description match the head commit, scope, and stack.
The host tests and planted refusal cases exercise the new checks.
Comments and docstrings are one line. No measurements or history in the source.
The diff contains no private paths, internal hosts, or attribution lines.
Adds a CPU-only host tool that validates the pinned DeepSeek V4.1 R5-A loop adapter sidecar (manifest, tensor hashes, shapes, finiteness, zero-gate consistency) and reports per-rank resident weight and SWA bytes, plus a serial FP32/BF16 reference for the loop entry and projection deltas.
Large code diff (618 lines across 5 files); requires maintainer review.
Findings:
[WARNING]zig/src/families/deepseek_v41/loop_adapter.zig: If checkWeights fails, the errdefer chain in open does not cover the returned result, so the three already-opened safetensors files leak on that error path. Suggested fix: Wrap the result construction and checkWeights call with an errdefer that closes all three files, or move checkWeights before the result is returned via a local that is covered by the existing errdefers.
[WARNING]zig/src/families/deepseek_v41/loop_asset_tool.zig: bytesAsSlice on unaligned file-read buffers requires the underlying allocation to be sufficiently aligned; readFileAlloc may return a pointer with alignment below u16, causing an illegal behavior on strict-alignment targets. Suggested fix: Use std.mem.bytesAsSlice(u16, old) only after verifying alignment, or copy through an aligned allocation (e.g. a.alloc(u16, ...) and read into it via bytesAsSlice on a properly aligned buffer).
Adds a CPU-only host tool that validates the pinned DeepSeek V4.1 R5-A loop sidecar (manifest, tensor digests, TP2 partitions) and computes per-rank resident byte costs, plus a serial FP32/BF16 entry and projection reference. Includes host tests and a recipe doc; no runtime or serving-path changes.
Findings:
[WARNING]zig/src/families/deepseek_v41/loop_adapter.zig: fit() returns zero for depth one without validating that the depth-one entry tensors exist or are loadable, so a depth-one budget of zero is reported even if the sidecar is unusable at that depth. Suggested fix: Validate the depth-one entry tensors (or document that depth one requires no adapter residency) before returning a zero Fit.
[WARNING]zig/src/families/deepseek_v41/loop_asset_tool.zig: The row-count check validates length in elements but the loop indexes rows by hidden only, so a file whose length is a multiple of hiddenhc but not a whole number of hidden-element rows per stream could still be mis-sliced if hiddenhc does not divide evenly into per-token rows. Suggested fix: Assert anchors.len % hidden == 0 explicitly and document the expected [tokens, 4, 5120] flattening order.
Adds a host-side admission tool and serial FP32/BF16 reference for the DeepSeek V4.1 R5-A loop sidecar, including manifest/tensor validation, per-rank memory fit reporting, a state key, and a new tf-dsv41-loop-check build step.
Findings:
[WARNING]zig/src/families/deepseek_v41/loop_adapter.zig: The three tensor files are opened and digest-checked sequentially with errdefer cleanup, but if checkWeights fails after all three opens, no errdefer covers that path, so a BadLoopTensorCount or NonfiniteLoopWeight failure leaks all three file handles. Suggested fix: Wrap the checkWeights call with an errdefer that closes all three files (e.g. errdefer result.close(io) placed after the last open), or restructure so close is guaranteed on any post-open failure.
[WARNING]zig/src/families/deepseek_v41/loop_asset_tool.zig: The entry command reads both input files fully into memory with a 16 MiB cap and no validation that the file length is a whole multiple of the token row size before indexing as token, stream, hidden, so a truncated file can produce an out-of-bounds slice or silently wrong results. Suggested fix: Validate old.len == past.len and old.len % (hc * hidden * @sizeof(u16)) == 0 before slicing, returning BadLoopReferenceRows otherwise.
Thanks @francip. Your commits had a work email as the commit address, and we don't put personal addresses into main's history, so we moved them to your GitHub noreply. Pushes to this branch are refused, so we carried the same three commits, authorship kept, in #6170, which lands in your name. Closing this in favour of #6170.
my (agent's) bad. will be careful with the noreply email moving forward.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Add an offline host check for the 1017 R5-A sidecar. It validates the pinned manifest and tensor payloads, uses the base TP partition for each projection, and computes the additional resident memory per rank and slot. It defines the loop state key and supplies a serial FP32 entry and projection reference at the BF16 rounding points.
mainatd5c37731bff66cbf99b4b5187db72713ba15cfc7.mainon December 3, 2026. The scoped check of deepseek_v41: reply logprobs normalize over all TP head columns (#1324) #2125 and deepseek_v41: opt-in per-layer hash files for TP repeat divergence (split from #2030) #3297 found zero overlaps on the final slice. A separate path scan covered 415 open PRs and found zero shared paths. The repository-wide ATC view hit its coverage limit.Review follow-up
BadLoopReferenceRows. Synthena’s follow-upOn this head, the three field-level
errdeferstatements are in the same function scope astry result.checkWeights(cfg). The allocator-backed fixture exercises that failure after opening all three files. The entry command guards equal lengths and whole-token multiples before taking the BF16 views, and the truncated fixture exercises the guard. Latest review · Cleanup · Row validationChecks on this head
4a863f03c8da496b918a215aaedd46823e235376. The focusedzig build test-dsv41-assets-host dsv41-assets --summary allpassed 21 build steps and 17 executed tests. Changed-file formatting and diff checks passed.c9cb75ad086270e82679a4213543a61ff723c36da6d6425bd7ffcfea3e13181b. The partial-token fixture produced no output file.4e232d7c91.Original host and device evidence
c7a412abfd2eb07d00967ab4a69e3f63d1610ec6.zig build dsv41-assets test-dsv41-assets-hostpassed 28 tests on Linux x86-64. The installed tool accepted the pinned step-300 sidecar and rejected an unsupported depth, a mismatched hash, incorrect layer coverage, a corrupt weight payload, and a correctly rehashed nonfinite weight.zig build test-golden test-kernel-contract fuzz-cortheon test-dsv41-assets-hostpassed 305 tests.zig fmt --check build.zig zigandgit diff --checkpassed.zig build testrun and the ordered native suite on upstream main stopped at the same CUDA disk staging-permit test. The test passed in isolation on upstream main. Both long runs were ended after reproducing the stall.Receipt
N/A for inference. This PR adds a CPU-only tool and its host reference. The standalone GB10 entry and TP2 projection receipts are recorded in #5938. The state key and byte accounting here are inputs for the serving integration.
The depth-two host result was 88,113,152 adapter bytes and 1,794,048 extra SWA bytes per slot on each rank. Depth one reported zero additional device bytes. The reference uses the published MIT-licensed sidecar for the experiment. Pinned R5-A checkpoint
Checklist