Top
Best
New

Posted by foohis 3 hours ago

GLM-5.4: Toward Generalized Coding with Our First Loop Transformer(z.ai)
298 points | 135 comments
HarHarVeryFunny 6 minutes ago|
I love the transparency, or at least given technical details, that Ziphu provide - a refreshing change from the locked-down approach of the western companies, and an interesting glimpse into the direction of SOTA LLMs.

Looped Transformers are an obvious direction even if there are still problems to be worked out. The original Transformer is a bit like an unrolled for loop, and rather unnaturally pairs different sets of weights, both for attention and feed forward (knowledge) with different "layers" (aka loop iterations). Far more natural is to strive for something more like our brain's thalamo-cortical loop and association cortex, where "thought" is iterative and there are no restrictions as to what patterns/knowledge get applied when.

A similar idea has been explored before ("Universal Transformer", 2019), seemingly going nowhere, but perhaps "necessity is the mother of invention" and compute-starved Chinese companies are finding a way to make it work.

aurareturn 21 minutes ago||
For those wondering what loop transformers are:

LLMs have layers of data, called weights. During inference, each layer gets computed once. Moving weights from HBM memory to the chip is a major bottleneck because to generate a token, you need to move an entire layer into the chip, compute once, move it out, move the next layer in. Hence, memory bandwidth has been the #1 bottleneck for inference.

A loop transformer optimizes this bottleneck. Instead of one layer being computed once, it will compute the same layer multiple times, increasing the model intelligence without relying memory bandwidth as much. Bandwidth is still important, but not as much anymore.

More intelligence is squeezed by using the GPU compute that is typically sitting idle during inference.

loubbrad 9 minutes ago||
If I understand you correctly, I think you are incorrect.

Looped transformers allow models to do more compute in the forward pass for the same total parameter budget (e.g., required VRAM to store the model). This doesn't inherently optimize the memory bandwidth bottleneck. A simple way to see this is that if we reuse a layer during the forward pass, we still need to fetch its weights from HBM again, which incurs additional memory bandwidth usage.

The main advantage is more computation for a fixed parameter count and model-weight VRAM footprint, not more computation for a fixed HBM bandwidth budget.

moffkalast 2 minutes ago||
I would imagine most inference setups already use up the idle compute on a draft model, but maybe it really can be that unbalanced on some systems.
lnenad 1 hour ago||
It's becoming reaally hard using chinese models with their "marathon thinking" sessions. It's not a problem when dealing with more complex stuff but constantly second guessing themselves even when working with the simplest of things (conceptually) is very annoying and time to completion is dramatically higher compared to frontier unless you're dealing with ridiculus tps performance.

I assume it's how they get close in benchmarks but the difference is staggering when compounding over several days/weeks/months.

lesspassiveobse 1 hour ago||
With US models you just don't see the CoT. They may very well do the same thing and just have higher tok/s
Almondsetat 1 hour ago|||
Are you suggesting they somehow increase CoT tokens' speed and then cap the output one? This is not prefill vs generation, CoT and normal tokens are literally the same
stingraycharles 1 hour ago||
No, the parent is suggesting that the US labs are doing the same but just have higher overall tps speed, and as such “feel” faster.
monsieurbanana 46 minutes ago|||
He understands that, but since we can see the speed of the output tokens we know what's the speed of the cot tokens, and it's not higher than the Chinese models.
NotAnAdminIThin 41 minutes ago|||
What I think they meant is: We can measure output tps and see that it's not drastically higher so it would have to come from reasoning tps being actually higher which we cannot measure and that this would be unlikely.
instrument_67 13 minutes ago||
But it has already been established in the thread that output tps and CoT tps are the same speed. And since they're the same as that of the Chinese models (the output tps), you can't attribute the difference in speed to that.
lnenad 1 hour ago||||
Do they have an order of magnitude higher tps (500+)? If they don't the comparison reveals different quality of reasoning.
lesspassiveobse 1 hour ago||
I would say so. I didn't look at the numbers, but in claude code the thinking tokens counter increases at ~400/s by eye, and on the full GLM and Kimi APIs I get ~40/s IIRC, deepseek and glm-flash are a bit faster. But I don't know how claude replies actually work, if they launch subagents and do batching if they do multiple passes on the CoT and summarize it, etc. so I guess it's not directly comparable.
qeternity 1 hour ago||||
Unless OpenAI is lying about the number of reasoning tokens for billing purposes, empirically we know this is not true.

If you look at the "cost per task" metrics, OpenAI is very low because their models use far fewer reasoning and output tokens for a given task.

