Claude Sonnet 5 vs Gemma 4 31B
Claude Sonnet 5 leads Gemma 4 31B on coding, 57.7 to 39.0 on the Vibe Coding Index, and Gemma 4 31B costs 25.0x less per output token ($0.40 vs $10.00 per million). Updated October 21, 2026; 63 benchmarks have a result for both.
Claude Sonnet 5 or Gemma 4 31B: which to pick
Pick Claude Sonnet 5 for coding: it scores 57.7 on the Vibe Coding Index against 39.0 for Gemma 4 31B.
Pick Gemma 4 31B for output tokens 25.0x cheaper ($0.40 vs $10.00 per million) and work measured by LMArena Text: medicine and healthcare or SAGE (Vals AI), where it leads.
- Shared results
- 63
- Claude Sonnet 5 only
- 58
- Gemma 4 31B only
- 8
- 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
Claude Sonnet 5
Claude Sonnet 5 scores 57.7 against 39.0.
6 and 2 benchmarks behind the scores
Intelligence
AA Intelligence Index
Claude Sonnet 5
Claude Sonnet 5 leads, 38.2 against 14.7.
Same board, both measured
Agentic work
AA Agentic Index
Claude Sonnet 5
Claude Sonnet 5 leads, 43.6 against 4.2.
Same board, both measured
Reasoning
GPQA Diamond
No call
Only Claude Sonnet 5 has a GPQA Diamond result, 88.9%.
Directional only
Knowledge
MMLU Pro
No call
Only Claude Sonnet 5 has a MMLU Pro result, 87.5%.
Directional only
Web design
Design Arena: websites
No call
Only Claude Sonnet 5 has a Design Arena: websites result, 1274.
Directional only
Long documents
Listed context window
Claude Sonnet 5
Claude Sonnet 5 takes 1M tokens against 262K.
Listed by OpenRouter
Everyday cost
1K input + 500 output tokens
Gemma 4 31B
Claude Sonnet 5 $0.0070, Gemma 4 31B $0.0003 per turn.
List prices
Cost per solved task
One SWE-bench Verified task, solved
No call
Only Claude Sonnet 5 has the number, $1.87.
Directional only
At a glance
- Coding index
- Claude Sonnet 5 57.7 from 6 benchmarks, Gemma 4 31B 39.0 from 2 benchmarks.
- Widest category
- Agentic work, 42.9 points apart on average over 4 shared benchmarks.
- Widest single gap
- LiveBench browser: Claude Sonnet 5 72.0% against Gemma 4 31B 4.0%, 68.0 points apart on a 0 to 100 scale.
- Output price
- Claude Sonnet 5 $10.00 against Gemma 4 31B $0.40 per million output tokens, 25.0x apart.
- Context window
- Claude Sonnet 5 takes 1M tokens, Gemma 4 31B 262K.
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 | Claude Sonnet 5 | Bars | Gemma 4 31B | Ties |
|---|---|---|---|---|
| Coding | 11 | 0 | ||
| Intelligence | 2 | 0 | ||
| Agentic work | 4 | 0 | ||
| Reasoning | 9 | 0 | ||
| Math | 3 | 0 | ||
| Knowledge | 5 | 1 | ||
| Web design | 1 | 0 | ||
| General | 17 | 10 | ||
| All shared boards | 52 | 11 |
CodingLike-for-likeSix of these boards feed the Vibe Coding Index110
| Benchmark | Claude Sonnet 5 | Gemma 4 31B | Leader |
|---|---|---|---|
| LiveBench coding | 74.7% | 49.0% | Claude Sonnet 5 |
| LMArena WebDev | 1540 | 1367 | Claude Sonnet 5 |
| AA Coding Index | 71.5 | 43.4 | Claude Sonnet 5 |
| LiveCodeBench (Vals AI) | 82.4% | Not measured | Only Claude Sonnet 5 measured |
| SWE-bench Verified (Vals AI) | 79.6% | Not measured | Only Claude Sonnet 5 measured |
| Terminal-Bench 4 (Vals AI) | 10.6% | Not measured | Only Claude Sonnet 5 measured |
| Vibe Code Bench (Vals AI) | 81.3% | Not measured | Only Claude Sonnet 5 measured |
| Code migration (Vals AI) | 44.4% | Not measured | Only Claude Sonnet 5 measured |
| ProgramBench (Vals AI) | 0.0% | Not measured | Only Claude Sonnet 5 measured |
| IOI (Vals AI) | 45.0% | Not measured | Only Claude Sonnet 5 measured |
| Terminal-Bench 2.1 (Vals AI) | 74.5% | Not measured | Only Claude Sonnet 5 measured |
| Vibe Code Bench 1-100 (Vals AI) | 13.8% | Not measured | Only Claude Sonnet 5 measured |
| SkillsBench (Vals AI) | 46.5% | Not measured | Only Claude Sonnet 5 measured |
| CyberBench (Vals AI) | 70.3% | Not measured | Only Claude Sonnet 5 measured |
| SciCode | 54.3% | 45.5% | Claude Sonnet 5 |
| Terminal-Bench Hard (Artificial Analysis run) | Not measured | 36.4% | Only Gemma 4 31B measured |
| FrontierCode | 42.7% | Not measured | Only Claude Sonnet 5 measured |
| GSO-Bench | 37.3% | Not measured | Only Claude Sonnet 5 measured |
| WeirdML | 68.8% | 52.3% | Claude Sonnet 5 |
| ALE-Bench | 1463.1 | 925.5 | Claude Sonnet 5 |
| LMArena Text: coding | 1483 | 1459 | Claude Sonnet 5 |
| LMArena Text: software and IT | 1474 | 1463 | Claude Sonnet 5 |
| LMArena WebDev: React | 1541 | 1359 | Claude Sonnet 5 |
| LMArena WebDev: HTML | 1527 | 1380 | Claude Sonnet 5 |
| LMArena WebDev: from an image | 1540 | Not measured | Only Claude Sonnet 5 measured |
| SciCode | 10.7% | 8.9% | Claude Sonnet 5 |
| Neither model has a result on the other 13 boards here | |||
IntelligenceLike-for-likePublic boards, shown as published, kept out of the index20
| Benchmark | Claude Sonnet 5 | Gemma 4 31B | Leader |
|---|---|---|---|
| AA Intelligence Index | 38.2 | 14.7 | Claude Sonnet 5 |
| Epoch Capabilities Index | 156.9 | 143.0 | Claude Sonnet 5 |
Agentic workLike-for-likePublic boards, shown as published, kept out of the index40
| Benchmark | Claude Sonnet 5 | Gemma 4 31B | Leader |
|---|---|---|---|
| AA Agentic Index | 43.6 | 4.2 | Claude Sonnet 5 |
| Design Arena: agents building web apps | 1245 | Not measured | Only Claude Sonnet 5 measured |
| Design Arena: agents building full-stack apps | 1249 | Not measured | Only Claude Sonnet 5 measured |
| Design Arena: agents building mobile apps | 1215 | Not measured | Only Claude Sonnet 5 measured |
| Design Arena: agents building Android apps | 1225 | Not measured | Only Claude Sonnet 5 measured |
| Design Arena: agents building Godot games | 1225 | Not measured | Only Claude Sonnet 5 measured |
| Design Arena: agents building games | 1227 | Not measured | Only Claude Sonnet 5 measured |
| Design Arena: HTML slides | 1218 | Not measured | Only Claude Sonnet 5 measured |
| Design Arena: PowerPoint slides | 1216 | Not measured | Only Claude Sonnet 5 measured |
| Design Arena: spreadsheets | 1021 | Not measured | Only Claude Sonnet 5 measured |
| LiveBench research | 82.8% | 44.4% | Claude Sonnet 5 |
| LiveBench browser | 72.0% | 4.0% | Claude Sonnet 5 |
| LiveBench long agentic | 39.0% | 13.3% | Claude Sonnet 5 |
| SREBench (Vals AI) | 0.4% | Not measured | Only Claude Sonnet 5 measured |
| Finance Agent (Vals AI) | 53.9% | Not measured | Only Claude Sonnet 5 measured |
| Tax Agent Bench (Vals AI) | 29.4% | Not measured | Only Claude Sonnet 5 measured |
| Legal Research Bench (Vals AI) | 41.8% | Not measured | Only Claude Sonnet 5 measured |
| Excel Modeling Benchmark (Vals AI) | 66.3% | Not measured | Only Claude Sonnet 5 measured |
| Terminal-Bench-Science (Vals AI) | 5.7% | Not measured | Only Claude Sonnet 5 measured |
| τ²-Bench Telecom | Not measured | 65.5% | Only Gemma 4 31B measured |
| APEX-Agents | 54.5% | Not measured | Only Claude Sonnet 5 measured |
| Vending-Bench 2 | $6,378 | Not measured | Only Claude Sonnet 5 measured |
| Neither model has a result on the other 19 boards here | |||
ReasoningLike-for-likePublic boards, shown as published, kept out of the index90
| Benchmark | Claude Sonnet 5 | Gemma 4 31B | Leader |
|---|---|---|---|
| GPQA Diamond | 88.9% | Not measured | Only Claude Sonnet 5 measured |
| LiveBench reasoning | 88.7% | 68.3% | Claude Sonnet 5 |
| MMMU Pro (Vals AI) | 83.0% | Not measured | Only Claude Sonnet 5 measured |
| GPQA Diamond (Artificial Analysis run) | 91.1% | 85.7% | Claude Sonnet 5 |
| Humanity's Last Exam (Artificial Analysis run) | 41.3% | 23.6% | Claude Sonnet 5 |
| GPQA Diamond (Epoch AI run) | 90.5% | 75.8% | Claude Sonnet 5 |
| SimpleBench | 60.6% | Not measured | Only Claude Sonnet 5 measured |
| Chess puzzles | 45.0% | Not measured | Only Claude Sonnet 5 measured |
| Mystery game puzzles | 35.0% | Not measured | Only Claude Sonnet 5 measured |
| LMArena Text: hard prompts | 1461 | 1448 | Claude Sonnet 5 |
| LMArena Text: expert | 1489 | 1464 | Claude Sonnet 5 |
| LMArena Text: hard prompts in English | 1464 | 1456 | Claude Sonnet 5 |
| LMArena Vision: diagrams | 1293 | 1283 | Claude Sonnet 5 |
| LMArena Vision: homework | 1311 | 1310 | Claude Sonnet 5 |
| Kagi LLM Benchmark | Not measured | 63.5% | 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 index30
| Benchmark | Claude Sonnet 5 | Gemma 4 31B | Leader |
|---|---|---|---|
| OTIS Mock AIME | 94.7% | 73.3% | Claude Sonnet 5 |
| FrontierMath, tiers 1 to 3 | 65.6% | Not measured | Only Claude Sonnet 5 measured |
| FrontierMath, tier 4 | 29.3% | Not measured | Only Claude Sonnet 5 measured |
| ProofBench | 77.0% | Not measured | Only Claude Sonnet 5 measured |
| LMArena Text: math | 1467 | 1463 | Claude Sonnet 5 |
| LMArena Text: mathematical work | 1481 | 1465 | Claude Sonnet 5 |
| Neither model has a result on the other 7 boards here | |||
KnowledgeLike-for-likePublic boards, shown as published, kept out of the index51
| Benchmark | Claude Sonnet 5 | Gemma 4 31B | Leader |
|---|---|---|---|
| MMLU Pro | 87.5% | Not measured | Only Claude Sonnet 5 measured |
| LegalBench (Vals AI) | 83.9% | Not measured | Only Claude Sonnet 5 measured |
| CaseLaw (Vals AI) | Not measured | 52.6% | Only Gemma 4 31B measured |
| CorpFin (Vals AI) | 67.0% | Not measured | Only Claude Sonnet 5 measured |
| TaxEval (Vals AI) | 75.6% | Not measured | Only Claude Sonnet 5 measured |
| MortgageTax (Vals AI) | 70.0% | 61.4% | Claude Sonnet 5 |
| MedCode (Vals AI) | 47.5% | Not measured | Only Claude Sonnet 5 measured |
| SimpleQA Verified | 33.7% | 10.4% | Claude Sonnet 5 |
| LMArena Text: science | 1460 | 1457 | Claude Sonnet 5 |
| LMArena Text: medicine and healthcare | 1442 | 1451 | Gemma 4 31B |
| LMArena Text: legal and government | 1454 | 1438 | Claude Sonnet 5 |
| LMArena Text: business and finance | 1436 | 1430 | Claude Sonnet 5 |
| FACTS Benchmark Suite | Not measured | 45.3% | Only Gemma 4 31B measured |
| Neither model has a result on the other 5 boards here | |||
Web designLike-for-likePublic boards, shown as published, kept out of the index10
| Benchmark | Claude Sonnet 5 | Gemma 4 31B | Leader |
|---|---|---|---|
| Design Arena: websites | 1274 | Not measured | Only Claude Sonnet 5 measured |
| Design Arena: UI components | 1280 | Not measured | Only Claude Sonnet 5 measured |
| Design Arena: game dev | 1278 | Not measured | Only Claude Sonnet 5 measured |
| Design Arena: data viz | 1251 | Not measured | Only Claude Sonnet 5 measured |
| Design Arena: 3D | 1261 | Not measured | Only Claude Sonnet 5 measured |
| Design Arena: all code categories | 1276 | Not measured | Only Claude Sonnet 5 measured |
| Design Arena: SVG | 1193 | Not measured | Only Claude Sonnet 5 measured |
| Design Arena: ASCII art | 1207 | Not measured | Only Claude Sonnet 5 measured |
| LiveBench design | 82.0% | 58.4% | Claude Sonnet 5 |
GeneralLike-for-likePublic boards, shown as published, kept out of the index1710
| Benchmark | Claude Sonnet 5 | Gemma 4 31B | Leader |
|---|---|---|---|
| LiveBench data analysis | 71.7% | 53.3% | Claude Sonnet 5 |
| Public Benefits Bench (Vals AI) | 66.0% | Not measured | Only Claude Sonnet 5 measured |
| SAGE (Vals AI) | 48.9% | 55.0% | Gemma 4 31B |
| MedScribe (Vals AI) | 76.0% | Not measured | Only Claude Sonnet 5 measured |
| Vals Multimodal Index | 68.8% | Not measured | Only Claude Sonnet 5 measured |
| IFBench | Not measured | 75.6% | Only Gemma 4 31B measured |
| Long context reasoning (AA-LCR) | 82.0% | 69.7% | Claude Sonnet 5 |
| DTBench | 92.5% | 82.7% | Claude Sonnet 5 |
| LMCA | 50.0% | 39.3% | Claude Sonnet 5 |
| Surface Evolver Bench | 60.0% | 30.6% | Claude Sonnet 5 |
| LMArena Text | 1442 | 1443 | Gemma 4 31B |
| LMArena Text: instruction following | 1452 | 1433 | Claude Sonnet 5 |
| LMArena Text: creative writing | 1416 | 1417 | Gemma 4 31B |
| LMArena Vision | 1273 | 1276 | Gemma 4 31B |
| LMArena Text: English | 1450 | 1451 | Gemma 4 31B |
| LMArena Text: non-English | 1431 | 1430 | Claude Sonnet 5 |
| LMArena Text: Chinese | 1478 | 1475 | Claude Sonnet 5 |
| LMArena Text: German | 1442 | Not measured | Only Claude Sonnet 5 measured |
| LMArena Text: Japanese | 1422 | Not measured | Only Claude Sonnet 5 measured |
| LMArena Text: Korean | 1412 | Not measured | Only Claude Sonnet 5 measured |
| LMArena Text: French | 1463 | 1436 | Claude Sonnet 5 |
| LMArena Text: Spanish | 1438 | 1442 | Gemma 4 31B |
| LMArena Text: Russian | 1450 | 1460 | Gemma 4 31B |
| LMArena Text: Polish | 1425 | 1433 | Gemma 4 31B |
| LMArena Text: multi-turn | 1453 | 1452 | Claude Sonnet 5 |
| LMArena Text: longer queries | 1462 | 1446 | Claude Sonnet 5 |
| LMArena Text: writing and language | 1436 | 1432 | Claude Sonnet 5 |
| LMArena Text: entertainment and media | 1411 | 1405 | Claude Sonnet 5 |
| LMArena Vision: English | 1275 | 1271 | Claude Sonnet 5 |
| LMArena Vision: Chinese | 1331 | 1326 | Claude Sonnet 5 |
| LMArena Vision: reading text | 1288 | 1282 | Claude Sonnet 5 |
| LMArena Vision: humor | 1261 | 1280 | Gemma 4 31B |
| LMArena Vision: captioning | Not measured | 1218 | Only Gemma 4 31B measured |
| LMArena Vision: recognizing things | Not measured | 1226 | Only Gemma 4 31B measured |
| LMArena Vision: creative writing | 1246 | 1285 | Gemma 4 31B |
| LMArena Document | 1466 | 1425 | Claude Sonnet 5 |
| 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
| Benchmark | Claude Sonnet 5 | Gemma 4 31B | 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 | Anthropic Claude Sonnet 5 | Google Gemma 4 31B |
|---|---|---|
| Maker | Anthropic | |
| Weights | No public weights listed | Open weights |
| Released | June 30, 2026 | April 2, 2026 |
| Context window | 1M | 262K |
| Input $/Mtok | $2.00 | $0.14 |
| Output $/Mtok | $10.00 | $0.40 |
| Coding index | 57.7 | 39.0 |
| Independent measurements behind it | 6 | 2 |
| Cost per solved task | $1.87 | Not computable |
| Source | OpenRouter listing | OpenRouter listing |
Questions
Is Claude Sonnet 5 better than Gemma 4 31B for coding?
Pick Claude Sonnet 5 for coding: it scores 57.7 on the Vibe Coding Index against 39.0 for Gemma 4 31B. Pick Gemma 4 31B for output tokens 25.0x cheaper ($0.40 vs $10.00 per million) and work measured by LMArena Text: medicine and healthcare or SAGE (Vals AI), where it leads.
Which is cheaper, Claude Sonnet 5 or Gemma 4 31B?
Claude Sonnet 5 costs $2.00 per million input tokens and $10.00 per million output tokens; Gemma 4 31B costs $0.14 and $0.40. Cost per solved task is known for Claude Sonnet 5 only.
Which has the bigger context window, Claude Sonnet 5 or Gemma 4 31B?
Claude Sonnet 5, with 1M tokens against 262K.
How many benchmarks is the Claude Sonnet 5 vs Gemma 4 31B comparison based on?
63 benchmarks have a result for both models as of October 21, 2026. Claude Sonnet 5's coding index rests on 6 independent benchmarks and Gemma 4 31B's on 2. Where only one model has a result, the page says so instead of naming a winner.