GLM-5.2: The Open-Weight Model That Beats GPT-5.5

How Zhipu AI's IndexShare mechanism makes 1M-token inference practical — and why the open-source community is paying attention.

This article covers GLM-5.2, released by Zhipu AI (Z.ai) under a permissive MIT license. Figures are from the official Z.ai announcement; a few conceptual diagrams are original illustrations built to reinforce the mechanics, and are labelled as such.

Introduction

For most of the last two years, the story of frontier AI was a story of closed labs. The best models lived behind APIs, their weights guarded, their architectures described only in vague blog posts. Open-weight models were the plucky underdogs — good enough for hobbyists, never quite good enough to threaten the leaders.

GLM-5.2 is the model that makes that framing feel out of date.

Released by the Chinese lab Zhipu AI under a permissive MIT license — no regional limits, no usage restrictions — GLM-5.2 is, by Z.ai’s evaluations, the highest-ranked open-source model. It quadruples its predecessor’s context window from 200K to 1M tokens, and on long-horizon coding tasks it slots in between Claude Opus 4.7 and 4.8 while beating GPT-5.5. You can download the weights, run them on your own hardware, and use them commercially.

The most direct way to see what changed is to look at agentic coding performance as a function of how much the model is allowed to “think”:

Agentic coding performance by effort level — GLM-5.2 vs GLM-5.1 vs Claude Opus 4.7/4.8
Figure 1 (Z.ai). Agentic coding score versus average output tokens per task. GLM-5.2's three effort levels (Non-Thinking → High → Max) trace a curve sitting between Claude Opus 4.7 and 4.8, and a large jump over GLM-5.1. Spending more tokens (Max effort) buys higher scores.
1M
token context window
(up from 200K)
2.9×
lower per-token FLOPs
at 1M context (IndexShare)
MIT
open-source license
no regional limits

The interesting question is not that GLM-5.2 is good — plenty of models are good. It’s how a model with a million-token context window can be served cheaply and quickly enough to be practical. The answer is a cluster of efficiency tricks built on top of sparse attention — IndexShare, KVShare, and a sharpened Multi-Token Prediction head. This article walks through the architecture, builds intuition for IndexShare with a hands-on visualizer, looks at the real benchmarks, and ends with what the community actually said.

Architecture for 1M Context

When GLM-5.2 extends the maximum context from 200K to 1M tokens, the primary inference bottleneck shifts away from raw computation toward KV-cache capacity and long-context kernel overhead. The architecture is a redesign aimed squarely at that shift. Z.ai’s own diagram captures the three moving parts:

Architecture changes in GLM-5.2: DSA blocks with and without indexer, IndexShare, shared KV cache, MTP modules, lower FLOPs, higher MTP acceptance length
Figure 2 (Z.ai). The GLM-5.2 architecture. The main model is a stack of DSA (sparse-attention) blocks; only some blocks compute the indexer — the rest reuse top-k indices (IndexShare). A shared KV cache (KVShare) feeds the Multi-Token Prediction (MTP) heads. The result: 2.9× lower single-token FLOPs and a 20% higher MTP acceptance length.

Underneath, GLM-5.2 is a Mixture-of-Experts (MoE) model: rather than running every parameter on every token, it routes each token through a small subset of “expert” feed-forward networks — you get the knowledge capacity of a huge model at the inference cost of a much smaller one. (Independent analyses put it at roughly 744B total parameters with ~40B active per token.) Conceptually:

token router top-k experts Expert 1 (active) Expert 2 Expert 3 (active) Expert 4 … 100s more weighted sum
Figure 3 (illustration). Mixture-of-Experts routing. A lightweight router selects a small number of experts per token (highlighted), so only a fraction of the total parameters fire on any token.

On top of the MoE backbone, GLM-5.2 builds on two ideas from the DeepSeek sparse-attention lineage:

DSA is what makes long context affordable in principle. But it has a hidden cost, and closing that cost is exactly what GLM-5.2’s headline contribution does.

The IndexShare Trick

Here is the subtle problem with sparse attention. The expensive part of dense attention — comparing every query against every key — doesn’t fully disappear. To decide which top-k tokens to keep, the indexer still has to score the query against all previous tokens. That scoring step is itself an $O(n)$-per-token operation, and crucially, standard DSA recomputes it in every single layer.

At a 1M-token context with ~90 layers, that indexer becomes the dominant cost. You are paying to re-rank a million tokens, ninety times over, for every token you generate.

GLM-5.2’s insight is almost embarrassingly simple: the set of relevant tokens doesn’t change much from one layer to the next. So why recompute it every layer?

IndexShare in one sentence: run the full top-k indexer only once every four layers, and let the next three layers reuse the same selected token indices.

Concretely, layers are grouped in fours. The first layer of each group computes the indexer and picks the top-k tokens; the remaining three layers skip the indexer entirely and attend over the indices their group-leader already chose. That eliminates the indexer’s dot-product and top-k computation in three out of every four layers.