Topfi 38 minutes ago||
That is true, though their reasoning efficiency is less connected to reduced second guessing and more due to their willingness to train the model to reason using extremely shortened, barely coherent gibberish [0].

That's also why Anthropic doesn't get the same, they value the ability to somewhat audit the model via CoT in coherent English over possible efficiency gains. Considering OpenAI models recent issues from compaction during 5.5 and long running task deviation in all models since, which in part was responsible for the HF incident [1], it seems a wise policy.

I am fairly unconvinced that readable CoT makes a models approach to task solving easier to audit given more recent developments, but wouldn't be surprised if OpenAI in future models backtracks on this to some extent.

Because nowadays reasoning from US labs are pretty locked down, how much these models backtrack before the final output is difficult to say as an outsider.

[0] https://www.reddit.com/r/OpenAI/comments/1vd3wfp/gpt56_sol_r...

[1] https://openai.com/index/hugging-face-incident-and-the-road-...

zozbot234 19 minutes ago||
> extremely shortened, barely coherent gibberish

Qwen 3.8FN has caveman-style CoT too. DS4.1F and Kimi are better, GLM is quite readable (and more verbose). It will be interesting to see what happens to the CoT in GLM 5.4 with the new looping. With the Inkling small looped model, more looping resulted in a cleaner CoT with trimmed dead ends, but did not hide any meaningful step; but obviously GLM is a very different starting point.

Starlevel004 1 hour ago|||
I've had GPT models occasionally leak their thinking into the regular channel and they definitely don't overthink like the Chinese models do. Even on medium GLM or Deepseek can spend 10+ minutes in a single thinking block.
irthomasthomas 51 minutes ago|||
You can just set reasoning_effort: low.

Also, I don't know why you're singling out Chinese models here. Look at Fable 5.2: "The output tokens per task just exploded. From 118k tokens (46k Answer/71k Reasoning) in 5.1 to 274k tokens (81k Answer/192k Reasoning) in 5.2." https://news.ycombinator.com/item?id=50432202

I suspect this comes down to the so-called anti-distillation changes, where they dropped retained reasoning so you can't see what the models are actually thinking. I say "so-called" because these changes conveniently showed up right after that paper came out on Opus 4.8's decoded reasoning, which proved the models were cheating on the benchmark questions they tested.

romanovcode 45 minutes ago||
He calls them out because Chinese models output their thinking word for word so you see what it thinks, and it thinks a lot
skew-aberration 1 hour ago|||
It's an artifact of naive RL. If you only reward pass/fail, then the only axis for improvement is for the AI to become more paranoid and hedge every bet in its reply. Being compute constrained, they presumably have less resources to tune their pipeline.
seertaak 1 hour ago|||
I can confirm the same annoying behaviour with MiniMax. It's exactly how you describe it: marathon thinking even for simple tasks that with, say, Sonnet or Opus would yield an answer almost immediately. I still use the Chinese models simply because I already have coding plans, but I use them for "background" tasks - and not the hardest ones at that.
throwa356262 1 hour ago||
I am surprised to read this.

GLM and Kimi are well know to think a lot, but I never had this problem with minimax. At least not with M3, but things maybe have changed in M3.1?

nialv7 1 hour ago|||
there are techniques that can stop this: https://bottlecapai.com/post/thinkingcap-qwen3-6-27b/ https://huggingface.co/ukisai/Swift-Qwen3.8-27b

turns out long reasoning may not be necessary for performance

segmondy 9 minutes ago|||
No one is forcing you to use it. You have American models.
yukai 1 hour ago|||
just set the thinking level lower. though the amount of tokens that claude gives to user is much less, chinese models are still a good for same work in most cases
reachableceo 46 minutes ago|||
GLM hasnt done this for a long time. This is a classic trope response that’s constantly torotted out at every GLM release.

And when GLM was doing it , a simple modification to the system prompt to tell it not to was sufficient.

cyanydeez 16 minutes ago|||
Skill issue. Add thinking budget and message, improve your harness to add it dynamically.
hologramofham 1 hour ago|||
> unless you're dealing with ridiculus tps performance.

They can have those tps reports on the manager's desk in no time at all.

nxpnsv 20 minutes ago|||
I get "annoying" but "reaally hard" I feel is an overreaction.
holoduke 38 minutes ago|||
Looping and reevaluating is a thing all AI models or systems in front of it are doing. It's not only Chinese. The difference is that US models are running in much better hardware conditions.
epolanski 1 hour ago|||
Every model does this, the difference is that for Chinese models you see the thinking trace in full ;)

