GLM-5.3-Flash EXL3 on 2x DGX Spark with TensorFold
Changelog
Every change to this recipe, newest first. Each release names the image it serves: scripts/prepare.sh pulls
ghcr.io/miaai-lab/glm-5.3-flash-exl3-2x-dgx-sparks-tensorfold by the digest pinned in scripts/config.sh.
Unreleased
A request held for room no longer re-reads its stored prompt every round (patch
0088-glm-spill-tier, PR #210 by nanashi66):GlmScheduler._admitforgot a request's "its stored prompt was looked for" mark beforeadmit, so a requestNoRoomheld started the NVMe read of its state again in every retry round (6 reads in 6 rounds in the check, 1 now). The mark now goes afteradmitsucceeds or the request fails. Added when taking it: a request whose firstprestageread nothing (no room for the read yet) drops the mark, so the prompt is looked for again and read once there is room (without that it would have prefilled from scratch). CPU test:tools/test_queued_cancellation.py(two cases; fails on the unpatched source).KV sharding (patch
0129-glm-kv-shard,TF_GLM_KV_SHARD=1, off by default, by Robert Wojciechowski (wojo on GitHub, @rwojo on X)): each conversation's MLA latent cache is stored once, on the Spark that owns it, instead of on every Spark (tensor parallelism splits the heads, but every head reads the whole latent). The owner computes the decode attention of its rows; a prompt chunk on the other Sparks gets only the history rows its sparse attention selects, or borrows free rows and attends locally. Two Sparks,PARALLEL=8: the pool holds 1.87x the tokens (1.51M -> 2.83M; 1.85M -> 3.47M withDISPLAY_KV_MIB=1792), every reply byte-equal to the unsharded engine's, decode within 1%, prompts within noise when rows can be borrowed and +1.8-3.5% when they are sent. A borrowed row is pinned while its prompt fills (a compaction moving it gave wrong replies under concurrent load; found in review, fixed, and a forced-compaction run on two Sparks is byte-equal). A cache hit whose part has no room no longer drops the cache or evicts kept conversations while another part has room: its rows are carried there (TF_GLM_KV_SHARD_CARRY, on; only when it saves a recompute, an eviction or a pause, never to even out the parts). The same shard code serves the tp4 branch (own-row front, microbatching, a carry relayed over a switchless ring's neighbour links); two Sparks and four (tp4, on a ring) tested, three untested. The staging buffers a prompt's history fetch keeps (shard._grown) are outside the start-up estimate. Builds on0128and0119(renumbered from0118, which #216 uses). CPU checks:tools/kv_shard_check.py,tools/kv_shard_mutants.sh.A rewound conversation keeps its id (patch
0119-glm-chat-continued, by Robert Wojciechowski (wojo on GitHub, @rwojo on X)): patch0089gave a stream a new conversation id unless it resumed from one of that conversation's own turn states, so a client rewinding before the kept turns (issue #104, @danielbanu), a state read back from the spill tier, or dropped states split one session into several ids, andTF_GLM_KEEP_PER_CHATcounted each piece on its own: one session held more states than the quota. Now the stream joins the conversation whose own kept state its prompt repeats past that conversation's first prompt and the first 32 tokens of the reply to it. On two Sparks (PARALLEL=8,TF_GLM_KEEP_PER_CHAT=2,TF_GLM_CACHE_ENTRIES=16), a ~110k-token session rewinding three rounds every fifth of 16 while six chats fill the cache: before, its states went under 3 ids; after, 1, holding 2 states as asked; replies the same drafted and withdraft:false. New counterschats_continued,chats_continued_prefill_tokens(/health,/metrics) and a rank-0 log line for one prefilling 4096 tokens or more, with where the prompt left the kept state and what it resumed from. Two sessions with the same opening message and the same first reply (temperature 0) cannot be told apart by this match and share an id. CPU check:tools/chat_continued_check.py(fails on the unpatched engine; also runs_admitteditself and thechat_rootspruning).prepare.shwarns when a node's NVIDIA CDI device cannot be confirmed (by SvangenStudios, pull request #207, issue #150): without the host's CDI spec, asystemctl daemon-reloadcan remove the GPU from a running container's cgroup and the next kernel load fails withoperation not permitted.prepare.shnow runsnvidia-ctk cdi liston the head and on each worker and warns, with the fix, whennvidia.com/gpu=allis not listed (an ssh failure is reported as such). A warning only; nothing is changed on the node. The README's Requirements say the same.README:
/no_thinkin prompt text does not disable thinking (by travellingsoldier85, pull request #193): the template does not read a/no_thinkor/thinksuffix, so a request that sends one keeps the server's default; the README names the settings that do work and says an emptycontentwithfinish_reason: "length"is a reply to retry.README: static addresses for the link (issue #196) and the Ablit weights' drafter (issue #83): a moved RoCE GID is not noticed by a running engine, so the Requirements ask for static addresses; the Ablit section records why the stock DFlash2 drafter stays for
ABLIT=1, with the two controlled runs by troshab and gulldan that measured the refitted one.CREDITS: four patch credits that had lost their name (0101, 0103, 0105, 0107, by BadAd84) are complete again and sit in the Patches section.
A chat's pictures keep their size past the 8th, so it still resumes from its kept prompt state (
TENSORFOLD_GLM_REQUEST_IMAGE_TOKENS, by abadawe-dev): TensorFold caps a picture at min(IMAGE_TOKENS, the request's picture budget / its pictures), and its own budget of 16,384 holds 8 pictures at 2,048. From the 9th on, every new picture shrank all the earlier ones: their rows and content keys changed, the kept state matched only up to the chat's first picture, and the rest was read again on every turn that brought a picture. An agent session reading screenshots at ~420k tokens waited 150-167 s (187-191k tokens) after each one.scripts/config.shnow sets the budget toMAX_IMAGESxIMAGE_TOKENS(50 x 2,048 = 102,400, at most 262,144), so the cap is the same for any number of pictures a request can carry, and reserves the feature rows that adds in the tower's workspace (TENSORFOLD_VISION_WORKSPACE_MIB768 -> 1,440 MiB: rank 0's startup estimate 88.09 -> 88.74 GiB, the pool 2,582,528 -> 2,537,472 tokens on two Sparks atPARALLEL=4).tools/picture_turns.py, a 48k-token chat, pictures 9 to 11: 16.4-16.6k tokens read and 13.0-13.3 s a turn before, 2.1k and 2.5-2.8 s now; a cold request of 50 full-size pictures (102,118 tokens) answers and resumes. Pictures past the 8th are no longer downscaled, so they cost up to 2,048 tokens each.TENSORFOLD_GLM_REQUEST_IMAGE_TOKENS=16384restores the shared budget. No patch and no image change. CPU check:tools/picture_budget_check.py.A phone photo (an iPhone MPO JPEG) is accepted (patch
0110-vision-mpo-first-frame, issue #201, diagnosed by robertforbes68): the decode guard refused any image whosen_frameswas not 1, and an MPO (what iPhones and many Android phones save as.jpg: the picture plus a preview, depth or gain map) reports 2 or more, so a photo straight from the phone got a 400 "animated and multipage images are unsupported". An MPO is now read from its first frame, the only one ever decoded; the size and pixel limits apply as before, and animated WebP and multi-frame PNG are still refused. CPU check:tools/test_mpo_first_frame.py(needs Pillow; fails without the patch).Pictures inside a Responses
function_call_output(patch0109-responses-tool-image, issue #162, by StrayDragon, pull request #175): an agent that returns a tool's screenshot asinput_imageparts got a 400 ("must be a string or input_text parts"), although the chat route renders tool-result pictures. The_outputhunk of TensorFold commit 69d0ca9 (v0.6.3) now lets those parts through. CPU check:tools/test_responses_tool_image.py(fails without the patch).Streamed replies keep the connection alive while they wait (patch
0111-server-sse-keepalive, issue #106, reported with the first version of the patch by stevehansen): a streamed reply sent nothing between its first event and its first token, so a request waiting for a lane or filling a long prompt was silent for minutes, and a proxy in front cut it as idle (reported: behind a Cloudflare Tunnel every such stream ended at ~125 s). Now a stream that has sent nothing forSSE_KEEPALIVE_Sseconds (15) writes an SSE comment line,: keepalive, on the chat, completions, Messages and Responses streams; SSE clients skip comment lines, and the events are the same bytes.SSE_KEEPALIVE_S=0turns it off; a value that is not a number of seconds stops the server at start. Non-streamed replies are unchanged. CPU test:tools/test_sse_keepalive.py.A streamed Anthropic reply opens with the prompt's token count (patch
0112-anthropic-stream-head-usage, by kky42, fixing TensorFold #672):message_startcarriedusage({}), all zeros, and the real counts only arrived in the finalmessage_delta, so a client that reads prompt counts from the head (Claude Code's context-window indicator) showed ~0% used on every streaming request. The CUDA chat handler now hands its prepared prompt's length to the translated request's wire before the stream head, and the head reports it whole (cache fields 0); the final delta keeps the engine's input/cache_read split, the two totals equal, and no second render runs. The Mac server's head is written before its render, so it keeps the old zeros (in the patch header). CPU check:tools/test_anthropic_stream_head.py.A tool call after a quoted
<tool_call>tag is a call again (patch0114-glm-tool-tag-mention, byA call to a tool the request did not offer stays text, and is now reported (patch
0115-glm-unoffered-tool-call, by kky42, adapted from BadAd84's #137, #103): such a call stayed content text withfinish_reason"stop" and nothing said why, so a gateway could not tell it from an answer. It still stays text and never runs, as in TensorFold since 7be90a36b / 806af974c (v1.0.0 on, only an offered name is a call; a one-call reply drops it). Now the server logstool call rejected: unknown_tool_name ['<name>'](names only), and withTF_GLM_TOOL_DIAGNOSTICS=1the reply'stensorfoldblock lists them astool_call_rejections. Tokens, content, calls andfinish_reasonare unchanged. CPU check:tools/test_unoffered_tool_call.py.A tool call after a quoted
<tool_call>tag is a call again (patch0112-glm-tool-tag-mention, by kky42): every place the server finds GLM calls ran a block from any<tool_call>to the next</tool_call>, so a reply that mentioned the tag ("the literal<tool_call>markup") before its real call made one unparseable block of both: across</think>in the reasoning (cut at the mention), across the prose in the answer. The call came back as content text withfinish_reason"stop" and notool_calls, and the agent stopped. An opener now starts a block only when a call's head follows (GLM's name then<arg_key>or</tool_call>, Qwen's<function=, or JSON), and a call in the think block does not cross</think>. A word the tags enclose with space ("The tags are<tool_call> and </tool_call>.") is prose too, not a call without arguments, which the chat template writes<tool_call>name</tool_call>: it stays incontent, streamed as well (the content hider used to drop it from the stream), and naming an offered tool that way is no longer a call. Two Sparks, 30 live replies to five prompts about the tag, each ending in a realbashcall (seeded; v1.10's image and the same image with only this file changed, token-identical replies):tool_calls15/30 -> 30/30, whole and streamed alike, and call markup incontent18 -> 0. A whole example call the model quotes is still read as a call, as before (3 of the 30 gave two calls). CPU check:tools/test_think_tag_mention.py.A quoted
<think>stays text (patch0116-glm-literal-added-tokens, by ahinore): the chat route renders a request into one string and encodes it whole, and HF tokenizers takes every added token's text out of a string, special or not (<think>and</think>are not special), so a request that only quoted one got that token: an agent reading another model's raw output, a chat template or a log saw<think>,</think>,<tool_call>or<|user|>as the tokens themselves, and wrote such a quote back as the token, where the reply's reasoning/content split broke. The request's text (content, reasoning, call arguments, JSON-escaped ones too, and the tools' definitions) is now masked before the template renders and encoded as text, around the template's own tokens; GLM's kept reasoning is put back before masking, so it is still found for clients that renumber call ids. A prompt without such text encodes to the same ids;/nothink, assistant turns with their reasoning inline and requests with pictures are as before;TF_GLM_LITERAL_TOKENS=0turns it off. The same prompts as tokens and as text, 10 sampled replies each, two Sparks (four): replies that wrote a quoted</think>as the token 7 (8) -> 0; an expected value starting with<think>written right 0 (0) -> 10 (10); which side of a failing assertion starts with</think>4 (3) -> 8 (7). A quote the model writes as text inside its reasoning still ends the reasoning where the reply is split today (at the first</think>in the text). CPU check:tools/literal_tokens_check.py.A
<tool_call>or</think>the reply spells as text stays text (patch0117-glm-reply-marker-ids, by ahinore): GLM writes its markup as single tokens, but the server read the decoded reply as text.- What went wrong:
- a
</think>the model quoted in its reasoning ended the reasoning there; - an example call written as text became a real
tool_callsentry; - a real call whose argument contains
</arg_value>,</tool_call>or</think>was cut.
- a
- The fix:
- each marker token in the reply is recorded with the occurrence of its text it wrote;
- every other occurrence is made inert at the same length before the parsers read the reply (
ThinkSplit, the call hiding and streaming, the end parser, #22's closing), so the parsers are unchanged; - everything the server sends has the text back.
- Scope: a reply without spelled markup parses as before;
TF_GLM_REPLY_IDS=0turns it off; other families are unchanged. It is the reply's side of patch 0122's rule and applies with or without it. It portsTENSORFOLD_REPLY_IDSfrom bertholomus/TensorFold@113a151c. - Measured: four Sparks with 0122, 10 sampled replies per case, recorded and parsed both ways. The answer was right:
- which side of a failing assertion starts with
</think>: 4 -> 7; - an expected value starting with
<think>: 9 -> 10; - echo
<think>hello</think> world: 0 -> 5.
- which side of a failing assertion starts with
- CPU check:
tools/reply_ids_check.py.
- What went wrong:
A rewound conversation keeps its id (patch
0119-glm-chat-continued, by Robert Wojciechowski (wojo on GitHub, @rwojo on X)): patch0089gave a stream a new conversation id unless it resumed from one of that conversation's own turn states, so a client rewinding before the kept turns (issue #104, @danielbanu), a state read back from the spill tier, or dropped states split one session into several ids, andTF_GLM_KEEP_PER_CHATcounted each piece on its own: one session held more states than the quota. Now the stream joins the conversation whose own kept state its prompt repeats past that conversation's first prompt and the first 32 tokens of the reply to it. On two Sparks (PARALLEL=8,TF_GLM_KEEP_PER_CHAT=2,TF_GLM_CACHE_ENTRIES=16), a ~110k-token session rewinding three rounds every fifth of 16 while six chats fill the cache: before, its states went under 3 ids; after, 1, holding 2 states as asked; replies the same drafted and withdraft:false. New counterschats_continued,chats_continued_prefill_tokens(/health,/metrics) and a rank-0 log line for one prefilling 4096 tokens or more, with where the prompt left the kept state and what it resumed from. CPU check:tools/chat_continued_check.py(fails on the unpatched engine).A system prompt's kept state stays once a second conversation goes on from it (patch
0120-glm-fork-point-shared, issue #121, diagnosed with a proposed fix by @RyanLeeUPC; by BadAd84): with a short first message, a conversation's own kept state is the system block's state. The next conversation resumed from it and kept a longer state beside it, and pastTF_GLM_CACHE_ENTRIESthe system block's state was dropped as superseded, so the third conversation on that system prompt prefilled it whole again. A kept state that a prompt goes on from differently than the prompt that wrote it is now a shared prefix (kept by recency,0077) and no conversation's own turn state (TF_GLM_KEEP_PER_CHAT); so is one two conversations prefilled at the same time. A conversation's own next turn is unchanged. The same replies: only which kept states stay changes. Known limit: with the opt-inTF_GLM_EFFORT_TAIL=1(0096) the generation prompt ends in the effort line, which the conversation's own next turn does not repeat at that position, so its own turn state can be taken for a fork (kept by recency instead of superseded-first; never a different reply). CPU check:tools/fork_point_check.py.Long agent sessions no longer stall before each request starts (patch
0121-glm-kept-reasoning-linear, by cawilliamson):KeptReasoning.restore(patch0036) looks up the reasoning of every assistant tool step a client sent back without any, by a signature of the conversation before that step, and rebuilt that signature from the whole history for every step: each request re-encoded and hashed its conversation once per tool step, the square of its length, in Python with the GIL held, before admission (so outside the TTFT metric) and with the engine loop and every other stream stopped meanwhile. A client that returns empty think blocks bare makes nearly every step a candidate. Three Sparks,PARALLEL=4, a real ~2,000-message, ~404k-token agent session replayed fully cached (prefill_s0.2): 4.8-5.3 s before the response headers, the thread insidekept_reasoning.restorein every stack dump; the fixed part of each turn grew from ~0.4 s at ~100k tokens to ~7 s at ~400k while decode held ~45-55 tok/s. One running SHA-256 over the message shapes, copied at each step, makes it one pass: that session's restore 4.06 -> 0.014 s, the same restores (the same history in each key; ids are still tried first). CPU check:tools/kept_reasoning_check.py(fails on the unpatched source).The first start of a new image no longer gets a smaller pool (patch
0122-cuda-budget-parked-pages, by Robert Wojciechowski (wojo on GitHub, @rwojo on X)). TensorFold budgets each rank fromMemAvailableat start; the first start of an image the worker lacked read 89.44 GiB "within" on rank 0 against 94.86 for a warm restart of the same image, and kept 2 prompt states, not 32. On kernel 6.7+ a bulk free leaves GiBs of free pages on the per-CPU lists (pagesetscount:in/proc/zoneinfo), in neitherMemFreenorMemAvailable: the image copy inprepare.sh(docker save/docker load) parks 5-9 GiB there, which comes back at ~0.05-0.1 GiB/s over 1-2 minutes, and the first start of a new image compilestensorfold_roce_v1inside the rank container ~1 s before the budget is read, which parks 2.4 GiB more.capacity.admitnow reads/proc/meminfoand, right after it, the lists once at start-up (every zone and CPU, less theirhigh_min:resting level, so a warm start's idle 0.28 GiB, 0.11 GiB over it, does not move the budget; 0 when/proc/zoneinfois unreadable) and adds the excess to that oneMemAvailablereading (capped atMemTotal) for bothavailable_bytesandpage_room, so pages that drain in between are undercounted, never counted twice. The start-up log says how many it counted, from 0.25 GiB. Only that start-up read counts them: the Qwen families' live memory gate keeps its figure, and the GLM family readsMemAvailablenowhere else.start.sh's own "memory available" check (and its warning below ~110 GiB) counts the same excess. Cold first start of a new image, TP=2: 94.58 GiB "within" on rank 0 (rank 1 95.20) against 89.44 with nothing counted; a warm restart 94.86. CPU check on synthetic zoneinfo / meminfo files, admit() included:tools/parked_pages_check.py.A prompt that fills beside other replies, ~10-14% sooner (
FILL_ROWS, by BadAd84): while other requests decode, a new prompt filled in 1,024-row chunks (TensorFold'sTF_GLM_FILL_ROWSdefault), half the 2,048-row prompt chunk whose buffers the engine keeps anyway.scripts/config.shnow sets 2,048 (at mostTF_GLM_PREFILL_ROWS): the same memory, the same replies, half the passes over the expert weights. Three Sparks,PARALLEL=4, a 35k-token reply streaming meanwhile: a warm +20k turn on a 596k conversation 15.6-15.7 -> 14.0-14.1 s, a cold ~256k prompt 132.2-132.6 -> 113.4-114.0 s; the reply's gaps during the fill median 13-15 / p99 20-25 / max 25-67 ms either way.FILL_ROWS=1024restores the old size. CPU check:tools/fill_rows_check.py.Decode matmuls without clusters where they cost more than they save (patch
0103-glm-qmm-decode-noclusters, by BadAd84): the decode 4-bit matmuls reduce their K slices through the partials buffer andreduce_kernelinstead of a thread-block cluster when the window has at most 64 rows and the weight holds fewer than 28 Mi values: the same slice-ordered fp32 sums, so the same bits. On a GB10 the cluster's launch and syncs cost 20-60% on those latency-bound matrices (a shared expert's gate/up at one row 29.3 -> 18.4 us), at the shapes of two, three and four Sparks; from 32 Mi the clusters mostly win, and no shape sits between. Live on three Sparks: real code 89.5 / 88.6 -> 90.6 / 90.0 tok/s, prose 64.7 / 64.5 -> 66.4 / 66.6.TF_GLM_QMM_CLUSTERS=1: the clusters as before. The extension is renamedtensorfold_qmm_v5, so a kernel folder with v4's build does not serve it. GPU check:tools/qmm_noclusters_check.py.A prompt chunk's dense projections on a faster tile (patch
0102-glm-prompt-matmul-tile, by BadAd84):forward.mmlaunched every 4-bit prompt projection on the extension's default tile 0. It now launches tile 9 (128 x 128 on four 64 x 64 warps, two blocks an SM) where K >= 1024 and the grid has 96 or more blocks, else tile 3. A tile only picks which warp computes an output, so the bits are the same. A 2,048-row chunk's dense projections on one GB10: 178.1 -> 152.2 ms at TP=3 shapes, 238.1 -> 200.7 ms at TP=2 shapes.TF_GLM_PROMPT_TILE=0: tile 0. GPU check:tools/prompt_tile_check.py.The next draft pass starts at a round's end (patch
0100-glm-draft-prelaunch, by BadAd84): a decode round asked for its DFlash2 drafts only after rank 0 had emitted the last round's tokens, planned the next round and sent its message, so the GPU sat idle meanwhile (an nsys trace on three Sparks: 0.47 ms a round between the taps update and the message gather, 0.74 ms at 4 streams). Now every rank launches the next round's block pass at the end of the round, from state every rank holds (never rank 0's own stop decisions), and the next round waits for it when its streams, pending tokens and contexts match (a context's every change bumps its generation), else runs its own pass. The same inputs give the same candidates: every digest equal, drafted and serial alike. Three Sparks,PARALLEL=4: one stream's prose 66.8-67.0 -> 67.9-68.2 tok/s (38.0 -> 37.3 ms a round), code 88.8-91.1 -> 89.2-92.3 (overlapping), four at 596k 133.7-133.9 -> 134.7-134.9;0092's check and retry is kept.TF_GLM_DRAFT_PRELAUNCH=0turns it off. GPU check:tools/draft_prelaunch_check.py.No stall at a long request's start (patch
0099-glm-tokenize-nogil, by BadAd84): the server tokenized each prompt with the tokenizer'sencode, which holds Python's GIL for the whole text (~1.2 us a token), so while a long prompt was being tokenized the engine loop, and every other stream with it, stopped: ~270 ms at 226k tokens and 725-768 ms at a ~619k-token agent turn (a second stream's longest gap, three Sparks). Every tokenizer call in the server now goes through one helper that usesencode_batch_faston the one text: the same ids (tools/tokenize_check.py: real code and prose files, filler, every added token, random Unicode, edge cases, bothadd_special_tokensvalues, and noencodecall left inserver.py), the GIL released (a counting thread keeps 93-99% of its rate, against ~1% underencode) and ~30% faster (689k tokens: 799-825 ms -> 559-593 ms). Requests with pictures or clips (GlmVision.prepare) tokenize the same way: the same ids, picture positions and content hash (tools/vision_tokenize_check.py), and a counting thread's longest gap at ~784k tokens 749 -> 8 ms.A decode window's latent attention in CUDA at three Sparks (patch
0108-glm-seg-chunks-cuda, by BadAd84):seg_chunks.cucomputes every chunk partial of_seg_chunkswith the Triton kernel's own instruction sequence (patch 0106's chains, in_seg_chunks' kWidth-4 dot layout and p-sum tree; key tiles past a chunk's last key, which Triton runs fully masked, are skipped): the same bits under Triton 3.7, and Triton's_mergereads them as before. FP8 arenas with 17-24 heads a rank (22 / 21 at TP=3); 32 heads keep Triton. One GB10, the whole call at 4 streams x 8 rows at 596k: 242.5 -> 94.8 us a call (x11 layers a round). Live on three Sparks: real code / prose rounds 46.90 / 37.40 -> 46.35 / 37.00 ms. Built when the engine starts; under another Triton release (sparse.TRITON_PTX), or when the build fails, the Triton kernel serves (logged once).TF_GLM_SEG_CHUNKS_CUDA=0: Triton. Applies after0104,0105and0106. GPU check:tools/seg_chunks_check.py.Three-Spark decode attention in one wave (patch
0104-glm-seg-attention-tp3-tiles, by BadAd84):seg_head_blockgave 32-head tiles from 8 rows, sized for two Sparks' 32 heads a rank. At three Sparks (22 / 21 heads) the 16-head tiles are two programs a row and chunk, so from 5 rows they pass the GB10's 48 SMs and run in two waves. A rank of 17 to 24 heads now takes 32-head tiles from 5 rows; 16 and 32 heads keep 8. The chunk pass at 5 / 6 / 7 rows on one GB10: 92.4 / 103.3 / 108.1 -> 65.3 / 65.9 / 66.4 us a call; the same bits. GPU check:tools/seg_head_block_check.py.A decode window's indexer, twice as fast with four agents (patch
0107-glm-decode-indexer, by BadAd84): the same tokens and counts in less time. (1) The Triton scoring's grid is 512 programs a segment (was 256). (2) Segments of 4 or more rows are scored byseg_scores.cu, which stores_seg_scores' scores with patch 0105's instruction sequence (the same bits under Triton 3.7) while a CTA converts each FP8 key tile once for up to 8 of the segment's rows; fewer rows stay on Triton (memory-bound there). (3) Windows of 8 or more rows select each row's pools by_seg_select_floor, one pass over its scores (patch 0101's method), instead ofselect_split's five. The indexer call on one GB10, 4 streams x 8 rows at 596k: 1,296 -> 647 us (x11 layers a round); 1 x 16 rows 635 -> 344 us. Live on three Sparks with four agents at ~596k, every stream's round -2 to -4%. Under another Triton release (sparse.TRITON_PTX), or when the build fails, the Triton scoring serves (logged once).TF_GLM_SEG_SCORES_CUDA=0/TF_GLM_SEG_SELECT_FLOOR=0: the old scoring / selection. Applies after0101,0105and0106. GPU check:tools/decode_indexer_check.py.A prompt chunk's sparse attention in CUDA at three Sparks (patch
0106-glm-sparse-onepass-cuda, by BadAd84):sparse_onepass.cucomputes every output of_sparse_onepasswith the Triton kernel's own instruction sequence, read from its PTX (the mma chains and their K order, the online softmax's roundings andex2.approx, the p-sum's reduction tree,div.full): the same bits under Triton 3.7. Producer warps gather and convert the FP8 rows two tiles ahead, q stays in registers, the softmax stays inside a warp, and 384 mma a tile instead of 768. FP8 caches with 17-24 heads a rank (22 / 21 at TP=3); 32 heads (TP=2) keep Triton. A 2,048-row chunk at 113k on one GB10: 7.98 -> 3.51 ms with recent selections, 8.72 -> 7.30 ms with spread ones. Live on three Sparks, cold prefill at 226k 103.58 -> 98.65 s (the first version), then 99.61 -> 98.53 s (the balanced warps). Built when the engine starts; under another Triton release (sparse.TRITON_PTX), or when the build fails, the Triton kernel serves (logged once).TF_GLM_ONEPASS_CUDA=0: Triton. Applies after0105. GPU check:tools/sparse_onepass_check.py.A prompt chunk's indexer scoring in CUDA (patch
0105-glm-prompt-scores-cuda, by BadAd84):_scores(patch 0086's loop) converts and loads each 64-pool FP8 key tile again for every row.prompt_scores.cucomputes every score with the Triton kernel's own instruction sequence, read from its PTX (the mma K order of Triton's kWidth-4 dot layout, the epilogue's roundings, the head sum's order), while a CTA of 8 rows converts each tile once: the same bits under Triton 3.7, whose PTX it reproduces. A 512-row block's scores on one GB10: 0.61 / 1.85 / 4.85 / 10.07 -> 0.40 / 1.30 / 3.39 / 6.77 ms at 35k / 113k / 300k / 590k. The extension is built when the engine starts, not at the first long prompt. Under another Triton release (sparse.TRITON_PTX), or when the build fails, the Triton kernel serves and the start goes on (logged once).TF_GLM_SCORES_CUDA=0: Triton. Applies after0101. GPU check:tools/prompt_scores_check.py.A prompt chunk's pool selection in one pass (patch
0101-glm-prompt-select-floor, by BadAd84):_select_rowsread a row's scores five times (four radix passes and the write), and at long context a row has hundreds of thousands of pools.prompt_poolsreads them once: a strided sample sets a floor, one pass compacts the pools at or above it in pool order, and the radix select runs over those in registers; a row with fewer than 512 or more than CAP candidates takes_select_rowsitself, so the pools and ties are the same. A 512-row block at 590k 6.24 -> 1.51 ms on one GB10. GPU check:tools/select_floor_check.py.kindling spark-os: the server starts (patch
0098-glm-mmap-uploads, by BadAd84): on kindling's 64 KiB-page kernel a pageable copy to the GPU straight from a safetensors mmap hangs in the driver (cuMemcpyHtoDAsync) once the process holds GPU memory, and the DFlash2 drafter and the GLM vision tower load after the main weights. v1.10 on three Sparks with kindling spark-os 0.9.5 stopped after the drafter timings (no vision line for 15 minutes, every rank spinning); with the patch it serves in 145 s. Both loaders now copy each tensor out of the mmap first (.clone()): the same bytes, one host copy a tensor at start; the main weights use direct reads and never had the problem. CPU check:tools/mmap_upload_check.py(fails on the unpatched loaders).A GET with a body no longer breaks the next request on its connection (patch
0113-http-get-delete-body-discard, by cawilliamson): the CUDA handler'sdo_GETanddo_DELETEnever read a request body, so a GET or DELETE carrying one left its bytes on the keep-alive connection and the stdlib parsed them as the next request's start: a "Bad request syntax" 400, an HTML page with no JSON, for whatever came next. Scanners probe with GET bodies, and behind a pooling proxy (nginx upstream keepalive) the next request on that connection is often another client's: the cross-session 400s that prompted this, with the probe's bytes quoted in a real agent's error. Both now read the body through0059's_discard_body(read_body: Content-Length or chunked; a refusal closes the connection) before answering; a request without one reads nothing. CPU test:tools/test_get_bodies.py(fails on the unpatched source).Broken concurrent GLM engine is visible (patch
0118-glm-broken-health-exit):/healthreportsok: falseand its first error inbroken;/metricsexposestensorfold_health:ok. Opt-inTF_GLM_EXIT_ON_BROKEN=1logs the cause and exits with code 1 as soon as the broken state latches. The existing stall watchdog is unchanged. The cause shown in/healthis cut at 200 characters. CPU check:tools/test_broken_health_exit.py.Spill tier, blocks (patch
0128-glm-spill-blocks; withPARALLELabove 1 andSPILL_GIBset; off by default): every kept prompt state is written to local disk when it is kept, in blocks of 2,048 tokens that later turns and forks of the same conversation share, so a conversation resumes from disk after an eviction, a clean restart, akill -9or a watchdog restart, and a turn writes only its new rows (a 10.4k-token turn of a 50k conversation: 68 MiB, not the whole state). Each conversation keeps its newestSPILL_TURNS(4) states, older turns trimmed as each one is written (each held a91 MB small part; the rows stay, the newest turn names them), and small parts go to disk with O_DIRECT, so the page cache keeps no copy. Room goes by conversation: old turns beyond0.25 ms a call against ~9 us idle), so a 260k-token restore beside a decoding stream took 1.0-1.3 s on two Sparks and 8.6-12.7 s on three (measured by BadAd84); now 0.54-0.61 s with 32 blocks read ahead (idle 0.40-0.46 s), the same replies. The read-ahead's first blocks go in the two 64 MiB read buffers pinned at start (ten blocks on two Sparks); the rest is pinned before the pool is sized, in power-of-two pieces, so that comes out of the pool, not the margin it keeps (the default 16 blocks: ~14k tokens atSPILL_TURNS, abandoned forks, whole conversations least recently used, shared system prompts last;SPILL_QUOTAcaps one conversation's share (#122, reported by xiepengqi: one conversation's per-turn states filled 128 GiB in 30 minutes and pushed the others out). The free-disk floor makes room in the same order. Blocks with equal bytes are linked, not written twice. Rank 0 asks every Spark before a read (HAS). The block layout, the lineage, writing at keep through a pinned ring and the fsync order are those of PR #118 by BadAd84, brought into the spill tier so there is one tier and one set of settings. The one-stream engine (PARALLEL=1) keeps its file a state.SPILL_HIGHWATERno longer changes anything. A restore reads ahead on 8 threads into pinned slots (TF_GLM_SPILL_READ_BLOCKS, 16) and the engine copies the blocks read between rounds (TF_GLM_SPILL_LOAD_MS, 40 ms, one budget for every restore in flight, each first in turn; beside decoding streams a restore ends only once those copies are done, rather than its end copying the read-ahead in one pause), as #118 does: issued from the reader's own thread, each copy waited on the decode loop (PARALLEL=4; 9 costs the pool nothing). The write ring's size isTF_GLM_SPILL_STAGE_MIB(256 MiB). A restore whose read fails on one Spark (a damaged or missing block) ends on every Spark and the prompt is computed again: a Spark with more blocks left than read slots (above ~65k tokens) waited for ever for the slots its own copies held (a ~100k-token conversation with damaged blocks on two Sparks: the request hung until the client gave up after 15 minutes; now answered in 50 s, its prompt recomputed). CPU check:hangintools/spill_blocks_check.py. Rows copied to host memory before they go (release) have their own cap,SPILL_RELEASE_MIB(an eighth ofMEMORY_RESERVE_GIBby default, not the 16 GiB write backlog); a state past it is not stored. One engine aSPILL_DIR(a flock on.lock-rank<N>: a second engine runs without the tier and says why), and temporary files openedO_EXCL | O_NOFOLLOW.A system prompt prefilled once for every agent (patch
0128,PREFIX_WAIT=1, off by default: it changes admission also withSPILL_GIB=0): a request whose prompt starts with what another request is still prefilling waits for that state, apart from the queue, then resumes from it. Six agents at once on a fresh 12k-token system prompt: all answered in 14.7-15.0 s instead of 45.7-47.0 s, the slowest first token 13.5-13.8 s instead of 45.0-46.2 s, the same replies. Counted in/health(prefix_waits,prefix_wait_tokens) and/metrics(prefix_waits_total,prefix_wait_tokens_total).tools/kept_state_check.py: the spill tier writes a state when it is kept, not when it is dropped.tools/test_queued_cancellation.py: the scheduler's prefix-wait list.tools/spill_blocks_check.py(CPU): the block store and its hooks inmulti.py(a read only reads; the engine copies, rank 1 as far as LOADPART says), the room (the files each eviction step deletes, the eviction order, a point being read, blocks a new state names), old turns trimmed (SPILL_TURNS), the quota, the floor, a restart with torn, orphaned and foreign files, older builds pruned, the release cap, temporary files and the folder lock, and the prefix wait (off by default; what it waits for, its release, the scheduler holding a request apart);tools/spill_blocks_mutants.shruns it on faithful mutants of each fix. Its whole-run watchdog is 900 s by default (TEST_TIMEOUT_S).
v1.10 (2026-10-08): the effort line at the tail (opt-in), a kept-state share, and a checked second rail
Image: v0.6.0-a1897d591f70 (sha256:bc34d7d63f978cf601f42863b284bc95a567c50c10e9adb0866a635be568bf5f), 96 patches (v1.9.1's plus 0096, 0097). Tested live on two
Sparks: with defaults, the rail probe keeps both rails (roceP2p1s0f1 <-> roceP2p1s0f1 ... used, the Link line names
2 rails), the smoke test and tools/toolcheck.py pass. Switching effort or thinking mid-conversation on a ~19.7k-token
history, cached_tokens: flag off high->low, high->off, off->high 0%, same mode 100%; TF_GLM_EFFORT_TAIL=1 99-100% for
every switch, toolcheck passes, and effort still sets the reasoning length (4 questions, low / high / max: 388 / 769 /
1,720 completion tokens, all answers correct). TF_GLM_CACHE_SHARE_PCT=25 starts with the estimate unchanged (88.09 GiB)
and logs its count (32: each state reserves ~91 MiB of a ~7.5 GiB budget here).
- A second rail is tested before it is used (#66). At two Sparks the launcher added the cabled port's PCIe twin by name
(v1.6) without checking that it reaches the peer; a twin that is up with a GID but unaddressed, on another subnet or at another
MTU ended in
vendor_err 0x81(transport retry exceeded) in the first all-gather.start.shnow sends a full-size unfragmentable ping from each second rail's own address to the peer's matching rail, both ways, and drops a rail that does not answer with aWARNnaming both devices, addresses and MTUs (one rail then, asNCCL_RAILS=1). The Link line also prints the GID indexes and the rail count passed toNCCL_IB_HCA/TF_ROCE_HCA(#88). TP=3/4 and the ring are unchanged (they pair devices by subnet). Scripts only, no patch. - Effort line at the tail, opt-in (patch
0096-effort-tail, issue #93, reported and measured by jdecker76 (@jdecker76)): the checkpoint's template renders<|system|>Reasoning Effort: Xat token 3, so a conversation that switches effort or thinking on/off missed the kept prompt entirely (0% cached on ~26k tokens) and prefilled again.TF_GLM_EFFORT_TAIL=1renders the line just before<|assistant|><think>instead (thinking off has none, as before); the reporter's emulation kept 98 to 99% cached across max, low and off. Off by default and then byte-identical to before: the model saw the line first in training, so run the quality A/B in the README before relying on it.GlmTokenizerand the CUDA server's template both honour it, and every rank reads it with the otherTF_GLM_*switches. CPU test:tools/test_effort_tail.py(--source-rootthe patchedsrc;--expect-stockshows the difference on the unpatched source). - Kept-state count follows a share of the pool (patch
0097-glm-kept-entries-share, issue #84, diagnosed by @jdecker76):TF_GLM_CACHE_ENTRIES(32) is a count, but each kept state is a reservation (~91 MiB measured on two Sparks; KDA recurrent state, conv window, DFlash2 window copy; flat in the context length) taken from the pool's budget, so finished one-shot conversations pushed live ones out with millions of pool tokens free.TF_GLM_CACHE_SHARE_PCT(default 0: off) makes the count at least that share of the budget (on two Sparks at the defaults the budget is ~7.5 GiB and 32 states already take ~38%, so 50 gives ~42 states and the 75% ceiling ~63); the same count sizes the reservation, so the start-up estimate is unchanged and the pool shrinks by it. Any count is cut to three quarters of the budget, logged (past it the states would own memory the estimate never counted). Every admission also rebuilt an int64 array of every kept state's ids to find shared prefixes (112 ms for 32 states of 200k tokens): built once per state now. Check:tools/kept_cap_check.py.
v1.9.1 (2026-10-08): the spill tier's free-disk floor makes room
Image: v0.6.0-ff5dffc865d3 (sha256:20275b2be818635a9c711d80a177477488d2c75cad373cc644422295c4fe9f07), 94 patches (v1.9's, with 0088 updated). Tested live on two Sparks: with
SPILL_GIB=32 and a floor above the disk's free space, the write is refused (no_space) on both ranks without an error; with the
50 GiB floor, a 20,469-token prompt is written (0.21 GiB), read back after a restart (prefill 10.96 -> 0.21 s, restore
29 ms) and the needle answer is unchanged; with defaults, the smoke test, tools/anthropiccheck.py and tools/toolcheck.py pass.
- Spill tier: the free-disk floor makes room (patch
0088-glm-spill-tier, #78 by Robert Wojciechowski (wojo on GitHub, @rwojo on X)): a write that would leave less thanSPILL_MIN_FREE_GIBfree now drops the oldest spilled files first, and is skipped only when that cannot make the room (before: always skipped). Writes still queued count as written. Off unlessSPILL_GIBis set.
v1.9 (2026-10-08): the Anthropic Messages API, long-context speed, a spill tier, a loop guard and protocol fixes
Image: v0.6.0-bd91ecd14811 (sha256:43a8e61cbd4288a07e69cb8677c40faa187d93f3a748111f51064f9e9f23e828), 94 patches, for two and three Sparks (v1.8's plus 0084-0095). Tested live on two
Sparks before release: the smoke test, tools/anthropiccheck.py (all ok, chunked bodies included),
tools/toolcheck.py, a chunked /v1/chat/completions body, /v1/responses with include, the 400 framing on a
kept-alive connection, and default sampling at greedy's speed (512 tokens, thinking off: 44.1 tok/s greedy, 43.5
sampled at temperature 1, top_p 0.95), needles at 194,851 and 502,691 tokens correct (prefill 111.2 s and 333.7 s),
tools/end_of_turn.py 4 of 48 cut, and in the image tools/select_split_check.py and tools/scores_loop_check.py
(0085, 0086: all pass), tools/display_kv_check.py, tools/kept_state_check.py and tools/pool_room_check.py.
The new switches are off by default (TF_GLM_LOOP_GUARD, SPILL_GIB,
TF_GLM_KEPT_BYTES_GIB, TF_GLM_KEEP_PER_CHAT, TF_GLM_EXL3_DEC_ORDER, DISPLAY_KV_BACKEND=dispram); their
contributors' measurements are in the PRs.
- Chunked request bodies (patch
0094-chunked-request-bodies, issues #67 and #74): aTransfer-Encoding: chunkedrequest (AI SDK clients, Chatbox, proxies) has noContent-Length, so v0.6.0 read it as an empty body ("messages must be a list" 400) and parsed the unread chunks as the next request on the keep-alive connection (the stdlib answers that in HTTP/0.9 mode: an HTML error page with no status line). The chat, completions, tokenizer and Responses routes, the MLX-style server and the 404 path now read bodies throughrequest_body.read_body, the reader patch0084brings from upstream TensorFold's 977f2cc by Jordi Posthumus (@JordiPosthumus); each route keeps its own limit (96 MiB for chat). A body with bothContent-LengthandTransfer-Encoding, or another transfer coding, is now a 400 with the connection closed. CPU test:tools/test_chunked_bodies.py(--source-rootthe patchedsrc;--expect-stockshows the failure on the unpatched source). - Streamed requests are refused at saturation (patch
0095-stream-admission, issue #50): withTF_GLM_MAX_QUEUEDset, a streamed request to a full server is answered 429 +Retry-After: 5before the stream opens;0082checked insidesubmit, after the 200 and headers had gone out, so streaming clients saw 200 and an error event. A request admitted between the check andsubmitstill gets the old error event. CPU test:tools/test_stream_admission.py. - Responses
include(patch0093-responses-include, issue #73):/v1/responsesaccepts OpenAI'sincludevalues and ignores them (once logged per value); an unknown value or a non-list is still a 400. CPU test:tools/test_responses_include.py. - Default sampling at greedy's pace (issue #91):
scripts/config.shnow setsTENSORFOLD_NUCLEUS_UNION=1(patch0034;NUCLEUS_UNION=0restores stock). The merged nucleus test gives the same draws; stock sent almost every sampled step to a whole-vocabulary CPU sort (~15 tok/s against greedy's ~58). CPU test:tools/test_nucleus_union.py. To measure on the Sparks: sampled against greedy tok/s on 2 and 3 Sparks. - The drafter checks its candidate ids (patch
0092-glm-draft-candidates-checked, issue #80): an id outside the vocabulary (a float's bits read as an id) is logged with its value and the rows are copied again once the device is idle; only a second bad read fails, as before. A mitigation: the root cause of #80 is not yet found, and the log line tells a late copy from a rank mismatch. - Anthropic Messages API (patch
0084-anthropic-messages, PR #90 by Eduardo Florencio, @eduffd): upstream TensorFold v0.6.3's/v1/messages(also/messages, with/count_tokens) by evilpsycho42 and ashhart, with Jordi Posthumus's request body reading, backported to v0.6.0; a tool_result's images ride the following user message (patch0056), capacity refusals answeroverloaded_error. Claude Code and the Anthropic SDKs talk to the server directly. Live checks:tools/anthropiccheck.py. TF_GLM_LOOP_GUARD=1(patch0091-glm-loop-guard, off by default; issues #89, #94): a think block that collapsed into repeating itself (an exact cycle of up to 16 tokens held for 256, or one token taking half of the last 256) is closed with the thinking budget's close, per request, and the model answers from there;usage.tensorfold.loop_guardcounts it. Paraphrase loops still need--thinking-budget. CPU test:tools/test_loop_guard.py.- The start's smoke test fails on one repeated character (#76, #81, #86): a collapsed model that answers "!!!!" no longer passes as OK.
- Expert decode launch order (patch
0090-glm-expert-launch-order, by Lukasz Raczylo, @lukaszraczylo, PR #95):TF_GLM_EXL3_DEC_ORDER=1(or2) maps the decode expert kernel's block grid so that the eight 128-column blocks of one k slice run together and read contiguous memory; the same bits for every value. Off by default (0, the old order). The author's run: one request +2.2%, four at once noisy. The patch's variable is its own: the PR'sTF_GLM_EXL3_ORDERis patch0020's prompt order (default on, any value but0), sotruewould have raised and1would have turned the new order on for existing users. - Hermes Agent (
docs/hermes-agent.md,tools/hermes_benchmark.py,tests/test_hermes_benchmark.py, by Steve Darlow, @kerpopule, PR #52): how to use the server as Hermes Agent's custom endpoint, and a stdlib harness that times synthetic requests against an idle server (any--modelid;/healthfields read as the server reports them). - Long-context decode (patch
0085-glm-select-split-loop): the DSA indexer's split top-k selection (select_split, in0029's segmented decode windows) ran its last pass as oneCP x 256tile per chunk program, masked to the chunks before it.CPcomes from the selection scratch, whichverify.pysizes for the whole KV pool (5,791,744 rows atPARALLEL=4on three Sparks: 512 chunks a row), not the row's context, so every program loaded and summed the full table: on rank 0 at 226k, 5.3 ms a launch and 92% of the growth of one request's decode round from 35k (nsys: the selection 9.3 -> 56.9 ms of a round's GPU time, everything else +4.3). The pass now sums only the earlier chunks' histograms, 16 at a time (SPLIT_BLK). The whole selection call, scoring included, at 16 rows: 0.96 -> 0.10 ms at 35k, 5.79 -> 0.28 at 226k, 15.68 -> 0.64 at 590k, 27.87 -> 1.08 at 1.04M; four requests x 8 rows at 590k 32.46 -> 1.27 (11 layers a round). Integer sums in another order: the tokens and counts are identical (tools/select_split_check.py: 149 checks against the kernel before the patch and a torch oracle). Live on three Sparks (PARALLEL=4), one request: decode at 35k / 226k / 590k 182.6 / 111.2 / 66.2 -> 203.0 / 191.0 / 184.4 tok/s, replies byte-identical. - Long-context cold prefill (patch
0086-glm-prompt-scores-loop): what grows with context in a cold prefill is the indexer's prompt scoring and selection (nsys on rank 0, two cold prompts of 35k and 226k tokens: the whole prefill 585 -> 687 us of kernel time a prompt token,_scores16.3 -> 103.6 of it,_select_rows3.0 -> 25.6, everything else flat).0009's_scoresran 4 rows and one 64-pool block a program and reloaded each row's 8 KB of queries for every block; it now takes one row and 32 blocks a program (SCORE_LOOP), the row's queries and head weights loaded once, each block computed exactly as a 1-row program did. A 512-row block at row positions 35k / 113k / 300k: 1.354 / 4.298 / 11.304 -> 0.867 / 2.766 / 7.250 ms (8 warps, or one dot over all rows' heads, is faster still but changes the head sum's rounding). Every score bit and selection identical (tools/scores_loop_check.py, 37 checks). Live on three Sparks: the same prompts cold, 35k 17.87 -> 17.47 s, 226k 138.27 -> 126.60 s, replies byte-identical.TF_GLM_SCORE_RBis retired. DISPLAY_KV_BACKEND=dispram(patch0087-glm-display-kv-dispram; defaultdrm, unchanged):DISPLAY_KV_MIBon kindling spark-os. Therenvidia_drmruns without modeset, so0072's DRM dumb buffer fails (DRM_IOCTL_MODE_CREATE_DUMB: ENOSYS) and the span never forms; kindling'sdispramdowns the reservation and lends it through its client'smap_glued(ordinary device memory with the reservation's slice right above it, one virtual range - the layout0072'smap_spanbuilds). The backend takes the span from there and everything carved from it is0072's, unchanged. Fails closed like the DRM path: no client, no daemon, or a slice shorter than the span stops the start.start.shchecks/run/dispram/dispram.sockand/opt/kindling/dispram/pythonon the head and mounts both into every rank. Measured on three Sparks (TP=3,PARALLEL=4,KV_POOL_GIB=30): 2032 MiB adds 317,440 pool tokens;tools/display_kv_check.py's GPU check passes 53/53 through the dispram span (display -> device copies 46.3 GiB/s); decode and prefill as without the span (structured / prose / code 140.4 / 74.3 / 112.5 tok/s against 141.2 / 74.2 / 112.5; drafted replies equal serial ones 7/7); an NVMe-backed restart and eviction test with the span on resumed byte-identical replies.- Spill tier (patch
0088-glm-spill-tier;SPILL_GIB,SPILL_DIR,SPILL_HIGHWATER; off by default): a kept prompt state that leaves the KV pool is written to local disk on each Spark and read back when a later request extends it, also after a clean restart, instead of a new prefill. PastSPILL_HIGHWATER(0.70) of the pool the states eviction would take next are written early, in the background, so an eviction frees its rows at once; a restore reads on a background thread while other streams keep decoding. Every read is checked against per-block CRC-32s, and the files are private to you. Prompts with images or video are stored under their pictures' content (PARALLELabove 1). It works besideDISPLAY_KV_MIB(rows in the display reservation go to and from disk through a kernel, as the pool's own moves there do). Authored by Robert Wojciechowski (wojo on GitHub, @rwojo on X), PR #78; credits inNOTICEandCREDITS.md. Numbers: README, "Spill tier". - Kept-state limits (patch
0089-glm-kept-state;TF_GLM_KEPT_BYTES_GIB,TF_GLM_KEEP_PER_CHAT; both off by default): a byte budget for the device memory the kept prompt states own outside the pool (past it the entry cap's victim order drops states, rank 0 deciding, and freed blocks go back to the driver once 512 MB has piled up), and a per-conversation quota of turn-boundary states, so one long chat cannot fill the entries alone. States dropped by either limit are not written to the spill tier (0088)./healthgainskept_bytes,kept_bytes_capandkept_mix. Authored by Thomas Wade (ThomasWadeZ, PR #65); the PR's copy-over-cut part is0071already and is not included.
v1.8 (2026-10-06): pictures read once, quoted markers, capacity refusals, and the take-over memory fix
Image: v0.6.0-31557ed1cef6 (sha256:cbb4b3c66273e2965dd40a7227e7a5243db333fe250113fb3987462ad4f12588), 82 patches, for two and three Sparks (v1.7.1's plus 0078-0083). Every change below was also
tested live on two Sparks before release; results are on the PRs.
Fixed
- A fresh conversation after a long one no longer runs both ranks out of memory (
_take_over, patch0078-glm-take-over-decide-then-copy, the same change as upstream ashhart/TensorFold#421). When a conversation sharing no prefix with the last one arrived after a long conversation, both ranks died withNV_ERR_NO_MEMORY; it also happened with the 1M window andKV_POOL_GIB=3._take_overcloned every kept state and only then dropped the ones over the budget, so reserved memory grew to the sum of all their sizes. It now works out which states stay and clones only those; the states that stay and the replies are the same by design (200 random cases against the old walk). After a 256k, 21-turn conversation, a fresh one on 2 Sparks:save_rows22 -> 1, reserved +14.8 -> +1.4 GiB,take_over3.3 -> 0.10 s; before, the driver loggedNV_ERR_NO_MEMORY22 times. After: 3 fresh boots, 5 cycles of a long task then a fresh one, 48 benchmark attempts, no allocation failure; pass counts match the unpatched build where it had the same trials (15 of 21 graded at low effort on both; 15 of 21 at high effort against 10 of 11 before). These runs used the v1.4 patch set; patches 0071, 0074 and 0077 change the shared pool and the kept cap (multi.py), not_take_over, so the patch applies to v1.7.1 unchanged.
Added
TENSORFOLD_GLM_PICTURE_CACHE(patch0079-glm-picture-cache, by ThomasWadeZ, #63): the vision frontend reads a request's pictures once, not on every turn of the chat. 10 pictures in a chat, a later turn's first token 0.43-0.46 s -> 0.16-0.19 s; prompt tokens and replies identical. Host memory only, LRU-capped (_PICTURE_CACHE_MB, default 384;_PICTURE_CANVASES, default 8);0restores the old path.- Quoted media markers (patch
0080-vision-quoted-markers, by ThomasWadeZ, #64, needs0079first): every picture and clip of a request carries a per-request nonce, so text that merely quotes the template's picture span stays text. A request quoting it beside a real picture was a 400, now answers; a template or client that drops a picture is still refused. - Capacity refusals render once (patch
0081-tfcap-capacity-status, by johnwhited, #48): 429 withRetry-After: 5everywhere (was a bare 503 at two sites, a 400 on the generate path). TF_GLM_MAX_QUEUED(patch0082-tfcap-admission-cap, by johnwhited, #48): unset queues as every scheduler always has; a number refuses foreground requests past the lanes plus that many. With0, the fifth request on four lanes gets 429 +Retry-After: 5at once; unset, it queues as before (38 s in the release check).- Delivery abort (patch
0083-tfcap-delivery-abort, by johnwhited, #48): a stream whose delivery callback raises (broken pipe, reset, timeout) ends at once and frees its lane, instead of the lane leaking until generation ends.
v1.7.1 (2026-10-05): a new agent run resumes its system prompt again once the kept cap is full
Image: v0.6.0-1692d2df78d2 (sha256:a8067cd7e14c14fa83d1dbed60261428f6d1737cec4554445573354af040dd7c), 76 patches, for two and three Sparks (v1.7's image plus 0077).
Fixed
- #75, a new run of an agent no longer resumed its system prompt once the kept cap was full (patch
0077-glm-kept-cap-shared-by-recency; diagnosed, and the fix proposed, by @meleesciony). Since0071every run and every cold start keeps its states in an extent of its own, and0063never dropped an extent's latest state while anything superseded was kept anywhere. Within hours of a start every entry was some conversation's latest state; a new run's system-block state was then the only superseded entry and went at its next kept state, so the next run of the same agent read its whole prompt again (first token 14 s -> 40 s on 42-49k-token prompts; 15 of 16 runs cold). Shared-prefix states now go by recency only, beside the other conversations' latest states; a conversation's earlier states still go first. A largerTF_GLM_CACHE_ENTRIESnow helps too (before, it only delayed this). Same replies.
v1.7 (2026-10-05): the Ablit weights (ABLIT=1, gated: needs HF_TOKEN)
Image: v0.6.0-c4cab25d2d36 (sha256:b47c19d66633f27cbe37da13fbc580363f466c08b9529feab1eecb1a4b904bf1), 75 patches, for two and three Sparks (unchanged from v1.6).
Added
ABLIT=1serves the Ablit weights, Mia-AiLab/GLM-5.3-Flash-EXL3-4bpw-TensorFold-Ablit (pinned at57edefd2), instead of the published checkpoint; set it inscripts/local.sh(now inlocal.sh.example) or.env. The repository is gated:start.sh,start-tp3.shandprepare.shstop whenHF_TOKENis not set and say how to get one and accept the terms on the model's page, andprepare.shchecks that the token reaches the gated files before the image and the download (README: Ablit weights), without putting the token on a command line.HF_TOKENset inscripts/local.shis now exported to the download.- With
ABLIT=1, thinking is off by default (THINKINGdefaults to0): the Ablit weights give their best results answering directly. A request can still ask to think, andTHINKING=1turns it back on by default.
v1.6 (2026-10-05): agent sessions keep their history (beside sub-agents and under a full pool), queued requests whose client left are dropped, no raw <|assistant|> in replies, the display reservation in the pool, a longer RoCE wait, SPLIT retried at start
Image: v0.6.0-c4cab25d2d36 (sha256:b47c19d66633f27cbe37da13fbc580363f466c08b9529feab1eecb1a4b904bf1), 75 patches, for two and three Sparks.
Fixed
- #43: a conversation lost its kept prompt whenever another conversation with the same system prompt resumed from
it (patch
0071-glm-shared-prefix-copy, by @ezoushen, #44). The resume took over the extent that held the shared state and evicted the longer states in it, which belong to the conversation that wrote it, so a coding agent re-read its whole history after each sub-agent request. The shared rows are now copied into free rows of their own; with no free rows, orTF_GLM_MULTI_LONE=1, it behaves as before. Placement only: the same replies. Two Sparks, v1.5 + 0071,tools/prompt_reuse.py(new): 5% -> 99% of a ~33k-token turn resumed, 16.5 s -> 1.0 s to the first token (measured by @ezoushen and @plotarmordev); the same replies, drafted == serial. - #61: two long conversations taking turns at a nearly full pool evicted each other's kept prompt (patch
0074-glm-compact-before-evict, by @ezoushen, #62). A turn whose rows the pool had free, but not in one range, evicted kept prompts until a range opened, and compacted only after evicting them all, so two coding agents at once re-read 150-210K tokens of history (2-3 minutes). The pool now moves caches together first (each at most once) and evicts only while its free rows fall short. Placement only: the same replies.tools/pool_pressure.py: the other conversation's next turn 0% -> 100% resumed (measured by @ezoushen, two Sparks);tools/pool_room_check.pychecks the moves on a CPU arena. - Requests waiting while every slot was busy kept waiting after their client left (patch
0073-glm-queued-cancellation, by @desy0305, #51), until a slot freed; the scheduler now drops them at once, in queue order. A reply whose connection fails mid-stream ends after the round instead of decoding on (the delivery-failure handling from @johnwhited's #48). Measured by @desy0305 on two Sparks: a queued fifth / ninth request cancelled with 4 / 8 slots busy was acknowledged in 0.11-0.21 s, the busy replies equal their serial ones,PARALLEL=1unchanged;tools/test_queued_cancellation.pychecks it on the CPU. - #60: a raw
<|assistant|>token reached replies (patch0075-glm-assistant-ends; reported by @Lukas-tek-no-logic). At high reasoning effort the model sometimes wrote it inside its answer and began a second one; it now ends the reply, like the checkpoint's end tokens.TF_GLM_ASSISTANT_ENDS=0restores the old behaviour. Replies without the token are unchanged. - #54: a RoCE all-gather failed on long prompts and took both Sparks down.
TF_ROCE_WAIT_Sis now 300 s (was the patch's 20): in the reports the failing rank's own writes had all completed, so the peer was late rather than lost. A late peer now costs a slow round; a rank that is really gone is noticed after 300 s, like the watchdog's report. - #36: with
SPLIT=1a rank's first NCCL connection failed about half the time on some pairs (NCCL error 2,ibv_reg_mr: cannot allocate memory, before any weights load).start.shnow tries such a start once more as it was, then starts withSPLIT=0(the same replies, long prompts fill slower) and says so.
Added
DISPLAY_KV_MIB(patch0072-glm-display-kv, by @ezoushen, #56; off by default): withPARALLELabove 1, up to 2032 MiB of the GB10's display reservation, which a headless Spark never uses andMemAvailablenever counts, joins the shared pool on every rank without taking host memory. Measured by @ezoushen atPARALLEL=8: 1792 MiB adds 276,480 tokens a boot (1,611,776 -> 1,992,704), the same reply hashes on and off, decode, prefill and the 195k needle within boot-to-boot noise. Headless Sparks only: refused while a display is connected; fails closed.tools/display_kv_check.pyruns its checks in the image.
Checked
The published image on three Sparks (./start-tp3.sh, PARALLEL=8) and two (./start.sh), 2026-10-05, against v1.5:
- Exact: 8 requests at once equal the same requests one at a time (11/11 staggered, 11/11 in a burst, three Sparks);
the 22 saved serial references byte-identical (two Sparks); drafted == serial 6/6 on three Sparks, two Sparks, the
small-pool start and
DENSE=fp8; prefill hashes at 12k / 50k / 149k tokens as v1.5's; the 195k needle (both). - Speed as v1.5 (sparkDash, three Sparks, 1 / 4 / 8 at once): prose 65.7 / 121.8 / 162.8 tok/s (v1.5 65.7 / 121.8 / 166.0), code 100.0 / 164.3 / 210.1 (100.4 / 165.3 / 211.5); prefill unchanged.
- #43:
tools/prompt_reuse.py5% -> 99% of each turn resumed (16.5 s -> 0.7-1.1 s), three and two Sparks. - #61:
tools/pool_pressure.py(CONTEXT=131072 KV_POOL_GIB=0.5,PARALLEL=8): the other conversation's next turn 0% resumed (15.8 s) without 0074, 100% (0.6 s) with it. - #60: its request with
DENSE=fp8: v1.5's reply carried<|assistant|>at character 1438 of 3,849; v1.6's ends there, 1,438 characters, no marker, the same reasoning (534 tokens). - CPU tests as v1.5's plus the new ones (0071's resume, 0075's end tokens), 0073's and 0074's checks in the image; the engine GPU tests have v1.5's 14 known failures and no new ones.
DISPLAY_KV_MIBwas not measured here: these Sparks runnvidia_drmwithmodeset=0(an/etc/modprobe.doverride), andstart.shrefuses it with that reason. @ezoushen's numbers are from modeset=1 Sparks.- The
start.shretry for #36 was checked offline (a harness with stubbed ranks), not against a real NCCL failure.
v1.5 (2026-10-03): up to 8 requests at once (8 by default on three Sparks), serial requests stop when their client leaves
Image: v0.6.0-9f73cca659a1 (sha256:ef83797d791fef96c4605e8d37367aca6de5aeac7bb672792cb682e2e55d4237), 70 patches, for two and three Sparks.
Added
- Up to 8 concurrent requests (patch
0069-glm-eight-streams):PARALLELtakes 1 to 8 (was 1 to 4; above 1 still needsDRAFTER=dflash2). Default: 4 on two Sparks (unchanged), 8 on three. The batched verify window's segment tables and the segmented kernels' launch grids hold one segment a stream past four (four, as before, up to four), and the multi-stream DFlash2 drafter, scheduler and startup estimate take 5 to 8 streams. sparkDash aggregate decode, 4 -> 8 requests at once: two Sparks prose 103.2 -> 130.8 tok/s (+27%), code 126.7 -> 167.0 (+32%); three Sparks prose 121.8 -> 166.0 (+36%), code 165.3 -> 211.5 (+28%); one request alone unchanged. Replies byte-identical: 22/22 concurrent cases equal their serial references with 8 in flight (two and three Sparks, windows 32 and 64), drafted == serial, the long-prompt hashes and the 195k needle unchanged;PARALLEL=4gives v1.4's shas. TF_GLM_MULTI_WINDOW(patch0069): the rows of every request's verify window together in a round, 16 to 64 in steps of 8; 32 as before, 64 by default past 4 requests (8 requests' code: 141.2 / 160.3 / 167.0 tok/s at 32 / 48 / 64 rows; prose the same at any size).TF_ROCE_MAX_KBfollows it past 32 rows (64: 1024) unless set, keeping a round's all-gathers on RoCE.- The memory reserve grows with the requests at once (
MEMORY_RESERVE_GIB: 14.5, plus ~0.95 GiB a request past 4 and ~0.04 GiB a window row past 32: 19.6 at 8 requests and 64 rows): more requests take more than the startup estimate counts (two Sparks, head's lowest free memory at the same reserve: 10.8 GiB at 4, 7.0 at 8, 5.8 at 8 with 64 rows). With the grown reserve: two Sparks 12.9 GiB at the lowest under a 195k-token prompt (pool ~1.5M tokens), three Sparks 11.5 GiB (pool ~4.0M).
Fixed
- #38: at
PARALLEL=1a request whose client left kept decoding toMAX_TOKENS(patch0070-glm-serial-stop), and every later request waited behind it; stop strings and gate cuts waited the same way. The serial decode loops did not read the request's stop: rank 0's decision now rides on the round's sample all-gather, so both ranks end after the same round. Same replies.--parallelabove 1 without the DFlash2 drafter is refused at start with the options (DFlash2,PARALLEL=1, or no drafts) instead of a confusing message after loading.
Changed
- The README no longer offers the earlier TR3-4bpw checkpoint, and
scripts/config.shno longer pins its revision: the recipe servesMia-AiLab/GLM-5.3-Flash-EXL3-4bpw-TensorFold. (AnyMODEL_IDstill works, without a pin.)
v1.4 (2026-10-03): image prompts resume, tool calls never dropped, pictures in tool results, earlier reasoning kept, smooth concurrent streaming, 3 Sparks (experimental)
Image: v0.6.0-5e01f1bb74d8 (sha256:14f15591eae5d6a540f09218d3852068962fe5381371bbfefe0e9194cd834529), 68 patches, for two and three Sparks.
Changed
- Earlier turns' reasoning stays in the prompt (#23, patch
0060-glm-keep-thinking, by @kky42), as in zai-org's current template. The checkpoint's template dropped it at each new user message, so agents prefilled the previous turn's tool loop again (a replayed agent session: 85,127 -> 16,106 tokens).TF_GLM_CLEAR_THINKING=1, or a request'schat_template_kwargs.clear_thinking: true, restores the old rendering. Prompts without earlier-turn reasoning render as before. chat_template_kwargs.thinking(#25, patch0057-server-thinking-alias, from @Alexbob0's PR) is read asenable_thinkingwhen that is absent:true/false, or{"type": "enabled" | "disabled"}. DeepSeek-V4 clients such as pi send it; it was ignored. Other values ({"type": "adaptive"}, a string) leave the server's default, as before, and are logged once; they are never refused.
Added
- Smooth streaming with several requests at once (patches
0062-glm-sliced-filland0061-server-smooth-stream;FILL_BUDGET_MS=200,FILL_DRAFTS=1,STREAM_SMOOTH=1, all on by default). Concurrent replies arrived in bursts and froze while another request's prompt filled: each 1,024-row prompt chunk (~0.65 s) stopped every other reply. Now a new prompt's chunks run a few layers at a time (aboutFILL_BUDGET_MSeach) with a drafted decode round between slices, and a streamed reply's tokens go out one event each at a steady pace from a 400 ms playout buffer (STREAM_SMOOTH_MS). Three replies streaming while a fresh ~25k-token prompt arrives (two boots each): the replies' gaps p50 / p90 / max 630 / 673-690 / 754-818 ms -> 81 / 149-150 / 230-231 ms, none above 250 ms (75-78 before); they received 81 -> 650-662 tokens during the fill; the new prompt's first token 16.1 -> 21.1-21.3 s (FILL_DRAFTS=0: 18.1 s with gaps up to ~250 ms;FILL_BUDGET_MS=0: the old behaviour). Without a fill, four replies at once: gaps p50 / p90 107 / 128 -> 40 / 58 ms, one reply 50 / 68 -> 16 / 20 ms; replies end when they did. Replies are byte-identical (22/22 concurrent cases against serial references, drafted == serial, long prompts, the needle); a request alone fills as before. Text appears ~0.4 s later than it is decoded; tool calls keep their place in the stream. - 3 Sparks (experimental):
./start-tp3.sh(TP=3,COMM=ncclby default,roceallowed), withWORKER2for rank 2. Links are found per pair of nodes (a triangle of direct cables);stop.shstops every configured worker;prepare.shprepares every worker. Each rank's container getsTF_ROCE_HCA, the RoCE devices its NCCL uses toward its peers (at two Sparks it is not set: the RoCE all-gathers take the same devices fromNCCL_IB_HCA). The PCIe-twin rail by name (#30) applies at two Sparks only: past two, a node's devices are the ones that share a subnet with a peer, so a twin without an address in such a subnet is not used. Three Sparks ran on v1.3.2's patches and, on 2026-10-03, on top of v1.4: exact (concurrent == one at a time 22/22, drafted == serial, sliced fill on == off, the 195k needle, cancellation mid-fill), measurements in the README. Two Sparks run as before: the same docker commands and defaults. - The TP-N GLM engine as patches 0066-0068, after 0001-0065:
0066-glm-tp-n(the engine on 3 ranks,--tp 3: heads, expert columns, vocab and DFlash2 KV groups in whole units, remainder to the lowest ranks; per-subnet RoCE, b12x's proxy modified for more than two Sparks),0067-glm-tp3-split-pad(atTP=3a 2,048-row prompt chunk pads to 2,049 rows, which the buffers did not hold, so the split prefill never ran: one pad row),0068-glm-tpn-split-buffer-rows(the memory estimate counts that row). On v1.4's code: the early split connection (0064, #36) opens one to every peer past two ranks instead of being skipped there, and the rank checks (0065, #29) name the follower's own rank in their errors. Two Sparks: buffers, estimate and connections unchanged. DRY_RUN=1 ./start.shprints every rank's docker command and exits without stopping or starting anything;DRY_RUN=1 ./stop.shsays what it would stop on which Spark and stops nothing.- Per-worker settings for the third Spark, as v1.3.3 / v1.4 do for the one worker:
FABRIC_PEER2,WORKER_HF_CACHE2,WORKER_WEIGHTS2,NFS_SERVER2; every rank's log saved before its container is removed (stop.sh, andstart.shfor a stopped container left from an earlier run); the image checked by content on every worker (#8); every worker's file list compared in byte order (#21) with only whatrsyncmust send counted (#24); aFABRIC_PEER2host name resolved as at two Sparks. KV_POOL_GIBdefaults perTP: 12.5 at two Sparks (unchanged), 32 at three (a 1M needle at 27 left rank 0 10.6 GiB at its lowest, so ~5.6 at 32).
Fixed
- #36,
SPLIT=1failed to start on some Spark pairs (NCCLibv_reg_mr ... Cannot allocate memoryon rank 1): the split's send/receive connection was opened after the cache pool had taken the memory. It now opens before the weights load (patch0064-glm-split-connect-early). Same replies. - #29, a stalled server said nothing (patch
0065-glm-rank-checks). Not the fix: the cause is not found yet. Each step's message between the ranks now carries a sequence number and a checksum, so ranks that fall out of step stop with an error naming it;/healthreportsiteration_s, how long the current step has run; andTF_GLM_MULTI_WATCHDOG_EXIT=1makes a server stuck pastTF_GLM_MULTI_WATCHDOG_S(300 s) exit after printing every thread's stack, so a supervisor can restart it. Same replies. - An agent's tool loop pushed other conversations' kept prompts out (PR #32 by @Alexbob0, patch
0063-glm-kept-cap-superseded-first): pastTF_GLM_CACHE_ENTRIESthe least recently used state went, so a conversation taking many short turns dropped the only state of another one waiting on a long reply, whose next turn then read its whole history again. A conversation's earlier states, superseded by its own longer ones, now go first. Same replies. - Downloads without the host
hfCLI left the Hugging Face cache root-owned (PR #34 by @100menotu001): the fallback container ran as root, so laterhfruns, the copy to the worker and cache cleanup failed with Permission denied. It now runs as your user, with the samehub/layout. - #11, a prompt with a picture anywhere in it never resumed from a kept state under
PARALLELabove 1: every turn of a conversation with pictures in its history read the whole history again (minutes at 100k+ tokens). Kept states are now told apart by each picture's content, and only the pictures past the resume point are encoded again (patch0054-glm-image-prompt-reuse, by @abhicnv007, applied as contributed with two review changes). Also reported, with measurements, by @DevRico003, @lukemdanastasi and @d4rkdpg. - #22, a tool call the model ended with its end token before
</tool_call>was dropped (finish_reason: "stop", no call, no text). It is now closed and sent as a call when it then parses, else returned as text; a call whose<arg_key>the model wrote as whitespace gets it back (patch0055-glm-open-tool-calls). A call cut by the token limit is still never sent. Reported by @teamlewis-bot, confirmed by @andrejsstepanovs. - #28, pictures in tool results were refused with HTTP 400 (
image_url parts are supported only in user messages), which every later request of an agent session replayed. They are now read in place, inside their<tool_response>, as the served template renders a tool result's media (patch0056-glm-tool-result-media). WithVISION=0they become the template's own "unable to process this image" reminder, so the session goes on; a picture in a user message still needsVISION=1(HTTP 400 that says so). Reported by @d4rkdpg. - A POST to an unknown route left its body on the kept-alive connection, so the next request on it failed with 400
(TensorFold v0.6.1's fix for #181, commit 50dfe38a, backported: patch
0059-server-refused-bodies). - A client that left was not noticed once the server held more than ~1,000 descriptors, and its reply was decoded for
nobody (TensorFold PR #218 by @jayleaton: patch
0058-server-client-gone-poll).
v1.3.3 (2026-10-02): our own checkpoint by default, setup fixes, saved server logs, both PCIe links of a QSFP port
Image unchanged: v0.6.0-ae8d1c789b47. No patch changes. The default checkpoint changes, so replies differ from v1.3.2
(with MODEL_ID=Mia-AiLab/GLM-5.3-Flash-EXL3-TR3-4bpw they are the same as before).
Changed
- Default checkpoint:
Mia-AiLab/GLM-5.3-Flash-EXL3-4bpw-TensorFold(rev078455ff), Mia's AI Lab's own EXL3 quantization of GLM-5.3-Flash, Apache-2.0. Same format, size (~176 GB), speed and memory as TR3-4bpw. Against TR3-4bpw on the same build: KL divergence to Z.AI's official FP8 release 2-18% lower as served, on all six test sets (paired 95% intervals exclude zero on all but chat); coding equal (HumanEval+ and MBPP+, thinking on: 469 vs 468 of 542, paired p = 1.0) with ~10% shorter replies; GSM8K 247 vs 245 of 250, HumanEval 157 vs 160 of 164 (neither significant). Details on its model card. TR3-4bpw stays pinned and one setting away:MODEL_ID=Mia-AiLab/GLM-5.3-Flash-EXL3-TR3-4bpw. - Disk: the first
./start.shafter updating downloads the new checkpoint (176 GB) and copies it to the worker. To free TR3's space afterwards, delete/.cache/huggingface/hubmodels--Mia-AiLab--GLM-5.3-Flash-EXL3-TR3-4bpwfrom the Hugging Face cache on both Sparks (`unlessHF_HOME/WORKER_HF_CACHE` say otherwise); the recipe never deletes it itself.
Added
- Saved server logs.
docker rm -fdeletes a container's log, so a crash's log was lost at the next stop or restart.stop.sh, andstart.shbefore it removes a stopped container left from an earlier run, now save each rank's log (stdout and stderr, with timestamps), gzipped, as<date>-<time>-rank<N>.log.gzin~/.cache/tensorfold-glm53/logson each Spark (LOG_DIRon the head), keep the newest 10 of each rank (LOG_KEEP;0saves none), and print where. A log that cannot be saved only warns. WORKERandFABRIC_PEERas host names (#26): a name (an/etc/hostsalias of the CX7 address, a LAN name, mDNS) is resolved to IPv4 before the route lookup, which takes addresses only; before, it stopped withno route from this node to <name>. By @Alexbob0.WORKER_HF_CACHE(#26): the worker's Hugging Face cache when it is not itsHF_HOME(a shared models folder, say), used by the copy, the checks and rank 1's mount. Unset, nothing changes. By @Alexbob0.tools/end_of_turn.py(#27): the end-of-turn check behind #18 (8 short French coding prompts, thinking off: replies cut bymax_tokens, and P(end of turn) right after the closing code fence); exit code 1 abovemax_cutcut replies. By @Alexbob0.
Changed (setup)
- Both PCIe links of the cabled QSFP port (#30): a Spark's QSFP port reaches the GB10 over two PCIe Gen5 x4
links, so it shows up as two netdevs and two RoCE devices ("twins"). The rails scan only took a second device in
the link's own subnet, so with the twins in different subnets (NVIDIA's two-Spark playbook) NCCL and the RoCE
all-gathers ran on one x4. The twin is now paired by name as well. By @webzone. With a fix of ours: when the twins
share the link's subnet (as on our pair), the twin was listed twice (
rocep1s0f1,roceP2p1s0f1,roceP2p1s0f1); it is listed once. On our pair the devices are unchanged (headrocep1s0f1,roceP2p1s0f1, workerrocep1s0f0,roceP2p1s0f0, as before).NCCL_RAILS=1still uses one device.
Fixed
- #21, the worker copy check failing when the two Sparks sort differently. The check compared the head's and the
worker's
find | sortmanifests as strings, each sorted in its own host's locale (ssh carries none of ours), so identical copies failed after the full copy whenever the locales differed or the launcher set none (systemd, cron, Tailscale SSH). Every manifest is now sorted in byte order (LC_ALL=C), inside the commands sent to the worker too, and a mismatch prints the first differing lines. Reported by @alexandrupetraru, reproduced by @ThinkCode. - #24, the disk checks asking for the whole checkpoint when it is already cached. The head asked for
MIN_FREE_GB(180 GB) whenever the pinned revision's snapshot was new, even when every blob was in the cache from an earlier revision. It now asks the Hub which files the revisions hold and counts only those whose blob is missing (by name and size), plus 5 GB; that needshuggingface_hubon the host (python3, or thehfCLI's own Python), and without it or the Hub the old rule applies. The worker check counted the whole snapshot; it now counts whatrsyncmust send. Reported by @ThinkCode.
Unchanged
- The image, the patches and every serving setting besides the checkpoint: memory and speed are those of v1.3.2
(except on pairs whose port twins were left out before, #30); with
MODEL_ID=Mia-AiLab/GLM-5.3-Flash-EXL3-TR3-4bpwreplies are too. start.sh's help saidTF_GLM_MULTI_LONEdefaults to 1; it has been 0 since v1.3.1 (help text only).
v1.3.2 (2026-10-01): more kept prompts, a note on non-English prompts
Image unchanged: v0.6.0-ae8d1c789b47.
Changed
TF_GLM_CACHE_ENTRIES8 -> 32 (#17): the engine kept at most 8 prompt states and dropped the oldest past that, however much of the pool was free. An agent request keeps 1 to 3 (its own state plus shared-prefix states), so three or four alternating agent conversations pushed each other out. Each entry reserves ~45 MiB at start, ~1 GiB more in all. Reported, with measurements, by @sm373373. The setting is now documented.
Docs
DENSE=q4and non-English prompts (#18): on short French coding promptsq4often loses the end of turn and runs tomax_tokens(12 of 48 replies, against 1 of 48 withbf16orfp8); the README says so and points toDENSE=fp8. A calibrated 4-bit for the dense weights, atq4's speed, is being worked on. Reported, with measurements, by @Alexbob0.DENSE=q4keepskv_bin BF16 (the docs said FP8).
v1.3.1 (2026-10-01): prompt cache in interactive sessions, setup fixes
Image unchanged: v0.6.0-ae8d1c789b47.
Changed
TF_GLM_MULTI_LONEnow defaults to 0 (#12, #13). With 1, a request decoding alone moved to the pool's first rows for the one-stream graphs and evicted the other conversations' kept prompts there, so conversations taking turns re-read their whole histories. Measured with three conversations taking turns (~4.5k tokens each, 6 warm turns): 0% of the prompts came from the cache with 1, 98.1% with 0. The one-stream graphs gave +0.6-0.9% at 1 stream;1still turns them on. Reported by @abhicnv007 and @kky42.
Fixed
- #9,
prepare.shpicked the LAN port whenWORKERis a LAN address. When the route to the worker leaves through a port without RoCE andFABRIC_PEERis unset, the worker's CX7 address that a local CX7 port reaches directly is now found and used (logged). Reported by @ttnghia. - #15, the weight copy to the worker missed files downloaded with huggingface_hub's xet backend: their blobs are
links into the cache root's
blobs/, outside the copied folder. The copy now follows those links. Reported by @huitseeker. - #8,
prepare.shfailed on every run when the two Sparks use different Docker image stores (containerd on one, overlay2 on the other): it compared image.Ids, which is the manifest digest under containerd and the config digest under overlay2, so the same image never matched. Images are now compared by content (their layers' diffIDs and runtime config), the same under both stores. Fix by @eleata, confirmed by @kafej; also reported in #14 by @huitseeker.
v1.3 (2026-10-01): TensorFold v0.6.0, issue fixes #2 and #6, whole tool calls
Image v0.6.0-ae8d1c789b47 (sha256:22789f0cb3dc308f0b2ce52a33961b88bd624af1725e91e8aba0a74a671bb969), 53 patches.
Changed
- TensorFold v0.6.0 (was v0.5.0). The patches are rebased onto it. Three of ours are now part of TensorFold
itself and were dropped: the idle doorbell,
TENSORFOLD_MEMORY_RESERVE_GIBandTF_GLM_MTP. The others keep their names, renumbered (0024 -> 0023 ... 0053 -> 0050; the README's patch table lists them). TensorFold is Apache-2.0 from v0.6.0;NOTICEandCREDITS.mdsay so. TF_GLM_MTP=autois now set explicitly: v0.6.0's own default (1) would load the MTP head (1.77 GiB a Spark) withPARALLEL=1.- Default reply budget 4,096 -> 32,768 tokens (
MAX_TOKENS) for a request that sets nomax_tokens, as agents such as Codex do. GLM thinks at Max by default and could run out of budget inside a tool call. A request's own value still wins; the default is cut to what the window has left, never refused. - Compiled kernels are kept per image (
~/.cache/tensorfold-glm53/<image hash>): another image's build of the same extension can no longer be loaded by mistake. A new image compiles once (a few minutes on its first start). - From v0.6.0 itself:
reasoning_effort: "medium"is heard ashigh;logprobs,top_logprobsandnother than 1 get HTTP 400 (they were ignored).
Fixed
- #6,
COMM=rocefirst start dying at the first all-gather. On a first start each rank builds its CUDA kernels on its own and could drift past the ~20 s a RoCE wait allows. Until startup is over, each RoCE gather first waits for the peer in an NCCL barrier; the RoCE kernel builds during setup. NewTF_ROCE_WAIT_S(default 20 s); a failure now prints the proxy's counters. Patch0052-cuda-roce-startup. - #2, one malformed tool call in the history blocking a conversation for good. A past tool call whose arguments
are not a JSON object is left out of the prompt with its result, and logged, instead of HTTP 400 on every later
turn. Patch
0051-glm-tool-history-recovery. - Cut-off tool calls are never sent. A tool call now goes out whole once it is written; a reply that ends inside
a call (its token limit) ends with
lengthand never sends that call, streamed or not, so a client cannot store or run cut arguments. While a call is written, an empty delta goes out every 2 s for clients with an idle timeout. Patch0053-glm-whole-tool-calls.
Unchanged
- Replies: the exactness checks (reference shas, drafted == serial 6/6, concurrency 22/22, images and videos, tool calls) equal v1.2's. Prefill speed is unchanged (sparkDash, 8k-256k).
- Memory: KV pool 2,922,496 tokens at the measured start (the 12.5 GiB cap); lowest free memory under a 1M-token prompt 5.6 GiB on the head, 9.5 GiB on the worker (needle found).
v1.2 (2026-10-01): bigger KV pool, worker weights over NFS
Image unchanged: v0.5.0-cb7c56f7f921 (sha256:6ee3c6e0430040b69ddcb0c96c7fbbcb94a5bed47d48a8ba092626369ae533b9),
53 patches.
Added
WORKER_WEIGHTS=nfs: the worker keeps no copy of the checkpoint and DFlash2 (~166 GiB less disk on it). Rank 1 reads the head's Hugging Face cache read-only over NFS, through a docker volume thatprepare.shcreates on the worker (no sudo there), after checking the worker sees every file of both snapshots as the head has them. The head exports its cache once (README: Worker weights over NFS). SettingsNFS_PATH,NFS_SERVER,NFS_VOLUME. The default stayscopy. Measured: both ranks live in ~2.2 minutes, as with a local copy.
Changed
KV_POOL_GIB11 -> 12.5: the shared KV pool is 2,852,864 tokens at the measured start (was 2,684,928), ~2.1-2.9M depending on what is free at start. Lowest free memory under a 1M-token prompt: 4.7 GiB on the head, 8.8 GiB on the worker (was 6.3 / 10.8); idle 7.8 / 10.8 GiB.prepare.shandstart.shno longer show TensorFold's "EXL3 support is experimental" note: this recipe serves the EXL3 checkpoint on purpose, and its replies are checked exact.
Removed
tools/bench.py. The recipe's performance numbers come from sparkDash, measured through the OpenAI API from another machine, so a second benchmark in the repo only gave numbers that did not match the published ones. Its shared helpers (the server URL, error messages, random prose) moved totools/client.py;tools/needle.pyandtools/toolcheck.pystay as correctness checks.
Unchanged
- Replies: the exactness checks (reference shas, drafted == serial 6/6, concurrency 22/22, images and videos, tool calls) equal v1.1's, and the 1M-token needle is found (981,841 tokens, 967 s).
v1.1 (2026-10-01): up to 50 images and 4 videos a request
Image v0.5.0-cb7c56f7f921 (sha256:6ee3c6e0430040b69ddcb0c96c7fbbcb94a5bed47d48a8ba092626369ae533b9), 53 patches.
Added
- Patch
0053-glm-many-media: up to 50 images and 4 videos a request (was 4 and 2).- A request's images share 16,384 tokens: up to 8 keep the full 2,048 each, more get an equal share (327 with 50). Its videos share 32,768: 1 or 2 keep 16,384 each, 3 or 4 get 10,922 or 8,192.
- Request bodies up to 96 MiB (was 32 MiB), so data URLs can carry about 70 MB of images and videos; images up to 64 MB in all (was 20 MB).
- Each image is resized as it is decoded, so only one full-size image is in memory at a time, and the vision tower's output is no longer copied once more at the end: lower peak memory for every image or video request.
- New settings:
TENSORFOLD_GLM_MAX_IMAGES(50),TENSORFOLD_GLM_MAX_VIDEOS(4),TENSORFOLD_GLM_REQUEST_IMAGE_TOKENS(16,384),TENSORFOLD_GLM_REQUEST_VIDEO_TOKENS(32,768).
CHANGELOG.md.
Changed
- The published image is pinned by digest (
IMAGE_TAG/IMAGE_DIGESTinscripts/config.sh):prepare.shpulls exactly that image while the patches are this release's.scripts/publish-image.shprints the values to pin after a push;start.shshows the patches hash it serves.
Unchanged
- Replies to text requests, and to requests with up to 4 images and 2 videos, are byte-identical to v1.0 (drafted and serial); the KV pool (2,684,928 tokens) and speed are the same.
- Measured: 50 images in one request answered in 12.5 s (16,239 prompt tokens), lowest free memory on the head 6.75 GiB; 4 videos 6.90 GiB.
v1.0 (2026-10-01): first release
Image v0.5.0-cefe8bf45d07 (sha256:7bcbb617b1f40f1ce12d37e5ba5e42caf1b1c53b444be9951915e966314c3e1d), 52 patches.
- GLM-5.3-Flash (EXL3 4-bit routed experts, checkpoint
Mia-AiLab/GLM-5.3-Flash-EXL3-TR3-4bpw) on two DGX Sparks with TensorFold v0.5.0 and 52 patches, as an OpenAI-compatible API on port 8888 (model idGLM-5.3-Flash-EXL3). - 1,048,576-token context, up to 4 requests at once over one shared FP8 KV pool of ~2.7M tokens, prompts that arrive together filled in one forward.
- DFlash2 and copy drafts (drafted replies equal serial ones), 4-bit dense weights, the RoCE all-gather between the Sparks, prompt and shared-system-prompt reuse.
- Image and video input (up to 4 images and 2 videos a request), tool calling, structured outputs,
/tokenize,/metrics,context_length_exceededrefusals. start.shsets everything up on first run (image, pinned checkpoint and drafter, copy to the worker) and starts both ranks;stop.shstops them.- Measured with sparkDash: one request 60.4 tok/s prose, 114.7 structured; 4 at once 108.8 / 227.9 tok/s in all; prefill ~1,950 tok/s up to 64k tokens.