Standard DSA — indexer every layer L1 ⌕ L2 ⌕ L3 ⌕ L4 ⌕ IndexShare — indexer once per group of 4 L1 ⌕ L2 ↺ L3 ↺ L4 ↺ ⌕ = compute indexer (expensive)   ↺ = reuse indices (free)
Figure 4 (illustration). IndexShare. Filled blocks recompute the top-k indexer; outlined blocks reuse the indices chosen by their group leader. Three of every four layers skip the most expensive step.

How much does this save? Let $D$ be the per-layer compute that is roughly independent of context length (the MLA projections and the MoE feed-forward), and let the indexer cost scale with context length $n$. For a model of $L$ layers with index groups of size $g$, the per-token compute is:

$$ \text{Standard} = L\,(D + \alpha n), \qquad \text{IndexShare} = L\,D + \frac{L}{g}\,\alpha n $$

The reduction factor is therefore $\dfrac{D + \alpha n}{D + \alpha n / g}$. When the context $n$ is small, the indexer is negligible and the two are basically equal. But as $n$ grows, the $\alpha n$ term dominates and the ratio approaches $g$. At a 1M-token context with $g = 4$, GLM-5.2 reports a 2.9× reduction in per-token FLOPs — most of the way to the theoretical 4× ceiling.

The cost of sharing is staleness. A layer reusing indices from three layers back can miss a token that only just became relevant. GLM-5.2's answer is empirical: it trains with IndexShare from mid-training (at a 128K sequence length) so the model learns to work within the constraint. The result still outperforms the previous version on long-context benchmarks while using less compute.

Interactive: The IndexShare FLOPs Visualizer

The interactive below lets you feel the scaling. Drag the context length to see how the indexer’s cost takes over at long context, and drag the group size to trade compute savings against index freshness. Group size 1 is plain DSA (no sharing); group size 4 is GLM-5.2’s choice.

Standard DSA
IndexShare
2.9×
fewer per-token FLOPs — 66% saved ·

Relative per-token compute in a simplified model (L = 92 layers). The 2.9× figure at 1M tokens with group size 4 is anchored to Z.ai's reported number; the curve illustrates the scaling, not exact hardware FLOPs.

Notice two things. First, at short context the two bars are nearly identical — IndexShare buys you almost nothing on a 4K prompt. Its entire value is unlocked at long context, which is precisely the regime GLM-5.2 targets. Second, pushing the group size past 4 keeps shrinking the bar, but Z.ai stopped at 4: beyond that, index staleness starts to hurt quality more than the compute saving is worth. Z.ai’s own measurement of single-token FLOPs versus position confirms the scaling — the gap between GLM-5.1 and GLM-5.2 widens with context length, reaching the headline 2.9× at 1M tokens (the right-hand panel of Figure 2).

KVShare and Multi-Token Prediction

IndexShare cuts the indexing cost, but two more changes do the heavy lifting for real serving.

KVShare lets the Multi-Token Prediction module reuse the main model’s KV cache instead of maintaining its own — important because, past 200K tokens, the bottleneck is no longer compute but KV-cache capacity.

Multi-Token Prediction (MTP) is GLM-5.2’s speculative-decoding engine. A small MTP head drafts several future tokens at once, which the main model then verifies in a single pass — accepted drafts are free speed. GLM-5.2 retrains this head with two goals: minimize the draft loss and maximize the acceptance rate. With the number of MTP steps set to 7, the acceptance length rises ~20% over the baseline (from 4.56 to 5.47 accepted tokens per step in coding scenarios — see the right panel of Figure 2). IndexShare is applied to the MTP layer too: the indexer runs on the first speculative step and the rest reuse its indices.

Multi-Token Prediction: an MTP layer drafts future tokens from embeddings and hidden states across two steps
Figure 5 (Z.ai). How the MTP head drafts ahead. Each step feeds token embeddings plus hidden states (from the target model and earlier MTP steps) into a shared MTP layer to predict the next token, which the main model later verifies in bulk via speculative decoding.

The payoff: throughput at long context

These tricks compound. Because GLM-5.1 simply runs out of context past 200K, the only fair comparison at extreme length is GLM-5.2 against itself at shorter lengths — and the throughput advantage grows steadily as sequences get longer.

Normalized engine throughput across sequence lengths: GLM-5.2 reaches 6.97x at 1024k tokens
Figure 6 (Z.ai). Normalized engine throughput by sequence length (relative to GLM-5.1 at 32K). GLM-5.2's advantage climbs from 1.03× at 32K to 6.97× at 1024K tokens; GLM-5.1 is out of context (OOC) beyond 200K. Long-context inference is exactly where the architecture pays off.

Benchmark Results

Across eight standard LLM benchmarks evaluated at maximum thinking effort, GLM-5.2 improves on GLM-5.1 by a wide margin and closes much of the gap to the closed-source frontier. The clearest single jump is on Terminal-Bench 2.1 (81.0 vs. 63.5), landing within a few points of Claude Opus 4.8 (85.0). On SWE-bench Pro it scores 62.1 (vs. 58.4 for GLM-5.1), and it leads the comparison set on MCP-Atlas (77.0).

