Enter opens the highlighted result. Esc closes.

Gemma 4 31B vs GLM 5

GLM 5 leads Gemma 4 31B on coding, 41.7 to 39.0 on the Vibe Coding Index, and Gemma 4 31B costs 8.0x less per output token ($0.40 vs $3.20 per million). Updated October 22, 2026; 42 benchmarks have a result for both.

Gemma 4 31BGoogle
Coding
39.0
Overall
42.1
Output $/M
$0.40
14
GLM 5Z.ai
Coding
41.7
Overall
54.3
Output $/M
$3.20
28
vs boards won of 42 shared

Gemma 4 31B or GLM 5: which to pick

Pick GLM 5 for coding: it scores 41.7 on the Vibe Coding Index against 39.0 for Gemma 4 31B.

Pick Gemma 4 31B for output tokens 8.0x cheaper ($0.40 vs $3.20 per million) and a larger context window (262K against 205K tokens).

Shared results
42
Gemma 4 31B only
29
GLM 5 only
34
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.

At a glance

Coding index
Gemma 4 31B 39.0 from 2 benchmarks, GLM 5 41.7 from 3 benchmarks.
Widest category
Agentic work, 32.7 points apart on average over 1 shared benchmark.
Widest single gap
τ²-Bench Telecom: Gemma 4 31B 65.5% against GLM 5 98.2%, 32.7 points apart on a 0 to 100 scale.
Output price
Gemma 4 31B $0.40 against GLM 5 $3.20 per million output tokens, 8.0x apart.
Context window
Gemma 4 31B takes 262K tokens, GLM 5 205K.

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.

