Enter opens the highlighted result. Esc closes.

Gemma 4 31B vs Grok 4.7

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

Gemma 4 31BGoogle
Coding
39.0
Overall
42.1
Output $/M
$0.40
33
Grok 4.7xAI
Coding
66.7
Overall
66.6
Output $/M
$6.00
20
vs boards won of 53 shared

Gemma 4 31B or Grok 4.7: which to pick

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

Pick Gemma 4 31B for output tokens 15.0x cheaper ($0.40 vs $6.00 per million) and work measured by LMArena Text: coding or LMArena Text: software and IT, where it leads.

Shared results
53
Gemma 4 31B only
18
Grok 4.7 only
46
Like-for-like categories
8 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.7 66.7 from 5 benchmarks.
Widest category
Agentic work, 44.9 points apart on average over 3 shared benchmarks.
Widest single gap
LiveBench browser: Gemma 4 31B 4.0% against Grok 4.7 60.0%, 56.0 points apart on a 0 to 100 scale.
Output price
Gemma 4 31B $0.40 against Grok 4.7 $6.00 per million output tokens, 15.0x apart.
Context window
Gemma 4 31B takes 262K tokens, Grok 4.7 500K.

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.7Ties
Coding25
Intelligence02
Agentic work03
Reasoning53
Math21
Knowledge41
Web design01
General204
All shared boards3320
CodingLike-for-likeSix of these boards feed the Vibe Coding Index25
Coding benchmarks for Gemma 4 31B and Grok 4.7
BenchmarkGemma 4 31BGrok 4.7Leader
LiveBench coding49.0%84.5%Grok 4.7
LMArena WebDev13671637Grok 4.7
AA Coding Index43.4Not measuredOnly Gemma 4 31B measured
Terminal-Bench 4 (Vals AI)Not measured28.8%Only Grok 4.7 measured
Vibe Code Bench (Vals AI)Not measured86.2%Only Grok 4.7 measured
Code migration (Vals AI)Not measured44.8%Only Grok 4.7 measured
ProgramBench (Vals AI)Not measured0.5%Only Grok 4.7 measured
IOI (Vals AI)Not measured57.7%Only Grok 4.7 measured
Terminal-Bench 2.1 (Vals AI)Not measured73.4%Only Grok 4.7 measured
SWE-bench Multimodal (Vals AI)Not measured42.9%Only Grok 4.7 measured
CyberBench (Vals AI)Not measured69.5%Only Grok 4.7 measured
SciCode45.5%57.8%Grok 4.7
Terminal-Bench Hard (Artificial Analysis run)36.4%Not measuredOnly Gemma 4 31B measured
FrontierCodeNot measured47.6%Only Grok 4.7 measured
FrontierSWENot measured29.5%Only Grok 4.7 measured
WeirdML52.3%Not measuredOnly Gemma 4 31B measured
ALE-Bench925.5Not measuredOnly Gemma 4 31B measured
LMArena Text: coding14591432Gemma 4 31B
LMArena Text: software and IT14631421Gemma 4 31B
LMArena WebDev: React13591663Grok 4.7
LMArena WebDev: HTML13801627Grok 4.7
LMArena WebDev: from an imageNot measured1586Only Grok 4.7 measured
SciCode8.9%Not measuredOnly Gemma 4 31B measured
Neither model has a result on the other 16 boards here
IntelligenceLike-for-likePublic boards, shown as published, kept out of the index02
Intelligence benchmarks for Gemma 4 31B and Grok 4.7
BenchmarkGemma 4 31BGrok 4.7Leader
AA Intelligence Index14.746.4Grok 4.7
Epoch Capabilities Index143.0154.4Grok 4.7
Agentic workLike-for-likePublic boards, shown as published, kept out of the index03
Agentic work benchmarks for Gemma 4 31B and Grok 4.7
BenchmarkGemma 4 31BGrok 4.7Leader
AA Agentic Index4.2Not measuredOnly Gemma 4 31B measured
LiveBench research44.4%86.4%Grok 4.7
LiveBench browser4.0%60.0%Grok 4.7
LiveBench long agentic13.3%50.1%Grok 4.7
SREBench (Vals AI)Not measured3.8%Only Grok 4.7 measured
Finance Agent (Vals AI)Not measured52.3%Only Grok 4.7 measured
Tax Agent Bench (Vals AI)Not measured34.2%Only Grok 4.7 measured
Legal Research Bench (Vals AI)Not measured47.1%Only Grok 4.7 measured
Harvey's Legal Agent Benchmark (Vals AI)Not measured18.3%Only Grok 4.7 measured
Excel Modeling Benchmark (Vals AI)Not measured67.0%Only Grok 4.7 measured
BioMysteryBench (Vals AI)Not measured69.3%Only Grok 4.7 measured
Terminal-Bench-Science (Vals AI)Not measured10.0%Only Grok 4.7 measured
Vals Science IndexNot measured34.8%Only Grok 4.7 measured
Robo-bench (Vals AI)Not measured0.2%Only Grok 4.7 measured
τ²-Bench Telecom65.5%Not measuredOnly Gemma 4 31B measured
APEX-AgentsNot measured54.6%Only Grok 4.7 measured
Vending-Bench 2Not measured$10,537Only Grok 4.7 measured
Neither model has a result on the other 24 boards here
ReasoningLike-for-likePublic boards, shown as published, kept out of the index53
Reasoning benchmarks for Gemma 4 31B and Grok 4.7
BenchmarkGemma 4 31BGrok 4.7Leader
LiveBench reasoning68.3%82.7%Grok 4.7
MysteryMechanism (Vals AI)Not measured25.2%Only Grok 4.7 measured
GPQA Diamond (Artificial Analysis run)85.7%Not measuredOnly Gemma 4 31B measured
Humanity's Last Exam (Artificial Analysis run)23.6%43.1%Grok 4.7
GPQA Diamond (Epoch AI run)75.8%92.7%Grok 4.7
ARC-AGINot measured90.2%Only Grok 4.7 measured
ARC-AGI-2Not measured61.4%Only Grok 4.7 measured
Chess puzzlesNot measured41.0%Only Grok 4.7 measured
Mystery game puzzlesNot measured29.0%Only Grok 4.7 measured
LMArena Text: hard prompts14481415Gemma 4 31B
LMArena Text: expert14641439Gemma 4 31B
LMArena Text: hard prompts in English14561427Gemma 4 31B
LMArena Vision: diagrams12831254Gemma 4 31B
LMArena Vision: homework13101309Gemma 4 31B
Kagi LLM Benchmark63.5%Not measuredOnly Gemma 4 31B measured
Neither model has a result on the other 7 boards here
MathLike-for-likePublic boards, shown as published, kept out of the index21
Math benchmarks for Gemma 4 31B and Grok 4.7
BenchmarkGemma 4 31BGrok 4.7Leader
OTIS Mock AIME73.3%98.1%Grok 4.7
FrontierMath, tiers 1 to 3Not measured53.0%Only Grok 4.7 measured
FrontierMath, tier 4Not measured17.1%Only Grok 4.7 measured
ProofBenchNot measured26.0%Only Grok 4.7 measured
LMArena Text: math14631414Gemma 4 31B
LMArena Text: mathematical work14651435Gemma 4 31B
Neither model has a result on the other 7 boards here
KnowledgeLike-for-likePublic boards, shown as published, kept out of the index41
Knowledge benchmarks for Gemma 4 31B and Grok 4.7
BenchmarkGemma 4 31BGrok 4.7Leader
LegalBench (Vals AI)Not measured84.4%Only Grok 4.7 measured
CaseLaw (Vals AI)52.6%Not measuredOnly Gemma 4 31B measured
MortgageTax (Vals AI)61.4%Not measuredOnly Gemma 4 31B measured
MedCode (Vals AI)Not measured49.5%Only Grok 4.7 measured
SimpleQA Verified10.4%56.0%Grok 4.7
LMArena Text: science14571419Gemma 4 31B
LMArena Text: medicine and healthcare14511395Gemma 4 31B
LMArena Text: legal and government14381423Gemma 4 31B
LMArena Text: business and finance14301389Gemma 4 31B
FACTS Benchmark Suite45.3%Not measuredOnly Gemma 4 31B measured
Neither model has a result on the other 8 boards here
Web designLike-for-likePublic boards, shown as published, kept out of the index01
Web design benchmarks for Gemma 4 31B and Grok 4.7
BenchmarkGemma 4 31BGrok 4.7Leader
Design Arena: websitesNot measured1254Only Grok 4.7 measured
Design Arena: UI componentsNot measured1275Only Grok 4.7 measured
Design Arena: game devNot measured1313Only Grok 4.7 measured
Design Arena: data vizNot measured1235Only Grok 4.7 measured
Design Arena: 3DNot measured1270Only Grok 4.7 measured
Design Arena: all code categoriesNot measured1271Only Grok 4.7 measured
LiveBench design58.4%78.0%Grok 4.7
Neither model has a result on the other 2 boards here
GeneralLike-for-likePublic boards, shown as published, kept out of the index204
General benchmarks for Gemma 4 31B and Grok 4.7
BenchmarkGemma 4 31BGrok 4.7Leader
Vals IndexNot measured58.6%Only Grok 4.7 measured
LiveBench data analysis53.3%76.9%Grok 4.7
Public Benefits Bench (Vals AI)Not measured65.6%Only Grok 4.7 measured
SAGE (Vals AI)55.0%40.8%Gemma 4 31B
MedScribe (Vals AI)Not measured89.4%Only Grok 4.7 measured
IFBench75.6%Not measuredOnly Gemma 4 31B measured
Long context reasoning (AA-LCR)69.7%80.0%Grok 4.7
DTBench82.7%96.0%Grok 4.7
LMCA39.3%49.4%Grok 4.7
Surface Evolver Bench30.6%Not measuredOnly Gemma 4 31B measured
Furniture assemblyNot measured20.8%Only Grok 4.7 measured
LMArena Text14431399Gemma 4 31B
LMArena Text: instruction following14331406Gemma 4 31B
LMArena Text: creative writing14171381Gemma 4 31B
LMArena Vision12761231Gemma 4 31B
LMArena Text: English14511411Gemma 4 31B
LMArena Text: non-English14301386Gemma 4 31B
LMArena Text: Chinese14751449Gemma 4 31B
LMArena Text: GermanNot measured1366Only Grok 4.7 measured
LMArena Text: JapaneseNot measured1359Only Grok 4.7 measured
LMArena Text: KoreanNot measured1383Only Grok 4.7 measured
LMArena Text: French14361431Gemma 4 31B
LMArena Text: Spanish14421406Gemma 4 31B
LMArena Text: Russian14601399Gemma 4 31B
LMArena Text: Polish14331420Gemma 4 31B
LMArena Text: multi-turn14521394Gemma 4 31B
LMArena Text: longer queries14461416Gemma 4 31B
LMArena Text: writing and language14321394Gemma 4 31B
LMArena Text: entertainment and media14051376Gemma 4 31B
LMArena Vision: English12711229Gemma 4 31B
LMArena Vision: Chinese13261250Gemma 4 31B
LMArena Vision: reading text12821241Gemma 4 31B
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 writing12851217Gemma 4 31B
LMArena Document1425Not measuredOnly Gemma 4 31B measured
Neither model has a result on the other 9 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.7
BenchmarkGemma 4 31BGrok 4.7Leader
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.7$0.0050Fits 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.7$0.118Fits 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.7$0.460Fits 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.7
SpecificationGoogle Gemma 4 31BSpaceXAI Grok 4.7
MakerGooglexAI
WeightsOpen weightsNo public weights listed
ReleasedApril 2, 2026September 21, 2026
Context window262K500K
Input $/Mtok$0.14$2.00
Output $/Mtok$0.40$6.00
Coding index39.066.7
Independent measurements behind it25
Cost per solved taskNot computableNot computable
SourceOpenRouter listingOpenRouter listing

Questions

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

Pick Grok 4.7 for coding: it scores 66.7 on the Vibe Coding Index against 39.0 for Gemma 4 31B. Pick Gemma 4 31B for output tokens 15.0x cheaper ($0.40 vs $6.00 per million) and work measured by LMArena Text: coding or LMArena Text: software and IT, where it leads.

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

Gemma 4 31B costs $0.14 per million input tokens and $0.40 per million output tokens; Grok 4.7 costs $2.00 and $6.00. Cost per solved task is known for neither of them.

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

Grok 4.7, with 500K tokens against 262K.

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

53 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.7's on 5. 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-7" title="Gemma 4 31B vs Grok 4.7, 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-7">LLMBenchmark.ai, Gemma 4 31B vs Grok 4.7</a></p>