According to Dynamix Beating's monitoring, a post-mortem analysis of the GLM-5 series model by Intelliscan in the Coding Agent scenario revealed issues such as garbled text, repetition, and rare characters. Since March, users have been providing feedback, indicating that the anomalies only occur in high-concurrency, long-context (average exceeding 70K tokens) Coding Agent tasks, and cannot be reproduced in a standard inference environment. Intelliscan stated that its inference system handles hundreds of millions of Coding Agent calls daily.
After several weeks of investigation, the team identified two independent underlying race condition bugs. The first bug was found in the PD separation architecture (a deployment method that separates prefilling and decoding into different nodes): after a timeout termination on the decoding side, the KV Cache (which stores precomputed attention states to avoid redundant calculations) was reclaimed, but the RDMA write on the prefilling side had not completed, leading to a situation where a new request was allocated to the same memory block, causing old data to overwrite new data. The fix involved adding explicit synchronization before reclamation to ensure that the write operation had completed before releasing the memory. Following the update, the anomaly rate dropped from over one in ten thousand to below three in ten thousand.
The second bug was found in HiCache (a multi-level KV Cache): during asynchronous cache swaps from CPU memory, there was a lack of synchronization point between the loading and computation pipelines, potentially resulting in the computation side reading data before it was fully loaded. After the fix, such anomalies disappeared completely, and the patch has been submitted to the SGLang community (PR #22811).
During the investigation, an unexpected discovery was made: the acceptance rate metric of Speculative Sampling (an acceleration technique that first uses a small model to guess a token and then validates it with a larger model) could serve as an anomaly detection signal. During garbled text, almost all draft tokens were rejected, while during repetition, the acceptance rate was unusually high. Leveraging this insight, the team implemented real-time monitoring: if the trigger threshold is met, generation is automatically terminated and retried.
After fixing the bugs, the team also implemented an optimization to address a bottleneck: LayerSplit KV Cache for hierarchical storage, where each GPU only stores a portion of the layers' KV Cache rather than the entire cache, facilitating collaborative computation via broadcasting. With a 90% cache hit rate, request lengths ranging from 40K to 120K, the throughput increased by 10% to 132%, with longer contexts yielding greater benefits.