Boards won, where both have a result
CategoryGemma 4 31BBarsGLM 5Ties
Coding35
Intelligence02
Agentic work01
Reasoning25
Math21
Knowledge23
General511
All shared boards1428
CodingLike-for-likeSix of these boards feed the Vibe Coding Index35
Coding benchmarks for Gemma 4 31B and GLM 5
BenchmarkGemma 4 31BGLM 5Leader
SWE-bench VerifiedNot measured72.8%Only GLM 5 measured
SWE-bench MultilingualNot measured69.7%Only GLM 5 measured
LiveBench coding49.0%Not measuredOnly Gemma 4 31B measured
LMArena WebDev13671435GLM 5
AA Coding Index43.4Not measuredOnly Gemma 4 31B measured
LiveCodeBench (Vals AI)Not measured81.9%Only GLM 5 measured
SWE-bench Verified (Vals AI)Not measured71.4%Only GLM 5 measured
Vibe Code Bench (Vals AI)Not measured23.4%Only GLM 5 measured
SciCode45.5%Not measuredOnly Gemma 4 31B measured
Terminal-Bench Hard (Artificial Analysis run)36.4%43.2%GLM 5
Terminal-BenchNot measured52.4%Only GLM 5 measured
WeirdML52.3%48.2%Gemma 4 31B
ALE-Bench925.5765.6Gemma 4 31B
LMArena Text: coding14591461GLM 5
LMArena Text: software and IT14631460Gemma 4 31B
LMArena WebDev: React13591424GLM 5
LMArena WebDev: HTML13801450GLM 5
SciCode8.9%Not measuredOnly Gemma 4 31B measured
Neither model has a result on the other 21 boards here
IntelligenceLike-for-likePublic boards, shown as published, kept out of the index02
Intelligence benchmarks for Gemma 4 31B and GLM 5
BenchmarkGemma 4 31BGLM 5Leader
AA Intelligence Index14.727.9GLM 5
Epoch Capabilities Index143.0145.8GLM 5
Agentic workLike-for-likePublic boards, shown as published, kept out of the index01
Agentic work benchmarks for Gemma 4 31B and GLM 5
BenchmarkGemma 4 31BGLM 5Leader
AA Agentic Index4.2Not measuredOnly Gemma 4 31B measured
Design Arena: agents building full-stack appsNot measured1123Only GLM 5 measured
Design Arena: agents building mobile appsNot measured1136Only GLM 5 measured
Design Arena: agents building Android appsNot measured1147Only GLM 5 measured
Design Arena: agents building Godot gamesNot measured1144Only GLM 5 measured
Design Arena: HTML slidesNot measured1098Only GLM 5 measured
LiveBench research44.4%Not measuredOnly Gemma 4 31B measured
LiveBench browser4.0%Not measuredOnly Gemma 4 31B measured
LiveBench long agentic13.3%Not measuredOnly Gemma 4 31B measured
τ²-Bench Telecom65.5%98.2%GLM 5
Vending-Bench 2Not measured$4,432Only GLM 5 measured
Neither model has a result on the other 30 boards here
ReasoningLike-for-likePublic boards, shown as published, kept out of the index25
Reasoning benchmarks for Gemma 4 31B and GLM 5
BenchmarkGemma 4 31BGLM 5Leader
GPQA DiamondNot measured83.3%Only GLM 5 measured
LiveBench reasoning68.3%Not measuredOnly Gemma 4 31B measured
GPQA Diamond (Artificial Analysis run)85.7%82.0%Gemma 4 31B
Humanity's Last Exam (Artificial Analysis run)23.6%29.3%GLM 5
GPQA Diamond (Epoch AI run)75.8%87.8%GLM 5
ARC-AGINot measured44.7%Only GLM 5 measured
ARC-AGI-2Not measured4.9%Only GLM 5 measured
SimpleBenchNot measured53.2%Only GLM 5 measured
LMArena Text: hard prompts14481452GLM 5
LMArena Text: expert14641454Gemma 4 31B
LMArena Text: hard prompts in English14561460GLM 5
LMArena Vision: diagrams1283Not measuredOnly Gemma 4 31B measured
LMArena Vision: homework1310Not measuredOnly Gemma 4 31B measured
Kagi LLM Benchmark63.5%75.0%GLM 5
Neither model has a result on the other 8 boards here
MathLike-for-likePublic boards, shown as published, kept out of the index21
Math benchmarks for Gemma 4 31B and GLM 5
BenchmarkGemma 4 31BGLM 5Leader
AIMENot measured91.7%Only GLM 5 measured
OTIS Mock AIME73.3%80.0%GLM 5
LMArena Text: math14631440Gemma 4 31B
LMArena Text: mathematical work14651451Gemma 4 31B
Neither model has a result on the other 9 boards here
KnowledgeLike-for-likePublic boards, shown as published, kept out of the index23
Knowledge benchmarks for Gemma 4 31B and GLM 5
BenchmarkGemma 4 31BGLM 5Leader
MMLU ProNot measured86.0%Only GLM 5 measured
LegalBench (Vals AI)Not measured84.1%Only GLM 5 measured
CaseLaw (Vals AI)52.6%52.5%Gemma 4 31B
CorpFin (Vals AI)Not measured62.9%Only GLM 5 measured
TaxEval (Vals AI)Not measured70.0%Only GLM 5 measured
MortgageTax (Vals AI)61.4%Not measuredOnly Gemma 4 31B measured
MedQA (Vals AI)Not measured94.3%Only GLM 5 measured
SimpleQA Verified10.4%Not measuredOnly Gemma 4 31B measured
LMArena Text: science14571460GLM 5
LMArena Text: medicine and healthcare14511455GLM 5
LMArena Text: legal and government14381453GLM 5
LMArena Text: business and finance14301430Gemma 4 31B
FACTS Benchmark Suite45.3%Not measuredOnly 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
Web design benchmarks for Gemma 4 31B and GLM 5
BenchmarkGemma 4 31BGLM 5Leader
Design Arena: websitesNot measured1247Only GLM 5 measured
Design Arena: UI componentsNot measured1228Only GLM 5 measured
Design Arena: game devNot measured1234Only GLM 5 measured
Design Arena: data vizNot measured1228Only GLM 5 measured
Design Arena: 3DNot measured1228Only GLM 5 measured
Design Arena: all code categoriesNot measured1246Only GLM 5 measured
Design Arena: SVGNot measured1167Only GLM 5 measured
Design Arena: ASCII artNot measured1147Only GLM 5 measured
LiveBench design58.4%Not measuredOnly Gemma 4 31B measured
GeneralLike-for-likePublic boards, shown as published, kept out of the index511
General benchmarks for Gemma 4 31B and GLM 5
BenchmarkGemma 4 31BGLM 5Leader
LiveBench data analysis53.3%Not measuredOnly Gemma 4 31B measured
SAGE (Vals AI)55.0%Not measuredOnly Gemma 4 31B measured
IFBench75.6%72.3%Gemma 4 31B
Long context reasoning (AA-LCR)69.7%75.7%GLM 5
DTBench82.7%Not measuredOnly Gemma 4 31B measured
LMCA39.3%Not measuredOnly Gemma 4 31B measured
CL-benchNot measured18.7%Only GLM 5 measured
Surface Evolver Bench30.6%Not measuredOnly Gemma 4 31B measured
LMArena Text14431446GLM 5
LMArena Text: instruction following14331428Gemma 4 31B
LMArena Text: creative writing14171438GLM 5
LMArena Vision1276Not measuredOnly Gemma 4 31B measured
LMArena Text: English14511458GLM 5
LMArena Text: non-English14301430Gemma 4 31B
LMArena Text: Chinese14751511GLM 5
LMArena Text: GermanNot measured1447Only GLM 5 measured
LMArena Text: JapaneseNot measured1416Only GLM 5 measured
LMArena Text: KoreanNot measured1423Only GLM 5 measured
LMArena Text: French14361456GLM 5
LMArena Text: Spanish14421454GLM 5
LMArena Text: Russian14601436Gemma 4 31B
LMArena Text: Polish14331434GLM 5
LMArena Text: multi-turn14521456GLM 5
LMArena Text: longer queries14461446Gemma 4 31B
LMArena Text: writing and language14321437GLM 5
LMArena Text: entertainment and media14051426GLM 5
LMArena Vision: English1271Not measuredOnly Gemma 4 31B measured
LMArena Vision: Chinese1326Not measuredOnly Gemma 4 31B measured
LMArena Vision: reading text1282Not measuredOnly Gemma 4 31B measured
LMArena Vision: humor1280Not measuredOnly Gemma 4 31B measured
LMArena Vision: captioning1218Not measuredOnly Gemma 4 31B measured
LMArena Vision: recognizing things1226Not measuredOnly Gemma 4 31B measured
LMArena Vision: creative writing1285Not measuredOnly Gemma 4 31B measured
LMArena Document1425Not measuredOnly 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
Image generation benchmarks for Gemma 4 31B and GLM 5
BenchmarkGemma 4 31BGLM 5Leader
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$0.0003Fits in one request
GLM 5$0.0026Fits in one request

