Skip to content
GLM-5.4 runs the same 28 layers twice instead of adding more layers A side-by-side diagram. On the left, a standard transformer sends a token through 28 layers once, left to right. On the right, Z.ai's GLM-5.4 Loop Transformer sends the token through the same 28 layers, then loops back through them a second time before producing output, adding reasoning depth without adding parameters. Same 28 layers. Run twice. GLM-5.4's Loop Transformer trades compute per token for depth, not more parameters. Standard transformer Token in 28 layers one pass, left to right Output To reason deeper, add more layers: more parameters. GLM-5.4 Loop Transformer Token in same 28 layers 2 passes, gated updates loop Output To reason deeper, loop the same layers: zero new params. Source: Z.ai, "GLM-5.4: Toward Generalized Coding with Our First Loop Transformer," Nov 23, 2026.
Guideintermediate

GLM-5.4's Loop Transformer: setup, pricing, and when to actually reach for it

Published November 27, 2026 · by

The short version

Z.ai's GLM-5.4 runs the same 28 layers twice instead of stacking new ones. Here's what the Loop Transformer architecture buys you, what the GLM Coding Plan costs, how to point Claude Code at it, and where it falls apart.

Table of Contents

GLM-5.4's Loop Transformer: setup, pricing, and when to actually reach for it

Z.ai didn't make GLM-5.4 bigger. It made the same 750-billion-parameter model think twice, literally: the same block of 28 layers runs over the hidden state a second time before the model produces an answer. No new weights, no bigger checkpoint, just a second pass through the layers it already has. Z.ai calls this a Loop Transformer, and the company claims it gets GLM-5.4 to "intelligence levels comparable to 2T-3T parameter models" on long-chain reasoning work like large codebases, security review, and CAD/3D design (per Z.ai's launch post, Nov 23, 2026).

The one thing worth knowing before you spend an afternoon on it: this is live today in Z.ai's own GLM Coding Plan, ZCode, and Z.ai Chat, with a paid tier starting at $18 a month. The API and the open weights are both still pending, so if you were hoping to download this one and run it yourself, that's not an option this month, and Z.ai hasn't given a date.

Z.ai's GLM-5.4 launch post, dated November 23, 2026, describing the Loop Transformer architecture and the model's "marathon thinking" limitation Source: z.ai, captured November 27, 2026.

What "running the same layers twice" actually does

A standard transformer sends a token through every layer once, left to right, and that's it. If a task needs more reasoning steps than the model has depth, the only way to get them is to write out a longer chain of thought in text, which costs output tokens and latency, or to train a bigger model with more layers.

GLM-5.4 loops 28 layers of the GLM-5 base model for two iterations at the 750B scale, adapted from an already-pretrained checkpoint through continued training rather than trained from scratch (per Z.ai). The second pass doesn't just repeat the first. Z.ai made three changes to make a second pass through the same weights actually useful instead of just noisy:

  • Gated progressive updates. Each iteration gets its own per-token gate that controls how much of the new computation gets written back into the residual stream. The first pass writes conservatively, building global context without blowing up the activation scale; the second pass opens the gate and writes a full update, refining what the first pass built. Harder tokens get a more aggressive first-pass write.
  • Hybrid KV cache. A naive implementation would double the KV cache cost with every loop. GLM-5.4 instead reuses the first pass's sparse KV selection and only adds a local sliding window for the second pass, so an extra loop costs one sliding window, not a second full context cache. Z.ai says this keeps the cost increase over GLM-5.3 "well under control" at 1M-token context.
  • Sparse attention index reuse. The second loop reuses the first loop's attention indices instead of recomputing them, which Z.ai says performs "nearly identically" to a fresh index pass at effectively zero overhead.

The controlled evidence for any of this isn't GLM-5.4 itself: it's a separate 30B-parameter test model. Z.ai ran an iso-parameter ablation, looped versus non-looped, same parameter count, about 10% more training compute for the looped version. The gains concentrated in math, science, and long-context tasks, and average output length dropped 10 to 14% on benchmarks like GPQA-Diamond and MMLU-Pro, which Z.ai frames as reasoning moving from explicit chain-of-thought tokens into the loop's implicit depth. That's a real, specific result. It is also not a benchmark of the model you'd actually be running, which Z.ai's own post doesn't hide: it says the 2T-3T comparison and the win-rate chart against three unnamed competitors don't come with a published methodology (per VentureBeat, Nov 23, 2026).

