AI News
AI News AgentModel releaseHugging Face4 min read

GLM-5.2 expands its context window to 1 million tokens

GLM-5.2 arrives with a 1 million token context window, improvements for extended programming tasks and an MIT license. Z.ai says it significantly outperforms GLM-5.1 in coding benchmarks and comes close to closed models such as Claude Opus 4.8 in some evaluations.

GLM-5.2 is now available with a 1 million token context window, five times larger than the 200,000 tokens in its previous version. In practice, it can work longer with large software projects, extended conversations and multistep tasks without losing all the context that came before.

Z.ai introduced the model as a system designed for long-running tasks, especially agentic programming. A token is a small unit of text that the model processes, so 1 million tokens allows it to analyze large amounts of code, documentation, logs and test results within a single session.

More context, but also greater stability

Having a huge context window does not guarantee that a model will use the information effectively. Z.ai says it trained GLM-5.2 on extended programming scenarios, such as building complete systems, conducting automated research, optimizing performance and debugging complex errors.

The company says the model is the highest-ranked open-source system in three long-task evaluations:

  • In FrontierSWE, it scored 74.4 points, compared with 75.1 for Claude Opus 4.8 and 72.6 for GPT-5.5.
  • In PostTrainBench, it reached 34.3 points, behind Claude Opus 4.8 but ahead of GPT-5.5.
  • In SWE-Marathon, it scored 13 points. Claude Opus 4.8 scored 26 and GPT-5.5 scored 12.

These figures come from evaluations published by Z.ai and depend on the environments, tools and limits used in each test. They do not mean the model will complete every software project without supervision.

In more common programming benchmarks, GLM-5.2 also clearly improves on GLM-5.1. In Terminal-Bench 2.1, it rises from 63.5 to 81 points, while in SWE-bench Pro it goes from 58.4 to 62.1. In the first benchmark, it comes close to Claude Opus 4.8, which scored 85 points under the compared configuration.

You can choose how much it reasons

GLM-5.2 includes several effort levels to control the balance between quality, speed and cost. For simple tasks, it can use less computation and respond faster. For difficult problems, the Max level allows it to spend more resources searching for a solution.

This is especially useful for programming agents. Asking it to rename a function is not the same as assigning it the complete migration of an application, including testing, fixes and deployment. In the second case, more reasoning may improve the result, but it also increases the time and usage.

Technical changes that make 1 million tokens viable

Processing such a long context is usually expensive and slow. To reduce that cost, GLM-5.2 introduces IndexShare, a technique that reuses part of the attention work, the mechanism that helps the model decide which parts of the context are relevant.

Instead of calculating that index at every layer, the model shares one indexer across each group of four layers. Z.ai says this reduces computations per token by 2.9 times when working with a 1 million token context.

It also improves the speculative decoding system. This technique has one component propose several tokens while the main model validates them, speeding up generation when the proposals are correct. In the company’s tests, the average acceptance length rises from 4.56 to 5.47 tokens, an increase of 20%.

The challenge does not disappear completely. Long contexts consume a lot of memory to maintain the so-called KV cache, a buffer that stores intermediate conversation data. That is why Z.ai also optimized memory management, GPU usage and request scheduling to improve performance when there are many users or lengthy documents.

Available as an open model

GLM-5.2 is released under an MIT license, and its weights are available on Hugging Face and ModelScope. It can run with tools such as Transformers, vLLM, SGLang, xLLM and KTransformers, allowing you to deploy it on your own servers if you have the necessary hardware.

You can also try it through programming agents such as ZCode, Claude Code and OpenCode. Coding Plan subscribers can activate the model using GLM-5.2, or GLM-5.2[1m] in Claude Code to enable the 1 million token context. Usage consumes more quota than other models, especially during peak hours.

For you, the most important change is not simply being able to paste more text. GLM-5.2 is aimed at work sessions that last for hours: reading an entire repository, modifying many files, running tests and fixing errors without starting from scratch at every step. The question now is whether that capability holds up in real projects and how much it costs to use when the context genuinely grows.