FAILURE MAP
← Case archive

FA-13826 / Numerical aggregation / Open access

Huber residual total: Negative tail residuals contribute negative loss. · case 01

The reduction disagrees with its explicit aggregation oracle.

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

ROOT CAUSE

Negative tail residuals contribute negative loss.

VERIFIED REPAIR

Preserve the huber residual total contract at the identified reduction decision.

Unsuccessful approach: Taking absolute value after subtracting the offset produces asymmetric losses.

Case contract

For integer residuals and nonnegative integer threshold delta, sum the convex Huber loss: e**2/2 inside threshold and delta*(abs(e)-delta/2) outside. Return exact Fraction string; this is a bounded loss reduction, not an optimizer.

Why this case matters

Exact bounded examples isolate a reduction defect without floating-point or external-service effects.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(errors, delta):
    if not errors: return "0"
    d=Fraction(delta)
    total=Fraction(0)
    for e in errors:
        a=abs(e)
        total+=Fraction(e*e,2) if a<=d else d*(e-d/2)
    return str(total)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 2, 4], 2)), '10')
check('regression 2', solve(*([0, 1, -1, 4, -4], 2)), '13')
check('regression 3', solve(*([], 2)), '0')
check('regression 4', solve(*([2, -2], 2)), '4')
check('regression 5', solve(*([1, -1, 3], 1)), '7/2')
check('regression 6', solve(*([-5, 0, 2], 3)), '25/2')
check('regression 7', solve(*([7, -2, 1], 0)), '0')
check('regression 8', solve(*([1, 2, 3], 4)), '7')
check("variable Huber tail",solve([N+2,-N-2],2),str(4*N+4))
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
regression 11010Passed
regression 2-313Failed
regression 300Passed
regression 444Passed
regression 57/27/2Passed
regression 6-35/225/2Failed
regression 700Passed
regression 877Passed
variable Huber tail-48Failed

SHA-256 / 2c7b64c4d68a4ccb43bdd793d96ffcc28ad9e46934737e82cbadcc02cac7df7f

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(errors, delta):
    if not errors: return "0"
    d=Fraction(delta)
    total=Fraction(0)
    for e in errors:
        a=abs(e)
        total+=Fraction(e*e,2) if a<=d else abs(d*(e-d/2))
    return str(total)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 2, 4], 2)), '10')
check('regression 2', solve(*([0, 1, -1, 4, -4], 2)), '13')
check('regression 3', solve(*([], 2)), '0')
check('regression 4', solve(*([2, -2], 2)), '4')
check('regression 5', solve(*([1, -1, 3], 1)), '7/2')
check('regression 6', solve(*([-5, 0, 2], 3)), '25/2')
check('regression 7', solve(*([7, -2, 1], 0)), '0')
check('regression 8', solve(*([1, 2, 3], 4)), '7')
check("variable Huber tail",solve([N+2,-N-2],2),str(4*N+4))
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
regression 11010Passed
regression 21713Failed
regression 300Passed
regression 444Passed
regression 57/27/2Passed
regression 643/225/2Failed
regression 700Passed
regression 877Passed
variable Huber tail128Failed

SHA-256 / d4ac3db8a98b4ca589eceb73550cfb7c9d7cca8caa64011d70eb8dabf83e0db8

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(errors, delta):
    if not errors: return "0"
    d=Fraction(delta)
    total=Fraction(0)
    for e in errors:
        a=abs(e)
        total+=Fraction(e*e,2) if a<=d else d*(a-d/2)
    return str(total)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 2, 4], 2)), '10')
check('regression 2', solve(*([0, 1, -1, 4, -4], 2)), '13')
check('regression 3', solve(*([], 2)), '0')
check('regression 4', solve(*([2, -2], 2)), '4')
check('regression 5', solve(*([1, -1, 3], 1)), '7/2')
check('regression 6', solve(*([-5, 0, 2], 3)), '25/2')
check('regression 7', solve(*([7, -2, 1], 0)), '0')
check('regression 8', solve(*([1, 2, 3], 4)), '7')
check("variable Huber tail",solve([N+2,-N-2],2),str(4*N+4))
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
regression 11010Passed
regression 21313Passed
regression 300Passed
regression 444Passed
regression 57/27/2Passed
regression 625/225/2Passed
regression 700Passed
regression 877Passed
variable Huber tail88Passed

SHA-256 / 78a8c2ac27d7f0b31f615e117198e611fa6bf184213587c0dee4eeb9201c804f

Verification & scope

Small offline integer/rational inputs only; no performance, statistical inference, or production-library conformance claim. 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-29T14:39:10.968612+00:00.

Case digest / 0d512acfce488fdf1b90a8a975d0c7109fcdbbf66d30be23eff388634db68800