Skip to content
Isometric chip on a plate with pins, one cell of the grid lit in accent blue

For AI labs

The bug that doesn't crash

The hardest bugs to test for produce no error. The code runs, the output looks right, and the numbers are quietly off. A quantised kernel that returns slightly wrong values is the classic case. This is the depth benchmark tasks need to reach, and how to write tests that reach it.

Prashant Kumar Singh · · 4 min read

In short

  • The most valuable benchmark tasks target bugs that do not crash: the code runs, nothing warns, and the result is slightly wrong.
  • Quantised (int8) kernels are the canonical example: a scale factor off by one, an overflow in accumulation, or a rounding mode produces plausible numbers that are wrong.
  • Tests for these bugs compare against a reference within a justified tolerance, probe the edges, and check a statistic across many inputs, not one sample.

A crash is a gift. It tells you where, it tells you when, and it stops the wrong answer from going anywhere. The bugs that cost real money are the ones that do none of that. The code runs to completion, the output has the right shape and a plausible range, and somewhere in it a number is off by a little. Nobody notices until something downstream behaves strangely weeks later.

These are the bugs I write benchmark tasks around, because they are where models, and plenty of engineers, slip. This post is about the pattern, with no client task content in it.

The canonical case: a quantised kernel

Quantisation stores numbers in fewer bits, int8 instead of float32, to make models smaller and faster. The arithmetic needs a scale factor and sometimes a zero point to map between the two ranges. Get the scale slightly wrong, accumulate in a type that overflows, or round in the wrong direction, and the kernel still runs. It returns numbers that are near the right ones. On a single test input the difference might be within noise. Across a model it degrades accuracy by a few points and nobody can say why.

A task built on this pattern is hard for the right reasons. The model has to understand what the code is supposed to compute, construct inputs that expose the drift, and reason about numerics rather than pattern-match a stack trace. There is no error message to search for.

Other bugs in the same family

  • Off-by-one in a window or a boundary. The loop runs, one element is dropped or doubled, aggregates shift slightly.
  • Timezone and daylight-saving handling. Dates parse, totals are right eleven months a year.
  • Floating-point accumulation order. Parallel sums differ from serial ones; a test with a tight equality check flakes, a loose one hides the bug.
  • Unit mismatches. Milliseconds in, seconds assumed. Everything runs; everything is a thousand times off in one branch.
  • Random seed not propagated. Results are reproducible on the author's machine and nowhere else.

How to test for a bug that does not crash

  1. 1.Compare against a reference, not against expected output. A slow, obviously correct implementation computes the truth; the test checks the fast path against it.
  2. 2.Use a justified tolerance. Not 1e-9 because it is small, and not 0.1 because the test passes. The tolerance is derived from the numerics and written in a comment.
  3. 3.Probe the edges. Maximum and minimum representable values, zero, negative zero, lengths of one and of a power of two, inputs that force rounding.
  4. 4.Check a statistic across many inputs. Mean absolute error across a thousand random inputs catches drift that one sample hides.
  5. 5.Make the hidden tests different from the visible ones. If the agent can see the inputs the test uses, it can special-case them.

Why this matters for benchmarks

A benchmark full of crash-and-fix tasks measures whether a model can read a stack trace. A benchmark with silent-bug tasks measures whether it can reason about what code is for. The second is the capability labs are paying to measure, and it is the kind of task that gets accepted at review because it cannot be gamed by pattern matching.

Questions people ask

What is a silent bug?
A defect that produces no error or crash. The code runs to completion and returns plausible output that is wrong, often by a small amount, such as a quantised kernel with a slightly incorrect scale factor.
How do you write tests for numerical bugs?
Compare the implementation against a slow reference within a tolerance derived from the numerics, probe boundary values, check an error statistic across many random inputs, and keep the hidden test inputs different from the visible ones.
Why are silent-bug tasks good benchmark tasks?
They cannot be solved by searching an error message. The model has to understand what the code should compute and construct inputs that expose the drift, which is the capability labs want to measure.

If you're a founder

Your AI feature can have silent bugs too: an answer that looks right and cites the wrong record. Design so the user can check the source, and the silent bug becomes visible.

If you run an AI lab or data team

If your task set is mostly crash-and-fix, send one task and I will show in the free review how to deepen it into a silent-bug task with tests that hold.

Sources

  1. Generic pattern from own authoring and review work; no client task content

Free first step

Get a free written review of one task.
No call needed, no commitment.

Send one task, rubric or test suite. NDA on request, or a sanitised sample. Written review within 48 hours.

Send a task for review

Free · Written review in 48 hours · No commitment

Prefer email? prashantkumarsingh.work@gmail.com