Repository navigation
DeepSeek-V4.1 EXL3: additive GLPv3 steering for standalone CUDA - #4273
BlivionIaG wants to merge 22 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.
- Record NVCC 13.0 sm_121 usage verified by live driver limits: stream42, writer44, final48 registers; leave other targets and later compilers unmeasured. - Document 195 family device passes, six public contract variants, ten discriminating controls, graph replay and sanitizer boundaries including the shared staging-cache exit allocation. - Propagate actual restored rows through the native target callback; verify the real target interface and stale-count rejection with 110 passing host tests plus Linux cross-compilation. - Keep the 16-row saved-state boundary explicit; remove metadata-pinning tests and their empty gate. Contribution preflight has zero errors and zero new lean findings.
- Retain the format and native-foundation provenance and the original FlashAlign clarification. - Preserve main changelog spacing so the independent ashhart#3093 insertion merges cleanly.
- Record exact off/zero and within-policy drafted, sampled, queued-client and RAM/NVMe comparisons. - Publish the synthetic active control costs without claiming semantic efficacy or a no-slowdown pass. - Clarify disposable cache lifetime and the rank-specific AOT asset mismatch behind the first wide-stream failure.
- Record source-pinned TP2 exactness and real RAM/NVMe prefix restoration. - Publish four-stream warm medians and per-rank process high-water without claiming device peaks or hiding failed performance cells.
- 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).
|
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
d56b4a622e(6647e9495aplus the Metal steer-contract lifetime fix); GitHub reports it mergeable against main68ff0ad8e6.tools/pr_check.py --base 68ff0ad8e64ed9d7b3f268cf0d21785ada0042f1 --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, 154/154 tests, 0 failed (test-glp59,test-glp-serve47,test-glp-steer4,test-steer24,test-dsv41-glp-host20).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.d56b4a622e(runners backlogged; not yet started). The previous head4727fd6734was fully green: nine checks pass, two nightly checks intentionally skip.Receipt
Main against branch: device cells below are pinned to model source
8da263a474; no exact-head (d56b4a622e) full-binary comparison exists yet. 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 default-path equality is not run.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.
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 run, default-path token equality and the peak-memory receipt remain open, as do repeated alternating cold prompts.Checklist
"draft": false, resumed equals fresh and concurrent equals solo at this head (pinned-source evidence only).--drafter(off-arm TTFT and the active sampled cell are open).