Enter opens the highlighted result. Esc closes.

Gemma 4 31B vs Grok 4.20

Gemma 4 31B leads Grok 4.20 on coding, 39.0 to 33.3 on the Vibe Coding Index, and Gemma 4 31B costs 6.3x less per output token ($0.40 vs $2.50 per million). Updated October 21, 2026; 15 benchmarks have a result for both.

Gemma 4 31BGoogle
Coding
39.0
Overall
42.1
Output $/M
$0.40
4
Grok 4.20xAI
Coding
33.3
Overall
41.0
Output $/M
$2.50
10
vs boards won of 15 shared, 1 tied

Gemma 4 31B or Grok 4.20: which to pick

Pick Gemma 4 31B for coding: it scores 39.0 on the Vibe Coding Index against 33.3 for Grok 4.20.

Pick Grok 4.20 for a larger context window (2M against 262K tokens) and work measured by Terminal-Bench Hard (Artificial Analysis run) or AA Intelligence Index, where it leads.

Shared results
15
Gemma 4 31B only
56
Grok 4.20 only
40
Like-for-like categories
6 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, Grok 4.20 33.3 from 2 benchmarks.
Widest category
Agentic work, 27.5 points apart on average over 1 shared benchmark.
Widest single gap
τ²-Bench Telecom: Gemma 4 31B 65.5% against Grok 4.20 93.0%, 27.5 points apart on a 0 to 100 scale.
Output price
Gemma 4 31B $0.40 against Grok 4.20 $2.50 per million output tokens, 6.3x apart.
Context window
Gemma 4 31B takes 262K tokens, Grok 4.20 2M.

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 31BBarsGrok 4.20Ties
Coding011 tie
Intelligence02
Agentic work01
Reasoning03
Knowledge11
General32
All shared boards4101 tie
CodingLike-for-likeSix of these boards feed the Vibe Coding Index01
Coding benchmarks for Gemma 4 31B and Grok 4.20
BenchmarkGemma 4 31BGrok 4.20Leader
LiveBench coding49.0%Not measuredOnly Gemma 4 31B measured
LMArena WebDev1367Not measuredOnly Gemma 4 31B measured
AA Coding Index43.4Not measuredOnly Gemma 4 31B measured
LiveCodeBench (Vals AI)Not measured84.3%Only Grok 4.20 measured
SWE-bench Verified (Vals AI)Not measured72.2%Only Grok 4.20 measured
Vibe Code Bench (Vals AI)Not measured4.1%Only Grok 4.20 measured
Code migration (Vals AI)Not measured0.3%Only Grok 4.20 measured
Terminal-Bench 2.1 (Vals AI)Not measured44.2%Only Grok 4.20 measured
SciCode45.5%Not measuredOnly Gemma 4 31B measured
Terminal-Bench Hard (Artificial Analysis run)36.4%37.9%Grok 4.20
Terminal-BenchNot measured57.3%Only Grok 4.20 measured
WeirdML52.3%52.3%Tie
ALE-Bench925.5Not measuredOnly Gemma 4 31B measured
LMArena Text: coding1459Not measuredOnly Gemma 4 31B measured
LMArena Text: software and IT1463Not measuredOnly Gemma 4 31B measured
LMArena WebDev: React1359Not measuredOnly Gemma 4 31B measured
LMArena WebDev: HTML1380Not measuredOnly Gemma 4 31B measured
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 Grok 4.20
BenchmarkGemma 4 31BGrok 4.20Leader
AA Intelligence Index14.725.7Grok 4.20
Epoch Capabilities Index143.0152.1Grok 4.20
Agentic workLike-for-likePublic boards, shown as published, kept out of the index01
Agentic work benchmarks for Gemma 4 31B and Grok 4.20
BenchmarkGemma 4 31BGrok 4.20Leader
AA Agentic Index4.2Not measuredOnly Gemma 4 31B measured
Design Arena: agents building web appsNot measured1144Only Grok 4.20 measured
Design Arena: agents building full-stack appsNot measured1054Only Grok 4.20 measured
Design Arena: agents building mobile appsNot measured1090Only Grok 4.20 measured
Design Arena: agents building Android appsNot measured1052Only Grok 4.20 measured
Design Arena: agents building Godot gamesNot measured1089Only Grok 4.20 measured
Design Arena: HTML slidesNot measured1180Only Grok 4.20 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 measured28.5%Only Grok 4.20 measured
Tax Agent Bench (Vals AI)Not measured7.0%Only Grok 4.20 measured
Legal Research Bench (Vals AI)Not measured13.9%Only Grok 4.20 measured
Excel Modeling Benchmark (Vals AI)Not measured11.7%Only Grok 4.20 measured
τ²-Bench Telecom65.5%93.0%Grok 4.20
Vending-Bench 2Not measured$4,663Only Grok 4.20 measured
Neither model has a result on the other 25 boards here
ReasoningLike-for-likePublic boards, shown as published, kept out of the index03
Reasoning benchmarks for Gemma 4 31B and Grok 4.20
BenchmarkGemma 4 31BGrok 4.20Leader
GPQA DiamondNot measured88.6%Only Grok 4.20 measured
LiveBench reasoning68.3%Not measuredOnly Gemma 4 31B measured
MMMU Pro (Vals AI)Not measured83.5%Only Grok 4.20 measured
GPQA Diamond (Artificial Analysis run)85.7%91.1%Grok 4.20
Humanity's Last Exam (Artificial Analysis run)23.6%34.5%Grok 4.20
GPQA Diamond (Epoch AI run)75.8%Not measuredOnly Gemma 4 31B measured
ARC-AGINot measured89.5%Only Grok 4.20 measured
ARC-AGI-2Not measured65.1%Only Grok 4.20 measured
LMArena Text: hard prompts1448Not measuredOnly Gemma 4 31B measured
LMArena Text: expert1464Not measuredOnly Gemma 4 31B measured
LMArena Text: hard prompts in English1456Not measuredOnly Gemma 4 31B measured
LMArena Vision: diagrams1283Not measuredOnly Gemma 4 31B measured
LMArena Vision: homework1310Not measuredOnly Gemma 4 31B measured
Kagi LLM Benchmark63.5%75.0%Grok 4.20
Neither model has a result on the other 8 boards here
MathDirectional onlyPublic boards, shown as published, kept out of the index4 boards, none shared
Math benchmarks for Gemma 4 31B and Grok 4.20
BenchmarkGemma 4 31BGrok 4.20Leader
AIMENot measured96.5%Only Grok 4.20 measured
OTIS Mock AIME73.3%Not measuredOnly Gemma 4 31B measured
LMArena Text: math1463Not measuredOnly Gemma 4 31B measured
LMArena Text: mathematical work1465Not measuredOnly Gemma 4 31B measured
Neither model has a result on the other 9 boards here
KnowledgeLike-for-likePublic boards, shown as published, kept out of the index11
Knowledge benchmarks for Gemma 4 31B and Grok 4.20
BenchmarkGemma 4 31BGrok 4.20Leader
MMLU ProNot measured86.3%Only Grok 4.20 measured
LegalBench (Vals AI)Not measured77.7%Only Grok 4.20 measured
CaseLaw (Vals AI)52.6%54.4%Grok 4.20
CorpFin (Vals AI)Not measured63.7%Only Grok 4.20 measured
TaxEval (Vals AI)Not measured74.1%Only Grok 4.20 measured
MortgageTax (Vals AI)61.4%45.4%Gemma 4 31B
MedQA (Vals AI)Not measured94.5%Only Grok 4.20 measured
MedCode (Vals AI)Not measured32.2%Only Grok 4.20 measured
SimpleQA Verified10.4%Not measuredOnly Gemma 4 31B measured
LMArena Text: science1457Not measuredOnly Gemma 4 31B measured
LMArena Text: medicine and healthcare1451Not measuredOnly Gemma 4 31B measured
LMArena Text: legal and government1438Not measuredOnly Gemma 4 31B measured
LMArena Text: business and finance1430Not measuredOnly Gemma 4 31B measured
FACTS Benchmark Suite45.3%Not measuredOnly Gemma 4 31B measured
Neither model has a result on the other 4 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 Grok 4.20
BenchmarkGemma 4 31BGrok 4.20Leader
Design Arena: websitesNot measured1229Only Grok 4.20 measured
Design Arena: UI componentsNot measured1199Only Grok 4.20 measured
Design Arena: game devNot measured1192Only Grok 4.20 measured
Design Arena: data vizNot measured1217Only Grok 4.20 measured
Design Arena: 3DNot measured1193Only Grok 4.20 measured
Design Arena: all code categoriesNot measured1221Only Grok 4.20 measured
Design Arena: SVGNot measured1164Only Grok 4.20 measured
Design Arena: ASCII artNot measured1174Only Grok 4.20 measured
LiveBench design58.4%Not measuredOnly Gemma 4 31B measured
GeneralLike-for-likePublic boards, shown as published, kept out of the index32
General benchmarks for Gemma 4 31B and Grok 4.20
BenchmarkGemma 4 31BGrok 4.20Leader
LiveBench data analysis53.3%Not measuredOnly Gemma 4 31B measured
SAGE (Vals AI)55.0%38.2%Gemma 4 31B
MedScribe (Vals AI)Not measured63.4%Only Grok 4.20 measured
Vals Multimodal IndexNot measured39.1%Only Grok 4.20 measured
IFBench75.6%81.2%Grok 4.20
Long context reasoning (AA-LCR)69.7%69.0%Gemma 4 31B
DTBench82.7%90.1%Grok 4.20
LMCA39.3%38.7%Gemma 4 31B
CL-benchNot measured22.2%Only Grok 4.20 measured
Surface Evolver Bench30.6%Not measuredOnly Gemma 4 31B measured
CL-bench LifeNot measured11.9%Only Grok 4.20 measured
LMArena Text1443Not measuredOnly Gemma 4 31B measured
LMArena Text: instruction following1433Not measuredOnly Gemma 4 31B measured
LMArena Text: creative writing1417Not measuredOnly Gemma 4 31B measured
LMArena Vision1276Not measuredOnly Gemma 4 31B measured
LMArena Text: English1451Not measuredOnly Gemma 4 31B measured
LMArena Text: non-English1430Not measuredOnly Gemma 4 31B measured
LMArena Text: Chinese1475Not measuredOnly Gemma 4 31B measured
LMArena Text: French1436Not measuredOnly Gemma 4 31B measured
LMArena Text: Spanish1442Not measuredOnly Gemma 4 31B measured
LMArena Text: Russian1460Not measuredOnly Gemma 4 31B measured
LMArena Text: Polish1433Not measuredOnly Gemma 4 31B measured
LMArena Text: multi-turn1452Not measuredOnly Gemma 4 31B measured
LMArena Text: longer queries1446Not measuredOnly Gemma 4 31B measured
LMArena Text: writing and language1432Not measuredOnly Gemma 4 31B measured
LMArena Text: entertainment and media1405Not measuredOnly Gemma 4 31B measured
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 Grok 4.20
BenchmarkGemma 4 31BGrok 4.20Leader
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
Grok 4.20$0.0025Fits in one request

