Enter opens the highlighted result. Esc closes.

Gemma 4 31B vs GLM 5.2

GLM 5.2 leads Gemma 4 31B on coding, 59.7 to 22.0 on the Vibe Coding Index, and Gemma 4 31B costs 12.6x less per output token ($0.35 vs $4.40 per million). Updated December 6, 2026; 51 benchmarks have a result for both.

Gemma 4 31BGoogle
Coding
22.0
Overall
35.6
Output $/M
$0.35
2
GLM 5.2Z.ai
Coding
59.7
Overall
65.2
Output $/M
$4.40
49
vs boards won of 51 shared

Gemma 4 31B or GLM 5.2: which to pick

Pick GLM 5.2 for coding: it scores 59.7 on the Vibe Coding Index against 22.0 for Gemma 4 31B.

Pick Gemma 4 31B for output tokens 12.6x cheaper ($0.35 vs $4.40 per million) and work measured by Kagi LLM Benchmark or IFBench, where it leads.

Shared results
51
Gemma 4 31B only
26
GLM 5.2 only
60
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 22.0 from 2 benchmarks, GLM 5.2 59.7 from 3 benchmarks.
Widest category
Agentic work, 33.6 points apart on average over 1 shared benchmark.
Widest single gap
GDPval-AA: Gemma 4 31B 630 against GLM 5.2 1383, 48.6 points apart on a 0 to 100 scale.
Output price
Gemma 4 31B $0.35 against GLM 5.2 $4.40 per million output tokens, 12.6x 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.