Gemma 4 31B costs less

Repository review

50K input + 3K output tokens

Gemma 4 31B$0.0082Fits in one request
GLM 5$0.060Fits in one request

Gemma 4 31B costs less

Agent loop

200K input + 10K output tokens

Gemma 4 31B$0.032Fits in one request
GLM 5$0.232Exceeds the context window

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.

Specifications of Gemma 4 31B and GLM 5
SpecificationGoogle Gemma 4 31BZ.ai GLM 5
MakerGoogleZ.ai
WeightsOpen weightsOpen weights
ReleasedApril 2, 2026February 11, 2026
Context window262K205K
Input $/Mtok$0.14$1.00
Output $/Mtok$0.40$3.20
Coding index39.041.7
Independent measurements behind it23
Cost per solved taskNot computable$0.63
SourceOpenRouter listingOpenRouter listing

Questions

Is Gemma 4 31B better than GLM 5 for coding?

Pick GLM 5 for coding: it scores 41.7 on the Vibe Coding Index against 39.0 for Gemma 4 31B. Pick Gemma 4 31B for output tokens 8.0x cheaper ($0.40 vs $3.20 per million) and a larger context window (262K against 205K tokens).

Which is cheaper, Gemma 4 31B or GLM 5?

Gemma 4 31B costs $0.14 per million input tokens and $0.40 per million output tokens; GLM 5 costs $1.00 and $3.20. Cost per solved task is known for GLM 5 only.

Which has the bigger context window, Gemma 4 31B or GLM 5?

Gemma 4 31B, with 262K tokens against 205K.

How many benchmarks is the Gemma 4 31B vs GLM 5 comparison based on?

42 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's on 3. Where only one model has a result, the page says so instead of naming a winner.

Compare next

Embed this comparison on your site

Free under CC BY 4.0, while the source link stays visible. Preview the frame · Terms and other embeds

<iframe src="https://llmbenchmark.ai/embed/compare/gemma-4-31b-it-vs-glm-5" title="Gemma 4 31B vs GLM 5, LLMBenchmark.ai" width="100%" height="360" style="border:0;max-width:100%" loading="lazy"></iframe>
<p style="font:13px/1.4 sans-serif;margin:6px 0 0">Source: <a href="https://llmbenchmark.ai/compare/gemma-4-31b-it-vs-glm-5">LLMBenchmark.ai, Gemma 4 31B vs GLM 5</a></p>