BenchmarkGLM-5.2Key comparisonWhere it lands
Terminal-Bench 2.181.0Opus 4.8: 85.0Within ~4
MCP-Atlas77.0Leads the setBest
SWE-bench Pro62.1GLM-5.1: 58.4Beats prior
FrontierSWE (20h)74.4GPT-5.5: 72.6 · Opus 4.8: 75.1Beats GPT-5.5
PostTrainBench34.3GPT-5.5: 25.0Beats GPT-5.5
SWE-Marathon13.0GPT-5.5: 12.0Edges GPT-5.5
LLM performance across 8 benchmarks: GLM-5.2 vs GLM-5.1, Claude Opus 4.8, GPT-5.5, Gemini 3.1 Pro
Figure 7 (Z.ai). Eight benchmarks (SWE-bench Pro, Terminal-Bench 2.1, NL2Repo, DeepSWE, ProgramBench, MCP-Atlas, Tool-Decathlon, Humanity's Last Exam), all at maximum thinking effort. GLM-5.2 (blue) consistently clears GLM-5.1 (green) and competes with Claude Opus 4.8, GPT-5.5, and Gemini 3.1 Pro.

Why do these long-horizon numbers matter more than the standard benchmarks? The more telling test is long-horizon coding — multi-step tasks, run over many hours, where the model must plan, write, run, and revise across very long sequences. This is the regime the 1M context and IndexShare were built for, and it’s where GLM-5.2 separates itself from the open field and beats GPT-5.5.

The architecture and the scores tell one story. IndexShare and KVShare exist to make million-token context cheap; long-horizon coding is the task that actually needs million-token context. The efficiency work is not a side quest — it is what turns a high leaderboard score into a model you can run for twenty hours on one problem.
Long-horizon task evaluation: FrontierSWE, PostTrainBench, SWE-Marathon results
Figure 8 (Z.ai). Long-horizon evaluations. On FrontierSWE (max 20 hrs) GLM-5.2 scores 74.4% — ahead of GPT-5.5 (72.6%) and Opus 4.7 (63.0%), just behind Opus 4.8 (75.1%). It similarly leads GPT-5.5 on PostTrainBench (34.3% vs. 25.0%) and edges it on SWE-Marathon (13.0% vs. 12.0%). Claude Opus 4.8 remains the overall leader.

To make that capability usable, GLM-5.2 exposes selectable thinking-effort levels — Non-Thinking, High, and Max — that trade latency for depth (Figure 1). Z.ai recommends Max for complex multi-step coding where the model needs to plan and revise across long sequences, and lighter levels for everyday use.

The cost story: with open MIT weights and (per independent listings) API pricing around $1.40 / $4.40 per million input/output tokens, GLM-5.2 is priced to be run, not just admired. It is one of the first models where "self-host the frontier" is a genuinely realistic sentence.

What the Community Said

The reception was warm but not uncritical. The lead thread on Hacker News drew 373 points and over 450 comments, and the discussion is more revealing than any benchmark.

The dominant note was gratitude to Chinese labs “for being open with their work” — a recurring theme as Western frontier labs tighten access. For many developers, GLM-5.2 is less a single model than evidence that the open-weight ecosystem is keeping pace.

The sharpest technical discussion wasn’t about IndexShare at all — it was about Z.ai’s slime asynchronous RL training framework. One widely-upvoted comment argued that “the actual gap between frontier and non-frontier models right now is RL infrastructure, not pre-training compute.” If that’s true, an openly-described RL stack may matter more in the long run than any single architecture trick.

The criticism was honest too:

Key Takeaways

1
Open weights reached the frontier. GLM-5.2 is MIT-licensed, ranks as the highest open-source model on Z.ai's evaluations, and beats GPT-5.5 on long-horizon coding while sitting between Claude Opus 4.7 and 4.8.
2
IndexShare is the enabling trick. Reusing sparse-attention indices across groups of four layers cuts per-token FLOPs by ~2.9× at 1M context — the savings that make million-token inference affordable.
3
The savings are a long-context phenomenon. At short context IndexShare barely helps; its value scales with sequence length, which is exactly where GLM-5.2 competes.
4
It builds on DeepSeek's ideas. MLA and DSA come from the DeepSeek V3.2 lineage; GLM-5.2's contribution is the engineering that makes them cheap at extreme context.
5
The real moat may be RL infrastructure. The community's sharpest insight: with the `slime` framework, the gap between frontier and the rest looks increasingly like RL tooling, not pre-training compute.

References

  1. Zhipu AI (Z.ai). "GLM-5.2." Official announcement (all figures sourced here). z.ai/blog/glm-5.2.
  2. GLM-5.2 model card. huggingface.co/zai-org/GLM-5.2.
  3. Raschka, Sebastian. "GLM-5.2 and IndexShare for Long-Context Sparse Attention." sebastianraschka.com.
  4. Artificial Analysis. "GLM-5.2 model overview." models.dev.
  5. "GLM 5.2 Is Out." Hacker News discussion. news.ycombinator.com.