Boards won, where both have a result
CategoryGemma 4 31BBarsGLM 5.2Ties
Coding011
Intelligence01
Agentic work01
Reasoning17
Math03
Knowledge06
General120
All shared boards249
CodingLike-for-likeSix of these boards feed the Vibe Coding Index011
Coding benchmarks for Gemma 4 31B and GLM 5.2
BenchmarkGemma 4 31BGLM 5.2Leader
LiveBench coding20.3%Not measuredOnly Gemma 4 31B measured
LMArena WebDev13711608GLM 5.2
LiveCodeBench (Vals AI)Not measured69.5%Only GLM 5.2 measured
SWE-bench Verified (Vals AI)Not measured82.8%Only GLM 5.2 measured
Code migration (Vals AI)Not measured37.9%Only GLM 5.2 measured
ProgramBench (Vals AI)Not measured0.5%Only GLM 5.2 measured
Terminal-Bench 2.1 (Vals AI)Not measured67.8%Only GLM 5.2 measured
SkillsBench (Vals AI)Not measured45.1%Only GLM 5.2 measured
SciCode45.5%51.2%GLM 5.2
Terminal-Bench Hard (Artificial Analysis run)36.4%50.8%GLM 5.2
Terminal-Bench 4.0 (Artificial Analysis run)0.0%1.0%GLM 5.2
FrontierCode 2.00.0%Not measuredOnly Gemma 4 31B measured
FrontierCodeNot measured24.5%Only GLM 5.2 measured
WeirdML52.3%70.1%GLM 5.2
MirrorCodeNot measured36.7%Only GLM 5.2 measured
ALE-Bench925.51047.0GLM 5.2
LMArena Text: coding14591488GLM 5.2
LMArena Text: software and IT14631487GLM 5.2
LMArena WebDev: React13631621GLM 5.2
LMArena WebDev: HTML13801567GLM 5.2
SciCode8.9%Not measuredOnly Gemma 4 31B measured
SWE Atlas: Codebase QnANot measured48.1%Only GLM 5.2 measured
SWE Atlas: RefactoringNot measured42.4%Only GLM 5.2 measured
SWE Atlas: Test WritingNot measured41.5%Only GLM 5.2 measured
GameBench 234.949.9GLM 5.2
Terminal-Bench 3.0Not measured4.6%Only GLM 5.2 measured
ProgramBenchNot measured0.0%Only GLM 5.2 measured
Neither model has a result on the other 25 boards here
IntelligenceLike-for-likePublic boards, shown as published, kept out of the index01
Intelligence benchmarks for Gemma 4 31B and GLM 5.2
BenchmarkGemma 4 31BGLM 5.2Leader
AA Intelligence Index4.0Not measuredOnly Gemma 4 31B measured
Epoch Capabilities Index144.1153.0GLM 5.2
Agentic workLike-for-likePublic boards, shown as published, kept out of the index01
Agentic work benchmarks for Gemma 4 31B and GLM 5.2
BenchmarkGemma 4 31BGLM 5.2Leader
Design Arena: agents building web appsNot measured1184Only GLM 5.2 measured
Design Arena: agents building full-stack appsNot measured1288Only GLM 5.2 measured
Design Arena: agents building mobile appsNot measured1152Only GLM 5.2 measured
Design Arena: agents building Android appsNot measured1162Only GLM 5.2 measured
Design Arena: agents building Godot gamesNot measured1142Only GLM 5.2 measured
Design Arena: agents building gamesNot measured1156Only GLM 5.2 measured
Design Arena: HTML slidesNot measured1077Only GLM 5.2 measured
Design Arena: PowerPoint slidesNot measured1157Only GLM 5.2 measured
Design Arena: spreadsheetsNot measured1123Only GLM 5.2 measured
LiveBench research38.1%Not measuredOnly Gemma 4 31B measured
LiveBench browser0.0%Not measuredOnly Gemma 4 31B measured
LiveBench long agentic8.5%Not measuredOnly Gemma 4 31B measured
SREBench (Vals AI)Not measured0.0%Only GLM 5.2 measured
Finance Agent (Vals AI)Not measured49.7%Only GLM 5.2 measured
Legal Research Bench (Vals AI)Not measured31.3%Only GLM 5.2 measured
Excel Modeling Benchmark (Vals AI)Not measured61.5%Only GLM 5.2 measured
τ²-Bench Telecom65.5%99.1%GLM 5.2
APEX-AgentsNot measured45.2%Only GLM 5.2 measured
PostTrainBenchNot measured30.4%Only GLM 5.2 measured
Vending-Bench 2Not measured$8,314Only GLM 5.2 measured
MCP AtlasNot measured77.8%Only GLM 5.2 measured
Toolathlon-VerifiedNot measured59.9%Only GLM 5.2 measured
τ³-BankingNot measured37.1%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 index17
Reasoning benchmarks for Gemma 4 31B and GLM 5.2
BenchmarkGemma 4 31BGLM 5.2Leader
GPQA DiamondNot measured85.6%Only GLM 5.2 measured
LiveBench reasoning68.3%Not measuredOnly 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
HLE-Diamond (Artificial Analysis run)7.2%17.7%GLM 5.2
CritPt v2, hard subset (Artificial Analysis run)4.0%Not measuredOnly Gemma 4 31B measured
GPQA Diamond (Epoch AI run)75.8%91.9%GLM 5.2
ARC-AGINot measured77.0%Only GLM 5.2 measured
ARC-AGI-2Not measured22.8%Only GLM 5.2 measured
SimpleBenchNot measured58.8%Only GLM 5.2 measured
Chess puzzlesNot measured22.0%Only GLM 5.2 measured
Mystery game puzzlesNot measured19.0%Only GLM 5.2 measured
EBR-benchNot measured9.5%Only GLM 5.2 measured
LMArena Text: hard prompts14481481GLM 5.2
LMArena Text: expert14651488GLM 5.2
LMArena Text: hard prompts in English14561481GLM 5.2
LMArena Vision: diagrams1287Not measuredOnly Gemma 4 31B measured
LMArena Vision: homework1310Not measuredOnly Gemma 4 31B measured
Kagi LLM Benchmark63.5%62.6%Gemma 4 31B
Neither model has a result on the other 7 boards here
MathLike-for-likePublic boards, shown as published, kept out of the index03
Math benchmarks for Gemma 4 31B and GLM 5.2
BenchmarkGemma 4 31BGLM 5.2Leader
OTIS Mock AIME73.3%86.4%GLM 5.2
FrontierMath, tiers 1 to 3Not measured59.2%Only GLM 5.2 measured
FrontierMath, tier 4Not measured29.3%Only GLM 5.2 measured
ProofBenchNot measured35.0%Only GLM 5.2 measured
LMArena Text: math14631485GLM 5.2
LMArena Text: mathematical work14641490GLM 5.2
MathArenaNot measured21.1%Only GLM 5.2 measured
Neither model has a result on the other 7 boards here
KnowledgeLike-for-likePublic boards, shown as published, kept out of the index06
Knowledge benchmarks for Gemma 4 31B and GLM 5.2
BenchmarkGemma 4 31BGLM 5.2Leader
MMLU ProNot measured86.7%Only GLM 5.2 measured
LegalBench (Vals AI)Not measured84.1%Only GLM 5.2 measured
CaseLaw (Vals AI)52.6%Not measuredOnly Gemma 4 31B measured
CorpFin (Vals AI)Not measured66.1%Only GLM 5.2 measured
TaxEval (Vals AI)Not measured73.3%Only GLM 5.2 measured
MortgageTax (Vals AI)61.4%Not measuredOnly Gemma 4 31B measured
MedCode (Vals AI)Not measured40.8%Only GLM 5.2 measured
AA-Omniscience-48.50.6GLM 5.2
SimpleQA Verified10.4%34.2%GLM 5.2
LMArena Text: science14561489GLM 5.2
LMArena Text: medicine and healthcare14501476GLM 5.2
LMArena Text: legal and government14381490GLM 5.2
LMArena Text: business and finance14311450GLM 5.2
FACTS Benchmark Suite50.1%Not measuredOnly Gemma 4 31B measured
Neither model has a result on the other 7 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.2
BenchmarkGemma 4 31BGLM 5.2Leader
Design Arena: websitesNot measured1323Only GLM 5.2 measured
Design Arena: UI componentsNot measured1271Only GLM 5.2 measured
Design Arena: game devNot measured1234Only GLM 5.2 measured
Design Arena: data vizNot measured1275Only GLM 5.2 measured
Design Arena: 3DNot measured1247Only GLM 5.2 measured
Design Arena: all code categoriesNot measured1328Only GLM 5.2 measured
Design Arena: SVGNot measured1245Only GLM 5.2 measured
Design Arena: ASCII artNot measured1174Only GLM 5.2 measured
LiveBench design56.5%Not measuredOnly Gemma 4 31B measured
GeneralLike-for-likePublic boards, shown as published, kept out of the index120
General benchmarks for Gemma 4 31B and GLM 5.2
BenchmarkGemma 4 31BGLM 5.2Leader
LiveBench data analysis53.3%Not measuredOnly Gemma 4 31B measured
SAGE (Vals AI)82.8%Not measuredOnly Gemma 4 31B measured
MedScribe (Vals AI)Not measured83.5%Only GLM 5.2 measured
IFBench75.6%73.3%Gemma 4 31B
Long context reasoning (AA-LCR)69.7%78.3%GLM 5.2
GDPval-AA6301383GLM 5.2
DTBench82.7%93.6%GLM 5.2
LMCA39.3%45.8%GLM 5.2
Surface Evolver Bench30.6%55.6%GLM 5.2
LMArena Text14431470GLM 5.2
LMArena Text: instruction following14341467GLM 5.2
LMArena Text: creative writing14151460GLM 5.2
LMArena Vision1279Not measuredOnly Gemma 4 31B measured
LMArena Text: English14511475GLM 5.2
LMArena Text: non-English14311458GLM 5.2
LMArena Text: Chinese14761523GLM 5.2
LMArena Text: GermanNot measured1467Only GLM 5.2 measured
LMArena Text: JapaneseNot measured1452Only GLM 5.2 measured
LMArena Text: KoreanNot measured1430Only GLM 5.2 measured
LMArena Text: French14351477GLM 5.2
LMArena Text: Spanish14441480GLM 5.2
LMArena Text: Russian14611466GLM 5.2
LMArena Text: Polish14311459GLM 5.2
LMArena Text: multi-turn14521470GLM 5.2
LMArena Text: longer queries14451479GLM 5.2
LMArena Text: writing and language14311462GLM 5.2
LMArena Text: entertainment and media14051448GLM 5.2
LMArena Vision: English1273Not measuredOnly Gemma 4 31B measured
LMArena Vision: Chinese1328Not measuredOnly Gemma 4 31B measured
LMArena Vision: reading text1285Not measuredOnly Gemma 4 31B measured
LMArena Vision: humor1279Not measuredOnly Gemma 4 31B measured
LMArena Vision: captioning1209Not measuredOnly Gemma 4 31B measured
LMArena Vision: recognizing things1228Not measuredOnly Gemma 4 31B measured
LMArena Vision: creative writing1287Not measuredOnly Gemma 4 31B measured
LMArena Document1435Not measuredOnly Gemma 4 31B measured
EQ-Bench 411101208GLM 5.2
Neither model has a result on the other 13 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.2
BenchmarkGemma 4 31BGLM 5.2Leader
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.2$0.0036Fits in one request

Gemma 4 31B costs less

Repository review

50K input + 3K output tokens

Gemma 4 31B$0.0079Fits in one request
GLM 5.2$0.083Fits in one request

Gemma 4 31B costs less

Agent loop

200K input + 10K output tokens

Gemma 4 31B$0.031Fits in one request
GLM 5.2$0.324Fits in one request

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.2
SpecificationGoogle Gemma 4 31BZ.ai GLM 5.2
MakerGoogleZ.ai
WeightsOpen weightsOpen weights
ReleasedApril 2, 2026June 16, 2026
Context window262K1.05M
Input $/Mtok$0.1375$1.40
Output $/Mtok$0.35$4.40
Coding index22.059.7
Independent measurements behind it23
Cost per solved taskNot computable$0.86
SourceOpenRouter listingOpenRouter listing

Questions

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

Pick GLM 5.2 for coding: it scores 59.7 on the Vibe Coding Index against 22.0 for Gemma 4 31B. Pick Gemma 4 31B for output tokens 12.6x cheaper ($0.35 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.1375 per million input tokens and $0.35 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?

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