By the way I agree that speed and consistent re-thinking of their own rationale is an issue in LLMs, but then I wonder: what is the meaningful difference between model A thinking for 4 minutes and model B thinking for 5? Both lead to the same hop on-hop off interaction style and to the same experience.

anon373839 1 hour ago|||
I don’t see this with Flash Next - using Nvidia’s quant, vLLM, and the exact sampling parameters recommended by Alibaba. The CoT explores alternate paths and checks assumptions, but not excessively. And for simple turns, it often basically just skips CoT (emitting only a short sentence like “Let me do X.”) Consequently, I leave the model set to xhigh and I don’t have any problem doing that.

However, when I’ve tried out some community quants or new serving engines such as TensorFold (which doesn’t accept all the required sampler params), then I’ve encountered disorganized CoT. So it makes me wonder how much of these problems come down to issues with how the models are served.

Majromax 10 minutes ago||
> I don’t see this with Flash Next - using Nvidia’s quant, vLLM, and the exact sampling parameters recommended by Alibaba.

Conversely, I do see this sort of behaviour with Flash Next, under sglang hosting, the official FP8 quantization, and the recommended sampling parameters. 3.8 Flash-Next appears to be a bit better about this problem than 3.8-27b, but beyond a certain level of task complexity the model becomes very introspective. This can also cross multiple turns; I've seen 100k+ tokens burned in a "plan, verify, re-plan, re-verify" loop before manual interruption.

Quantitatively, about 58% of all output tokens appear to be reasoning tokens, during agentic work where the average session had about 90k output tokens in total.

In addition to the verbose thinking, I also see reversion to RL-training recitation during thinking in 'boring' sections. Where one tool call follows another without much logic in between, more often than not I see a pro forma block like 'The user has repeated their last message. I must use the audit tool to accurately report my thinking.' Once in a while it decides it's solving a logic problem; I've seen the Pigeonhole Principle spontaneously invoked a few times.

lnenad 1 hour ago||||
I am not saying Opus doesn't reason :). And in my experience the difference is much greater than 4 vs 5 minutes. I'm seeing often that for simple things that take Opus/Sonnet seconds, the Chinese models I am testing (DS4.1, Hy4 flash, Qwen FN) take 10+ minutes.
sorrywhat 32 minutes ago|||
I'm not sure that's the case. I haven't seen even the smaller US models get stuck in a thinking loop, while with DS models I often get thinking traces that look like

  Now foo.cpp:
  <1000 lines>
  Wait, no.
  <the same 1000 lines with 1 change somewhere in line 359>
  Let me reconsider.
  <the same fucking 1000 lines>
  OK, finalizing.
  <the same 1000 lines>
  Now write the file:
  </thinking>
  <TOOL CALL: write the 1000 lines>
grumple 45 minutes ago|||
I feel the same way about the latest American models. They’ve all gotten really slow and ponderous.
zozbot234 1 hour ago|||
Thinking levels are adjustable, just don't use the max level unless you're willing to wait. Closed models second-guess and gaslight themselves just as much btw, they just hide that thinking from you because it's such a blatant model welfare concern and they like to pretend that Claude and Astra are happily "flying, dancing and sparkling" while they do things on your behalf. Not so fast!
lnenad 1 hour ago||
Comparing performance between reasoning levels shows a significant drop in Chinese models so you are kind of forced to use max to get the results you need. So I am comparing max levels. It's night and day in time to completion.

BTW I am a big proponent of open models. I have a homelab. I am also consistently annoyed when asking DS4.1 to change something simple and see it run around in circles over a trivial change that takes 10/15 minutes compared to a few seconds it takes for Opus/Sol to do it. I have 60tps on DS, so unless Opus is 1k tps the difference doesn't make sense (take note I'm not comparing capability, I know these are very different sized models, I'm looking at simple use cases, simple changes). I ran GLM5.3 getting 25tps as well. The speed (naively) seems to be enough, but since it's reasoning too much it's fairly useless unless you really want something complex and the time makes sense.

ranguna 1 hour ago||
You said so yourself:

> It's not a problem when dealing with more complex stuff but constantly second guessing themselves even when working with the simplest of things

Just be mindful what you choose and don't leave reasoning on max all the time.

