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 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.
Coding
Vibe Coding Index, six public coding benchmarks
Grok 4.7
Grok 4.7 scores 66.7 against 39.0.
2 and 5 benchmarks behind the scores
Intelligence
AA Intelligence Index
Grok 4.7
Grok 4.7 leads, 46.4 against 14.7.
Same board, both measured
Agentic work
AA Agentic Index
No call
Only Gemma 4 31B has a AA Agentic Index result, 4.2.
Directional only
Web design
Design Arena: websites
No call
Only Grok 4.7 has a Design Arena: websites result, 1254.
Directional only
General
Vals Index
No call
Only Grok 4.7 has a Vals Index result, 58.6%.
Directional only
Long documents
Listed context window
Grok 4.7
Grok 4.7 takes 500K tokens against 262K.
Listed by OpenRouter
Everyday cost
1K input + 500 output tokens
Gemma 4 31B
Gemma 4 31B $0.0003, Grok 4.7 $0.0050 per turn.
List prices
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.
| Category | Gemma 4 31B | Bars | Grok 4.7 | Ties |
|---|---|---|---|---|
| Coding | 2 | 5 | ||
| Intelligence | 0 | 2 | ||
| Agentic work | 0 | 3 | ||
| Reasoning | 5 | 3 | ||
| Math | 2 | 1 | ||
| Knowledge | 4 | 1 | ||
| Web design | 0 | 1 | ||
| General | 20 | 4 | ||
| All shared boards | 33 | 20 |
CodingLike-for-likeSix of these boards feed the Vibe Coding Index25
| Benchmark | Gemma 4 31B | Grok 4.7 | Leader |
|---|---|---|---|
| LiveBench coding | 49.0% | 84.5% | Grok 4.7 |
| LMArena WebDev | 1367 | 1637 | Grok 4.7 |
| AA Coding Index | 43.4 | Not measured | Only Gemma 4 31B measured |
| Terminal-Bench 4 (Vals AI) | Not measured | 28.8% | Only Grok 4.7 measured |
| Vibe Code Bench (Vals AI) | Not measured | 86.2% | Only Grok 4.7 measured |
| Code migration (Vals AI) | Not measured | 44.8% | Only Grok 4.7 measured |
| ProgramBench (Vals AI) | Not measured | 0.5% | Only Grok 4.7 measured |
| IOI (Vals AI) | Not measured | 57.7% | Only Grok 4.7 measured |
| Terminal-Bench 2.1 (Vals AI) | Not measured | 73.4% | Only Grok 4.7 measured |
| SWE-bench Multimodal (Vals AI) | Not measured | 42.9% | Only Grok 4.7 measured |
| CyberBench (Vals AI) | Not measured | 69.5% | Only Grok 4.7 measured |
| SciCode | 45.5% | 57.8% | Grok 4.7 |
| Terminal-Bench Hard (Artificial Analysis run) | 36.4% | Not measured | Only Gemma 4 31B measured |
| FrontierCode | Not measured | 47.6% | Only Grok 4.7 measured |
| FrontierSWE | Not measured | 29.5% | Only Grok 4.7 measured |
| WeirdML | 52.3% | Not measured | Only Gemma 4 31B measured |
| ALE-Bench | 925.5 | Not measured | Only Gemma 4 31B measured |
| LMArena Text: coding | 1459 | 1432 | Gemma 4 31B |
| LMArena Text: software and IT | 1463 | 1421 | Gemma 4 31B |
| LMArena WebDev: React | 1359 | 1663 | Grok 4.7 |
| LMArena WebDev: HTML | 1380 | 1627 | Grok 4.7 |
| LMArena WebDev: from an image | Not measured | 1586 | Only Grok 4.7 measured |
| SciCode | 8.9% | Not measured | Only 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
| Benchmark | Gemma 4 31B | Grok 4.7 | Leader |
|---|---|---|---|
| AA Intelligence Index | 14.7 | 46.4 | Grok 4.7 |
| Epoch Capabilities Index | 143.0 | 154.4 | Grok 4.7 |
Agentic workLike-for-likePublic boards, shown as published, kept out of the index03
| Benchmark | Gemma 4 31B | Grok 4.7 | Leader |
|---|---|---|---|
| AA Agentic Index | 4.2 | Not measured | Only Gemma 4 31B measured |
| LiveBench research | 44.4% | 86.4% | Grok 4.7 |
| LiveBench browser | 4.0% | 60.0% | Grok 4.7 |
| LiveBench long agentic | 13.3% | 50.1% | Grok 4.7 |
| SREBench (Vals AI) | Not measured | 3.8% | Only Grok 4.7 measured |
| Finance Agent (Vals AI) | Not measured | 52.3% | Only Grok 4.7 measured |
| Tax Agent Bench (Vals AI) | Not measured | 34.2% | Only Grok 4.7 measured |
| Legal Research Bench (Vals AI) | Not measured | 47.1% | Only Grok 4.7 measured |
| Harvey's Legal Agent Benchmark (Vals AI) | Not measured | 18.3% | Only Grok 4.7 measured |
| Excel Modeling Benchmark (Vals AI) | Not measured | 67.0% | Only Grok 4.7 measured |
| BioMysteryBench (Vals AI) | Not measured | 69.3% | Only Grok 4.7 measured |
| Terminal-Bench-Science (Vals AI) | Not measured | 10.0% | Only Grok 4.7 measured |
| Vals Science Index | Not measured | 34.8% | Only Grok 4.7 measured |
| Robo-bench (Vals AI) | Not measured | 0.2% | Only Grok 4.7 measured |
| τ²-Bench Telecom | 65.5% | Not measured | Only Gemma 4 31B measured |
| APEX-Agents | Not measured | 54.6% | Only Grok 4.7 measured |
| Vending-Bench 2 | Not measured | $10,537 | Only 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
| Benchmark | Gemma 4 31B | Grok 4.7 | Leader |
|---|---|---|---|
| LiveBench reasoning | 68.3% | 82.7% | Grok 4.7 |
| MysteryMechanism (Vals AI) | Not measured | 25.2% | Only Grok 4.7 measured |
| GPQA Diamond (Artificial Analysis run) | 85.7% | Not measured | Only 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-AGI | Not measured | 90.2% | Only Grok 4.7 measured |
| ARC-AGI-2 | Not measured | 61.4% | Only Grok 4.7 measured |
| Chess puzzles | Not measured | 41.0% | Only Grok 4.7 measured |
| Mystery game puzzles | Not measured | 29.0% | Only Grok 4.7 measured |
| LMArena Text: hard prompts | 1448 | 1415 | Gemma 4 31B |
| LMArena Text: expert | 1464 | 1439 | Gemma 4 31B |
| LMArena Text: hard prompts in English | 1456 | 1427 | Gemma 4 31B |
| LMArena Vision: diagrams | 1283 | 1254 | Gemma 4 31B |
| LMArena Vision: homework | 1310 | 1309 | Gemma 4 31B |
| Kagi LLM Benchmark | 63.5% | Not measured | Only 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
| Benchmark | Gemma 4 31B | Grok 4.7 | Leader |
|---|---|---|---|
| OTIS Mock AIME | 73.3% | 98.1% | Grok 4.7 |
| FrontierMath, tiers 1 to 3 | Not measured | 53.0% | Only Grok 4.7 measured |
| FrontierMath, tier 4 | Not measured | 17.1% | Only Grok 4.7 measured |
| ProofBench | Not measured | 26.0% | Only Grok 4.7 measured |
| LMArena Text: math | 1463 | 1414 | Gemma 4 31B |
| LMArena Text: mathematical work | 1465 | 1435 | Gemma 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
| Benchmark | Gemma 4 31B | Grok 4.7 | Leader |
|---|---|---|---|
| LegalBench (Vals AI) | Not measured | 84.4% | Only Grok 4.7 measured |
| CaseLaw (Vals AI) | 52.6% | Not measured | Only Gemma 4 31B measured |
| MortgageTax (Vals AI) | 61.4% | Not measured | Only Gemma 4 31B measured |
| MedCode (Vals AI) | Not measured | 49.5% | Only Grok 4.7 measured |
| SimpleQA Verified | 10.4% | 56.0% | Grok 4.7 |
| LMArena Text: science | 1457 | 1419 | Gemma 4 31B |
| LMArena Text: medicine and healthcare | 1451 | 1395 | Gemma 4 31B |
| LMArena Text: legal and government | 1438 | 1423 | Gemma 4 31B |
| LMArena Text: business and finance | 1430 | 1389 | Gemma 4 31B |
| FACTS Benchmark Suite | 45.3% | Not measured | Only 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
| Benchmark | Gemma 4 31B | Grok 4.7 | Leader |
|---|---|---|---|
| Design Arena: websites | Not measured | 1254 | Only Grok 4.7 measured |
| Design Arena: UI components | Not measured | 1275 | Only Grok 4.7 measured |
| Design Arena: game dev | Not measured | 1313 | Only Grok 4.7 measured |
| Design Arena: data viz | Not measured | 1235 | Only Grok 4.7 measured |
| Design Arena: 3D | Not measured | 1270 | Only Grok 4.7 measured |
| Design Arena: all code categories | Not measured | 1271 | Only Grok 4.7 measured |
| LiveBench design | 58.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
| Benchmark | Gemma 4 31B | Grok 4.7 | Leader |
|---|---|---|---|
| Vals Index | Not measured | 58.6% | Only Grok 4.7 measured |
| LiveBench data analysis | 53.3% | 76.9% | Grok 4.7 |
| Public Benefits Bench (Vals AI) | Not measured | 65.6% | Only Grok 4.7 measured |
| SAGE (Vals AI) | 55.0% | 40.8% | Gemma 4 31B |
| MedScribe (Vals AI) | Not measured | 89.4% | Only Grok 4.7 measured |
| IFBench | 75.6% | Not measured | Only Gemma 4 31B measured |
| Long context reasoning (AA-LCR) | 69.7% | 80.0% | Grok 4.7 |
| DTBench | 82.7% | 96.0% | Grok 4.7 |
| LMCA | 39.3% | 49.4% | Grok 4.7 |
| Surface Evolver Bench | 30.6% | Not measured | Only Gemma 4 31B measured |
| Furniture assembly | Not measured | 20.8% | Only Grok 4.7 measured |
| LMArena Text | 1443 | 1399 | Gemma 4 31B |
| LMArena Text: instruction following | 1433 | 1406 | Gemma 4 31B |
| LMArena Text: creative writing | 1417 | 1381 | Gemma 4 31B |
| LMArena Vision | 1276 | 1231 | Gemma 4 31B |
| LMArena Text: English | 1451 | 1411 | Gemma 4 31B |
| LMArena Text: non-English | 1430 | 1386 | Gemma 4 31B |
| LMArena Text: Chinese | 1475 | 1449 | Gemma 4 31B |
| LMArena Text: German | Not measured | 1366 | Only Grok 4.7 measured |
| LMArena Text: Japanese | Not measured | 1359 | Only Grok 4.7 measured |
| LMArena Text: Korean | Not measured | 1383 | Only Grok 4.7 measured |
| LMArena Text: French | 1436 | 1431 | Gemma 4 31B |
| LMArena Text: Spanish | 1442 | 1406 | Gemma 4 31B |
| LMArena Text: Russian | 1460 | 1399 | Gemma 4 31B |
| LMArena Text: Polish | 1433 | 1420 | Gemma 4 31B |
| LMArena Text: multi-turn | 1452 | 1394 | Gemma 4 31B |
| LMArena Text: longer queries | 1446 | 1416 | Gemma 4 31B |
| LMArena Text: writing and language | 1432 | 1394 | Gemma 4 31B |
| LMArena Text: entertainment and media | 1405 | 1376 | Gemma 4 31B |
| LMArena Vision: English | 1271 | 1229 | Gemma 4 31B |
| LMArena Vision: Chinese | 1326 | 1250 | Gemma 4 31B |
| LMArena Vision: reading text | 1282 | 1241 | Gemma 4 31B |
| LMArena Vision: humor | 1280 | Not measured | Only Gemma 4 31B measured |
| LMArena Vision: captioning | 1218 | Not measured | Only Gemma 4 31B measured |
| LMArena Vision: recognizing things | 1226 | Not measured | Only Gemma 4 31B measured |
| LMArena Vision: creative writing | 1285 | 1217 | Gemma 4 31B |
| LMArena Document | 1425 | Not measured | Only 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
| Benchmark | Gemma 4 31B | Grok 4.7 | Leader |
|---|---|---|---|
| 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 costs less
Repository review
50K input + 3K output tokens
Gemma 4 31B costs less
Agent loop
200K input + 10K output tokens
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.
| Specification | Google Gemma 4 31B | SpaceXAI Grok 4.7 |
|---|---|---|
| Maker | xAI | |
| Weights | Open weights | No public weights listed |
| Released | April 2, 2026 | September 21, 2026 |
| Context window | 262K | 500K |
| Input $/Mtok | $0.14 | $2.00 |
| Output $/Mtok | $0.40 | $6.00 |
| Coding index | 39.0 | 66.7 |
| Independent measurements behind it | 2 | 5 |
| Cost per solved task | Not computable | Not computable |
| Source | OpenRouter listing | OpenRouter 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.