Repository navigation
DeepSeek-V4.1 EXL3: additive GLPv3 steering for standalone CUDA - #4273
BlivionIaG wants to merge 29 commits into
Conversation
|
On A trial merge against main Igor Lessio - AIFLOW LABS |
Preserve both upstream release notes and ashhart#4273 attribution. Retain upstream contract coverage and remove the obsolete GLP test-only import.
|
Main I ran your exact five-target host command on The description now includes the completed one-/four-slot TP2 mechanism and RAM/NVMe receipts, explicitly pinned to model source The foundation selection remains a landing prerequisite: this branch ports #1835's foundation in |
|
The completed
Targeted checks pass 108/108 tests and 26/26 steps, plus formatting/preflight. Main advanced during CI; normal merge Current-head hosted CI, including native Windows execution, is still a gate. GPU receipts remain pinned to |
|
CI on d028dda now passes native Windows, Linux shard A and the other checks; only the benchmark manifest fixture failed in shard B. Commit 2ffb28a replaces its sleep-dependent stream delivery with the existing padded fixture, preserving all receipt assertions and production qualification rules. Local test-server-cpu passes 1708 tests with 15 skips, 7/7 steps, formatting and preflight. Current-head hosted CI remains pending; no model math or GPU receipt is changed. |
|
Current head 2ffb28a is green: nine checks pass, two nightly checks intentionally skip, no failures. Both Linux shards and native Windows host checks pass: https://github.com/ashhart/TensorFold/actions/runs/44857407142 . The description now records the completed result. The PR remains a draft: foundation coordination, the explicitly failed/unmeasured performance cells, trained-vector quality and source-current full-model gates are not represented as complete. Original attribution and source-pinned GPU receipts are unchanged. |
|
Merged current main f0b9cb8 into the PR: head is now e2377ab and the PR is mergeable. The only code conflict was zig/src/server/cli.zig; it keeps main's --parallel/--log-json/--unix-socket parsing and this branch's --glp plumbing. On this head the requested host set |
|
Foundation reconciliation and stack check: #1835 is now merged to current main and pushed as |
|
Additional exact-head evidence: Linux aarch64 CUDA/server cross-compilation passes on |
|
Correction: the hosted matrix on e2377ab was fully green (9 pass, 2 nightly skips), but the "Zig format" run failed with zero jobs because the merged |
|
Refreshed onto main Verification on the new head: reviewer's five host targets → 37/37 steps, 151/151 tests (fresh local cache); No CUDA device execution or peak-memory receipt is claimed for this merge; those stay pinned to the earlier source heads and the exact-head CUDA run, full-model binary and hosted CI remain open. |
|
Refreshed onto current main (2ce240c), head Two lean-ceiling extractions, behaviour unchanged: the seven |
|
Refreshed onto current main Your asks on #1835 are carried here, since this branch holds the ported foundation:
Checks on this head: lean 165 vs 165 (0 new), Still open and not claimed: the exact-head CUDA/full-model receipt (default-path token equality, loaded-zero equality, concurrent/resumed, decode and prompt no-slowdown at one and four streams, peak memory) is pinned to |
|
Thank you @BlivionIaG. The opt-in checks, DeepSeek zero-strength bypass, cache identity and MTP exclusion look consistent in the source. One fix is needed in the Metal contract check: it registers probes for the later gate pass, then frees those probes and releases their pipelines before that pass starts. Please keep them alive until the gate pass finishes. The earlier device receipts remain useful, with the seeded-drafting slowdown and current-head qualification gaps kept visible.
|
|
Fixed on Running the check on an M4 Pro also showed it compiling both kernels by hand without production's Evidence ( |
|
Thanks @BlivionIaG. The outer Suite lifetime and production specialization fix the numerical probes, and the new run demonstrates that repair. One related issue remains: the resource checker still specializes the steering source by hand without Q27_XS, so it checks a different variant from M5 serving. Please use the production specialization there too. The reported filter also misses that resource entry; the broader steer filter includes it. Current-head model, cold-latency, drafting and peak-memory qualification remains open as you documented.
|
1 similar comment
|
Thanks @BlivionIaG. The outer Suite lifetime and production specialization fix the numerical probes, and the new run demonstrates that repair. One related issue remains: the resource checker still specializes the steering source by hand without Q27_XS, so it checks a different variant from M5 serving. Please use the production specialization there too. The reported filter also misses that resource entry; the broader steer filter includes it. Current-head model, cold-latency, drafting and peak-memory qualification remains open as you documented.
|
|
Thanks, fixed in To prove the sources are equal, the limits pass compares the launch's sources byte for byte with the serving specialization (this GPU's Filter:
|
|
Thanks, @BlivionIaG. The resource check now uses serving's specialization for both variants, compares the source bytes and selects the right entry with the broader filter. The new M5 and M4 results address that finding; the earlier probe lifetime repair remains intact. This is ready for the remaining comparisons after integration with current main. Full-model serial equality, cold latency, sampled drafting and peak memory remain open, along with the DeepSeek extension's agreed landing gate and foundation order. The resource result does not close those cells.
|
|
Merged main |
|
I tested zig build test-dsv41-glp-host test-glp test-glp-steer test-glp-serve test-steer \
tf-kernel-contract -Dfixed-cpu -j2 --summary all
./zig-out/bin/tf-kernel-contract --only steerAll 155 host checks passed. The fractional-strength fixture matched the separately rounded result bit for bit over 1,495,040 output elements at strengths 0.1 and 0.3. The contracted control differed in every element. The production-specialized resource check covered the M5 and pre-M5 forms, with zero launch-limit problems. This closes my check of the revised rounding fixture on M5. Full-model equality, cold latency, sampled drafting, peak memory and the DeepSeek foundation order are still open. Igor Lessio - AIFLOW LABS |
|
The same contraction was in this PR's copy of
On an M4 Pro, |
- Reuse the native reader and Qwen additive path from c5947a8 on upstream main. - Preserve weightless/@msuiche, original directional-research and llama.cpp attribution; no project mode or vector assets. - Correct tf-glp-check missing-output argument handling before I/O, with actual CLI regression checks. - Host and compile-only gates pass; Metal GPU/runtime qualification remains separate.
- Extend ashhart#1835’s additive reader with strict GLPv3 paired-site admission; retain the original format, research and native implementation credits. - Add immutable add-only GPU plans, TP policy agreement, checkpoint binding, and decode/whole-prefill integration without changing the release refusal or importing the fork Metal backend. - Verify paired parsing/startup host tests, 317 host tests with two platform skips, Linux CUDA/tool compile gates, and a real GLPv3 checker round trip. GPU qualification remains pending.
- Include the known agent-owned contract records and final-fold device harness plus startup normalization from the host-qualified integration. - Keep new CUDA resources explicitly unmeasured until device qualification.
- Split the CUDA contract fixture from execution and move GLP flag/refusal handling into existing startup boundaries; keep touched source files below 600 lines. - Preserve the original credits and shorten redundant comments. Contribution preflight reports zero errors and zero new lean findings. - Verify the ported Metal epilogue on M5 Ultra: 24 exact GPU cases against BF16-RNE residual and existing normalization/XS oracles. Integrated host checks are running.
- Bound tensor spans by subtraction after validating start; both legacy and paired files now refuse crafted wrapping offsets without a panic or out-of-bounds slice. - Verify the public reader with 55 passing tests, including the malicious-offset regression for versions 1 and 3. - Report invalid/orphan worker strengths and add five real-process Linux CLI refusal checks that require a named flag diagnostic, not pinned wording. Linux execution remains part of rig qualification.
- Recognize native Windows and mixed separators without interpreting backslashes as POSIX separators. - Cover Windows, UNC and mixed snapshot paths plus local/lookalike refusals. - Remove the redundant DeepSeek image-count assertion; retain the all-launch/control resolver contract.
- Reuse the padded-stream fixture instead of sleep-based delivery timing for manifest metadata checks. - Preserve unranked receipt assertions and share immutable replies across missing-field cases. - Leave production benchmark timing and qualification logic unchanged.
A container whose metadata nests arrays deeper than four levels is refused by name instead of recursing to the stack limit, and a glp.content_sha256 key that is not text is refused rather than read as no claim. Both regressions build the malformed containers directly.
The MTP head builds its stages over the target model, so an active control vector covering layer 63 applied that direction a second time inside the head. headStages turns Stages.steer off for the head alone; its rows keep the steering the target already applied. A regression with a 63-of-64 vector pins that the target reads the direction and the head does not.
capabilities --json listed --glp and --glp-alpha on a build that refuses every valid use of them. A flag now carries whether it is advertised, so it stays accepted and named by a config file while a build without a steering engine leaves it out of the listing.
The relative-path rule covers a path flag, so glp = "vector.gguf" reads from the file's folder like chat-template and api-key-file; the config regression now asserts it.
One changelog line for the feature, as the maintainer asked on ashhart#1835, and the --glp rows name the DeepSeek CUDA paired site that takes its own file instead of reading as a blanket CUDA refusal.
The steer suite freed its probes and pipelines when collection returned, before the later gate pass read them; hold both until that pass finishes. Build the fused kernel and the plain norm from the production specialization, so the plain norm returns the padded rows the launch dispatches.
…zation, Q27_XS included Its source here is quant_gpu's with this GPU's tensor units, and before the M5 the one without; the limits pass checks both against serving's key.
Metal contracted hv + alpha * d into one fused multiply-add, which differs from the separately rounded reference at strengths whose products round (0.1, 0.3); powers of two were exact either way.
… add at 0.1 and 0.3 The GPU suite ran only at strength 1.0, where a contracted fused multiply-add and the separately rounded add coincide. It now builds rows that sit on a bf16 tie only the product's own rounding breaks, checks the steered row bit for bit against the separately rounded add at 0.1 and 0.3, and plants a contracted kernel that must differ in every element.
…hart#4273 on today's main Main's zig/src/families/deepseek_v41/cuda_model.zig (594 lines) and zig/src/families/qwen27/quant_gpu.zig (598) take ashhart#4273's GLP boot and normSteer to 605 and 620. Main's TF_DSV41_* readers move unchanged to deepseek_v41/model_env.zig, re-exported from cuda_model.zig so every caller's model.layersEnv, contextEnv and ownPrefillEnv stays; quant_gpu.zig's three tests of its pure helpers move unchanged to qwen27/quant_gpu_test.zig, which it references. No code that runs changes.
d56b4a6 to
9fafdda
Compare
|
Thanks @BlivionIaG. We rebased this onto today's main and pushed it to your branch, with your authorship and messages kept. What changed in the rebase:
Three things to fix on your side, all reached only with steering on or left unused:
Next on our side: device runs to check that unsteered tokens equal main's on Metal (Qwen3.8-27B) and on a GB10 (DeepSeek-V4.1).
|
Main's shifted norms (weight + 1) apply to SenseNova, and the steered norm has no shift, so a steered SenseNova norm would drop it. The engine refuses the vector by name when the config shifts its norms; the server already refuses sensenova_loop, now under a test.
normSteer set .xs from tensorUnits() while main's norm keys on xsGroup. steerKey takes the same xs_group, so both cache keys carry the same sums, and refuses the 128-column sums norm_steer.metal does not write. The limits entries compile through it.
Main moved the context check elsewhere; nothing calls it.
|
Thanks @ashhart. Pushed on top of your rebase (fast-forward, your commits kept):
The fp-contract pragma in |
|
Thank you, @BlivionIaG. The named SenseNova refusal, xsGroup key and matching resource specialization are present, and the unused servedContext is gone. The ordered-add pragma and regression survived. The head merges cleanly. The remaining checks are unsteered Qwen tokens against main on Metal and unsteered DeepSeek tokens on GB10, at matching pinned checkpoints and settings. Current-head serial/drafted equality, cold latency, memory and the DeepSeek extension gate remain open. The reported operator passes keep their stated scope.
|
|
@BlivionIaG, the first of our two unsteered checks is in. On The DeepSeek-V4.1 unsteered tokens on GB10 come next; that run needs our two-box pair. The remaining items from our last note are still open on your side: serial/drafted equality on the current head, cold latency, memory, and the DeepSeek extension gate.
|
|
@ashhart, the four items on our side, at Serial vs drafted, steered. Four prompts (4,528, 1,706, 29 and 30 tokens), 256 tokens each, greedy and seeded (seed 1234, top-k 20, top-p 0.95), Steering off. The head equals main in all 16 cells (4 prompts, greedy and seeded, serial and drafted), and serial equals drafted in both. Cold prompts. Main, head off and head at alpha 1 in A/B/C/C/B/A order, two cycles, a fresh server per block, prompt cache off, 64 tokens greedy, 16 rows per size and arm, every row uncached:
The first request after startup, with no warm-up request (8,192 tokens, six per arm), took 5.2842 s for main, 5.2842 s with steering off and 5.2849 s at alpha 1. Medians are shown. Off tokens equal main's on every row. Memory. Server process max RSS / peak footprint from
Steering adds 4–7 MiB per process; the vector is 1.23 MiB. DeepSeek extension gate. As written in
The landing order with #1835 is unchanged. |
|
This is a merge of upstream/main into the branch (merge only, no rebase; your commits kept), now at |
|
Merged upstream/main (
|
|
Thank you for merging current main and for keeping the earlier technical fixes through the merge. The current head has no merge conflicts, and the GLP records, CUDA contract sets, and Qwen test registrations are all preserved. The provenance review found no affirmative evidence of code copied from another engine or library. The source and notices describe TensorFold's own implementation, and The earlier static asks remain addressed. SenseNova's shifted norms are refused, the production group-sum key is used, the Metal add is protected against contraction with a planted regression control, and the changed source files remain within the line limit. Your reported 33/33 host-test result at the current head is noted; I did not rerun it here. The verdict is now SAFE TO A/B, rather than LAND. The remaining evidence is exact-head device coverage:
The separate landing-order decision with #1835 also remains open. No device run was performed in this review.
|
What this changes
Before: current main (
9fa8863bcf) has no control-vector path, and the experimental standalone DeepSeek-V4.1 EXL3 CUDA pair reports zero restored prompt rows through HTTP. After:--glp FILEreads a GLP container once at startup and applies add-only directions at Qwen3.8-27B's post-block residual site (Metal) and at DeepSeek-V4.1's GLPv3hc_fold_pre_engrampaired site (the experimental standalone CUDA pair);--glp-alphaoverrides the strength. With no--glp, the launch list, kernels and saved-state identity are unchanged. The prefill telemetry forwards the target's existing resumed-row callback, so a restored prompt reports its actual rows.Issue: Refs GLP control vector support for Qwen3.8-27B on Metal #1834 and Implement GLP control vectors with a fused Metal kernel for Qwen3.8-27B #1835. The additive-only steering policy was agreed on GLP control vector support for Qwen3.8-27B on Metal #1834/Implement GLP control vectors with a fused Metal kernel for Qwen3.8-27B #1835; the DeepSeek paired-site/backend expansion and its landing gate are proposed here, not represented as maintainer-approved.
Stacked on: main
9fa8863bcf. Implement GLP control vectors with a fused Metal kernel for Qwen3.8-27B #1835 (head24de2f6cb7) is still open and conflicting with main, so its foundation is ported here (89b8928e25…, DeepSeek extension from792e8b36d0). This is not an independently landable duplicate: if Implement GLP control vectors with a fused Metal kernel for Qwen3.8-27B #1835 lands first, this branch must be restacked on it.atc overlap --json: run on this head; the result is incomplete (pullRequestsLimit,pullFilesUnavailable,timeLimit). It reports file-level overlap with the unmerged qwen27: serve the 27B pair, refuse what a pair cannot keep, and die with the peer #1434, qwen27 Metal: DSpine drafter for Qwen3.8-27B, opt-in #2634, ricursive: load Ripple's EXL3 packs through main's shared EXL3 code #2514 and dsv41 metal: TF_DSV41_ROUND_PROF times each decode round and the drafter's passes (stacked on #1720) #2951, none of which is a merged-base conflict; this head merges9fa8863bcfcleanly (GitHub: MERGEABLE).Add only. No project mode, refusal vector, trained assets, checkpoint modification, per-request steering or token-path optimization.
Whole-backbone decode and whole-prefill programs only. Replay, TBO, traces and layer prefixes refuse an active vector at startup; MTP/drafter blocks are not steered.
The ordinary release CUDA DeepSeek refusal is unchanged. No fork-only Metal backend, mixed-device prefill consumer, Gemma or ROCm steering is imported.
Checks on this head
8dd0fad4f3(a merge of main into the maintainer's rebasedfd0c848325, plus the three fixes he asked for and our fp-contract pragma and its contract cell); merge state is whatever GitHub reports against current main.tools/pr_check.py --base eff4e5b7545477750df78916a0fc07eb4a69bf1e --pr 4273reports 0 errors, 0 warnings over 107 files (merge base9fa8863bcf); lean 165 vs 165, 0 new.zig build test-dsv41-glp-host test-glp test-glp-steer test-glp-serve test-steer -Dcpu=apple_m1 -j4 --summary all→ 37/37 steps, 156/156 tests, 0 failed (re-run at this head).test-qwen27-startup-host(12 tests × 2 env runs, includes the new MTP/layer-63 regression),test-contract-images-host(5) andcheck-qwen27-speed-hostcompile → 54/54 steps, 183 fresh tests.zig build test-server-cpu -Dcpu=apple_m1 -j4 --summary all→ 7/7 steps, 1913/1928 passed, 15 skipped, 0 failed.zig fmt --check build.zig zigandgit diff --checkpass; scoped to every changed.zig.glp.content_sha256is refused; a 63-of-64 vector is read by the target’s stages and not by the MTP head’s;--glpis advertised only where a build steers; a config file’s relativeglpresolves from the file’s folder.4bade0ff1apending when this was written.Receipt
Qwen3.8-27B on Metal, this head (M5 Ultra, macOS 27.0): base main
0a5c699c89; checkpoint70ae7fac63, DFlash250307d4c4c; Implement GLP control vectors with a fused Metal kernel for Qwen3.8-27B #1835's synthetic vector4717ec19…. Steered serial equals drafted on 4 prompts × greedy/seeded at alpha 0.1, 1 and 4 (24/24 pairs, full ids and text, 256 tokens); the long-prompt steered outputs equal Implement GLP control vectors with a fused Metal kernel for Qwen3.8-27B #1835's separately rounded reference. Off equals main in 16/16 cells. Cold A/B/C/C/B/A, 16 rows per arm: TTFT 2,048 rows 1.3002 / 1.3005 / 1.3000 s and 8,192 rows 5.2785 / 5.2799 / 5.2781 s (main / off / alpha 1), decode 48.03 / 48.08 / 48.07 and 46.20 / 46.22 / 46.18 tok/s; first request after start 5.2842 / 5.2842 / 5.2849 s. Process max RSS / peak footprint: steering adds 4–7 MiB (e.g. 16001.9 / 33785.0 off vs 16006.0 / 33788.9 MiB at alpha 1).Main against branch: device cells below are pinned to model source
8da263a474; the exact-head (fd0c848325) DeepSeek full-binary comparison is not run (Qwen's is above). Refreshed-source integration is host/compile checked separately.Boxes it reaches: Qwen additive Metal foundation and the experimental standalone DeepSeek EXL3 CUDA pair only; no ordinary release DeepSeek enablement.
Switch: no file is the default;
--glp FILEloads a validated immutable policy,--glp-alpha FLOAToverrides finite non-negative strength. Loaded zero is unsteered but identifies its file. No new environment variable is read; noplatform/environment.zigrule is added.Synthetic input pins: file A
c3db012bafa6a6c13a7aa99f2bdc534068aad23a817502ebf7d127c13aa338c5, file Bcc1b266b8cdbbaca29aa27665ab01fa4b2b2bf4685bdcf027983655d3f4f4ab2. Same 39 deterministic unit directions at H=5120, different default-alpha metadata; both active runs override alpha to 4. No trained assets are published.Environment: two GB10 / sm_121 systems, 128-GB RAM class, Ubuntu 24.04, Linux
6.17.0-1032-nvidia, Zig 0.17.0, NVCC 13.0.88, driver 580.173.02; TP2 over RoCE. Checkpoint:Mia-AiLab/DeepSeek-V4.1-Flash-1017-EXL3-EAQ-v1-2.9-bpwat45ee5d0fd106c94a3d77f721e09cbb2f50e5a16b, including its DSpark/MTP blocks. Context 131072, pool 65536, graphs, whole prefill, sampling, slot drafts and multi-slot sessions enabled; hard/target memory floors 4/5 GiB.AOT build provenance: existing recipe tools; build-only Python reference reconstructed from TensorFold
c4646171139ee8a3c38103eaa1699dad226ec12bplus the three SHA-checked patches at recipe391d677b300d9b53e64f4265a261c0b329ea58e0. Triton 3.7.1 and PTXAS 13.3.73 in immutable imagesha256:6d819669d3907619d048a7799ef82365c89acd8a661d77e77ae6f993bc57e8df; asset compilation, not Python serving.Candidate model binary SHA-256: server
951c0b8467f25c06c981431bf435b523d4857bbd5f64bd861fa640368042d686; follower211b03ab4f0538414e39cd7d9381ee3d9243217774ce1a1f3b8bdb0fb862c72c.Baseline model binary SHA-256: server
de909e67ef8d00ff32372f23bdd5a96e341b3eef778f6871bff92e85430d8222; follower8f6c0a3258588f1760e562574657346e06f4a258470404520792c7d9160655b4.Paths/platforms: no mixed-device or other-backend qualification is inferred; executed and unrun cells are distinguished above.
Exactness: on the pinned source, off and loaded zero equal baseline on long and diverse short prompts; within each active policy, greedy/seeded plain vs actual drafting, solo vs queued concurrent, and cold vs restored outputs agree. Active long greedy SHA-256
1a3830d3fa9e5185d9345abc1937c2b7f0c0f33a235ff639497bd6cbedc6989b; off/zero/baseline97fb62186ea3990c7db7090abb68370d3858e8ea48244efacd82e68918a6cd1b. These synthetic controls do not establish model quality. Exact-head DeepSeek default-path equality is not run (the maintainer's GB10 check).Decode before/after: matched 8192-input/64-output warm-cache client-window medians, single physical slot, three plain/draft/draft/plain repetitions (six samples per mode); binary arms were not alternated, so small differences are observations:
Active steering changes target tokens and drafter acceptance, so its drafted difference is not isolated kernel overhead. In the seeded active cell, drafting is slower: 22.465 vs 30.415 tokens/s, 17 of 112 proposals accepted. That no-slowdown cell is not qualified.
Prompt speed: one cold 8192-token first-request TTFT per arm: baseline 5.785 s, off 6.927 s, zero 5.952 s, active 6.075 s (pinned source). The off arm is worse in this single observation and is not dismissed as noise; repeated alternating cold runs and the 2k/32k/64k cache-off matrix remain open. For Qwen on Metal at this head, repeated alternating cold prompts are level (Receipt, first bullet).
Memory: normal floor admission observed. Four-slot per-rank process
VmHWM(pinned source, client decode window): baseline 5818.754 / 5723.016 MiB, no file 5818.938 / 5722.879, loaded zero 5820.980 / 5724.922, strength 4 5822.289 / 5726.652. This is/prochigh-water, not a device/pinned-allocation peak; single-slot and complete device peaks remain unqualified.New weights/drafter licence: n/a, none are added or modified. Synthetic unit directions are local mechanism controls, not trained vector assets.
Kernel contract
dsv41_glp_add_stream,dsv41_glp_add_writer,dsv41_glp_add_final; no existing kernel is replaced. The public GLP slice covers all six dispatch variants; the family runner covers the paired composite.qwen27 steeron an M4 Pro (this branch's ported foundation),tf-kernel-contract --only "qwen27 steer", exit 0:Q27_XSspecialization (previouslyFusedNormDiffersFromPlainNorm); the nan control is red as planted. The unfiltered Metal run needs a rotary accuracy receipt on this host (UnrecordedRotaryCompiler), so this is the filtered steer line, not the whole Metal suite.Remaining boundaries
Synthetic unit directions are mechanism controls only. The maintainer-owned #1835 M5 Ultra gate and the 1/2/4/8-stream sweep remain separate. The operator proof above is not a full-model Qwen claim. The portable evidence is pinned to
8da263a474; the exact-head CUDA TP2 run (default-path, zero/add, drafting, concurrency, restore, no-slowdown, cold TTFT and device peak memory) remains open; Qwen's current-head serial/drafted, cold-latency and process-memory cells are measured above.Checklist
"draft": false, resumed equals fresh and concurrent equals solo at this head (Qwen: drafted equals"draft": falseat this head; DeepSeek: pinned-source evidence only).--drafter(Qwen single-stream cold prompts and decode are level at this head; DeepSeek off-arm TTFT and the active sampled cell are open).