Gemma 4 31B costs less

Repository review

50K input + 3K output tokens

Gemma 4 31B$0.0082Fits in one request
Grok 4.20$0.070Fits in one request

Gemma 4 31B costs less

Agent loop

200K input + 10K output tokens

Gemma 4 31B$0.032Fits in one request
Grok 4.20$0.275Fits 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 Grok 4.20
SpecificationGoogle Gemma 4 31BSpaceXAI Grok 4.20
MakerGooglexAI
WeightsOpen weightsNo public weights listed
ReleasedApril 2, 2026March 31, 2026
Context window262K2M
Input $/Mtok$0.14$1.25
Output $/Mtok$0.40$2.50
Coding index39.033.3
Independent measurements behind it22
Cost per solved taskNot computable$0.72
SourceOpenRouter listingOpenRouter listing

Questions

Is Gemma 4 31B better than Grok 4.20 for coding?

Pick Gemma 4 31B for coding: it scores 39.0 on the Vibe Coding Index against 33.3 for Grok 4.20. Pick Grok 4.20 for a larger context window (2M against 262K tokens) and work measured by Terminal-Bench Hard (Artificial Analysis run) or AA Intelligence Index, where it leads.

Which is cheaper, Gemma 4 31B or Grok 4.20?

Gemma 4 31B costs $0.14 per million input tokens and $0.40 per million output tokens; Grok 4.20 costs $1.25 and $2.50. Cost per solved task is known for Grok 4.20 only.

Which has the bigger context window, Gemma 4 31B or Grok 4.20?

Grok 4.20, with 2M tokens against 262K.

How many benchmarks is the Gemma 4 31B vs Grok 4.20 comparison based on?

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