Skip to content

glm cuda: full GLM-5.3 keeps conversation states on disk (--prompt-cache-disk) - #5432

Merged
ashhart merged 7 commits into
ashhart:mainfrom
bjornmonnens:glm53-c-main
Nov 28, 2026
Merged

ashhart merged 7 commits into
ashhart:mainfrom
bjornmonnens:glm53-c-main

Conversation

@bjornmonnens

Copy link
Copy Markdown
Contributor

GLM's disk store (#1411) wrote GLM-5.3-Flash's images only: its Shape took the latent row as
kv_lora, pools of 4 (sparse.pool) and index rings and pooled keys on every cache. A kept
state's image now reads them from the state: the latent row (576 wide on full GLM-5.3), the pool
(Config.kpool: 1), and which caches keep index keys — a shared indexer layer's cache holds
latent rows alone, so its rings and pooled keys take no bytes and no rows by position.
GLM-5.3-Flash's values are the ones the image took before, so its images are unchanged.

The store serves both GLM entries (cuda_glm_disk.serves), and --prompt-cache-disk (and its
older alias --learn-conversations) reaches full GLM-5.3 at TP=3; at TP=1 its held shares still
keep no states.

Tests.

  • Host test: full GLM-5.3's image against the snapshot plan at four positions and every head
    length, and that its rows by position are the 78 caches' latent rows and the 21 indexed
    layers' pooled keys.
  • The same focused host suite as glm cuda: full GLM-5.3 (glm_moe_dsa) at TP=3 with a bf16 cache, drafts, slots and prompt steps #4900, run on the tested commit 6ec94e2a7 and again on the previous rebase 9fd37df44 (those five files matched the tested commit). Not repeated on 91e4975cf3. The only extra line in the five files is main's env-reader migration in cuda.zig (2b76e782fb), which is not on the disk path.
    zig build test-glm-keep-seqs-host test-glm-snapshots-host test-glm-tp3-host test-glm-exl3-host test-glm-exl3-prompt-host test-glm-prompt-settings-host test-glm-formats-host -Dfixed-cpu -j4 --summary all →
    Build Summary: 25/25 steps succeeded; 100/100 tests passed (one test prints a harmless
    failed command: line to stderr; the Build Summary line is authoritative).
    Cross-build: zig build check-native-cuda-host compile-cuda-tests -Dtarget=aarch64-linux-gnu -Dfixed-cpu -j4 --summary all → Build Summary: 21/21 steps succeeded on the tested commit.
  • CI host suite on the previous head 8f87e985c (same slice-c files as 9fd37df44), not repeated after the rebase onto c464c9128b: zig build -Dfixed-cpu test-host --test-timeout 20m --summary all →
    Build Summary: 2726/2726 steps succeeded; 2647/2697 tests passed (50 skipped), exit 0.
    An earlier run on the same tree reported five C compile failures (tfvideo_stub.c,
    mem_seek_test.c, window_fallback_shim.c, drama_cfg_mix_shim.c): clang 22, under -Werror,
    rejected this machine's GCC 12 install because it had no libstdc++ headers. Installing g++-12
    and libstdc++-12-dev (12.3.0) cleared it. Those steps now succeed, and none of those files are
    in this change. The lower inner-test total versus that earlier run is cached test binaries; the
    step total is the full graph. zig fmt --check and git diff --check passed.

Device (the disk tier across a restart, three GB10s at TP=3, BF16 cache).
host-a/b/c, LAUNCHER and CKPT as in #4900's receipt; the learn test waits for no .part
files before the restart. Tested implementation is 6ec94e2a7 (binary sha256 9f91d3cb4c05…), built
-Dgpu=spark -Doptimize=fast. The code commit on this branch is 91e4975cf3.
git diff 6ec94e2a7 91e4975cf3 is empty on the other four files. cuda.zig also
contains main's env-reader migration (2b76e782fb), not on the disk path. BF16 cache, no --kv-cache.
Receipt: docs/receipts/glm53-disk-6ec94e2a7/.

  • Turn 1 wrote 22,528 tokens to disk: 88 new blocks, 2,120 MiB this state (2,046 MiB of rows it
    shares) in 13.738 s.
  • After a full restart the state was read back: 2,120 MiB in 2.729 s, 2.1 GiB on disk.
  • Turn 2 resumed at cached 22528; its token sha equals the cache-off reference (PASS). The
    shas are the same as the cache-off turns in this run (37287f2c420f…, af785ef933c5…).

No precision or token trades. The store's image is the state's bytes; resumed equals fresh.

@ashhart

ashhart commented Nov 27, 2026

Copy link
Copy Markdown
Owner

Thanks, @bjornmonnens, for the full GLM-5.3 disk-state implementation and the detailed restart evidence.

Three small cleanups remain:

  • zig/src/families/glm/cuda_disk_image_test.zig:134 is 128 columns including its trailing comment. Please move the comment to its own line or shorten the statement so the line is at most 120 columns.

  • docs/api.md:1567-1570 still lists only GLM-5.3-Flash for CUDA conversation states and describes only Flash's cross-rank behavior. Please update both statements to include full GLM-5.3.

  • The new serves(F) predicate admits full GLM-5.3, but zig/src/native/cuda_refusal.zig:137 and zig/src/native/cuda_glm_disk.zig:184 still name only GLM-5.3-Flash when a full-model server refuses these disk-state combinations. Please make both messages name the applicable GLM family and extend the refusal test at cuda_refusal.zig:429-442 to cover full GLM.

  • Synthena

@bjornmonnens

Copy link
Copy Markdown
Contributor Author

@ashhart, thanks. 5a298bb30d does the three cleanups.

  • The disk-image comment is on its own line. The assertion is unchanged.
  • The CUDA notes in docs/api.md include full GLM-5.3. The Mac list is still Flash only.
  • The spill and share refusals name Flash or full GLM-5.3, and the refusal test covers both.

The same learn test still matches: turn 2 sha af785ef933c5, disk cached 22528, cache-off cached 0.

ashhart and others added 7 commits November 28, 2026 20:57
…che-disk)

GLM's disk store (ashhart#1411) wrote GLM-5.3-Flash's images only: its Shape took
the latent row as kv_lora, pools of 4 (sparse.pool) and index rings and
pooled keys on every cache. A kept state's image now reads them from the
state: the latent row (latentRow: 576 wide on full GLM-5.3), the pool
(Config.kpool: 1), and which caches keep index keys (a shared indexer
layer's cache holds latent rows alone, so its rings and pooled keys take
no bytes and no rows by position). GLM-5.3-Flash's values are the ones
the image took before, so its images are unchanged.

The store serves both GLM entries (cuda_glm_disk.serves), and
--prompt-cache-disk (and its older alias --learn-conversations) reaches full GLM-5.3 at TP=3;
at TP=1 its held shares still keep no states. A host test checks full
GLM-5.3's image against the snapshot plan at four positions and every
head length, and that its rows by position are the 78 caches' latent rows
and the 21 indexed layers' pooled keys.
Checkpoint digests, the launch, and the learn-test rows. The binary was built from 6ec94e2a7. The code commit on this branch is the rebase of that change; its five files are unchanged.
The server bound every interface. The dotted unspecified address is what pr_check warns on, so the launch line states the fact without it.
The spill and share refusals name Flash or full GLM-5.3, the refusal
test covers both, and the CUDA conversation-state notes do too. The
disk-image assertion stays, with its comment on its own line.
@ashhart
ashhart merged commit f2392a0 into ashhart:main Nov 28, 2026
5 of 6 checks passed
@ashhart

ashhart commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Thank you @bjornmonnens. 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.

2 participants