FAILURE MAP
← Case archive

FA-98941 / Optimizer update state / Open access

SGD adds the gradient instead of taking a descent step · case 01

SGD adds the gradient instead of taking a descent step.

Verified by executionVariant 1 · 6 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The gradient is added to the parameter.

THE FAILURE

The gradient is added to the parameter.

Unsuccessful approach: Taking the gradient magnitude fixes positive gradients but still mishandles negative ones.

Case contract

One scalar SGD step returns p-lr*g for finite inputs and nonnegative lr.

Why this case matters

Optimizer implementations must associate each parameter with its own mathematically specified update state.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p, g, lr):
    return p+lr*g
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('positive gradient',solve(5,2,N),5-2*N)
check('negative gradient',solve(5,-2,N),5+2*N)
check('zero gradient',solve(N,0,N),N)
check('zero rate',solve(3,-4,0),3)
check('fractional rate',solve(2,1,0.5),1.5)
check('negative parameter',solve(-N,1,2),-N-2)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
positive gradient73Failed
negative gradient37Failed
zero gradient11Passed
zero rate33Passed
fractional rate2.51.5Failed
negative parameter1-3Failed

SHA-256 / ad199038872cedda8c3ccad61a8fc2bafe6860f5ae7c3e590a8a36752c26ec21

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p, g, lr):
    return p-lr*abs(g)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('positive gradient',solve(5,2,N),5-2*N)
check('negative gradient',solve(5,-2,N),5+2*N)
check('zero gradient',solve(N,0,N),N)
check('zero rate',solve(3,-4,0),3)
check('fractional rate',solve(2,1,0.5),1.5)
check('negative parameter',solve(-N,1,2),-N-2)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
positive gradient33Passed
negative gradient37Failed
zero gradient11Passed
zero rate33Passed
fractional rate1.51.5Passed
negative parameter-3-3Passed

SHA-256 / d6e047089e0dfde423a97ebbaa0fb4cb76fe33c63952dac96c33912b531ab011

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 6 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

These are deterministic scalar or short-vector toy contracts, not claims about production optimizer APIs or training quality. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-30T16:48:18.534164+00:00.

Case digest / 487db718c739f51065dd586ca3f0658b6a786ef0cf5c02999eb2acbd40792cc4