Enter opens the highlighted result. Esc closes.

Gemma 4 31B vs GLM 5.1

GLM 5.1 leads Gemma 4 31B on coding, 49.2 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 21, 2026; 45 benchmarks have a result for both.

Gemma 4 31BGoogle
Coding
39.0
Overall
42.1
Output $/M
$0.40
4
GLM 5.1Z.ai
Coding
49.2
Overall
57.5
Output $/M
$4.40
41
vs boards won of 45 shared

Gemma 4 31B or GLM 5.1: which to pick

Pick GLM 5.1 for coding: it scores 49.2 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 a larger context window (262K against 205K tokens).

Shared results
45
Gemma 4 31B only
26
GLM 5.1 only
44
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.1 49.2 from 3 benchmarks.
Widest category
Agentic work, 25.9 points apart on average over 2 shared benchmarks.
Widest single gap
τ²-Bench Telecom: Gemma 4 31B 65.5% against GLM 5.1 97.7%, 32.2 points apart on a 0 to 100 scale.
Output price
Gemma 4 31B $0.40 against GLM 5.1 $4.40 per million output tokens, 11.0x apart.
Context window
Gemma 4 31B takes 262K tokens, GLM 5.1 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 5.1Ties
Coding28
Intelligence02
Agentic work02
Reasoning06
Math03
Knowledge15
General115
All shared boards441
CodingLike-for-likeSix of these boards feed the Vibe Coding Index28
Coding benchmarks for Gemma 4 31B and GLM 5.1
BenchmarkGemma 4 31BGLM 5.1Leader
LiveBench coding49.0%Not measuredOnly Gemma 4 31B measured
LMArena WebDev13671508GLM 5.1
AA Coding Index43.455.8GLM 5.1
LiveCodeBench (Vals AI)Not measured81.4%Only GLM 5.1 measured
SWE-bench Verified (Vals AI)Not measured76.4%Only GLM 5.1 measured
Vibe Code Bench (Vals AI)Not measured31.5%Only GLM 5.1 measured
Code migration (Vals AI)Not measured25.8%Only GLM 5.1 measured
ProgramBench (Vals AI)Not measured0.0%Only GLM 5.1 measured
Terminal-Bench 2.1 (Vals AI)Not measured56.9%Only GLM 5.1 measured
SciCode45.5%44.8%Gemma 4 31B
Terminal-Bench Hard (Artificial Analysis run)36.4%43.2%GLM 5.1
WeirdML52.3%57.1%GLM 5.1
ALE-Bench925.5887.1Gemma 4 31B
LMArena Text: coding14591485GLM 5.1
LMArena Text: software and IT14631484GLM 5.1
LMArena WebDev: React13591505GLM 5.1
LMArena WebDev: HTML13801508GLM 5.1
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.1
BenchmarkGemma 4 31BGLM 5.1Leader
AA Intelligence Index14.726.1GLM 5.1
Epoch Capabilities Index143.0149.8GLM 5.1
Agentic workLike-for-likePublic boards, shown as published, kept out of the index02
Agentic work benchmarks for Gemma 4 31B and GLM 5.1
BenchmarkGemma 4 31BGLM 5.1Leader
AA Agentic Index4.223.9GLM 5.1
Design Arena: agents building web appsNot measured1175Only GLM 5.1 measured
Design Arena: agents building full-stack appsNot measured1167Only GLM 5.1 measured
Design Arena: agents building mobile appsNot measured1162Only GLM 5.1 measured
Design Arena: agents building Android appsNot measured1180Only GLM 5.1 measured
Design Arena: agents building Godot gamesNot measured1053Only GLM 5.1 measured
Design Arena: agents building gamesNot measured1164Only GLM 5.1 measured
Design Arena: HTML slidesNot measured1170Only GLM 5.1 measured
Design Arena: PowerPoint slidesNot measured1188Only GLM 5.1 measured
Design Arena: spreadsheetsNot measured1315Only GLM 5.1 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
Finance Agent (Vals AI)Not measured44.8%Only GLM 5.1 measured
Legal Research Bench (Vals AI)Not measured27.9%Only GLM 5.1 measured
τ²-Bench Telecom65.5%97.7%GLM 5.1
APEX-AgentsNot measured40.9%Only GLM 5.1 measured
Vending-Bench 2Not measured$5,634Only GLM 5.1 measured
Neither model has a result on the other 23 boards here
ReasoningLike-for-likePublic boards, shown as published, kept out of the index06
Reasoning benchmarks for Gemma 4 31B and GLM 5.1
BenchmarkGemma 4 31BGLM 5.1Leader
GPQA DiamondNot measured84.5%Only GLM 5.1 measured
LiveBench reasoning68.3%Not measuredOnly Gemma 4 31B measured
GPQA Diamond (Artificial Analysis run)85.7%86.8%GLM 5.1
Humanity's Last Exam (Artificial Analysis run)23.6%30.1%GLM 5.1
GPQA Diamond (Epoch AI run)75.8%89.9%GLM 5.1
SimpleBenchNot measured55.1%Only GLM 5.1 measured
Chess puzzlesNot measured20.0%Only GLM 5.1 measured
LMArena Text: hard prompts14481473GLM 5.1
LMArena Text: expert14641478GLM 5.1
LMArena Text: hard prompts in English14561482GLM 5.1
LMArena Vision: diagrams1283Not measuredOnly Gemma 4 31B measured
LMArena Vision: homework1310Not measuredOnly Gemma 4 31B measured
Kagi LLM Benchmark63.5%Not measuredOnly Gemma 4 31B measured
Neither model has a result on the other 9 boards here
MathLike-for-likePublic boards, shown as published, kept out of the index03
Math benchmarks for Gemma 4 31B and GLM 5.1
BenchmarkGemma 4 31BGLM 5.1Leader
AIMENot measured91.9%Only GLM 5.1 measured
OTIS Mock AIME73.3%93.3%GLM 5.1
FrontierMath, tiers 1 to 3Not measured36.8%Only GLM 5.1 measured
ProofBenchNot measured22.2%Only GLM 5.1 measured
LMArena Text: math14631473GLM 5.1
LMArena Text: mathematical work14651470GLM 5.1
Neither model has a result on the other 7 boards here
KnowledgeLike-for-likePublic boards, shown as published, kept out of the index15
Knowledge benchmarks for Gemma 4 31B and GLM 5.1
BenchmarkGemma 4 31BGLM 5.1Leader
MMLU ProNot measured86.9%Only GLM 5.1 measured
LegalBench (Vals AI)Not measured84.4%Only GLM 5.1 measured
CaseLaw (Vals AI)52.6%51.5%Gemma 4 31B
CorpFin (Vals AI)Not measured64.5%Only GLM 5.1 measured
TaxEval (Vals AI)Not measured71.2%Only GLM 5.1 measured
MortgageTax (Vals AI)61.4%Not measuredOnly Gemma 4 31B measured
MedCode (Vals AI)Not measured41.6%Only GLM 5.1 measured
SimpleQA Verified10.4%34.0%GLM 5.1
LMArena Text: science14571478GLM 5.1
LMArena Text: medicine and healthcare14511474GLM 5.1
LMArena Text: legal and government14381465GLM 5.1
LMArena Text: business and finance14301452GLM 5.1
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.1
BenchmarkGemma 4 31BGLM 5.1Leader
Design Arena: websitesNot measured1290Only GLM 5.1 measured
Design Arena: UI componentsNot measured1292Only GLM 5.1 measured
Design Arena: game devNot measured1265Only GLM 5.1 measured
Design Arena: data vizNot measured1366Only GLM 5.1 measured
Design Arena: 3DNot measured1336Only GLM 5.1 measured
Design Arena: all code categoriesNot measured1268Only GLM 5.1 measured
Design Arena: SVGNot measured1218Only GLM 5.1 measured
Design Arena: ASCII artNot measured1142Only GLM 5.1 measured
LiveBench design58.4%Not measuredOnly Gemma 4 31B measured
GeneralLike-for-likePublic boards, shown as published, kept out of the index115
General benchmarks for Gemma 4 31B and GLM 5.1
BenchmarkGemma 4 31BGLM 5.1Leader
LiveBench data analysis53.3%Not measuredOnly Gemma 4 31B measured
Public Benefits Bench (Vals AI)Not measured61.8%Only GLM 5.1 measured
SAGE (Vals AI)55.0%Not measuredOnly Gemma 4 31B measured
MedScribe (Vals AI)Not measured72.3%Only GLM 5.1 measured
IFBench75.6%76.3%GLM 5.1
Long context reasoning (AA-LCR)69.7%73.7%GLM 5.1
DTBench82.7%Not measuredOnly Gemma 4 31B measured
LMCA39.3%Not measuredOnly Gemma 4 31B measured
Surface Evolver Bench30.6%Not measuredOnly Gemma 4 31B measured
ExploitBenchNot measured18.1%Only GLM 5.1 measured
LMArena Text14431463GLM 5.1
LMArena Text: instruction following14331453GLM 5.1
LMArena Text: creative writing14171453GLM 5.1
LMArena Vision1276Not measuredOnly Gemma 4 31B measured
LMArena Text: English14511476GLM 5.1
LMArena Text: non-English14301448GLM 5.1
LMArena Text: Chinese14751515GLM 5.1
LMArena Text: GermanNot measured1467Only GLM 5.1 measured
LMArena Text: JapaneseNot measured1435Only GLM 5.1 measured
LMArena Text: KoreanNot measured1424Only GLM 5.1 measured
LMArena Text: French14361470GLM 5.1
LMArena Text: Spanish14421468GLM 5.1
LMArena Text: Russian14601454Gemma 4 31B
LMArena Text: Polish14331449GLM 5.1
LMArena Text: multi-turn14521473GLM 5.1
LMArena Text: longer queries14461467GLM 5.1
LMArena Text: writing and language14321454GLM 5.1
LMArena Text: entertainment and media14051442GLM 5.1
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 10 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.1
BenchmarkGemma 4 31BGLM 5.1Leader
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.1$0.0036Fits 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.1$0.083Fits 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.1$0.324Exceeds 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.1
SpecificationGoogle Gemma 4 31BZ.ai GLM 5.1
MakerGoogleZ.ai
WeightsOpen weightsOpen weights
ReleasedApril 2, 2026April 7, 2026
Context window262K205K
Input $/Mtok$0.14$1.40
Output $/Mtok$0.40$4.40
Coding index39.049.2
Independent measurements behind it23
Cost per solved taskNot computable$0.60
SourceOpenRouter listingOpenRouter listing

Questions

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

Pick GLM 5.1 for coding: it scores 49.2 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 a larger context window (262K against 205K tokens).

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

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

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

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

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

45 benchmarks have a result for both models as of October 21, 2026. Gemma 4 31B's coding index rests on 2 independent benchmarks and GLM 5.1'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-1" title="Gemma 4 31B vs GLM 5.1, 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-1">LLMBenchmark.ai, Gemma 4 31B vs GLM 5.1</a></p>