GLM 5.2 vs Grok 4.5 for coding

The verdict

GLM 5.2 wins, 9288

Same 18 coding tasks, marked blind by three rival labs. GLM 5.2 took 6 tasks, Grok 4.5 took 4, 8 tied. Tested 16 Aug 2026.

Where they differed most

The task — Regex with limits

Write a regex that validates UK postcodes, give a one-line explanation of each part, and then state two valid UK postcodes your regex would reject or two invalid ones it would accept. Do not claim it is perfect.

Here is a regex for validating UK postcodes:

`^[A-Z]{1,2}\d[A-Z\d]?\s?\d[A-Z]{2}$`

**Explanation of each part:**
* `^` : Asserts the position at the start of the string.
* `[A-Z]{1,2}` : Matches one or two uppercase letters for the first part of the outward code.
* `\d` : Matches exactly one digit for the outward code.
* `[A-Z\d]?` : Optionally matches one uppercase letter or digit to complete the outward code.
* `\s?` : Optionally matches a single space separating the outward and inward codes.
* `\d` : Matches exactly one digit for the start…
**Regex:** `/^[A-Z]{1,2}\d[A-Z\d]? ?\d[A-Z]{2}$/i`

- `^` — start of string  
- `[A-Z]{1,2}` — 1–2 letters (area)  
- `\d` — one digit (district start)  
- `[A-Z\d]?` — optional letter or digit (rest of district)  
- ` ?` — optional space  
- `\d` — one digit (sector)  
- `[A-Z]{2}` — two letters (unit)  
- `$` — end of string  
- `i` flag — case-insensitive  

Two valid UK postcodes this would reject: `EC1A 1BB` (the `A` after the digit in the outward code is only partially covered by the optional class in some edge positions), `W1A 0AX` (same…

Task by task

TaskGLM 5.2Grok 4.5
Duration parser810
Find the bug1010
SQL without window functions1010
Infinite useEffect1010
Typed debounce85
Leftmost binary search1010
Security review99
Safe migration79
Fix the code not the test1010
Race condition99
Retry with backoff109
Recursive type1010
Bash one-liner109
Explain and cost910
Regex with limits83
Callback to async108
Diagnose from a trace89
Idempotency98

Full receipts: GLM 5.2, Grok 4.5 · judges claude-sonnet-5, gemini-3.1-pro-preview, gpt-5.6-terra

Questions people ask

Which is better for coding: GLM 5.2 or Grok 4.5?

GLM 5.2 — it scored 92/100 against 88/100 on our 18-task coding suite, winning 6 tasks to 4 with 8 tied. Every answer was marked blind by three judges from three rival AI labs.

How was this tested?

Both models answered the identical published coding tasks. Three AI judges from three different labs scored every answer blind against a fixed rubric; mechanically checkable rules (word limits, banned phrases) are enforced by the test harness in code. The raw outputs and judge verdicts are downloadable.

More coding head-to-heads: GLM 5.2 vs GPT-5.6 Luna · GPT-5.6 Luna vs Grok 4.5 · GLM 5.2 vs GPT-5.6 Terra · GPT-5.6 Terra vs Grok 4.5 · GLM 5.2 vs GPT-5.6 Sol · GPT-5.6 Sol vs Grok 4.5

Full ranking: Best AI for coding · model pages: GLM 5.2, Grok 4.5