What GLM-5.4 Loop Transformer Actually Saves: The KV, Token and Latency Ledger

Start with numbers that do not look like a model launch post. In a test published by QbitAI on 2026-11-28, the same task set took GLM-5.3 28 minutes 2 seconds and GLM-5.4 1 hour 19 minutes 9 seconds. The 43 minutes 14 seconds of difference came almost entirely from one Blender task, where one round issued 107 model requests that returned usage data against 28 for GLM-5.3. Zhipu calls the behavior marathon thinking in its 2026-11-23 technical post.

The other set of numbers is about savings. The official post says a second loop at 1M context costs one sliding window of KV cache instead of another full copy. In a 30B iso-parameter control, about 10% more training compute produced clear gains and average output length fell 10% to 14% on most benchmarks. The Hacker News thread on 2026-11-28 reached 1186 points and 388 comments; the argument was about whether the depth is free.

My take: the saved part and the spent part are separate ledgers. The saved part is KV memory and indexing. The spent part is request count in long tasks. Mix them and you get two wrong conclusions: that looping is free, or that looping is slow.

Loop Transformer is not just running the same weights twice

The official path (z.ai, 2026-11-23) starts from a pretrained GLM-5 base and turns the middle 28 layers into a two-pass weight-shared loop. Training a looped model from scratch is explicitly rejected: under the same pretraining compute it loses to ordinary stacking.

Three side effects have to be handled:

  • Gated progressive updates. Overwriting the residual stream with the second-pass candidate blows up activation norms across iterations, so downstream layers see out-of-distribution inputs. Each token and each pass gets its own write gate. Pass one writes conservatively to build global context; pass two opens wider to refine. Harder tokens get a wider first-pass gate so they benefit earlier.
  • Hybrid KV cache. The naive version stores a full KV copy per iteration. Instead, pass two reuses the global sparse KV selected in pass one and keeps only its own local sliding window. One position can therefore hold two representations at different depths.
  • Sparse attention index reuse. The base model already has an indexer. Pass two reuses its selected indices instead of rescanning the full context. The official experiments report near-identical quality to recomputing indices every pass.

A community teardown on 2026-11-28 sketches the forward pass as first 26 layers, middle 28 layers twice, last 24 layers, or 106 layer applications. It also assumes a 128-token sliding window. Those are not official parameters; the calculation below treats them as inputs, not conclusions.

KV ledger: the second pass adds one window

Translated into arithmetic, a naive second pass stores N more tokens of KV while the hybrid design stores W more, where N is context length and W is window size. Standard library only, no network.

# stdlib only; run: python kv_budget.py
CONTEXT = 1000000
WINDOW = 128
KV_PER_TOKEN = 64 * 1024

full_cache = CONTEXT * KV_PER_TOKEN / (1024 ** 3)
extra_cache = WINDOW * KV_PER_TOKEN / (1024 ** 2)
ratio_pct = WINDOW / CONTEXT * 100
factor = full_cache * 1024 / extra_cache

print("GLM-5.4 hybrid KV budget (assumed per-token KV = 64 KiB)")
print("context tokens         :", CONTEXT)
print("naive second pass full :", f"{full_cache:.2f} GiB")
print("hybrid sliding window  :", f"{extra_cache:.2f} MiB")
print("extra ratio            :", f"{ratio_pct:.4f}%")
print("saving factor          :", f"{factor:.1f}x")

Output:

GLM-5.4 hybrid KV budget (assumed per-token KV = 64 KiB)
context tokens         : 1000000
naive second pass full : 61.04 GiB
hybrid sliding window  : 8.00 MiB
extra ratio            : 0.0128%
saving factor          : 7812.5x

64 KiB per token is an example, since the real value depends on MLA compression and implementation details. Swap in your own measured number and the direction holds: at 1M context a sliding window and a full cache are not in the same league. That is how Zhipu can add depth while quoting 70 to 80 tokens per second at peak and 200 off peak.

Latency ledger: 107 requests are the marathon thinking

KV memory was saved. Time was not. In the QbitAI test, GLM-5.4 saved both animation sizes and then kept adjusting the maintenance rig and door clearance, issuing 107 usage-bearing model requests in one round. Each tool turn pulls prior code and check results back into context, so later inputs grow.

A deliberately simple model: if every new output re-enters input on the next call, cumulative input units over n requests are n(n+1)/2. The script also splits the measured wall time.

# stdlib only; run: python snowball.py
def cumulative_units(requests):
    return requests * (requests + 1) // 2

base_req, loop_req = 28, 107
base_units = cumulative_units(base_req)
loop_units = cumulative_units(loop_req)
base_sec = 28 * 60 + 2
loop_sec = 3600 + 19 * 60 + 9
extra_sec = loop_sec - base_sec
blender_sec = 43 * 60 + 14

print("Request snowball model: each new output re-enters all later calls")
print("baseline requests      :", base_req, "-> units", base_units)
print("loop requests          :", loop_req, "-> units", loop_units)
print("input amplification    :", f"{loop_units / base_units:.2f}x")
print("total time             :", f"{base_sec}s -> {loop_sec}s (+{extra_sec}s)")
print("Blender share of extra :", f"{blender_sec / extra_sec * 100:.2f}% ({blender_sec}s)")

Output:

Request snowball model: each new output re-enters all later calls
baseline requests      : 28 -> units 406
loop requests          : 107 -> units 5778
input amplification    : 14.23x
total time             : 1682s -> 4749s (+3067s)
Blender share of extra : 84.58% (2594s)

14.23x is an estimate, not vendor telemetry, but it explains the counterintuitive result: remove the Blender task and the remaining jobs only cost slightly more time while using fewer output tokens. The loop itself does not make each forward pass drastically slower. Repeated self-check plus history replay does. arXiv:2611.34112, listed on 2026-11-28, frames the same issue as not every input needing everything and proposes unifying expert gating, model cascades and agent orchestration. GLM-5.4 token-level gates are the weight-side version of that idea.

How to use it today, and three traps

As of 2026-11-28 the z.ai model API page still lists GLM-5.3 as flagship at 1.4 dollars per million input tokens and 4.4 per million output tokens. GLM-5.4 is available through ZCode and Coding Plan, and the official post says open weights wait for safety hardening. Do not point production at a model name that is not on the API page yet.

  • Route by task. Short answers, format conversion and deterministic extraction stay on a fast model. Multi-file refactors and long causal chains get the deep loop. Make depth a routing decision, not a global default.
  • Put a hard gate on tool rounds. 107 requests can mean careful verification or a loop that edits in a blocking bug. In the same test the first 3D web run ended after 704.5 seconds and five retries with no HTML, and the next output failed to parse on duplicate declarations. Cap rounds and cumulative input tokens, then hand off to a human at the limit.
  • Do not treat 2T-3T class as a benchmark result. It is an extrapolation from an iso-parameter control and Zhipu has not published full GLM-5.4 scores. Use it as a hypothesis for evaluation, not as a procurement number.

Depth is a real new axis. It replaces stacking parameters, not engineering constraints. Watch the KV ledger and the request ledger separately and the savings become visible.

Further reading

Commentaires

Ce site est uniquement frontal : pas de backend ni de compte. Les commentaires vont sur GitHub Issues, Discussions ou par e-mail.

Collez ceci dans l'issue ou l'e-mail pour m'aider à localiser le problème ; cela n'inclut rien de ce que vous avez saisi

Aussi :Voir les commentaires existants · Commentaires par e-mail (sans compte GitHub) :278975598@qq.com