GLM-5.2: Built for Long-Horizon Tasks
11:01 · June 17, 2026 · Hugging Face Blog

Summary
GLM-5.2 is an open model with a 1M-token context window, developed to support sustained performance on long-horizon coding-agent workflows rather than simply extending sequence length. Training data for the 1M regime focused on large-scale implementation, automated research, performance tuning, and multi-step debugging, producing measurable gains on benchmarks that require hours-long agent trajectories. On FrontierSWE the model trails Opus 4.8 by one point while surpassing GPT-5.5 and earlier Opus versions; on PostTrainBench it ranks second only to Opus 4.8; and on SWE-Marathon it remains the strongest open model despite a larger gap to the leading closed system. Standard coding suites show similar patterns, with Terminal-Bench 2.1 rising from 63.5 to 81.0 and SWE-bench Pro improving from 58.4 to 62.1.
To keep attention computation tractable at this scale, GLM-5.2 applies IndexShare, a technique that reuses a single lightweight indexer across every four transformer layers. The indexer runs only on the first layer of each group, supplying top-k indices for the remaining three layers and thereby cutting indexer FLOPs by roughly three-quarters. The same sharing pattern is extended to the multi-token prediction (MTP) layers used for speculative decoding. By aligning KV-cache contents and index reuse between training and inference, the revised MTP stack raises acceptance length by 20 percent while lowering draft-model overhead.
Users can also select an explicit effort level that trades additional compute for higher task success. At matched token budgets the model already exceeds GLM-5.1; the highest setting further widens the margin on difficult instances, positioning capability between Opus 4.7 and Opus 4.8 under comparable resource use.
Post-training relies on the slime framework to orchestrate large-scale agentic reinforcement learning. slime accommodates white-box and black-box rollouts, trajectory compaction, and sub-agent workflows, allowing more than ten expert models to be merged in roughly two days. To counter reward hacking common in verifiable coding environments, an online guard detects shortcut behaviors such as direct retrieval of reference solutions, blocks the offending call, and supplies dummy feedback so that the rollout can continue without destabilizing training.
Inference optimizations address the shift from compute-bound to memory-bound regimes at 1M context. Finer-grained KV-cache partitioning, length-aware kernel scheduling, and CPU-side request management together increase usable cache capacity and reduce pipeline stalls, yielding progressively larger throughput gains as context length grows. The model weights are released under the MIT license on Hugging Face and integrate with vLLM and SGLang.
Why it matters
Provides concrete architectural details, ablation studies, production inference challenges, and benchmark comparisons directly usable by ML engineers deploying or fine-tuning long-context agents.








