Skip to content

Upstream PR: Drama 3 semantic guidance (CFG) on CUDA - #4153

Merged
ashhart merged 18 commits into
ashhart:mainfrom
plotarmordev:feat/105-upstream-pr-drama-3-semantic-guidance-cf
Nov 24, 2026
Merged

ashhart merged 18 commits into
ashhart:mainfrom
plotarmordev:feat/105-upstream-pr-drama-3-semantic-guidance-cf

Conversation

@plotarmordev

@plotarmordev plotarmordev commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

On main, --cfg-gamma and the other guidance flags work only on Metal: the CUDA Drama 3 backend has no guide, so guided serving can't run on a Spark. This adds the semantic CFG guide on CUDA over the shared weights (d3_cfg_mix, a fork of the backbone only), with the same guide lifecycle as Metal, and admission counts the guide's state.

  • Issue: n/a. It brings an existing Metal flag to CUDA; no new arithmetic or family.
  • Stacked on: main (1587c8caee631dcc97c8fbb68f4bba353353c4c5, this head's merge-base).
  • atc overlap --json: incomplete. Against ashhart/TensorFold it hit the open-PR and time limits (complete: false, no PR overlaps reported); the only conflicts it found were with my own local worktrees.

Checks on this head

  • Head commit: f9cc095d5cefa32f21820e98885de8690188370e, your rebase 2578cd905 plus one commit that makes tools/zig/drama_guidance_check.py take and record the checkpoint's pinned Hugging Face commit (--revision REPO@COMMIT, a full 40-hex sha, never a branch such as main).
  • Lean checker, python3 tools/zig/lean_check.py: 167 problems on this head, the same as main.
  • python3 tools/zig/test_drama_guidance_check.py: 9 passed, 0 failed.
  • zig build test test-golden on the Mac (macOS 27 arm64, Zig 0.17.0): at this head 933/940 steps, 1853/1884 tests passed, 27 skipped, 4 failed, plus the memcpy link guard; at main 1587c8cae 932/938 steps, 16525/16669 tests passed, 141 skipped, 3 failed, plus the same guard. Three failures are main's own on this Mac: stage net and both DeepSeek vision_config tests. The fourth, DeepSeek's serve_steps, depends on timing: zig build test-dsv41-metal, which runs it, passed three reruns in a row at this head.
  • GB10: job top-fbe539d4a46b on TOP's Spark at 42d72aac3b249cdeb2ed0c34a9b1844fa4713495, which is 2578cd905 plus the job's own wrapper and nothing else. The guidance check and the CFG-off comparison below come from its log. The job exits 2 on the wrapper's own last line (it reads $contract, which the wrapper no longer sets because the contract ran in an earlier job), after every check had finished and passed.
  • CI: not run yet. Both workflows for this head (No GPU and Zig format, runs 44948680877 and 44948681035) were queued at 20:53 UTC on 21 Nov and no job has started, so there is no failure to report.
  • Not run, and why: no GB10 job at f9cc095d5 itself, because its one commit over 2578cd905 changes only tools/zig/drama_guidance_check.py and its test, which never reach the binary; Linux and Windows builds, which only CI runs; tools/bench_openai.py and tools/bench_cache.py, because Drama 3 speech is measured as RTF (below), not tokens.

Receipt

  • Main against branch: main has no guide on CUDA, so guided RTF on main is n/a. Unguided, the FP8 voice generation in the same job ran at RTF 1.43.
  • Boxes it reaches: CUDA (Spark GB10); Metal shares the guide lifecycle.
  • New switch? No. --cfg-gamma and --cfg-batched already exist on Metal; their defaults are unchanged.
  • Environment: DGX Spark (GB10, sm_121, 128 GB unified memory), driver 580.173.02, CUDA 13.0; GPU job bottom-49eafd253777, 12 Nov 2026, my fork's main at 132bd1238. tensorfold-native built with -Dgpu=spark -Dfatbins. Each checkpoint is served with serve CKPT --parallel 2 --voices DIR --default-voice VOICE --cfg-gamma 1.5 --cfg-batched; every request carries "seed": 7 and "response_format": "pcm".
  • Paths and platforms the change reaches, which I ran and which I could not: CUDA on the Spark (fork's main, guided, three checkpoints, in the table; this PR's guidance check on the FP8 and compact NVFP4 checkpoints in job top-fbe539d4a46b); Metal on the Mac at this head (gamma 1 against plain, and main against head with CFG off, below); Mac host tests at this head.
Checkpoint Experts held Peak device (GiB) RTF (guided)
fp8 10240 39.57 2.359
pruned 7369 21.71 2.157
pruned-5900 5900 19.29 2.233

Source: docs/receipts/drama3-pruned-main/README.md on my fork's main, with spark/results.json and the three spark/server-*.log beside it.

  • Exactness: on the Spark (spark/results.json: "pass": true, no problems), whole and streamed replies equalled their repeats and their concurrent lanes, by PCM sha256, for all three checkpoints.
  • Checkpoints, pinned to the Hugging Face commits the hub API reports (/api/models/REPO/commits/main and /tree/COMMIT), never main:
    • FP8: fishaudio/drama-3@e0a9218aa48888270f06ef1ed9ea67622c0e17d2. TOP's /assets/drama3-pilot/checkpoint is that 8-shard release: its config.json sha256 4b13a31b…0b693 and its codec.pth sha256 74fc41c5…052bb2f (job top-41f63db6cf5a) match the files at this commit. The weights' LFS sha256s are unchanged through b2b5ee998034b2975720906c815e7fb0e9f007bd; the 15-shard re-upload of 29 Oct (256faf59…) is a different checkpoint.
    • Compact NVFP4 (7,369 experts): plotarmordev/drama-3-NVFP4-Pruned@f3de225065142d287ccb5be85f5fe7d4ddb9f6d0. TOP's /assets/drama3-pilot/drama-3-NVFP4-Pruned passes sha256sum -c against that commit's MANIFEST.sha256 (jobs top-127ed43127ff, top-41f63db6cf5a).
    • tools/zig/drama_guidance_check.py now takes this as --revision REPO@COMMIT and writes it into results.json; job top-fbe539d4a46b ran before that flag, so its results.json does not carry it.
  • CUDA guidance check this PR adds (tools/zig/drama_guidance_check.py: paired equals separate guides, gamma 1 equals plain, gamma above 1 differs, concurrent lanes equal their solo runs), GB10 job top-fbe539d4a46b: FP8 "pass": true, "problems": [] and compact NVFP4 "pass": true, "problems": [], at 1 and 64 prefill rows; per prefill size and checkpoint, each guided server resumed its cached reference 12 times and each plain one twice.
Compact NVFP4 PCM sha256s from job top-fbe539d4a46b (separate and paired guides gave the same bytes for every reply)
Prefill rows Reply PCM sha256
1 t0-g1 682dfd5069a29853bd98c9a680eb2780fe87b790f6d53e655844cfa7ca745b12 = plain
1 t0-g1.5 6aca9311a3e631e3a7af0e64078403eacaa0e83b4e1dc594c11be9a088079dbe
1 t0-g3 1834678634cf4a2eb7a19a0d1ae6fa89b9c824eb9f9736f148126b46c9bbacdb
1 t1-g1 9686275299c289f9063230cc30cd3698b481e9fc5daded75d9bcc940c81c2fca = plain
1 t1-g1.5 6204fb1a7774c0c67fb73dd671b52bca8d3e65d96298adcbab94c7244d59232f
1 t1-g3 a31790e4e838778b2aad75db47e155a5217ea871ce86d1c03759449c5fd33c36
1 t2-g1 5f37fff24534feb54ae369ab0a8b28f5374fe06db7a26b2f8e6d7a79fea7244b = plain
1 t2-g1.5 0a71244ac8cf6cef126e061f4da85ee686e4b469e9530efae3506ec37709f8d4
1 t2-g3 5c8a683d9f7484eb4cbbb10af00a34b5f2f7891389671296874eb638e36d0ec3
1 solo-lane-a f2f18b6bd3b5ebc92b41cf00c84e106387520e4920f2af1531053f92f3515879
1 solo-lane-b fe6b11f7b820f7fa198418415481696df48cef2ad4c0adae61dea1aea6409a37
1 lane-a f2f18b6bd3b5ebc92b41cf00c84e106387520e4920f2af1531053f92f3515879
1 lane-b fe6b11f7b820f7fa198418415481696df48cef2ad4c0adae61dea1aea6409a37
64 t0-g1 d83b249fd534dcd30e8f327400bb4be6e51165414a9508d317ae89e9ebf92784 = plain
64 t0-g1.5 819e402ded8319010cecf1698675c20bda043fbc3d35ff1f6c3717dc885285cb
64 t0-g3 22ac6744c59dd7ed2daf953eda141e874304bf48045c229e026054f08e806853
64 t1-g1 faf8220ba693f76ba47b930f54fa28568abe0cd92ae21800fc5f4b1badda2f42 = plain
64 t1-g1.5 f1a07b0f33f7cf17dd56fe925b8296adb9d62b2b061f27da6203596eac9d3309
64 t1-g3 fd70e071b76597a17dd8a84305dcce8c2c8f58b84bf7057fe0771457b343be2f
64 t2-g1 b057aced7e689d7e1635bad91ec0083c60b8b401bb85ce63b7733d13797e51cb = plain
64 t2-g1.5 0fbbe5b9a0cfb7bfd91313952d041ddfeadbc865dc48ab3ac707c3b8f9ea5a5e
64 t2-g3 b667c3d1f9c5ab8e0accae8e605f23943f48abed12a364c8029b210d9a59077d
64 solo-lane-a 1ddfef4459ea8bc36b0548531fb71a5960c4a4dee13e77c276f2e7a9d5ecbbc3
64 solo-lane-b f90b6011d26017ecc20f38db72c45f1eecb1d91daed8c3bde43c8e287f3502d9
64 lane-a 1ddfef4459ea8bc36b0548531fb71a5960c4a4dee13e77c276f2e7a9d5ecbbc3
64 lane-b f90b6011d26017ecc20f38db72c45f1eecb1d91daed8c3bde43c8e287f3502d9
  • CFG off, main 1587c8caee631dcc97c8fbb68f4bba353353c4c5 against head on the GB10 (same job, FP8): drama3-generate --seed 7 frames are byte-identical (sha256 a8177713a8d4e8affdea82824d7dfe6653a8a7a974e3e5b5333c3345736848a5, 102 frames, RTF 1.60 against 1.61), and the served PCM is equal for every reply:
    • t0: ef86f3bc0c71dcf8d7d13e3753e3f3b47b41a2bec7d79f0897f4ca879f6a414f on both
    • t1: 1d27394b79b580c7b93ce531174c6bb33547b2d6aa55ad3b61cee8e4a83e893d on both
    • t2: cff4742d5d92cea4d8b8b7aab5595cf7a6491ae539d6e9033d13418a0711d737 on both
    • lane-a: 05b41e70f22042a5373ae09d944163fd902c4576fa29c3260c2d14e886c4dcc8 on both
    • lane-b: 67cab08faa48461a09bcc3348fc8871f1f0b6189985a29426ea2f6781641920e on both
  • Metal on the Mac (Apple Silicon, macOS 27, Zig 0.17.0), zig build native -Dcpu=apple_m1 -Doptimize=ReleaseFast at main 1587c8cae and at this head, compact NVFP4 checkpoint (plotarmordev/drama-3-NVFP4-Pruned@f3de225065142d287ccb5be85f5fe7d4ddb9f6d0: the Mac's copy passes shasum -a 256 -c against that commit's MANIFEST.sha256 for all 8 shards, the index, config.json, codec.pth and the tokenizer files), a synthetic reference voice of 119 code rows, two texts, under the Mac's model lock:
    • Servers: the head's plain server; the head's guided server (--cfg-gamma 1.5 --cfg-allow-request-gamma --cfg-force-guided, every request X-Cfg-Gamma: 1; its log reads semantic CFG enabled and it resumed the cached reference); main's plain server.
    • t0: 0aff27edc911ffcef7602f4bc90cb476d20f7b2c96af22cb70d0f6da0a281951 (389120 bytes) from all three, byte-equal.
    • t1: 5e8a906ab0677481db0b6c02a4d72b1efae66b4568f21fc403cb1bc014debdad (389120 bytes) from all three, byte-equal.
  • Main against this branch, same machine and checkpoint: n/a, main can't run guided on CUDA.
  • Decode speed before and after: n/a, measured as RTF only.
  • Prompt speed before and after: n/a, measured as RTF only.
  • Licence of any new weights or drafter: n/a.
Kernel contract
  • Kernels registered with the contract: d3_cfg_mix (new; it replaces no kernel), registered from contract_drama3's set.
  • A planted control for each new kernel: a second d3_cfg_mix launched with gamma - 1 (the other CFG convention, cond + gamma(cond - uncond)), which must go red at gate 3 (zig/tests/cuda/contract_drama3.zig). The non-finite inputs are a gate, not the control.
  • Each backend's SUMMARY line and exit status: GB10 at 821d2ad62, sh docs/recipes/drama3-cuda/cfg-mix-gb10.sh, exit 0: CONTROL cuda drama3 d3_cfg_mix control: launched with gamma - 1: red at shapes, as planted, (filtered) 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 41 ms, limits 0 ms.
  • Contract at this kernel: job top-fbe539d4a46b skipped the contract, its wrapper noting it ran in job top-ba4d66a0b414 at e5749c944 (2578cd905 plus a job wrapper and nothing else). That job's log is no longer kept, so I can't quote its summary; the one above is from 821d2ad62, which has the same kernel.

Checklist

  • The title and description match the head commit, including the receipt and the stack.

  • New tests fail before the change, pass after it, and skip cleanly without their dependency. (d3_cfg_mix's planted gamma - 1 control goes red on the GB10; the host CFG-mix test runs the kernel body through a C shim, so it needs no GPU and has nothing to skip.)

  • Comments and docstrings are one line. No measurements or history in the source.

  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off. (The guide advances inside its lane's round; Drama 3 has no drafter.)

  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (No drafter; cached-reference replies and concurrent lanes equal their solo runs, PCM sha256 above.)

  • No precision traded for speed. If the bits change, the description says which sums change and why. (CFG off and gamma 1 are byte-identical to main and to plain; only gamma above 1 changes the logits, by the CFG mix.)

  • Decode and prompt processing are no slower than main at one stream and the widest admitted; with --drafter, no slower than without it, greedy and sampled. (CFG off: RTF 1.60 on main against 1.61 here, served wall times within 1% serial and on both concurrent lanes; guided has no main on CUDA to compare with.)

Before (spark-cfg-rtf) After (spark-cfg-rtf)
Before After

How to check

  • Base commit (main): 98325615718e9bb45f862a05e0740c182fa0cb13
  • Head commit: ef5dc0e08a2c0e370c1387070480fab3c6b90dd7
  • Machine: an Apple Silicon Mac · macOS 27 · Zig 0.17.0

Test results:

  • zig build test test-golden at 2578cd905e45 (older head): 1853 passed, 4 failed, 27 skipped
  • zig build test-drama-cfg-mix-host test-drama-cfg-host test-drama-host test-drama-owner test-drama-prefill-host at ab109901f8c9 (older head): 0 passed, 0 failed, 0 skipped
  • zig build test-flashnext-scheduling-host at ab109901f8c9 (older head): 59 passed, 0 failed, 0 skipped
  • zig build compile-cuda-tests -Dtarget=x86_64-linux at a4f00a4d7256 (older head): 1 passed, 0 failed, 0 skipped
  • zig build test-golden at b60aef3e03f4 (older head): 391 passed, 0 failed, 0 skipped
  • zig build test-drama-cfg-mix-host test-drama-cfg-host test-drama-host test-drama-owner test-drama-prefill-host --summary all at f9cc095d5cef (older head): 92 passed, 0 failed, 0 skipped
  • cd tools/zig && python3 test_drama_guidance_check.py at f2c1c032fd9f (older head): 7 passed, 0 failed, 0 skipped
  • zig build test-drama-host check-drama-cuda-host test-drama-metal-quant-host test-drama-nvfp4-reference-host test-drama-prefill-host --summary all at f44964aa01d7 (older head): 63 passed, 0 failed, 0 skipped
  • zig build test-cuda-host --summary all at ef5dc0e08a2c: 8830 passed, 0 failed, 50 skipped
  • python3 -m unittest tools/zig/drama3_limits_gate_test.py at c67d82bb4508 (older head): 8 passed, 0 failed, 0 skipped
  • python3 tools/zig/test_drama_guidance_check.py at f9cc095d5cef (older head): 9 passed, 0 failed, 0 skipped
  • zig build compile-cuda-tests -Dtarget=x86_64-linux --summary all at 821d2ad62fb9 (older head): 1 passed, 0 failed, 0 skipped
  • zig build -Dfixed-cpu test-kernel-contract --summary all at f44964aa01d7 (older head): 268 passed, 0 failed, 0 skipped
  • python3 -m unittest test_drama_guidance_check test_drama_reference_cache_check at 821d2ad62fb9 (older head): 13 passed, 0 failed, 0 skipped
  • zig build test at 2578cd905e45 (older head): 1854 passed, 3 failed, 27 skipped
  • zig build test-drama-cfg-mix-host at 2578cd905e45 (older head): 3 passed, 0 failed, 0 skipped
  • python3 -m unittest discover -s tools/zig -p 'test*guidance*.py' at 2578cd905e45 (older head): 8 passed, 0 failed, 0 skipped
  • zig build test test-golden --summary all at f9cc095d5cef (older head): 1831 passed, 3 failed, 27 skipped
  • python -m pytest -q -p no:cacheprovider at f9cc095d5cef (older head): 703 passed, 17 failed, 110 skipped
  • python -m pytest -q -p no:cacheprovider tools/zig/test_drama_guidance_check.py tools/zig/ -k drama at f9cc095d5cef (older head): 27 passed, 0 failed, 1 skipped
  • zig build test-lane-explore-host -Dexplore-seed=1592590343 --summary all at ef5dc0e08a2c: 36 passed, 0 failed, 0 skipped

#4144 and #4153 together: the combined tree, checked on a GB10

I merged both branches over current main, resolving them the way @AIFlowML described in #4144 (comment). I then ran the host tests and one GB10 job on the result.

  • Base (ashhart main): 210e3b0c59e1d2910492fc6e0277a0f887f0591e
  • Upstream PR: Drama 3 on CUDA loads a compact NVFP4 checkpoint as stored #4144 head: a57d9c23d40693cd5f10a1fabb1b2d27e52d7661, merged first: 62273c2ed28606689b4323f585e08a71e380391b
  • Upstream PR: Drama 3 semantic guidance (CFG) on CUDA #4153 head: b60aef3e03f466b62d93576f9632016e8ba8d35d, merged over it, giving the combined tree: 972dbd4f310c60883bc9f6628125a0809c912cda
  • GPU job commit: c4ac3fe4f85cf234486cc78bbae88ec6c7fa2a64, which is the combined tree plus the job script docs/recipes/drama3-cuda/combined-gb10.sh and nothing else. It is on plotarmordev/TensorFold branch trial/4144-4153-combined and is not for merge.

The resolution

Four files conflict, as Igor found: registry_media.zig, drama3/cuda/kernels.zig, tests/cuda/contract_drama3.zig and tests/cuda/contract_tests.zig.

The resolution on its own is resolution.patch. I checked it on #4153's branch, both with #4144's merge and with #4144 squashed onto main. In each case I ran git merge main (four conflicts), applied it with git apply resolution.patch, and got a tree identical to 972dbd4f.

Host tests on the combined tree (macOS arm64, Zig 0.17.0)

  • zig build test-drama-host check-drama-cuda-host test-drama-metal-quant-host test-drama-nvfp4-reference-host test-drama-prefill-host --summary all: 19/19 steps, 63/63 tests passed.
  • python3 -m unittest -v tools/zig/drama3_limits_gate_test.py: 8 passed.
  • python3 tools/zig/test_drama_guidance_check.py: 7 passed.
  • zig build compile-cuda-tests -Dtarget=x86_64-linux --summary all: 10/10 steps succeeded.

GB10 (TOP's Spark, sm_121, nvcc 13.0): job top-aaf334ae7ce0, exit 1

  • Kernel contract, tf-cuda-test kernel-contract 'compact router' 'd3_cfg_mix':
    • Gates pass:
      • d3_router_compact passes nonfinite, repeat and shapes (6 shapes exact).
      • d3_cfg_mix passes nonfinite (3 non-finite and 4094 finite outputs match the float64 classes), repeat and shapes (5 shapes, worst 0.433 of the bound).
    • The planted controls are red as planted:
      • Router: CONTROL cuda drama3 compact router control: d3_router, unmasked: red at shapes, as planted.
      • CFG mix: its non-finite fill (NaN, +Inf, -Inf) is classified correctly.
    • It still exits 1, on the limits check for d3_cfg_mix's pending record: FAIL limits live drama3 d3_cfg_mix: 256 threads launched, the driver allows 1024; 12 registers, 0 + 0 shared bytes (recorded 0, 0). The summary reads (filtered) SUMMARY 2 kernels: 2 pass gates 1-4, 0 fail, 0 known findings; 1 controls: 1 red as planted, 0 missed; 1 limit problems. This is the pending record waiting for its first nvcc receipt. The record to add is 12 registers, 0 static shared bytes, 256 threads.
  • Compact NVFP4 load (Upstream PR: Drama 3 on CUDA loads a compact NVFP4 checkpoint as stored #4144's check): failed before any weight was mapped, with error: FileNotFound from drama3-generate --model /assets/drama3-pilot/models/drama-3-NVFP4-Pruned. It never reached the routed experts held line. The published checkpoint ships tokenizer.json, so the copy in the pilot folder is missing or incomplete. This is not the merge. The FP8 checkpoint loaded on the same tree: routed experts held 10240 of 10240; routed experts NVFP4 in 0 of 40 layers; compact routers in 0 of 40 layers, RESULT drama3 OK frames=116 … rtf=1.42.
  • CFG guidance (Upstream PR: Drama 3 semantic guidance (CFG) on CUDA #4153's check), tools/zig/drama_guidance_check.py on the FP8 checkpoint with a synthetic reference voice: "pass": true, "problems": [].
    • It ran at 1 and 64 prefill rows. At each, the plain run gave 3 replies and the separate and paired runs gave 11 each. That held for gamma 1 against plain, gamma above 1 against gamma 1, and paired against separate.
    • Each guided run resumed its cached reference 10 times.

d3_cfg_mix's limits record, rerun on the GB10

#4153 now records what that job measured for d3_cfg_mix in cuda_pending: 12 registers, 0 static shared bytes, 256 threads (sm_121, nvcc 13.0). That is commit f2c1c032fd9fb810d7ae4a782059276228789bd9, and nothing else in the kernel or its gates changed.

  • Upstream PR: Drama 3 semantic guidance (CFG) on CUDA #4153 alone, job top-6e269b37764c at f2c1c032, exit 0: tf-cuda-test kernel-contract 'd3_cfg_mix' passes nonfinite, repeat and shapes as before, and the limits check now reads PASS limits live drama3 d3_cfg_mix: 256 threads launched, the driver allows 1024; 12 registers, 0 + 0 shared bytes (recorded 12, 0). Summary: (filtered) SUMMARY 1 kernels: 1 pass gates 1-4, 0 fail, 0 known findings; 0 controls: 0 red as planted, 0 missed; 0 limit problems; gates 39 ms, limits 0 ms.
  • Combined tree, job top-7e8a48a1639d at 16272c0d5e8f05138de450db3f239d00ad662a39, exit 0. This is f2c1c032 merged over Upstream PR: Drama 3 on CUDA loads a compact NVFP4 checkpoint as stored #4144 (62273c2e, from a57d9c23) with resolution.patch, as c578e8e8, plus the job script. It is on trial/4144-4153-combined and is not for merge. kernel-contract 'compact router' 'd3_cfg_mix' passes both kernels' gates, and the unmasked d3_router control is red at shapes, as planted. Summary: (filtered) SUMMARY 2 kernels: 2 pass gates 1-4, 0 fail, 0 known findings; 1 controls: 1 red as planted, 0 missed; 0 limit problems; gates 43 ms, limits 0 ms.

The compact checkpoint, restaged on TOP

plotarmordev/drama-3-NVFP4-Pruned is in TOP's pilot folder at /assets/drama3-pilot/drama-3-NVFP4-Pruned. fetch hf top refuses it: that command copies a Spark's Hugging Face cache to the Mac. So the job checks the Desk's put itself, with sha256sum -c against the published MANIFEST.sha256 (revision f3de2250). All 8 shards, model.safetensors.index.json and tokenizer.json read OK.

  • Combined tree, job top-69fda464a7b5 at 1acbb3b5d1e89ed284232119104826fbd8110256, exit 1. This is 16272c0d plus docs/recipes/drama3-cuda/combined-gb10.sh and nothing else. The 16272c0d merge had kept 87ca3a66's tree, which dropped that script. The script now points --model at the restaged folder, checks the sha256s and requires routed experts held 7369 of 10240. It is on trial/4144-4153-combined and is not for merge.
    • Kernel contract: (filtered) SUMMARY 2 kernels: 2 pass gates 1-4, 0 fail, 0 known findings; 1 controls: 1 red as planted, 0 missed; 0 limit problems; gates 45 ms, limits 0 ms.
    • Compact NVFP4 load (Upstream PR: Drama 3 on CUDA loads a compact NVFP4 checkpoint as stored #4144's check): the checkpoint loads as stored, with routed experts held 7369 of 10240; routed experts NVFP4 in 40 of 40 layers; compact routers in 36 of 40 layers. Generation then fails with error: ReplayMismatch, so there is no RESULT line. --replay 1 resets and regenerates greedily, and families/drama3/replay.zig requires byte-identical output. On the GB10 the compact path gave different bytes on the second pass.
    • CFG guidance (Upstream PR: Drama 3 semantic guidance (CFG) on CUDA #4153's check): "pass": true, "problems": [].
  • Combined tree, job top-127ed43127ff at 922d9020df54307eef3606952eb8e33d0a9af770, exit 1. This is 1acbb3b5 with the job script changed and nothing else.
    • The script now starts in the Desk's copy, before the build. There it checks MANIFEST.sha256 against the published file's own hash (f447d4ba…), then runs sha256sum -c MANIFEST.sha256 under set -e, so any mismatch would have ended the job there. The job went on to build and run, so all 21 lines matched. The door keeps only the log's tail, which drops the printed OK count.
    • The script also splits the plain compact load from its --replay 1 check, so each reports on its own.
    • Kernel contract: (filtered) SUMMARY 2 kernels: 2 pass gates 1-4, 0 fail, 0 known findings; 1 controls: 1 red as planted, 0 missed; 0 limit problems; gates 45 ms, limits 0 ms.
    • Compact NVFP4 load (Upstream PR: Drama 3 on CUDA loads a compact NVFP4 checkpoint as stored #4144's check): routed experts held 7369 of 10240; routed experts NVFP4 in 40 of 40 layers; compact routers in 36 of 40 layers, then RESULT drama3 OK frames=76 eos=true audio_s=3.53 prompt_rows=31 ref_frames=0 encode_ms=0.0 prefill_ms=849.4 first_audio_ms=965.6 total_ms=3157.0 fps=32.94 rtf=1.53 device_peak_gb=21.72.
    • Compact replay: --replay 1 fails again with error: ReplayMismatch, the same as in top-69fda464a7b5.
    • CFG guidance (Upstream PR: Drama 3 semantic guidance (CFG) on CUDA #4153's check): "pass": true, "problems": [].

Still open: #4144's compact path loads and generates on the GB10, but it does not replay byte-identically (ReplayMismatch at --replay 1, twice). That replay is a gate in #4144's own tools/zig/drama3_compact_gb10.sh. #4144 reports that script passing at edbfbff7, before it merged main into a57d9c23. The next GPU run should be that script at a57d9c23 alone, to tell #4144's main merge from #4153's.

#4144's whole GB10 check on the combined tree, with codec-chunk PCM reported instead of gated

#4144 at 8aabdc780197cf5544d9911d931d68e2f0480f9f (one-line comment fix over 2519ef8fc5b7ac69544a102e77349a439b691bed) keeps every exact check in tools/zig/drama3_compact_gb10.sh exact: FP8 codes against the pre-feature tree, and the replay's frames, graph replay, poison/reset and PCM chunk 1 against chunk 1. The only stop it accepts is the chunk-4 PCM byte compare in replay.zig (main's own cuBLAS-shape-dependent CUDA codec; proven on plain main e3fb56cb in job top-171f7969b5e0). It then decodes the compact run at codec chunks 1, 4 and 16, requires byte-identical frames, and reports PCM at chunks 4 and 16 against chunk 1 as max abs and RMS in 16-bit steps, for information only.

  • Combined tree: a0c1f48a9427da04a7f2dd7cc9e32956722b1260, which is Upstream PR: Drama 3 semantic guidance (CFG) on CUDA #4153 f2c1c032 with Upstream PR: Drama 3 on CUDA loads a compact NVFP4 checkpoint as stored #4144 8aabdc780 merged in using resolution.patch's resolution. Its four resolved files are byte-identical to c578e8e8's. The pre-feature tree is main 37fa51d2 merged with f2c1c032 (tree c5d6fe9064bb7050a8f85432c7b6e799e4335d98), rebuilt in the job from combined-base.patch as commit d7b15e1711f2880119a7a8bc5856b3ea8106c769.
  • Earlier job top-b46176ce1b50 at c3ced5af251e1754fce7ab044b24445e97f6746c exited 0, but nvcc warnings from the subsequent guidance build pushed RECEIPT.txt out of the door's 200-line log tail. Printing RECEIPT.txt last in combined-gb10.sh resolved that.
  • Job top-f47e9ab508b0 at d273d1517ada405364743f6a0bd3df0c8915e3b0 also exited 0, but its manifest check ran sha256sum -c MANIFEST.sha256 inside an echo substitution, so a shard mismatch would not have stopped it. combined-gb10.sh now runs that check as its own command under set -e (checked locally: a tampered file stops the script with exit 1).
  • Clean combined GB10 job top-41f63db6cf5a at c523dd1deb830aabd2f867344a40c6507d487b73 on plotarmordev/TensorFold branch trial/4144-4153-combined (not for merge; d273d1517 plus that script change), exit 0:
head c523dd1deb830aabd2f867344a40c6507d487b73 pre-feature fb163f535621b56372eabb35532a051db0bb648c
NVIDIA GB10, 580.173.02
Build cuda_13.0.r13.0/compiler.36424714_0
input /assets/drama3-pilot/checkpoint: 03a652743d32d316d66a0bc36dd7611fb6e8974973fcb4daafb66478f631ec7b
input /assets/drama3-pilot/drama-3-NVFP4-Pruned: abd1d1c0d26bd0316d1621bfb0849afd3e89c5e7ae81fe0feca8cccf6479e737
input /assets/drama3-pilot/checkpoint/codec.pth: 74fc41c5a7151c6f350af8bd7e5d6e3accfcc7f3dfbfac23afd35af07052bb2f
PASS fp8 greedy codes byte-identical to fb163f535621b56372eabb35532a051db0bb648c: cd050efdecb401b3d79ac82cd177ce9c90c10126e24e6bb9445f83b8a5499102
PASS compact routed experts held 7369 of 10240; routed experts NVFP4 in 40 of 40 layers; compact routers in 36 of 40 layers
PASS compact replay exact through PCM chunk 1 vs 1, then: error: ReplayMismatch
PASS compact batched prefill (64 rows) replay exact through PCM chunk 1 vs 1, then: error: ReplayMismatch
PASS compact decode at codec chunk 1, frames byte-identical at chunks 4 and 16: RESULT drama3 OK frames=76 eos=true audio_s=3.53 prompt_rows=31 ref_frames=0 encode_ms=0.0 prefill_ms=848.5 first_audio_ms=883.2 total_ms=3163.5 fps=32.83 rtf=1.52 device_peak_gb=21.72
INFO compact PCM at codec chunk 4 against 1, 16-bit steps: max abs 1, RMS 0.0464 over 155648 samples
INFO compact PCM at codec chunk 16 against 1, 16-bit steps: max abs 1, RMS 0.0518 over 155648 samples
INFO compact codes at 1 and 64 prompt rows differ
(filtered) 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 44 ms, limits 0 ms
RECORD drama3 d3_router_compact: .usage = .{ .{ .regs = 19, .static = 592, .bound = 0 }, .{ .regs = 19, .static = 592, .bound = 0 }, .{ .regs = 19, .static = 592, .bound = 0 }, .{ .regs = 26, .static = 592, .bound = 0 }, .{ .regs = 26, .static = 592, .bound = 0 }, }
  • Mac host tests at 8aabdc780 (macOS 27 arm64, Zig 0.17.0):
    • python3 -m unittest -v tools/zig/drama3_limits_gate_test.py: 8 passed, 0 failed.
    • zig build test-drama-host check-drama-cuda-host test-drama-metal-quant-host test-drama-nvfp4-reference-host test-drama-prefill-host test-golden --summary all: 24/24 steps succeeded, 54/54 tests passed; server goldens 69/69 and 324/337 (0 unexpected differences).
    • zig build test test-golden: not green, exit 1: 925/931 steps succeeded (4 failed), 1763/1793 tests passed, 27 skipped, 3 failed. The same four steps fail at base 70e78d03, and Upstream PR: Drama 3 on CUDA loads a compact NVFP4 checkpoint as stored #4144 changes no Zig file:
      • vision.test.the release's vision_config parses to the defaults and the same test under families.deepseek_v41.metal.vision: the test expects UnsupportedVision for a head count of 0, check() returns ZeroHeads. Upstream main still has it; the fork's main fixes the test in f5423d498, outside this PR.
      • stage net: an unknown host is refused: this Mac's resolver answers no-such-host.invalid with 198.18.5.202 (a proxy's fake-IP range), so listen reaches bind and returns AddressInUse.
      • The macOS tensorfold-native check that memcpy comes from libSystem.

Review fix: a replay stop at chunk 4 or 16, in a tested gate

#4144 at 2c09de9ddd6df2e6583f0bbebee9e659d6370e42 moves the replay stop check into tools/zig/drama3_replay_gate.sh. It passes only when the log ends in error: ReplayMismatch and the codec lines read 1 1 4 (the chunk 4 PCM compare failed) or 1 1 4 16 (chunk 4 matched, chunk 16 failed). A stop at the frames (1), at PCM chunk 1 against 1 (1 1), at the fork lane's chunk 1 PCM (1 1 4 16 1) or on any other error still fails. A fork-lane frame mismatch after chunk 16 prints the same log as a chunk 16 PCM one, because replay.zig prints nothing between them, so the gate cannot tell those two apart. Each PCM measurement now runs as its own command under set -e, so a missing or short PCM stops the run instead of leaving an empty INFO line.

  • python3 -m unittest -v tools/zig/drama3_replay_gate_test.py tools/zig/drama3_limits_gate_test.py: 14 passed (6 replay gate, 8 limits gate).
  • Combined tree: 534ba5271b497ebd75c2fbc806e28a8f83097424 merges Upstream PR: Drama 3 on CUDA loads a compact NVFP4 checkpoint as stored #4144 2c09de9dd into c523dd1de. Then 4cc7f9b58603b5921e23b42846621fddea6956c5 regenerates combined-base.patch so that the pre-feature tree also drops the gate and still matches tree c5d6fe9064bb7050a8f85432c7b6e799e4335d98. Both are on plotarmordev/TensorFold branch trial/4144-4153-combined and are not for merge. Job top-2e6793417079 at 534ba5271 stopped at that patch, before any build.
  • Clean combined GB10 job top-e2c133e77bb3 at 4cc7f9b58, exit 0:
head 4cc7f9b58603b5921e23b42846621fddea6956c5 pre-feature 65fd46082320cbf87b21facf2166bf9fbe9db8bf
NVIDIA GB10, 580.173.02
Build cuda_13.0.r13.0/compiler.36424714_0
input /assets/drama3-pilot/checkpoint: 03a652743d32d316d66a0bc36dd7611fb6e8974973fcb4daafb66478f631ec7b
input /assets/drama3-pilot/drama-3-NVFP4-Pruned: abd1d1c0d26bd0316d1621bfb0849afd3e89c5e7ae81fe0feca8cccf6479e737
input /assets/drama3-pilot/checkpoint/codec.pth: 74fc41c5a7151c6f350af8bd7e5d6e3accfcc7f3dfbfac23afd35af07052bb2f
PASS fp8 greedy codes byte-identical to 65fd46082320cbf87b21facf2166bf9fbe9db8bf: cd050efdecb401b3d79ac82cd177ce9c90c10126e24e6bb9445f83b8a5499102
PASS compact routed experts held 7369 of 10240; routed experts NVFP4 in 40 of 40 layers; compact routers in 36 of 40 layers
PASS compact replay exact through PCM chunk 1 vs 1, then: error: ReplayMismatch
PASS compact batched prefill (64 rows) replay exact through PCM chunk 1 vs 1, then: error: ReplayMismatch
PASS compact decode at codec chunk 1, frames byte-identical at chunks 4 and 16: RESULT drama3 OK frames=76 eos=true audio_s=3.53 prompt_rows=31 ref_frames=0 encode_ms=0.0 prefill_ms=848.2 first_audio_ms=883.4 total_ms=3177.4 fps=32.63 rtf=1.52 device_peak_gb=21.72
INFO compact PCM at codec chunk 4 against 1, 16-bit steps: max abs 1, RMS 0.0464 over 155648 samples
INFO compact PCM at codec chunk 16 against 1, 16-bit steps: max abs 1, RMS 0.0518 over 155648 samples
INFO compact codes at 1 and 64 prompt rows differ
(filtered) 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 44 ms, limits 0 ms
RECORD drama3 d3_router_compact: .usage = .{ .{ .regs = 19, .static = 592, .bound = 0 }, .{ .regs = 19, .static = 592, .bound = 0 }, .{ .regs = 19, .static = 592, .bound = 0 }, .{ .regs = 26, .static = 592, .bound = 0 }, .{ .regs = 26, .static = 592, .bound = 0 }, }
  • Mac at Upstream PR: Drama 3 on CUDA loads a compact NVFP4 checkpoint as stored #4144's new head (macOS 27 arm64, Zig 0.17.0): zig build test test-golden exits 1. 925/931 steps succeeded (4 failed), and 1763/1793 tests passed, with 27 skipped and 3 failed. These are the same four steps that fail at base 70e78d03:
    • the two vision_config UnsupportedVision against ZeroHeads tests, fixed on the fork's main in f5423d498;
    • the resolver fake-IP for no-such-host.invalid, fixed in afc998ed7;
    • the macOS memcpy libSystem guard, fixed in c3d801235.

@AIFlowML

Copy link
Copy Markdown
Contributor

I trial-merged b60aef3e cleanly into 767d3d75. On M5 Max with Zig 0.17.0, these targets passed 85 host tests. The seven Python guidance-verifier tests also passed.

zig build test-drama-cfg-mix-host test-drama-cfg-host test-drama-host \
  test-drama-owner test-drama-prefill-host check-drama-cuda-host \
  -Dcpu=apple_m1 -j5 --summary all
python3 -m unittest discover -s tools/zig -p test_drama_guidance_check.py -v

For the overlap with #4144, I kept both registrations and the router control under one contract owner in the scratch merge. The combined tree passed 102 host tests and cross-compiled tf-cuda-test for Linux. The first GPU check still open is the PR's guidance comparison on an upstream build: gamma 1 versus plain, then paired versus separate at gamma above 1.

Igor Lessio - AIFLOW LABS

@ashhart

ashhart commented Nov 21, 2026

Copy link
Copy Markdown
Owner

@plotarmordev, the kernel half of the device check is done on this head (f2c1c032fd), on a GB10 (sm_121, nvcc 13.0): tf-cuda-test kernel-contract d3_cfg_mix passes all four gates. Non-finite inputs give the float64 classes (3 non-finite, 4,094 finite), five runs are byte-identical, the five shapes are within the float64 bound (worst 0.433 of it) with no edge refused, and the launch matches its recorded limits (256 threads, 12 registers, no shared memory). SUMMARY 1 kernels: 1 pass gates 1-4, 0 fail.

The end-to-end half (tools/zig/drama_guidance_check.py: separate and paired PCM equal, gamma 1 identical to unguided, PCM changing above gamma 1, cached-reference hits, concurrent guided lanes) needs a Drama 3 voices catalog with a reference voice longer than 64 rows, which we do not have on our GB10s. Could you post that check's output on this head (PCM hashes, pass and problem counts, guided RTF), or point us to the catalog you used?

  • Synthena

@plotarmordev

Copy link
Copy Markdown
Contributor Author

@ashhart Thanks. I don't have a voice catalog to point you to: I made the reference voice from Drama 3 itself, so the check needs only the FP8 checkpoint. From the job script (combined-gb10.sh, lines 58-65):

text="The lighthouse keeper climbed the winding stairs and lit the lamp before the storm."
drama3-generate --model "$fp8" --codec "$fp8/codec.pth" --text "$text" --wav synthetic.wav
drama3-voice --codec "$fp8/codec.pth" --ref-audio synthetic.wav --ref-text "$text" \
    --source-kind synthetic --source-note "Drama 3's built-in voice, generated by drama3-generate." \
    --out voices/synthetic.json --generate drama3-generate
cd tools/zig && python3 drama_guidance_check.py --bin tensorfold-native --checkpoint "$fp8" \
    --voices voices --voice synthetic --out guidance

What I have from TOP's GB10 (sm_121, nvcc 13.0) is from the tree that combines this PR with #4144, not from this head alone:

  • Job top-aaf334ae7ce0 (this PR at b60aef3e): "pass": true, "problems": []. At both 1 and 64 prefill rows, plain gave 3 replies and separate and paired gave 11 each. Gamma 1 matched plain, gamma above 1 changed the PCM, and paired matched separate. Each guided run resumed its cached reference 10 times.
  • Jobs top-69fda464a7b5 and top-127ed43127ff (this PR at f2c1c032 merged over Upstream PR: Drama 3 on CUDA loads a compact NVFP4 checkpoint as stored #4144): "pass": true, "problems": [] both times.

I don't have the PCM hashes. The door keeps only the end of the log, so results.json didn't survive. The check doesn't time anything either, so I have no guided RTF at this head. The only guided figure I have is the one in the description: RTF 2.359 on FP8 with --cfg-gamma 1.5 --cfg-batched, from my fork's main (bottom-49eafd253777).

plotarmordev added a commit to plotarmordev/TensorFold that referenced this pull request Nov 21, 2026
plotarmordev added a commit to plotarmordev/TensorFold that referenced this pull request Nov 21, 2026
@plotarmordev

Copy link
Copy Markdown
Contributor Author

I merged main (with #4144) into this branch, no rebase: c67d82b. The four conflicts resolve the way @AIFlowML described: d3_router_compact then d3_cfg_mix in the name table, F and cuda_pending (d3_cfg_mix keeps its sm_121 receipt), and #4144's compact router with its unmasked d3_router control now registers in this PR's drama3 Set, which replaces Group. On macOS arm64 with Zig 0.17.0: zig build test-drama-host check-drama-cuda-host test-drama-metal-quant-host test-drama-nvfp4-reference-host test-drama-prefill-host 63/63, zig build test-cuda-host 7895 passed and 50 skipped, both Python drama tests (8 + 7) pass, and zig build compile-cuda-tests -Dtarget=x86_64-linux builds.

@ashhart

ashhart commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Thanks for preserving the compact-router registrations. This still needs changes before it can land.

Please add a deliberately broken d3_cfg_mix contract control and post the complete CUDA summary showing it red as planted; non-finite gate inputs are not that control (zig/tests/cuda/contract_drama3.zig:127-129,204-205). Please also rebase onto current main, resolve the launcher and media-registry conflicts without dropping the compact-router registrations or records, refresh the receipts on that head, and update the stale base/head fields in the description.

The latest push still does not include the requested current-head PCM hashes, pass/problem counts and guided RTF. tools/zig/drama_guidance_check.py:17-21,34-53 also needs serial solo controls so each concurrent lane is compared with its own solo output. Please include immutable checkpoint revisions and cover FP8 and compact/pruned NVFP4, along with CFG-disabled main/head PCM/token equality and timing on CUDA and the corresponding Metal PCM comparison for the shared lifecycle.

Finally, update the Metal-only wording in docs/run-guide.md:133-136 and replace the private execution identifiers and staging details in zig/src/core/contract/registry_media.zig and docs/recipes/drama3-cuda/cfg-mix-gb10.sh:2-6 with public reproducible provenance and commands.

  • Synthena

plotarmordev added a commit to plotarmordev/TensorFold that referenced this pull request Nov 21, 2026
plotarmordev added a commit to plotarmordev/TensorFold that referenced this pull request Nov 21, 2026
), printing receipt last (not for merge)
@plotarmordev

Copy link
Copy Markdown
Contributor Author

Pushed 38c5855 (normal merge of main at ecc80b9, then one commit; I don't rebase or force-push this branch, so main is merged in rather than rebased onto). Main merged cleanly: no launcher or media-registry conflicts, and d3_router_compact with its unmasked d3_router control is still registered next to d3_cfg_mix.

  • Planted control: contract_drama3.zig now registers a second d3_cfg_mix launched with gamma - 1 (the other CFG convention, cond + gamma(cond - uncond)), marked as a gate-3 control, so tf-cuda-test kernel-contract d3_cfg_mix must print it red as planted.
  • drama_guidance_check.py: each concurrent lane now also runs alone first (solo-lane-a, solo-lane-b), and the verdict fails a lane whose concurrent PCM differs from its own solo run, in both guided modes. A unit test covers it.
  • docs/run-guide.md: the four CFG flags now describe Metal and CUDA (--cfg-batched on CUDA joins the two streams with events).
  • registry_media.zig and cfg-mix-gb10.sh: no job ids or staging paths; the script is the public command (Zig 0.17.0 and CUDA 13.0 nvcc on PATH, sh docs/recipes/drama3-cuda/cfg-mix-gb10.sh).

On macOS arm64, Zig 0.17.0, at this head: zig build test-drama-cfg-mix-host test-drama-cfg-host test-drama-host test-drama-owner test-drama-prefill-host 91/91, python3 -m unittest test_drama_guidance_check test_drama_reference_cache_check 13/13, zig build compile-cuda-tests -Dtarget=x86_64-linux builds, lean checker 167 problems on main and on this head.

Not done yet: I couldn't get a GB10 window for this head, so the CUDA SUMMARY with the control red, the refreshed guidance receipts (PCM hashes, pass/problem counts, guided RTF on FP8 and compact NVFP4 with pinned checkpoint revisions), the CFG-disabled main/head equality and timing, and the Metal PCM comparison are still to come. I'll post them here and update the description's base/head when they are.

@ashhart

ashhart commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Thanks @plotarmordev. The gamma - 1 planted control, the solo-lane assertions and their unit test, the Metal and CUDA docs, and the public recipe and provenance cleanup answer our code asks.

What's left is integration and device evidence:

  1. The branch conflicts with current main in zig/src/families/drama3/cuda/kernels.zig and zig/src/core/contract/registry_media.zig. We'll rebase it ourselves, keeping the compact-router registrations and both CFG instances, and push to your branch. Please then update the base/head fields and the planted-control paragraph, which still calls the non-finite inputs the planted control.
  2. On that head, on GB10: the complete kernel-contract d3_cfg_mix summary, with the production kernel passing and the gamma - 1 control red at gate 3 as planted.
  3. The updated tools/zig/drama_guidance_check.py at pinned FP8 and compact/pruned NVFP4 revisions: PCM hashes, pass/problem counts, cache hits, guided RTF, and solo versus concurrent results.
  4. With CFG off, main versus this head: PCM and token equality and timing on CUDA, and the PCM comparison on Metal. These show the default path is unchanged.
  • Synthena

@plotarmordev

Copy link
Copy Markdown
Contributor Author

I merged current main again (821d2ad, normal merge; I don't rebase or force-push this branch). Main merged cleanly, and the compact-router registrations and records are untouched. I then ran this head on a DGX Spark (GB10, sm_121, CUDA 13.0 at /usr/local/cuda, Zig 0.17.0). The only addition to the tree was a wrapper that unpacks that machine's toolchain and calls the two public commands below.

Contract (sh docs/recipes/drama3-cuda/cfg-mix-gb10.sh, exit 0):

commit 521417599e2848af617c7a1fb17c26f8c0671761   (821d2ad62 + the wrapper)
FAIL shapes cuda drama3 d3_cfg_mix control: launched with gamma - 1: at 1x4097x1 output 0 is -3.065564e1 where float64 gives -4.758625e1: 1120676.84 of its bound
CONTROL cuda drama3 d3_cfg_mix control: launched with gamma - 1: red at shapes, as planted
(filtered) 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 41 ms, limits 0 ms

Guidance, FP8 (cd tools/zig && python3 drama_guidance_check.py --bin tensorfold-native --checkpoint FP8 --voices voices --voice synthetic --out guidance, the voice built from Drama 3's own output as in my earlier comment): "pass": true, "problems": [], exit 0. At both 1 and 64 prefill rows:

  • gamma 1 equals plain;
  • gamma 1.5 and 3 differ from gamma 1;
  • paired equals separate;
  • each concurrent lane equals its own serial solo run.

The FP8 config.json sha256 is 4b13a31b504cf54181f52df5bbb27604f5cc4b77b6e90a12ab85d62e0d70b693.

Guided speed is whole-reply wall time over serial requests, with each server's first request left out as warm-up. It includes HTTP and the server, so it is not the same measure as the 2.359 in the description:

rows plain separate (gamma 1.5/3) paired (gamma 1.5/3)
1 1.100x real time 0.690x 0.682x
64 1.276x 0.741x 0.735x
PCM sha256
plain = separate = paired, gamma 1:
t0-g1 ef86f3bc0c71dcf8d7d13e3753e3f3b47b41a2bec7d79f0897f4ca879f6a414f
t1-g1 1d27394b79b580c7b93ce531174c6bb33547b2d6aa55ad3b61cee8e4a83e893d
t2-g1 cff4742d5d92cea4d8b8b7aab5595cf7a6491ae539d6e9033d13418a0711d737
separate = paired:
t0-g1.5 729c0c8956214c84c8426a62cf3ecc0fb3299a14e04b4aa7d7a1d188b466e7c2
t0-g3   56e855e070908dc8fbeacd3d601ac8d5b2f51bc63d089c4e6b92ea3f988dd694
t1-g1.5 cf2d1835bbd56e2d89ad9c213fb8dd143bf097add8c4de941b4522bc14ca56e2
t1-g3   089fe0e6a58ed4547083e97f0f2f9d9562244fa1b922a2689dc437ddec078e9f
t2-g1.5 aea4afc76193d17c6e245b8ac02f81656a03014340dddc90da2fe75cd0a7f6ea
t2-g3   5892a5a49102913c684f098e2ecc376d4f02b71f1914cf2feb410992a6136554
lane-a = solo-lane-a 8ae35ae194f245e2cd33c646f56c789cf988079959f212e14d2f9953b0359b24
lane-b = solo-lane-b 9af20cf905485fb5d6dc727b54c833c71709ec027a3d91b7f20c03cefd344a24
rows=64, gamma 1 (plain = separate = paired):
t0-g1 81bc000b92090f20676f98a0eaa5fd54b162c4bef97d01e9b7069b656aa48f58
t1-g1 30facd540798dfdaf170ca32cb01bf6fd97cae47cf4dfb753d1b5b010750dda2
t2-g1 5c2f89a04e23064ab4f5b141ea1071c6e4423a908a28019bf760ae1a2e1d19be
lane-a = solo-lane-a 3ad1b02854fe0bb3aa4c127d23a82bbb6ab4c4e560ad80dc0749ec317d9f6986
lane-b = solo-lane-b fe660f0139d445308689e0340e81de1172fc8b54c212acc5613b76830cf2b619

Still open:

  • the same check on the compact/pruned NVFP4 checkpoint;
  • CFG-disabled main/head PCM, token and timing equality on CUDA;
  • the Metal PCM comparison;
  • Hugging Face revision ids for both checkpoints (I only have the local checkpoint's config.json hash).

I'll post those here as they come.

@ashhart
ashhart force-pushed the feat/105-upstream-pr-drama-3-semantic-guidance-cf branch from 821d2ad to 2578cd9 Compare November 21, 2026 13:12
@ashhart

ashhart commented Nov 21, 2026

Copy link
Copy Markdown
Owner

@plotarmordev, as promised we rebased this onto today's main and pushed it to your branch (head 2578cd905e). Your commits are kept as they were, along with the compact-router registrations and both CFG instances. Please pull before you push again.

On that head, the device evidence from our last comment is what's left: the GB10 kernel-contract d3_cfg_mix summary, the pinned FP8 and compact/pruned NVFP4 guidance check, and the CFG-off main-versus-head comparisons on CUDA and Metal. Also update the base/head fields and the planted-control paragraph in the description.

  • Synthena

@plotarmordev

Copy link
Copy Markdown
Contributor Author

I ran your rebase (2578cd905, merge-base 1587c8cae with main) on a DGX Spark (GB10, sm_121, CUDA 13.0, Zig 0.17.0). The job added only a scratch wrapper commit on top of it, which isn't for merge. Main for the comparison was rebuilt as this head with the PR's diff reversed, and that tree is byte-identical to 1587c8cae.

Guidance (cd tools/zig && python3 drama_guidance_check.py --bin tensorfold-native --checkpoint CKPT --voices voices --voice synthetic --out guidance): "pass": true, "problems": [], exit 0, on both FP8 and the compact/pruned NVFP4 checkpoint, at 1 and 64 prefill rows. That covers 116 PCM replies, with 2 cache hits per plain run and 12 per guided run. On both checkpoints:

  • gamma 1 equals plain;
  • gamma 1.5 and 3 differ from gamma 1;
  • paired equals separate;
  • each concurrent lane equals its own serial solo run.

Guided RTF is audio seconds over whole-reply wall time, serial, with each server's first request left out:

checkpoint rows plain separate paired
FP8 1 1.126 0.690 0.685
FP8 64 1.281 0.748 0.736
NVFP4 1 1.193 0.744 0.742
NVFP4 64 1.345 0.807 0.799

CFG off, main against head, FP8:

  • drama3-generate --text "The lighthouse keeper climbed the winding stairs and lit the lamp before the storm." --seed 7 --out F: frames are byte-identical (sha256 a8177713a8d4e8affdea82824d7dfe6653a8a7a974e3e5b5333c3345736848a5, 102 frames). RTF is 1.60 on main and 1.61 on head.
  • Served PCM through tensorfold-native with no --cfg-gamma (the three serial texts and two concurrent lanes from drama_reference_cache_check.py) is identical, and wall times are within 1%:
t0     ef86f3bc0c71dcf8d7d13e3753e3f3b47b41a2bec7d79f0897f4ca879f6a414f  9.400s / 9.372s
t1     1d27394b79b580c7b93ce531174c6bb33547b2d6aa55ad3b61cee8e4a83e893d  9.121s / 9.144s
t2     cff4742d5d92cea4d8b8b7aab5595cf7a6491ae539d6e9033d13418a0711d737  8.690s / 8.764s
lane-a 05b41e70f22042a5373ae09d944163fd902c4576fa29c3260c2d14e886c4dcc8 17.211s / 17.102s
lane-b 67cab08faa48461a09bcc3348fc8871f1f0b6189985a29426ea2f6781641920e 16.755s / 16.655s

The planted control is the second d3_cfg_mix launched with gamma - 1, and it is red as planted. Non-finite inputs are an ordinary gate, not the control. Running sh docs/recipes/drama3-cuda/cfg-mix-gb10.sh on the same tree printed:

FAIL shapes cuda drama3 d3_cfg_mix control: launched with gamma - 1: at 1x4097x1 output 0 is -3.065564e1 where float64 gives -4.758625e1: 1120676.84 of its bound
CONTROL cuda drama3 d3_cfg_mix control: launched with gamma - 1: red at shapes, as planted
(filtered) 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 42 ms, limits 0 ms

Here's what I haven't posted yet:

  • A Metal PCM comparison for CFG off. I didn't run one here because this Mac's GPU is serving other work.
  • Upstream revision ids for the two checkpoints. I'm identifying them by the FP8 config.json sha256 (4b13a31b504cf54181f52df5bbb27604f5cc4b77b6e90a12ab85d62e0d70b693) and these PCM hashes.
Guided PCM sha256, NVFP4 (separate = paired)
rows=1
t0-g1   682dfd5069a29853bd98c9a680eb2780fe87b790f6d53e655844cfa7ca745b12 (= plain)
t0-g1.5 6aca9311a3e631e3a7af0e64078403eacaa0e83b4e1dc594c11be9a088079dbe
t0-g3   1834678634cf4a2eb7a19a0d1ae6fa89b9c824eb9f9736f148126b46c9bbacdb
t1-g1   9686275299c289f9063230cc30cd3698b481e9fc5daded75d9bcc940c81c2fca (= plain)
t1-g1.5 6204fb1a7774c0c67fb73dd671b52bca8d3e65d96298adcbab94c7244d59232f
t1-g3   a31790e4e838778b2aad75db47e155a5217ea871ce86d1c03759449c5fd33c36
t2-g1   5f37fff24534feb54ae369ab0a8b28f5374fe06db7a26b2f8e6d7a79fea7244b (= plain)
t2-g1.5 0a71244ac8cf6cef126e061f4da85ee686e4b469e9530efae3506ec37709f8d4
t2-g3   5c8a683d9f7484eb4cbbb10af00a34b5f2f7891389671296874eb638e36d0ec3
lane-a  f2f18b6bd3b5ebc92b41cf00c84e106387520e4920f2af1531053f92f3515879 (= solo)
lane-b  fe6b11f7b820f7fa198418415481696df48cef2ad4c0adae61dea1aea6409a37 (= solo)
rows=64
t0-g1   d83b249fd534dcd30e8f327400bb4be6e51165414a9508d317ae89e9ebf92784 (= plain)
t0-g1.5 819e402ded8319010cecf1698675c20bda043fbc3d35ff1f6c3717dc885285cb
t0-g3   22ac6744c59dd7ed2daf953eda141e874304bf48045c229e026054f08e806853
t1-g1   faf8220ba693f76ba47b930f54fa28568abe0cd92ae21800fc5f4b1badda2f42 (= plain)
t1-g1.5 f1a07b0f33f7cf17dd56fe925b8296adb9d62b2b061f27da6203596eac9d3309
t1-g3   fd70e071b76597a17dd8a84305dcce8c2c8f58b84bf7057fe0771457b343be2f
t2-g1   b057aced7e689d7e1635bad91ec0083c60b8b401bb85ce63b7733d13797e51cb (= plain)
t2-g1.5 0fbbe5b9a0cfb7bfd91313952d041ddfeadbc865dc48ab3ac707c3b8f9ea5a5e
t2-g3   b667c3d1f9c5ab8e0accae8e605f23943f48abed12a364c8029b210d9a59077d
lane-a  1ddfef4459ea8bc36b0548531fb71a5960c4a4dee13e77c276f2e7a9d5ecbbc3 (= solo)
lane-b  f90b6011d26017ecc20f38db72c45f1eecb1d91daed8c3bde43c8e287f3502d9 (= solo)

@plotarmordev

Copy link
Copy Markdown
Contributor Author

I've updated the description for head f9cc095d5cefa32f21820e98885de8690188370e (your rebase 2578cd905 plus one commit) over main 1587c8caee631dcc97c8fbb68f4bba353353c4c5. It uses GB10 job top-fbe539d4a46b.

1. GB10 job top-fbe539d4a46b (at 42d72aac3b24, which is 2578cd905 plus the job's wrapper)

  • tools/zig/drama_guidance_check.py gave "pass": true, "problems": [] on FP8 and on compact NVFP4, at 1 and 64 prefill rows. Paired equals separate, gamma 1 equals plain, gamma above 1 differs, and the concurrent lanes equal their solo runs.
  • With CFG off, main and head gave byte-identical FP8 frames (a8177713…848a5) and equal PCM for all five replies (for example t0 ef86f3bc0c71dcf8d7d13e3753e3f3b47b41a2bec7d79f0897f4ca879f6a414f).

2. Pinned checkpoints, read from the hub API, never main. The guidance check now requires them as --revision REPO@COMMIT and records them in results.json:

  • FP8: fishaudio/drama-3@e0a9218aa48888270f06ef1ed9ea67622c0e17d2
  • Compact NVFP4: plotarmordev/drama-3-NVFP4-Pruned@f3de225065142d287ccb5be85f5fe7d4ddb9f6d0

The compact NVFP4 PCM sha256s from the job's log (separate and paired gave the same bytes for each):

  • rows 1, t0-g1: 682dfd5069a29853bd98c9a680eb2780fe87b790f6d53e655844cfa7ca745b12
  • rows 1, t0-g1.5: 6aca9311a3e631e3a7af0e64078403eacaa0e83b4e1dc594c11be9a088079dbe
  • rows 1, t0-g3: 1834678634cf4a2eb7a19a0d1ae6fa89b9c824eb9f9736f148126b46c9bbacdb
  • rows 1, t1-g1: 9686275299c289f9063230cc30cd3698b481e9fc5daded75d9bcc940c81c2fca
  • rows 1, t1-g1.5: 6204fb1a7774c0c67fb73dd671b52bca8d3e65d96298adcbab94c7244d59232f
  • rows 1, t1-g3: a31790e4e838778b2aad75db47e155a5217ea871ce86d1c03759449c5fd33c36
  • rows 1, t2-g1: 5f37fff24534feb54ae369ab0a8b28f5374fe06db7a26b2f8e6d7a79fea7244b
  • rows 1, t2-g1.5: 0a71244ac8cf6cef126e061f4da85ee686e4b469e9530efae3506ec37709f8d4
  • rows 1, t2-g3: 5c8a683d9f7484eb4cbbb10af00a34b5f2f7891389671296874eb638e36d0ec3
  • rows 1, solo-lane-a: f2f18b6bd3b5ebc92b41cf00c84e106387520e4920f2af1531053f92f3515879
  • rows 1, solo-lane-b: fe6b11f7b820f7fa198418415481696df48cef2ad4c0adae61dea1aea6409a37
  • rows 1, lane-a: f2f18b6bd3b5ebc92b41cf00c84e106387520e4920f2af1531053f92f3515879
  • rows 1, lane-b: fe6b11f7b820f7fa198418415481696df48cef2ad4c0adae61dea1aea6409a37
  • rows 64, t0-g1: d83b249fd534dcd30e8f327400bb4be6e51165414a9508d317ae89e9ebf92784
  • rows 64, t0-g1.5: 819e402ded8319010cecf1698675c20bda043fbc3d35ff1f6c3717dc885285cb
  • rows 64, t0-g3: 22ac6744c59dd7ed2daf953eda141e874304bf48045c229e026054f08e806853
  • rows 64, t1-g1: faf8220ba693f76ba47b930f54fa28568abe0cd92ae21800fc5f4b1badda2f42
  • rows 64, t1-g1.5: f1a07b0f33f7cf17dd56fe925b8296adb9d62b2b061f27da6203596eac9d3309
  • rows 64, t1-g3: fd70e071b76597a17dd8a84305dcce8c2c8f58b84bf7057fe0771457b343be2f
  • rows 64, t2-g1: b057aced7e689d7e1635bad91ec0083c60b8b401bb85ce63b7733d13797e51cb
  • rows 64, t2-g1.5: 0fbbe5b9a0cfb7bfd91313952d041ddfeadbc865dc48ab3ac707c3b8f9ea5a5e
  • rows 64, t2-g3: b667c3d1f9c5ab8e0accae8e605f23943f48abed12a364c8029b210d9a59077d
  • rows 64, solo-lane-a: 1ddfef4459ea8bc36b0548531fb71a5960c4a4dee13e77c276f2e7a9d5ecbbc3
  • rows 64, solo-lane-b: f90b6011d26017ecc20f38db72c45f1eecb1d91daed8c3bde43c8e287f3502d9
  • rows 64, lane-a: 1ddfef4459ea8bc36b0548531fb71a5960c4a4dee13e77c276f2e7a9d5ecbbc3
  • rows 64, lane-b: f90b6011d26017ecc20f38db72c45f1eecb1d91daed8c3bde43c8e287f3502d9

3. Metal on this Mac at main 1587c8cae and this head, on the compact NVFP4 checkpoint at f3de2250 (I checked it against that commit's MANIFEST.sha256):

  • t0: 0aff27edc911ffcef7602f4bc90cb476d20f7b2c96af22cb70d0f6da0a281951
  • t1: 5e8a906ab0677481db0b6c02a4d72b1efae66b4568f21fc403cb1bc014debdad

For each text, the head with CFG at gamma 1 (--cfg-force-guided, X-Cfg-Gamma: 1), the head without CFG, and main without CFG gave byte-equal PCM.

@plotarmordev

Copy link
Copy Markdown
Contributor Author

The red pytest check isn't from this PR: main's 41177ae made tools/test_ci_workflow_conditions.py import yaml, and the root-pytest venv in no-gpu.yml installs only pytest, so collection stops there for every PR merged with current main. #4454 adds pyyaml to that venv. I've left this branch unchanged so the two don't overlap; pytest goes green here once #4454 lands. The PR's own Python tests (tools/zig/test_drama_guidance_check.py and the drama checks) pass at f9cc095.

@AIFlowML

Copy link
Copy Markdown
Contributor

I applied f9cc095d5 and #4454 at 8ad01daee to main 1eed88bb0. They combine cleanly. With Python 3.12 and the workflow's proposed pytest and PyYAML dependencies in a fresh venv, root collection succeeds with 854 tests. The Drama guidance and workflow-condition files passed all ten tests and four subtests.

python -m pytest -q -p no:cacheprovider --collect-only
python -m pytest -q -p no:cacheprovider tools/zig/test_drama_guidance_check.py tools/test_ci_workflow_conditions.py
zig build test-drama-cfg-host test-drama-cfg-mix-host test-drama-host \
  test-gradient-serving check-native-cuda-host -Dcpu=apple_m1 -j4 --summary all

On M5 Max with Zig 0.17.0 the Zig run passed all 24 steps and 88 tests, including the serving pins and the Linux ARM64 CUDA build check. The full hosted pytest run and the existing GB10 receipts are separate from this local integration run.

Igor Lessio - AIFLOW LABS

@ashhart
ashhart force-pushed the feat/105-upstream-pr-drama-3-semantic-guidance-cf branch from f9cc095 to ef5dc0e Compare November 24, 2026 00:36
@plotarmordev

Copy link
Copy Markdown
Contributor Author

The red zig job on ef5dc0e is one test I don't touch: lane_host_explore_test "a seed replays its schedule", seed 1592590343 (ScheduleNotReplayed); the other 19,700 tests passed. This PR changes nothing under the lane host. Its replay, zig build test-lane-explore-host -Dexplore-seed=1592590343, passes here (36/36), and the full explore binary passed 60 runs in a row, so I read it as the idle-arrival timing race 4aaa498 narrowed. I can't rerun jobs on this repo; could you rerun the failed zig job?

…metic tests and contract entry; GB10 check rejects empty PCM and reference-less voices

(cherry picked from commit f4cbd22)
plotarmordev and others added 13 commits November 24, 2026 11:58
…gamma above 1 to change PCM and cached-reference hits

(cherry picked from commit 0b38180)
… rows

Gate 1 probes every kernel at small(k.spec, 5, 8), which clamps the mix
spec's served rows = 1 up to 5; prepare refused any shape.rows != 1, so
the kernel-contract run failed the kernel on 'refused a served shape'.
The launch depends only on n ((n+255)/256 blocks), so the row guard is
dropped and prepare sizes from shape.n, as Norm.prepare does.
Main's note and the PR's list comment both stay, each on one line.
@ashhart
ashhart force-pushed the feat/105-upstream-pr-drama-3-semantic-guidance-cf branch from ef5dc0e to 0a66e9c Compare November 24, 2026 11:58
@ashhart
ashhart merged commit feaf982 into ashhart:main Nov 24, 2026
1 of 11 checks passed
@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Thank you @plotarmordev. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

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