---
title: "GLM-5.2: Built for Long-Horizon Tasks"
description: "GLM-5.2 is presented as a flagship model for long-horizon tasks, extending GLM-5.1’s capability to a solid 1M-token context for sustained engineering work. It was trained extensively on 1M-context coding-agent scenarios involving large-scale implementation, automated research, performance optimization, and complex debugging, and adds effort-level controls to balance capability, latency, and computational cost. Its architecture uses IndexShare, sharing one lightweight indexer across every four transformer layers and reducing per-token FLOPs by 2.9× at 1M context; MTP changes for speculative decoding increase acceptance length by up to 20%. On reported long-horizon and standard coding benchmarks, GLM-5.2 is described as the highest-ranked open-source model: it trails Opus 4.8 by 1% on FrontierSWE, ranks second only to Opus 4.8 on PostTrainBench, and scores 81.0 on Terminal-Bench 2.1 versus GLM-5.1’s 63.5."
---

# GLM-5.2: Built for Long-Horizon Tasks

[Hugging Face](https://yomu.fyi/company/hugging-face) · Z.AI · Jun 17, 2026

**Type:** Announcement

## Summary

GLM-5.2 is presented as a flagship model for long-horizon tasks, extending GLM-5.1’s capability to a solid 1M-token context for sustained engineering work. It was trained extensively on 1M-context coding-agent scenarios involving large-scale implementation, automated research, performance optimization, and complex debugging, and adds effort-level controls to balance capability, latency, and computational cost. Its architecture uses IndexShare, sharing one lightweight indexer across every four transformer layers and reducing per-token FLOPs by 2.9× at 1M context; MTP changes for speculative decoding increase acceptance length by up to 20%. On reported long-horizon and standard coding benchmarks, GLM-5.2 is described as the highest-ranked open-source model: it trails Opus 4.8 by 1% on FrontierSWE, ranks second only to Opus 4.8 on PostTrainBench, and scores 81.0 on Terminal-Bench 2.1 versus GLM-5.1’s 63.5.

## Context

Long-horizon coding-agent work requires a 1M-token context that maintains quality and reliability across messy, extended trajectories, rather than merely accepting more tokens. Extending context also shifts inference pressure toward KV-cache capacity, long-context kernel overhead, CPU-side management, concurrency, and throughput under limited GPU resources.

## Approach / What changed

GLM-5.2 expands 1M-context training for coding-agent scenarios, adds selectable effort levels, and uses IndexShare to share a lightweight indexer across four transformer layers. Its speculative-decoding MTP layer combines IndexShare, KV sharing, rejection sampling, and end-to-end TV loss. The inference engine adds finer-grained memory management and parallelization, long-context kernel and cache-transfer coordination, and CPU-side cache and scheduling optimizations.

## Takeaways

- IndexShare places one lightweight indexer at the first layer of each four-layer group and reuses its top-k indices, reducing indexer dot-product and top-k computation in three of the four layers.
- An MTP ablation on GLM-5.1’s backbone and training data increased final-layer acceptance length from 4.56 to 5.47, a 20% improvement, after adding IndexShare, KV sharing, rejection sampling, and end-to-end TV loss.
- GLM-5.2 weights are publicly available on HuggingFace and ModelScope, with local inference support listed for transformers, vLLM, SGLang, xLLM, and ktransformers.

**Tags:** [LLMs](https://yomu.fyi/topic/llm), [Machine Learning](https://yomu.fyi/topic/machine-learning), [Open Source](https://yomu.fyi/topic/open-source), [Performance](https://yomu.fyi/topic/performance), [Scalability](https://yomu.fyi/topic/scalability)

- Source: [Hugging Face](https://huggingface.co/blog/zai-org/glm-52-blog)
- Source URL: https://huggingface.co/blog/zai-org/glm-52-blog
- Ingested by Yomu: 2026-08-29T01:50:30.130Z

[Read original post](https://huggingface.co/blog/zai-org/glm-52-blog)
