GLM-5.3-Flash EXL3 on 2x DGX Spark with TensorFold
Python
Renumber the loop guard to 0091; README patch row and CHANGELOG entries for 0091 and the smoke test
MiaAI-Lab81323497603b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f923510..79002d7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,12 @@ Every change to this recipe, newest first. Each release names the image it serve## Unreleased+- **`TF_GLM_LOOP_GUARD=1`** (patch `0091-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_guard`+ counts 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.- **Long-context decode** (patch `0085-glm-select-split-loop`): the DSA indexer's split top-k selection(`select_split`, in `0029`'s segmented decode windows) ran its last pass as one `CP x 256` tile per chunk program,masked to the chunks before it. `CP` comes from the selection scratch, which `verify.py` sizes for the whole KVdiff --git a/README.md b/README.mdindex 045292a..7fc3112 100644--- a/README.md+++ b/README.md@@ -464,7 +464,7 @@ sets a value wins: the environment, then `scripts/local.sh`, then `.env`, then t| `DRAFTER` | `dflash2` | `dflash2`: IncoAI's DFlash2 drafter, licensed [CC BY-NC-ND 4.0](https://creativecommons.org/licenses/by-nc-nd/4.0/), **non-commercial use only**; +5-10% decode. `mtp`: the checkpoint's own MTP head, one request at a time, which avoids that license (set it before the first `./start.sh` and DFlash2 is never downloaded) || `TF_GLM_MTP` | `auto` | the checkpoint's MTP head beside DFlash2: `auto` leaves it out while DFlash2 drafts every request; `1` (TensorFold v0.6.0's own default) loads it, 1.77 GiB a Spark, with `PARALLEL=1`. `DRAFTER=mtp` always loads it || `TF_GLM_ASSISTANT_ENDS` | `1` | `<\|assistant\|>` ends a reply, like `<\|user\|>` and `<\|observation\|>` (patch 0075, issue #60); `0`: only the checkpoint's own end tokens |-| `TF_GLM_LOOP_GUARD` | `0` | `1`: 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_guard` counts it (patch 0084, issues #89 and #94). Paraphrase loops need `--thinking-budget` |+| `TF_GLM_LOOP_GUARD` | `0` | `1`: 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_guard` counts it (patch 0091, issues #89 and #94). Paraphrase loops need `--thinking-budget` || `DRAFT_POLICY` | `fnc7:0.3` | how many DFlash2 drafts a round verifies: up to 7, until the drafts' chance under the request's own sampling noise drops below 0.3 || `COPY` / `COPY_MAX` | `1` / `15` | copy drafts: when the reply's last 8 tokens occurred before, the tokens that followed are verified ahead of DFlash2's, up to 15 a round || `COPY_CODE` | `1` | 16-row verify windows as CUDA graphs, and copies from the reply itself only after a 16-token match |@@ -600,6 +600,7 @@ applied with `patch -p0` in filename order); `start.sh` rebuilds or re-pulls the| Pool room | `0074-glm-compact-before-evict` | a request or a growing stream whose rows the pool has free, but not in one range, gets them by moving other caches (each at most once) instead of evicting kept prompts until a range opens; eviction only while the free rows fall short (by ezoushen, issue #61) | two conversations taking turns at a nearly full pool keep each other's kept state (`tools/pool_pressure.py`: the other's next turn 0% -> 100% resumed) || Queued cancellation | `0073-glm-queued-cancellation` | a request waiting while every slot is busy, whose client left, is dropped at once instead of when a slot frees (the scheduler polls the waiting callers; only it removes them, so rank 1 never sees them); a reply whose client connection fails mid-stream ends after the round (delivery failures, after johnwhited's #48) (by desy0305, PR #51) | a ninth request cancelled with 8 slots busy: acknowledged in ~0.1-0.2 s; the busy replies unchanged (two Sparks, by desy0305) || End of turn | `0075-glm-assistant-ends` | `<\|assistant\|>` ends a reply like the checkpoint's end tokens: the model sometimes started a second answer with it at high reasoning effort, and the raw token reached the reply's text (issue #60); `TF_GLM_ASSISTANT_ENDS=0` keeps the checkpoint's end tokens; the ranks check they agree at start | replies without the token unchanged |+| Loop guard | `0091-glm-loop-guard` | `TF_GLM_LOOP_GUARD=1` (off by default): a think block that collapsed into repeating itself (an exact cycle of up to 16 tokens held for 256 tokens, or one token taking half of the last 256) is closed with the thinking budget's close and the model answers from there (issues #89, #94); `usage.tensorfold.loop_guard` counts it | off: nothing changes; on: a looping reply ends instead of running to `max_tokens` || Picture cache | `0079-glm-picture-cache` | the vision frontend reads a request's pictures once, not on every turn of the chat: what reading each source cost (rows, key, digest, canvas) is kept by the source's bytes and handed back on later turns (host memory only; `TENSORFOLD_GLM_PICTURE_CACHE`, by ThomasWadeZ, #63) | 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 || Quoted markers | `0080-vision-quoted-markers` | every picture and clip of a request is marked with a per-request nonce, and a marker not behind one stays text: quoting the template's picture span in a prompt, a log or a refusal no longer counts as media, while a template or client that drops a picture is still refused (by ThomasWadeZ, #64) | a request quoting the picture span beside a real picture: 400 -> 200, the right answer || Capacity status | `0081-tfcap-capacity-status` | every capacity refusal renders the same way: 429 with `Retry-After: 5` (was a bare 503 at two sites, a 400 on the generate path) (by johnwhited, #48) | a refused request's client can back off instead of stacking |diff --git a/patches/0084-glm-loop-guard.patch b/patches/0091-glm-loop-guard.patchsimilarity index 100%rename from patches/0084-glm-loop-guard.patchrename to patches/0091-glm-loop-guard.patchdiff --git a/tools/test_loop_guard.py b/tools/test_loop_guard.pyindex 6173090..c7ffbda 100644--- a/tools/test_loop_guard.py+++ b/tools/test_loop_guard.py@@ -1,4 +1,4 @@-"""CPU-only test of patch 0084's loop guard with the real call_gate.generate_gated.+"""CPU-only test of patch 0091's loop guard with the real call_gate.generate_gated.python3 -B tools/test_loop_guard.py --source-root /path/to/patched/srcNo Torch/CUDA, sockets or source writes. Replays token streams: a clean block, an exact cycle, a mostly-"the" block,