lnenad 1 hour ago|||
I mean is it fair to say that it shouldn't take 10 minutes for simple things even on max reasoning when it takes frontier 30 seconds?
viraptor 37 minutes ago||
Max means slightly different things from different providers, but often it's literally raising the lower threshold for stopping rather than the higher threshold. That is, max is often made by design to overthink and score high on benchmarks. But it's not made for most normal requests.
vachina 1 hour ago|||
This is true. I have GPT Luna on Max sometimes it will spend almost 2 minutes trying to do a small refactor.
zhengzefeng 1 hour ago||
[flagged]
lewdwig 1 hour ago||
“Generalized coding” working effectively beyond domains that would not be traditionally attacked by code to me feels like models working around the limitations of harnesses and the context window. If they externalise their reasoning as code, it will survive compaction and context decay by becoming a durable artifact.

It’s cool that models can do this, but I think it also shows harnesses still have significant weaknesses around long term memory and context, necessitating models use what is essentially a code-as-long-term-memory hack.

xscott 38 minutes ago|
I'm sure harnesses will continue to advance, but I think training the models to do more of their thinking in code is a great thing regardless.

The silly example is writing a line of Python to count the Rs in strawberry, but people have moved on from that. I saw a video where the guy pointed out they're getting better at chess, but not great yet. If he had asked it write a chess engine (or if it had chosen to do that on its own), the model would be amazing at chess.

Lean is showing the potential for using code in the math domain. We have more trust in the compiler than we do the models. What are other non-programming areas where we could have "compilers" for the model?

Even if we restrict it to code, I'd rather the model did some trial and error experiments on the side (possibly with a sub-agent) than read pages of its thinking process where it keeps second guessing itself to make zero errors on the first try.

lineshogan 17 minutes ago||
I still don't understand the point of loop models. All their benefits seem theoretical, such as passing information beyond language across decoding steps. But all their drawbacks are practical. For example, you essentially need a fixed number of loops; otherwise, serving becomes much more challenging.

They don't save training compute or inference compute either. The only real advantage I can see is that they allow continued pretraining.

And as for GLM, I'd argue that it's little more than weight sharing rather than looping in the usual sense, since its architecture is tightly coupled to the specific design of the second loop pass.

segmondy 7 minutes ago||
Read the blog, they showed a 750B model will match a 2000B-3000B model while increasing intelligence.
throwa356262 11 minutes ago||
The announcement is surprisingly honest about this. They mention their current issues but also highlightimprovements, for example:

    On a 30B model [...] with identical parameter counts and only ~10% more total training compute, the looped version showed clear gains.

Also, looped architecture translates to fewer weights which is good if your hardware is limited to older generations with less memory. Sounds like a no-brainer for China?
maelito 3 minutes ago||
How much times till Mistral hosts it ?
w2seraph 1 hour ago||
Personally can't get enough of my cyber experiments regarding these somewhat more lax models. Good on you GLM.
lesspassiveobse 1 hour ago|
They said in the release notes that they will only release weights after nerfing cyber. So the open version will be different from the API version, and the smarter API version will just have input/output prefiltering using some other model most likely.
zozbot234 1 hour ago|||
> So the open version will be different from the API version, and the smarter API version will just have input/output prefiltering using some other model most likely.

None of these things were mentioned, they only talked about a safety review. GLM 5.x is a comparatively smaller model (vs. K3 or Qwen Max) and it's not obvious that even the raw weights would pose any such concern.

lesspassiveobse 1 hour ago||
>Open Weights: We plan to open-source the model weights responsibly after completing necessary safety hardening. This sounds to me like modification and not just a review.
AIShill101 1 hour ago|||
Just nerfs is good I think. The worst case is the chinese export controls that prevent training on cyber stuff.

You can't abliterate a model that never learnt cyber testing. But this 5.4 release I think within a few weeks will be good for cyber stuff.

dingaling911 1 hour ago||
So they're just embedding the "thinking" loops in the LLM architecture itself? Also, it seems like they just loop "twice" so how does it get stuck in marathon thinking? What am I missing?

Why not just leave that up to the harness? I guess performance. But no benchmarks.

nialv7 1 hour ago||
no. it's a more efficient way to increase network depth without adding more parameters. if you think this is embedding "thinking" then transformers are already embedding thinking.
dingaling911 1 hour ago||
OK that makes more sense.
ytxm 1 hour ago|||
Looping on hidden state matrices and looping on single tokens are very different things. And the benchmarks were included in the post.
grim_io 1 hour ago||
The benchmarks are from an unspecified 30B model based on the same architecture.
jdb9001 53 minutes ago||
those would be very, very grim benchmarks for the full model.
samrus 1 hour ago||
No its looping on hidden states. Basically RNNs
theanonymousone 10 minutes ago||
Shouldn't we have price and benchmarks as fist things in such announcements? Could there be a reason they omitted?
maelito 6 minutes ago|
How independent is z.ai from the Chinese regime ?
More comments...