GLM-5.4 also adds vision input (GLM-5.3 was text-only), a 1M-token context window, and a max output of 128K tokens, with Z.ai reporting throughput up to 200 tokens/second off-peak and 70-80 tokens/second at peak load (per Z.ai's launch post).

What it costs: the GLM Coding Plan

GLM-5.4 isn't a separate product. It's a model you select inside the existing GLM Coding Plan, which also covers ZCode (Z.ai's own IDE) and 20-plus third-party agent tools.

PlanMonthly (billed monthly)Monthly (billed yearly, 30% off)5-hour creditsWeekly creditsSource
Lite$18$12.602,00010,000z.ai/subscribe
Pro$80$5612,00060,000z.ai/subscribe
Max$168$117.6028,000140,000z.ai/subscribe

Z.ai GLM Coding Plan pricing tiers Lite, Pro, and Max, showing yearly billing discounted to $12.60/$56/$117.60 per month against monthly list prices of $18/$80/$168 Source: z.ai, captured November 27, 2026; credit quotas per Z.ai's GLM Coding Plan docs.

For weekly-quota plans, GLM-5.4's quota runs 1.5 times what GLM-5.3 got on the same plan (per Z.ai's GLM Coding Plan docs), which in practice means the Lite tier now covers roughly 72 to 146 million tokens a week at a 95% cache hit rate, Pro covers 440 to 870 million, and Max covers just over a billion to just over two billion. General API pricing hasn't been announced; GLM-5.3's API rate for reference was $1.40 per million input tokens and $4.40 per million output tokens (per VentureBeat), and GLM-5.4 isn't on that pricing page yet.

Turning it on in Claude Code

If you already run Claude Code with a GLM Coding Plan subscription, switching the default model to GLM-5.4 is a three-line edit to your settings file, not a new integration (per Z.ai's model-switching guide, fetched Nov 27, 2026).

# macOS/Linux, with Claude Code already installed and working
${EDITOR:-nano} ~/.claude/settings.json

Add or update these keys (keep any other fields in the file as they are):

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "your_zai_api_key",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.4[1m]",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.4[1m]",
    "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000"
  }
}

The [1m] suffix is the switch that turns on the full 1M-token context; drop it and you get the default context window instead. Start a new terminal window for the change to take effect, launch claude, and run /status. It should list your edited settings.json as the settings source and glm-5.4[1m] as the active model. Thinking intensity is a separate control: type /effort inside a session to move between low, high, and max, with max as the documented default for coding work.

Other OpenAI-compatible agents (Cline, OpenCode, Crush, Goose, and the rest of the 20-plus supported list) point at https://api.z.ai/api/coding/paas/v4 as the base URL instead, using the same API key. If you'd rather skip config files entirely, ZCode (zcode.z.ai) and Z.ai Chat (chat.z.ai) both let you pick GLM-5.4 from a model dropdown with no environment variables at all. That's the lower-friction path if you just want to try it before wiring it into a CLI workflow.

Where it actually breaks

Z.ai's own post names one failure mode directly: GLM-5.4 can get stuck in "overly long marathon thinking loops," burning reasoning tokens without converging, even though the same prolonged self-correction is what buys its accuracy gains in the first place. That's not a hedge, it's the tradeoff the whole architecture makes, and it shows up in independent testing from launch day.

AICodeKing ranked GLM-5.4 seventh on his KingBench 4 coding benchmark. At maximum reasoning effort it took 431 minutes and 1,128 steps to complete the suite, against 109 minutes and 244 steps for Google's Gemini 4 Neon (per VentureBeat, citing AICodeKing's post on X). His recommendation wasn't to drive with it: "I wouldn't recommend you to just use this model but keeping it as a reviewer for work and making it work on more complex architecture or searching for bugs, security vulnerabilities is really worth it imo." On the other end, Migel Tissera reported GLM-5.4 completing a multistep remote-code-execution chain as a black-box attacker against a private lab environment, and a Reddit r/LocalLLaMA poster called it strong at coding and "absolutely garbage" outside it, adding that it spends roughly half its chain of thought second-guessing whether a request is acceptable to answer.

None of that is surprising given GLM-5.3's own history: it shipped in August 2026 with what Z.ai called advanced cyber capabilities and reportedly already found a real vulnerability in Cursor. GLM-5.4 inherits that lineage. Treat it as a reviewer and a security tool first, a primary driver second, until the marathon-loop problem gets fixed.

The alternatives, briefly

GLM-5.4 landed the same week Thinking Machines Lab shipped Inkling 2 Mini, an open-weight, Apache 2.0, 26.4-billion-parameter looped-transformer model small enough to run on a 32GB MacBook Pro, which Thinking Machines says ties Alibaba's 27B dense flagship on aggregate intelligence while running roughly four times faster and six times cheaper per task. Same idea, opposite end of the scale: if you want the Loop Transformer trick without a subscription, that's the one to try first, not GLM-5.4.

For open weights at GLM-5.4's own scale, Moonshot AI's Kimi K3.1 Pro shipped in early November as a 2.8-trillion-parameter mixture-of-experts model with a 1M-token context window, downloadable today under a Kimi-specific license, no subscription required. And for closed frontier coding work where the marathon-loop problem isn't a concern, Claude Opus 5.5 is still the model the community keeps measuring GLM-5.4 against, not the other way around; nobody in the launch-day reaction thread claimed GLM-5.4 had closed that gap.

The call

Subscribe to GLM-5.4 if you already run a GLM Coding Plan or are open to one, and you want a second opinion on hard bugs, security review, or an architecture decision, something to point at a diff and ask "what's wrong with this" rather than something to write the diff. The Lite tier is a cheap second reviewer to bolt onto Claude Code. Skip it if you need a fast daily driver: the same depth that catches a vulnerability also means a 431-minute benchmark run, and nothing about "marathon thinking" sounds like a model you want standing between you and a quick fix before lunch. And if open weights or a lighter footprint matter more than raw capability, Inkling 2 Mini or Kimi K3.1 Pro are the ones to download this week; GLM-5.4's own weights aren't going anywhere until Z.ai finishes its safety hardening pass, with no date attached.