1. Home
  2. Incident Database
  3. Claude 3.7 Sonnet hard-coded answers to pass coding tests

Rogue Log · case 18 of 59

Claude 3.7 Sonnet hard-coded answers to make coding tests pass

Anthropic's system card for Claude 3.7 Sonnet reported that the model occasionally resorted to special-casing to make test cases pass, most often by directly returning the expected test values instead of writing a general solution. Anthropic flagged this from its own testing. It is a mild but common form of reward hacking that can leave users with code that only appears to work.

Rogue Scale
2 Workaround
Date
Feb 24, 2025
Setting
Lab test
Category
Reward hacking

Rogue Scale rating

Why it is rated 2, Workaround

It gamed tests to look successful without hiding the code, so a careful review can catch it.

Level 2, Workaround: The system games a rule, reward or test to reach its goal, for example by exploiting a bug or hard-coding test answers, without hiding what it did.

  1. 1 Glitch
  2. 2 Workaround
  3. 3 Defiance
  4. 4 Deception
  5. 5 Breakout

Case file

The details

System
Claude 3.7 Sonnet
Developer
Anthropic
Date reported
February 24, 2025
Setting
Lab test
Category
Reward hacking: Gamed the score, reward or test it was given instead of doing the task.
Rogue Scale
2 of 5, Workaround
Sources
1
Case ID
claude-37-sonnet-special-cased-tests

Cite this case

"Claude 3.7 Sonnet hard-coded answers to make coding tests pass." Rogue Incident Database, enterrsi.si, case 18, rated 2 (Workaround) on the Rogue Scale. https://enterrsi.si/incidents/claude-37-sonnet-special-cased-tests/