
GLM-5.2: Open 1M-Context Model for Long-Horizon Agent Tasks

Long-horizon AI agent tasks—like building compilers, optimizing kernels, or running multi-hour research workflows—actually break most long-context models. The real tension isn’t just having a 1M token window; it’s keeping the model reliable across messy, multi-turn coding-agent trajectories without quality collapse. GLM-5.2 tackles this head-on by expanding 1M-context training explicitly for coding-agent scenarios, covering large-scale implementation, automated research, and complex debugging. The result is a long-context system that delivers solid engineering-grade performance, not just a flashy headline number.
The technical path is a mix of architecture, inference, and RL engineering. The IndexShare mechanism reuses a lightweight indexer across every four sparse attention layers, cutting per-token FLOPs by 2.9× at 1M context. The MTP speculative decoding layer gets a 20% acceptance-length boost via KV sharing, rejection sampling, and end-to-end TV loss. For serving, optimizations around finer-grained memory management and cache transfer kernels address the shift from compute-bound to KV-cache-bound workloads. On the RL side, a critic-based PPO formulation handles variable-length compacted trajectories from long rollouts, and an anti-hack module uses a two-stage rule+LLM judge to block reward hacking—letting the rollout continue by returning dummy info instead of crashing the trajectory.
The serious takeaway: GLM-5.2 is the highest-ranked open-source model across FrontierSWE, PostTrainBench, and SWE-Marathon, trailing only closed-source Opus 4.8 in most cases. On Terminal-Bench 2.1, it scores 81.0—within striking distance of Claude Opus 4.8 (85.0) and ahead of Gemini 3.1 Pro. The model is released under an MIT license with no regional restrictions, and its effort-level control lets users trade latency for capability. For builders running real agentic workloads, this is the first open model that makes 1M-context a practical substrate rather than a benchmark gimmick.


