Gemma 4 31B vs GLM 5.2
GLM 5.2 leads Gemma 4 31B on coding, 61.1 to 39.0 on the Vibe Coding Index, and Gemma 4 31B costs 11.0x less per output token ($0.40 vs $4.40 per million). Updated October 22, 2026; 48 benchmarks have a result for both.
Gemma 4 31B or GLM 5.2: which to pick
Pick GLM 5.2 for coding: it scores 61.1 on the Vibe Coding Index against 39.0 for Gemma 4 31B.
Pick Gemma 4 31B for output tokens 11.0x cheaper ($0.40 vs $4.40 per million) and work measured by Kagi LLM Benchmark or IFBench, where it leads.
- Shared results
- 48
- Gemma 4 31B only
- 23
- GLM 5.2 only
- 50
- Like-for-like categories
- 7 of 9
Only benchmarks that tested both models count toward a pick; a result only one model has is shown but not compared.
Which one for your work
Each card is decided by one number both models carry. Where only one has it, the card says so and makes no call.
Coding
Vibe Coding Index, six public coding benchmarks
GLM 5.2
GLM 5.2 scores 61.1 against 39.0.
2 and 4 benchmarks behind the scores
Intelligence
AA Intelligence Index
GLM 5.2
GLM 5.2 leads, 33.7 against 14.7.
Same board, both measured
Agentic work
AA Agentic Index
GLM 5.2
GLM 5.2 leads, 38.4 against 4.2.
Same board, both measured
Reasoning
GPQA Diamond
No call
Only GLM 5.2 has a GPQA Diamond result, 85.6%.
Directional only
Knowledge
MMLU Pro
No call
Only GLM 5.2 has a MMLU Pro result, 86.7%.
Directional only
Web design
Design Arena: websites
No call
Only GLM 5.2 has a Design Arena: websites result, 1285.
Directional only
Long documents
Listed context window
GLM 5.2
GLM 5.2 takes 1.05M tokens against 262K.
Listed by OpenRouter
Everyday cost
1K input + 500 output tokens
Gemma 4 31B
Gemma 4 31B $0.0003, GLM 5.2 $0.0036 per turn.
List prices
Cost per solved task
One SWE-bench Verified task, solved
No call
Only GLM 5.2 has the number, $0.86.
Directional only
At a glance
- Coding index
- Gemma 4 31B 39.0 from 2 benchmarks, GLM 5.2 61.1 from 4 benchmarks.
- Widest category
- Agentic work, 33.9 points apart on average over 2 shared benchmarks.
- Widest single gap
- LMArena WebDev: React: Gemma 4 31B 1359 against GLM 5.2 1617, 40.1 points apart on a 0 to 100 scale.
- Output price
- Gemma 4 31B $0.40 against GLM 5.2 $4.40 per million output tokens, 11.0x apart.
- Context window
- Gemma 4 31B takes 262K tokens, GLM 5.2 1.05M.
Benchmark by benchmark
First the score: boards each model leads, per category, where both have a result. Then every board, a category to a fold; bars are each result on a 0 to 100 scale, so compare the two in a row, not one row with another.
| Category | Gemma 4 31B | Bars | GLM 5.2 | Ties |
|---|---|---|---|---|
| Coding | 0 | 10 | ||
| Intelligence | 0 | 2 | ||
| Agentic work | 0 | 2 | ||
| Reasoning | 1 | 6 | ||
| Math | 0 | 3 | ||
| Knowledge | 0 | 5 | ||
| General | 1 | 18 | ||
| All shared boards | 2 | 46 |
CodingLike-for-likeSix of these boards feed the Vibe Coding Index010
| Benchmark | Gemma 4 31B | GLM 5.2 | Leader |
|---|---|---|---|
| LiveBench coding | 49.0% | Not measured | Only Gemma 4 31B measured |
| LMArena WebDev | 1367 | 1604 | GLM 5.2 |
| AA Coding Index | 43.4 | 68.8 | GLM 5.2 |
| LiveCodeBench (Vals AI) | Not measured | 69.5% | Only GLM 5.2 measured |
| SWE-bench Verified (Vals AI) | Not measured | 82.8% | Only GLM 5.2 measured |
| Vibe Code Bench (Vals AI) | Not measured | 64.0% | Only GLM 5.2 measured |
| Code migration (Vals AI) | Not measured | 37.9% | Only GLM 5.2 measured |
| ProgramBench (Vals AI) | Not measured | 0.5% | Only GLM 5.2 measured |
| Terminal-Bench 2.1 (Vals AI) | Not measured | 67.8% | Only GLM 5.2 measured |
| SkillsBench (Vals AI) | Not measured | 45.1% | Only GLM 5.2 measured |
| SciCode | 45.5% | 51.2% | GLM 5.2 |
| Terminal-Bench Hard (Artificial Analysis run) | 36.4% | 50.8% | GLM 5.2 |
| FrontierCode | Not measured | 24.5% | Only GLM 5.2 measured |
| WeirdML | 52.3% | 70.1% | GLM 5.2 |
| ALE-Bench | 925.5 | 1047.0 | GLM 5.2 |
| LMArena Text: coding | 1459 | 1487 | GLM 5.2 |
| LMArena Text: software and IT | 1463 | 1486 | GLM 5.2 |
| LMArena WebDev: React | 1359 | 1617 | GLM 5.2 |
| LMArena WebDev: HTML | 1380 | 1565 | GLM 5.2 |
| SciCode | 8.9% | Not measured | Only Gemma 4 31B measured |
| Neither model has a result on the other 19 boards here | |||
IntelligenceLike-for-likePublic boards, shown as published, kept out of the index02
| Benchmark | Gemma 4 31B | GLM 5.2 | Leader |
|---|---|---|---|
| AA Intelligence Index | 14.7 | 33.7 | GLM 5.2 |
| Epoch Capabilities Index | 143.0 | 151.9 | GLM 5.2 |
Agentic workLike-for-likePublic boards, shown as published, kept out of the index02
| Benchmark | Gemma 4 31B | GLM 5.2 | Leader |
|---|---|---|---|
| AA Agentic Index | 4.2 | 38.4 | GLM 5.2 |
| Design Arena: agents building web apps | Not measured | 1222 | Only GLM 5.2 measured |
| Design Arena: agents building full-stack apps | Not measured | 1241 | Only GLM 5.2 measured |
| Design Arena: agents building mobile apps | Not measured | 1159 | Only GLM 5.2 measured |
| Design Arena: agents building Android apps | Not measured | 1178 | Only GLM 5.2 measured |
| Design Arena: agents building Godot games | Not measured | 1142 | Only GLM 5.2 measured |
| Design Arena: agents building games | Not measured | 1206 | Only GLM 5.2 measured |
| Design Arena: HTML slides | Not measured | 1125 | Only GLM 5.2 measured |
| Design Arena: PowerPoint slides | Not measured | 1170 | Only GLM 5.2 measured |
| LiveBench research | 44.4% | Not measured | Only Gemma 4 31B measured |
| LiveBench browser | 4.0% | Not measured | Only Gemma 4 31B measured |
| LiveBench long agentic | 13.3% | Not measured | Only Gemma 4 31B measured |
| SREBench (Vals AI) | Not measured | 0.0% | Only GLM 5.2 measured |
| Finance Agent (Vals AI) | Not measured | 49.7% | Only GLM 5.2 measured |
| Legal Research Bench (Vals AI) | Not measured | 31.3% | Only GLM 5.2 measured |
| Excel Modeling Benchmark (Vals AI) | Not measured | 61.5% | Only GLM 5.2 measured |
| τ²-Bench Telecom | 65.5% | 99.1% | GLM 5.2 |
| APEX-Agents | Not measured | 45.2% | Only GLM 5.2 measured |
| PostTrainBench | Not measured | 31.7% | Only GLM 5.2 measured |
| Vending-Bench 2 | Not measured | $8,314 | Only GLM 5.2 measured |
| Neither model has a result on the other 21 boards here | |||
ReasoningLike-for-likePublic boards, shown as published, kept out of the index16
| Benchmark | Gemma 4 31B | GLM 5.2 | Leader |
|---|---|---|---|
| GPQA Diamond | Not measured | 85.6% | Only GLM 5.2 measured |
| LiveBench reasoning | 68.3% | Not measured | Only Gemma 4 31B measured |
| GPQA Diamond (Artificial Analysis run) | 85.7% | 89.5% | GLM 5.2 |
| Humanity's Last Exam (Artificial Analysis run) | 23.6% | 41.1% | GLM 5.2 |
| GPQA Diamond (Epoch AI run) | 75.8% | 91.9% | GLM 5.2 |
| ARC-AGI | Not measured | 77.0% | Only GLM 5.2 measured |
| ARC-AGI-2 | Not measured | 22.8% | Only GLM 5.2 measured |
| SimpleBench | Not measured | 58.8% | Only GLM 5.2 measured |
| Chess puzzles | Not measured | 22.0% | Only GLM 5.2 measured |
| Mystery game puzzles | Not measured | 19.0% | Only GLM 5.2 measured |
| EBR-bench | Not measured | 9.5% | Only GLM 5.2 measured |
| LMArena Text: hard prompts | 1448 | 1481 | GLM 5.2 |
| LMArena Text: expert | 1464 | 1487 | GLM 5.2 |
| LMArena Text: hard prompts in English | 1456 | 1481 | GLM 5.2 |
| LMArena Vision: diagrams | 1283 | Not measured | Only Gemma 4 31B measured |
| LMArena Vision: homework | 1310 | Not measured | Only Gemma 4 31B measured |
| Kagi LLM Benchmark | 63.5% | 62.6% | Gemma 4 31B |
| Neither model has a result on the other 5 boards here | |||
MathLike-for-likePublic boards, shown as published, kept out of the index03
| Benchmark | Gemma 4 31B | GLM 5.2 | Leader |
|---|---|---|---|
| OTIS Mock AIME | 73.3% | 86.4% | GLM 5.2 |
| FrontierMath, tiers 1 to 3 | Not measured | 59.2% | Only GLM 5.2 measured |
| FrontierMath, tier 4 | Not measured | 29.3% | Only GLM 5.2 measured |
| ProofBench | Not measured | 35.0% | Only GLM 5.2 measured |
| LMArena Text: math | 1463 | 1483 | GLM 5.2 |
| LMArena Text: mathematical work | 1465 | 1489 | GLM 5.2 |
| Neither model has a result on the other 7 boards here | |||
KnowledgeLike-for-likePublic boards, shown as published, kept out of the index05
| Benchmark | Gemma 4 31B | GLM 5.2 | Leader |
|---|---|---|---|
| MMLU Pro | Not measured | 86.7% | Only GLM 5.2 measured |
| LegalBench (Vals AI) | Not measured | 84.1% | Only GLM 5.2 measured |
| CaseLaw (Vals AI) | 52.6% | Not measured | Only Gemma 4 31B measured |
| CorpFin (Vals AI) | Not measured | 66.1% | Only GLM 5.2 measured |
| TaxEval (Vals AI) | Not measured | 73.3% | Only GLM 5.2 measured |
| MortgageTax (Vals AI) | 61.4% | Not measured | Only Gemma 4 31B measured |
| MedCode (Vals AI) | Not measured | 40.8% | Only GLM 5.2 measured |
| SimpleQA Verified | 10.4% | 34.2% | GLM 5.2 |
| LMArena Text: science | 1457 | 1489 | GLM 5.2 |
| LMArena Text: medicine and healthcare | 1451 | 1475 | GLM 5.2 |
| LMArena Text: legal and government | 1438 | 1486 | GLM 5.2 |
| LMArena Text: business and finance | 1430 | 1451 | GLM 5.2 |
| FACTS Benchmark Suite | 45.3% | Not measured | Only Gemma 4 31B measured |
| Neither model has a result on the other 5 boards here | |||
Web designDirectional onlyPublic boards, shown as published, kept out of the index9 boards, none shared
| Benchmark | Gemma 4 31B | GLM 5.2 | Leader |
|---|---|---|---|
| Design Arena: websites | Not measured | 1285 | Only GLM 5.2 measured |
| Design Arena: UI components | Not measured | 1294 | Only GLM 5.2 measured |
| Design Arena: game dev | Not measured | 1268 | Only GLM 5.2 measured |
| Design Arena: data viz | Not measured | 1285 | Only GLM 5.2 measured |
| Design Arena: 3D | Not measured | 1287 | Only GLM 5.2 measured |
| Design Arena: all code categories | Not measured | 1287 | Only GLM 5.2 measured |
| Design Arena: SVG | Not measured | 1213 | Only GLM 5.2 measured |
| Design Arena: ASCII art | Not measured | 1191 | Only GLM 5.2 measured |
| LiveBench design | 58.4% | Not measured | Only Gemma 4 31B measured |
GeneralLike-for-likePublic boards, shown as published, kept out of the index118
| Benchmark | Gemma 4 31B | GLM 5.2 | Leader |
|---|---|---|---|
| LiveBench data analysis | 53.3% | Not measured | Only Gemma 4 31B measured |
| SAGE (Vals AI) | 55.0% | Not measured | Only Gemma 4 31B measured |
| MedScribe (Vals AI) | Not measured | 83.5% | Only GLM 5.2 measured |
| IFBench | 75.6% | 73.3% | Gemma 4 31B |
| Long context reasoning (AA-LCR) | 69.7% | 78.3% | GLM 5.2 |
| DTBench | 82.7% | 93.6% | GLM 5.2 |
| LMCA | 39.3% | 45.8% | GLM 5.2 |
| Surface Evolver Bench | 30.6% | 55.6% | GLM 5.2 |
| LMArena Text | 1443 | 1470 | GLM 5.2 |
| LMArena Text: instruction following | 1433 | 1466 | GLM 5.2 |
| LMArena Text: creative writing | 1417 | 1463 | GLM 5.2 |
| LMArena Vision | 1276 | Not measured | Only Gemma 4 31B measured |
| LMArena Text: English | 1451 | 1475 | GLM 5.2 |
| LMArena Text: non-English | 1430 | 1459 | GLM 5.2 |
| LMArena Text: Chinese | 1475 | 1522 | GLM 5.2 |
| LMArena Text: German | Not measured | 1470 | Only GLM 5.2 measured |
| LMArena Text: Japanese | Not measured | 1450 | Only GLM 5.2 measured |
| LMArena Text: Korean | Not measured | 1440 | Only GLM 5.2 measured |
| LMArena Text: French | 1436 | 1479 | GLM 5.2 |
| LMArena Text: Spanish | 1442 | 1478 | GLM 5.2 |
| LMArena Text: Russian | 1460 | 1468 | GLM 5.2 |
| LMArena Text: Polish | 1433 | 1456 | GLM 5.2 |
| LMArena Text: multi-turn | 1452 | 1469 | GLM 5.2 |
| LMArena Text: longer queries | 1446 | 1480 | GLM 5.2 |
| LMArena Text: writing and language | 1432 | 1463 | GLM 5.2 |
| LMArena Text: entertainment and media | 1405 | 1450 | GLM 5.2 |
| LMArena Vision: English | 1271 | Not measured | Only Gemma 4 31B measured |
| LMArena Vision: Chinese | 1326 | Not measured | Only Gemma 4 31B measured |
| LMArena Vision: reading text | 1282 | Not measured | Only Gemma 4 31B measured |
| LMArena Vision: humor | 1280 | Not measured | Only Gemma 4 31B measured |
| LMArena Vision: captioning | 1218 | Not measured | Only Gemma 4 31B measured |
| LMArena Vision: recognizing things | 1226 | Not measured | Only Gemma 4 31B measured |
| LMArena Vision: creative writing | 1285 | Not measured | Only Gemma 4 31B measured |
| LMArena Document | 1425 | Not measured | Only Gemma 4 31B measured |
| Neither model has a result on the other 12 boards here | |||
Image generationNot comparablePublic boards, shown as published, kept out of the index0 boards, none shared
| Benchmark | Gemma 4 31B | GLM 5.2 | Leader |
|---|---|---|---|
| Neither model has a result on 5 boards here | |||
What each workload costs
Three fixed token mixes at each model's listed price, so per-token rates become a bill.
Chat turn
1K input + 500 output tokens
Gemma 4 31B costs less
Repository review
50K input + 3K output tokens
Gemma 4 31B costs less
Agent loop
200K input + 10K output tokens
Gemma 4 31B costs less
Listed OpenRouter rates, without cache or batch discounts. A workload that does not fit a model's context window would need splitting.
Specification differences
The leading value in a row is marked; a row with a missing value names no leader. Our two rows are marked in red.
| Specification | Google Gemma 4 31B | Z.ai GLM 5.2 |
|---|---|---|
| Maker | Z.ai | |
| Weights | Open weights | Open weights |
| Released | April 2, 2026 | June 16, 2026 |
| Context window | 262K | 1.05M |
| Input $/Mtok | $0.14 | $1.40 |
| Output $/Mtok | $0.40 | $4.40 |
| Coding index | 39.0 | 61.1 |
| Independent measurements behind it | 2 | 4 |
| Cost per solved task | Not computable | $0.86 |
| Source | OpenRouter listing | OpenRouter listing |
Questions
Is Gemma 4 31B better than GLM 5.2 for coding?
Pick GLM 5.2 for coding: it scores 61.1 on the Vibe Coding Index against 39.0 for Gemma 4 31B. Pick Gemma 4 31B for output tokens 11.0x cheaper ($0.40 vs $4.40 per million) and work measured by Kagi LLM Benchmark or IFBench, where it leads.
Which is cheaper, Gemma 4 31B or GLM 5.2?
Gemma 4 31B costs $0.14 per million input tokens and $0.40 per million output tokens; GLM 5.2 costs $1.40 and $4.40. Cost per solved task is known for GLM 5.2 only.
Which has the bigger context window, Gemma 4 31B or GLM 5.2?
GLM 5.2, with 1.05M tokens against 262K.
How many benchmarks is the Gemma 4 31B vs GLM 5.2 comparison based on?
48 benchmarks have a result for both models as of October 22, 2026. Gemma 4 31B's coding index rests on 2 independent benchmarks and GLM 5.2's on 4. Where only one model has a result, the page says so instead of naming a winner.