Repository navigation
glm: draw every target row with the shared keyed sampler - #892
Conversation
Port the sampling follow-up from ashhart#835 (fb3cc20 and 8e8dc68), incorporating the queued-row and shared-sampler repairs from ashhart#524 (79e1004, 1e28ee6 and 0174809). Keep the cache lifetime repair separate. Arm queued and pipelined standalone target rows at their absolute output positions. Pack canonical gpu_rule values without lossy conversions, bound dispatch-run copies, and preserve local greedy vocabulary widths on peers. Include host regressions and a Mac qualification recipe.
Record the 95818b3 implementation's one-Mac feature-correctness gates, exact public requests and token hashes. Remove user-specific filesystem paths and archive metadata. Retain unrun coverage limits without making a performance claim. Runtime code is unchanged.
|
Thank you, @heitke, for splitting the sampling change out of #835 and supplying the four restored prompt cases. We checked 77894a7 and found no new code issue. This is ready and goes into the landing batch after 1.0.12. Posted by Ash's AI Assistant Synthena |
#709 and #892 each added their steps to build.zig, which was already past 600 lines. The same steps now come from zig/build/merge.zig (test-merge and tf-merge-check, host only on every OS) and glm_checks.zig's sampler (tf-glm-sample-check and test-glm-sampling); build.zig keeps one call for each. No step, module or option changes.
…row 0, keyed at the prompt's length)
…VIEW names the refused GLM pair requests rightly One line each for #881, #882, #883, #889, #890, #709, #848, #892, #867, #868, #871 and #873, crediting their authors. ZIG-PREVIEW said a two-Mac GLM pair refuses "temperature-1" requests; it refuses any temperature above 0 (backend.zig and engine.zig both test temperature > 0).
|
Thank you, @heitke, for splitting the keyed sampling change out of #835. #892 is included in 1.0.12 as merge 39b8334, at 77894a7. GLM's first reply token, plain rounds and queued rounds now use the request's shared sampling rule. We preserved image input during the merge. 2931b7b moves the build steps into zig/build/glm_checks.zig, and f4da332 corrects the rule-row comment. On M3 Ultra, an eight-layer GLM fixture passes drafted/plain equality in 17 of 17 cells, seed checks in 10 of 10 and sampled cached/fresh conversations in 12 of 12. Concurrent sampled replies match solo and plain runs. The nine greedy/thinking cells also match the previous build. Synthetic sampler checks pass on M3 Ultra and M5 Ultra. The two-Mac path still refuses sampled requests; its device check remains owed. Posted by Ash's AI Assistant Synthena |
…ared keyed rule
ashhart#709 and ashhart#892 each added their steps to build.zig, which was already past 600 lines. The same steps now come from zig/build/merge.zig (test-merge and tf-merge-check, host only on every OS) and glm_checks.zig's sampler (tf-glm-sample-check and test-glm-sampling); build.zig keeps one call for each. No step, module or option changes.
… (rule row 0, keyed at the prompt's length)
…VIEW names the refused GLM pair requests rightly One line each for ashhart#881, ashhart#882, ashhart#883, ashhart#889, ashhart#890, ashhart#709, ashhart#848, ashhart#892, ashhart#867, ashhart#868, ashhart#871 and ashhart#873, crediting their authors. ZIG-PREVIEW said a two-Mac GLM pair refuses "temperature-1" requests; it refuses any temperature above 0 (backend.zig and engine.zig both test temperature > 0).
What this changes
Adds seeded GLM sampled decoding on one Mac using the shared
tf_sample_fullsampler andlanes.gpu_rule.rule.This is the sampling follow-up requested in the #835 maintainer review.
The cache lifetime fix is excluded from this diff; #835 was reset to 027ddea as requested.
Ports fb3cc20 and 8e8dc68 from #835 and incorporates the queued-row/shared-sampler repairs from #524 (79e1004, 1e28ee6, 0174809). #524 is unchanged; this is a consolidated replacement candidate, not another sampler implementation to merge alongside it.
Qualification receipt
Redacted logs, exact public token arrays, request bodies, native hashes and checksums.
Tested implementation: 95818b3, tree dba292097c3d46ef5df5c3e078882374cd2149b2, based on main c7137bb. The follow-up receipt commit adds documentation/evidence only; it does not change tested runtime code.
Environment: Apple M3 Ultra, 256 GB RAM, macOS 26.6.2 / 25G83; Zig 0.17.0 is the pinned compiler requirement (no independent version capture in the upload). GLM-5.3-Flash MLX 4-bit MTP, 45/45 layers plus MTP, 180.58 GB in buffers; checkpoint revision not captured. Standalone load limit GLM_LOAD_LIMIT_GB=235.
The JSON results were independently rechecked against their native token hashes, restoration counts and drafting telemetry. Sampled standalone hashes differ from greedy, so sampled requests are not silently using argmax.
Additional Linux checks: 46/46 host steps succeeded; 19 draw/packing tests passed, nine client tests passed, 317 server/engine-seam tests passed, Apple Silicon production semantic compilation passed, formatting/diff checks passed. Lean: 525 inherited findings versus pinned main's 527; zero new by finding identity. The dispatch bounds and bit-preservation regressions reproduce the old failures when the inherited expressions are restored.
Scope and limits
This PR adds a feature. No performance improvement or performance-regression claim is made; speed comparisons are not supplied. Raw qualification tools retain incidental timing fields.
Not run: served streaming disconnect/recovery, MTP-omitted model execution, and two-Mac hardware behavior. Standalone cancellation passed. These configurations are not claimed as qualified. Sampled peer execution remains unsupported. The archive does not independently capture checkpoint revision, compiler version or peak physical/device memory.
Checklist
Merge Danger
Two-way door: reverting removes GLM sampled decoding; no migration. Affects GLM Metal target-head dispatch and standalone/server sampling. The maintainer's review, required CI and release decisions still apply.