Skip to content

DeepSeek-V4.1 EXL3: additive GLPv3 steering for standalone CUDA - #4273

Open
BlivionIaG wants to merge 22 commits into
ashhart:mainfrom
BlivionIaG:work/dsv41-glp-add-upstream
Open

BlivionIaG wants to merge 22 commits into
ashhart:mainfrom
BlivionIaG:work/dsv41-glp-add-upstream

Conversation

@BlivionIaG

@BlivionIaG BlivionIaG commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

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 FILE reads 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 GLPv3 hc_fold_pre_engram paired site (the experimental standalone CUDA pair); --glp-alpha overrides 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.

Checks on this head

  • Head commit: d56b4a622e (6647e9495a plus the Metal steer-contract lifetime fix); GitHub reports it mergeable against main 68ff0ad8e6.
  • Lean checker: 165 on the base, 165 on this head, 0 new; tools/pr_check.py --base 68ff0ad8e64ed9d7b3f268cf0d21785ada0042f1 --pr 4273 reports 0 errors, 0 warnings over 107 files (merge base 9fa8863bcf); lean 165 vs 165, 0 new.
  • Tests run:
    • 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-glp 59, test-glp-serve 47, test-glp-steer 4, test-steer 24, test-dsv41-glp-host 20).
    • Additional targets at this head: test-qwen27-startup-host (12 tests × 2 env runs, includes the new MTP/layer-63 regression), test-contract-images-host (5) and check-qwen27-speed-host compile → 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 zig and git diff --check pass; scoped to every changed .zig.
  • New regressions: metadata arrays nest four levels and the fifth is refused; a non-text glp.content_sha256 is refused; a 63-of-64 vector is read by the target’s stages and not by the MTP head’s; --glp is advertised only where a build steers; a config file’s relative glp resolves from the file’s folder.
  • CI: queued on d56b4a622e (runners backlogged; not yet started). The previous head 4727fd6734 was fully green: nine checks pass, two nightly checks intentionally skip.
  • Not run: CUDA device execution, Metal device run with a vector, native Windows execution, other SMs/compilers. Scoped host and compile checks do not replace them.

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 FILE loads a validated immutable policy, --glp-alpha FLOAT overrides finite non-negative strength. Loaded zero is unsteered but identifies its file. No new environment variable is read; no platform/environment.zig rule is added.

  • Synthetic input pins: file A c3db012bafa6a6c13a7aa99f2bdc534068aad23a817502ebf7d127c13aa338c5, file B cc1b266b8cdbbaca29aa27665ab01fa4b2b2bf4685bdcf027983655d3f4f4ab2. 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-bpw at 45ee5d0fd106c94a3d77f721e09cbb2f50e5a16b, 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 c4646171139ee8a3c38103eaa1699dad226ec12b plus the three SHA-checked patches at recipe 391d677b300d9b53e64f4265a261c0b329ea58e0. Triton 3.7.1 and PTXAS 13.3.73 in immutable image sha256:6d819669d3907619d048a7799ef82365c89acd8a661d77e77ae6f993bc57e8df; asset compilation, not Python serving.

  • Candidate model binary SHA-256: server 951c0b8467f25c06c981431bf435b523d4857bbd5f64bd861fa640368042d686; follower 211b03ab4f0538414e39cd7d9381ee3d9243217774ce1a1f3b8bdb0fb862c72c.

  • Baseline model binary SHA-256: server de909e67ef8d00ff32372f23bdd5a96e341b3eef778f6871bff92e85430d8222; follower 8f6c0a3258588f1760e562574657346e06f4a258470404520792c7d9160655b4.

  • 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/baseline 97fb62186ea3990c7db7090abb68370d3858e8ea48244efacd82e68918a6cd1b. 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:

    Policy Plain tokens/s Drafted tokens/s
    Baseline 38.418 181.404
    Candidate, no file 38.337 180.362
    Candidate, loaded zero 38.316 181.143
    Candidate, synthetic strength 4 37.758 113.236

    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 /proc high-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
  • Registered 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.
  • Ten CUDA planted controls fail as planted; no missed control.
  • CUDA public GLP selection, exit 0:
    (filtered) SUMMARY 6 kernels: 6 pass gates 1-4, 0 fail, 0 known findings; 10 controls: 10 red as planted, 0 missed; 0 limit problems; gates 85 ms, limits 0 ms
    
  • Family GLP runner: 195 passes, zero failures. These selected operator checks are not the complete unfiltered backend suite.
  • Metal qwen27 steer on an M4 Pro (this branch's ported foundation), tf-kernel-contract --only "qwen27 steer", exit 0:
    SUMMARY 1 kernels: 1 pass gates 1-4, 0 fail, 0 known findings; 1 controls: 1 red as planted, 0 missed; 0 limit problems; gates 7 ms, limits 512 ms
    
    The suite now stays alive through the gate pass (previously exit 139) and both kernels compile with the production Q27_XS specialization (previously FusedNormDiffersFromPlainNorm); 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.
  • Unrun: other CUDA SMs/compiler versions, complete offline multi-SM limits, other Apple chips, HIP/XPU and Windows GPU runtime; the unfiltered Metal suite on this host (a rotary deployment receipt is absent).

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

  • The title and description match this head, including the stack and the completed host checks.
  • New tests fail before their change, pass after it, and skip cleanly without their dependency.
  • Comments/docstrings are one line; no measurements or history in source.
  • Outgoing identities use the approved noreply address; no AI attribution, private paths, machine names or hosts.
  • Every token still goes through the lane rounds; no serial path and nothing that needs drafts off.
  • Drafted output equals "draft": false, resumed equals fresh and concurrent equals solo at this head (pinned-source evidence only).
  • No precision traded for speed; active FP32 additions and BF16-RNE stores are described and bounded by the operator reference.
  • Decode and prompt processing no slower than main at one and widest streams, with and without --drafter (off-arm TTFT and the active sampled cell are open).

@AIFlowML

Copy link
Copy Markdown
Contributor

On e8bc1c2b with Zig 0.17.0 and M5 Max, zig build test-dsv41-glp-host test-glp test-glp-steer test-glp-serve test-steer -Dcpu=apple_m1 -Doptimize=ReleaseSafe -j4 --summary all passed 149/149. This gives a focused rerun for the container, server admission, launch plans and reference checks without a GPU.

A trial merge against main 523d58cb had two conflicts, in the changelog and contract registry. Trial-merging against public #1835 at c5947a8d had 20 conflicts, including the GLP container reader, the Qwen forward path, and server startup. That confirms the foundation needs to be reconciled before this can land as a separate increment. Rerun these targets on the extension after the foundation is selected. My host run leaves the exact-head CUDA and peak-memory receipts open.

Igor Lessio - AIFLOW LABS

BlivionIaG added a commit to BlivionIaG/TensorFold that referenced this pull request Nov 21, 2026
Preserve both upstream release notes and ashhart#4273 attribution. Retain upstream contract coverage and remove the obsolete GLP test-only import.
@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Main 523d58cbe3 is now merged normally in 574d6c661e; the changelog and registry conflicts are resolved. Current head 4fcd457af5 adds the measured four-slot documentation only. Preflight reports zero errors/warnings; the refreshed integration check passes 296 tests with five skips and Linux CUDA/server compilation.

I ran your exact five-target host command on 4fcd457af5 with Zig 0.17.0, -Dcpu=apple_m1 -Doptimize=ReleaseSafe -j4. All 37 build steps succeed: 46 fresh tests pass, while the remaining test executions are reported cached. I am not calling that 149 fresh passes.

The description now includes the completed one-/four-slot TP2 mechanism and RAM/NVMe receipts, explicitly pinned to model source 8da263a474, plus matched four-slot per-rank process high-water. Neither those older binaries nor /proc high-water are presented as exact-current-head CUDA/full-device-peak qualification. The strong-vector sampled-drafting slowdown remains an open performance cell.

The foundation selection remains a landing prerequisite: this branch ports #1835's foundation in 89b8928e25; it is not an independently composable duplicate, and the original #1835 head has not been rewritten or marked qualified by these results. The draft retains that coordination gate.

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

The completed 4fcd457af5 CI run exposed two issues, now corrected in 5aa777641d:

  • The DeepSeek-only image test pinned a count of 32 after the GLP image was added. That redundant cardinality test is removed; the existing test resolving every registered CUDA launch/control to its matching image bytes remains and passes.
  • Windows snapshot paths were treated as unnamed local conversions, skipping repository/revision comparison. Native Windows, mixed and UNC separators now identify the snapshot; POSIX backslashes remain ordinary filename characters. New lexical regressions pass, and the existing Windows startup mismatch test is unchanged.

Targeted checks pass 108/108 tests and 26/26 steps, plus formatting/preflight. Main advanced during CI; normal merge d028dda224 incorporates 37fa51d239 and moves the GLP changelog notes away from the prepend collision. Reconciliation passes 44/44 steps, 51 fresh tests (other executions cached), and Linux server compilation. Selected overlap checks remain clean with #3093/#3827; #1835 still requires foundation coordination.

Current-head hosted CI, including native Windows execution, is still a gate. GPU receipts remain pinned to 8da263a474, not relabelled as new measurements.

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

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.

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

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.

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

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 test-dsv41-glp-host test-glp test-glp-steer test-glp-serve test-steer -Dcpu=apple_m1 -Doptimize=ReleaseSafe -j4 passes 37/37 steps and 66/66 tests; pr_check against f0b9cb8 is 0 errors / 0 warnings and lean 168 vs 168. Hosted CI is re-running on this head. Foundation stacking (#1835) and the exact-head CUDA/peak-memory receipts remain open and are not claimed.

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Foundation reconciliation and stack check: #1835 is now merged to current main and pushed as 32affbfd5f (host: 37/37 steps, 89 tests). Stacking this PR (e2377ab20f) on that refreshed foundation trial-merges with 12 conflict files, all mechanically resolvable because this extension carries a strict superset of the GLP core (glp.zig 594 vs 419 lines, paired-vector support, safer container bounds check, persistence_policy.extend state identity); ten files take the extension side, forward.zig differs only in inlining, and cli.zig keeps the cli_flag import. In that resolved tree the five host targets pass: 37/37 steps (test-dsv41-glp-host test-glp test-glp-steer test-glp-serve test-steer -Dcpu=apple_m1 -Doptimize=ReleaseSafe -j4). This is host evidence only; the exact-head CUDA and peak-memory receipts you flagged remain open.

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Additional exact-head evidence: Linux aarch64 CUDA/server cross-compilation passes on e2377ab20f (zig build compile-dsv41-cuda compile-dsv41-server -Dtarget=aarch64-linux-gnu -Dcpu=baseline -Doptimize=ReleaseSafe -j4 --summary all → 14/14 steps, exit 0). This covers compilation only; the device run and peak-memory receipt you asked for remain open.

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

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 .github/workflows/zig-fmt.yml ended up with two concurrency: keys. Fixed in head 624e358 (that file only; no code change). Local zig fmt --check build.zig zig passes on the tree, and the matrix is re-running on 624e358.

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Refreshed onto main d3d9a66117 in c22d1a6a2a (still draft). The single conflict was zig/tests/cuda/contract_family_sets.zig, resolved by keeping both main's idol_decoder set and this branch's glp set; zig/src/server/cli.zig auto-merged with both main's parsing and the --glp plumbing, and .github/workflows/zig-fmt.yml keeps exactly one concurrency: key.

Verification on the new head: reviewer's five host targets → 37/37 steps, 151/151 tests (fresh local cache); zig build compile-dsv41-cuda compile-dsv41-server -Dtarget=aarch64-linux-gnu -Dcpu=baseline -Doptimize=ReleaseSafe -j4 --summary all → 14/14 steps; zig fmt --check clean on every changed .zig; tools/pr_check.py --base d3d9a66117 --pr 4273 → 0 errors, 0 warnings across 99 changed files (lean 167 vs 167, zero new).

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.

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Refreshed onto current main (2ce240c), head 39b1eb5e7c. Resolutions: the target vtable keeps both first_mask (main) and resumed (this branch); the last-block norm takes main's per-session norm in both the steering and plain calls; metal.open keeps main's MTP fields beside .glp; qwen27_served.open applies steering and then runs main's MTP refusal/load; cli.zig takes main's cli_args.zig split with glp carried there plus this branch's --glp/--glp-alpha parsing.

Two lean-ceiling extractions, behaviour unchanged: the seven metal_qwen4_* contract suites moved to metal_qwen4_main.zig, and the TF_DSV41_ASSETS file list moved to asset_names.zig (re-exported as asset_names). pr_check now reports 0 errors, lean 165 vs 165, 0 new; compile-dsv41-server (the Linux CUDA build) and test-glp/test-glp-serve pass.

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Refreshed onto current main 9fa8863bcf; head is 6647e9495a and GitHub reports it mergeable (the CHANGELOG, qwen27_served.zig and engines.zig conflicts are resolved by keeping main's drafter startup field, main's released() request builder and main's changelog layout, plus this branch's GLP plumbing).

Your asks on #1835 are carried here, since this branch holds the ported foundation:

  • The MTP head no longer re-applies the target's last-layer direction: Stages.steer defaults on, mtp.headStages turns it off for the head alone, and a 63-of-64 regression proves the target reads the direction and the head does not.
  • Metadata arrays are bounded at four levels and a non-text glp.content_sha256 is refused rather than read as no claim; tensor offsets were already checked with std.math.mul/add.
  • --glp/--glp-alpha stay accepted and nameable by a config file but are listed by capabilities --json only on a build that can steer (macOS Metal, or a Linux CUDA server for the DeepSeek paired site).
  • A config file's relative --glp resolves from the file's folder, with a regression.
  • One changelog line for the feature, as you asked.

Checks on this head: lean 165 vs 165 (0 new), pr_check --base 9fa8863bcf --pr 4273 0 errors / 0 warnings over 107 files, zig fmt --check and git diff --check clean. Host: the five targets you asked for pass 37/37 steps and 154/154 tests; test-qwen27-startup-host, test-contract-images-host and check-qwen27-speed-host are included in a 54/54-step, 183-test run; test-server-cpu is 7/7 steps, 1913/1928 with 15 skips. Hosted CI is queued on this head; the previous head was green.

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 8da263a474, not to this head; the off-arm cold TTFT and the active sampled drafting cell are failed/unmeasured cells, not dismissed. Landing order with #1835 is still the coordinator's call.

@BlivionIaG
BlivionIaG marked this pull request as ready for review November 24, 2026 11:10
@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

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.

  • Synthena

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Fixed on 28a61d757e. metal_main.zig now holds the steer Suite in a defer that runs after the gate pass, instead of the run() helper whose own defer freed the probes and released their pipelines before runAll read them; the helper is gone.

Running the check on an M4 Pro also showed it compiling both kernels by hand without production's Q27_XS, so the plain-norm comparison failed (FusedNormDiffersFromPlainNorm) while the padded launch ran past the rows. Both kernels now come from quant_gpu.specializedSource, as production builds them. That is the same fix already on #1835 (a3d2877632), so the two files are now identical.

Evidence (tf-kernel-contract --only "qwen27 steer"): with the lifetime change reverted, exit 139 (SIGSEGV) after PASS normalised; on 28a61d757e, exit 0 with PASS nonfinite/repeat/shapes qwen27 steer, the nan control red as planted, and SUMMARY 1 kernels: 1 pass gates 1-4, 0 fail, 0 known findings; 1 controls: 1 red as planted, 0 missed; 0 limit problems. Lean is 165 vs 165 (0 new); pr_check --base 68ff0ad8e6 --pr 4273 reports 0 errors and 0 warnings. The unfiltered Metal suite needs a rotary accuracy receipt on this host (UnrecordedRotaryCompiler), so this is the filtered steer line. The device receipts and the open qualification cells are unchanged.

@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

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.

  • Synthena

1 similar comment
@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

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.

  • Synthena

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Thanks, fixed in 137631bc40. The resource checker no longer builds the steering source by hand. metal_limits.zig resolves the qwen27 norm steer entry through the production quant_gpu.specializedSource with serving's key: .kind = .norm_steer and K = 5120 in both cases, plus .xs = device.tensorUnits() for the pipeline on this GPU and .xs = false for the pre-M5 (offline M1/M2) source. On an M5 it compiles the Q27_XS 1 variant that serving runs. The branch's hand specialize/qwen27Source helpers are removed, and the generic qwen27 line is back to main's.

To prove the sources are equal, the limits pass compares the launch's sources byte for byte with the serving specialization (this GPU's Q27_XS here, Q27_XS 0 before the M5) and counts any mismatch as a limit problem.

Filter: tf-kernel-contract --only steer. It selects the qwen27 steer gates, the nan control and the qwen27 norm steer limits entry (1 selected registered Metal launches).

  • Red, M5 Ultra (tensor units true), 28a61d7's hand specialization with the check added: FAIL limits qwen27 norm steer …: the serving source here (Q27_XS 1) and before the M5 (Q27_XS 0), then SUMMARY 1 kernels: 1 pass gates 1-4, 0 fail, 0 known findings; 1 controls: 1 red as planted, 0 missed; 1 limit problems; gates 8 ms, limits 388 ms (exit 1).
  • Green, M5 Ultra, 137631bc40: PASS limits qwen27 norm steer …: the serving source here (Q27_XS 1) and before the M5 (Q27_XS 0). PASS limits here …: 320 threads launched, the pipeline takes 1024; 48 threadgroup bytes and 0 set (declared at most 48, the GPU's most 32768). Then SUMMARY 1 kernels: 1 pass gates 1-4, 0 fail, 0 known findings; 1 controls: 1 red as planted, 0 missed; 0 limit problems; gates 6 ms, limits 28 ms (exit 0).
  • Green, M4 Pro (tensor units false), 137631bc40: PASS limits qwen27 norm steer …: the serving source here (Q27_XS 0) and before the M5 (Q27_XS 0), the same 320/1024 threads and 48/48 bytes, then SUMMARY 1 kernels: 1 pass gates 1-4, 0 fail, 0 known findings; 1 controls: 1 red as planted, 0 missed; 0 limit problems; gates 7 ms, limits 556 ms (exit 0).

test-metal-launch-map-host: 5/5 steps, 8/8 tests. pr_check.py --base 9fa8863bcf --pr 4273 reports 0 errors and 0 warnings; lean is 165 vs 165, 0 new. Current-head model, cold-latency, drafting and peak-memory qualification are still open, as documented.

@ashhart

ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

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.

  • Synthena

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Merged main 4c79cfe346; it conflicted after main's SenseNova norm and Qwen host refactors. Unsteered norms call main's normShift; this PR's own normSteer stays, and the shared fitsWords moved to norm_fits_gpu.zig to keep quant_gpu.zig at 600 lines. The old servedContext is dropped because main's qwen27_engine now does the same job. SenseNova checkpoints refuse --glp. Head 93507082cd: the six GLP steps 47/47 steps, 187/187 tests; tf-kernel-contract --only steer exit 0 (M4 Pro); pr_check 0/0 over 107 files. The comparisons you listed (full-model serial equality, cold latency, sampled drafting, peak memory) are still to come.

@AIFlowML

Copy link
Copy Markdown
Contributor

I tested d56b4a622e on M5 Max after trial-merging into 47a605aa12. The two conflicts are the changelog and the qwen27_served.zig test import block. Keeping both the startup-line and MTP imports gives a clean test build.

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 steer

All 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

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

The same contraction was in this PR's copy of norm_steer.metal; the CUDA kernels already round separately (__fmul_rn/__fadd_rn). Two commits are pushed to this branch:

On an M4 Pro, tf-kernel-contract --only steer fails against the old kernel (error: SteeredAddNotSeparatelyRounded) and passes against the fix: "PASS ordered: 1495040 elements at alpha 0.1 and 0.3 are the separately rounded add, bit for bit; the contracted add differs in every one", with the planted NaN control still red. The summary is 1 pass, 1 control red as planted, 0 missed. test-steer and test-glp-steer pass, and zig fmt is clean. pr_check reports lean 165 vs 165 (0 new), 0 errors and 0 warnings.

- 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.
BlivionIaG and others added 17 commits November 25, 2026 12:15
- 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.
@ashhart
ashhart force-pushed the work/dsv41-glp-add-upstream branch from d56b4a6 to 9fafdda Compare November 25, 2026 12:17
@ashhart

ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

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:

  • Your CHANGELOG hunks were dropped, since we place the line at landing.
  • One added commit moves main's TF_DSV41_CONTEXT and TF_DSV41_OWN_PREFILL readers to deepseek_v41/model_env.zig, and quant_gpu.zig's helper tests to qwen27/quant_gpu_test.zig. That keeps both files under 600 lines with your GLP code in them.
  • Without --glp, nothing new runs: glpRefusal returns at once, Qwen27 takes main's normShift, and DeepSeek-V4.1's GLP plan is null.

Three things to fix on your side, all reached only with steering on or left unused:

  1. SenseNova checkpoints (shift_norms) now use main's shifted norms, and normSteer has no shift. A steered SenseNova norm would drop it. Please either refuse --glp by name on a shift-norm checkpoint, or give normSteer the same shift.
  2. normSteer's quant key still sets .xs = tensorUnits(), while main's norm now keys on xsGroup. Please follow main's key.
  3. qwen27_reserve.servedContext is now unused: main moved that code elsewhere. Please remove it.

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).

  • Synthena

This branch has not been deployed

No deployments
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.

3 participants