Negative controls for the reference comparators: a rejected variant must fail
Summary
ds4_test has several comparators that judge a backend against a reference
(official continuation vectors, local golden vectors, cold-vs-resumed
prefill). Each one is only evidence when it is known to reject a wrong
backend, and today only one test in the tree demonstrates that. This issue
proposes adding a "rejected variant must fail" control to each comparator,
before any of the thresholds are touched or reused for new backends. It is
test infrastructure, so it is filed as an issue first rather than a PR.
What exists
The one control is tests/test_dspark_eos_contract.py: line 6 says
"An optional source path admits a pre-fix negative control without editing
it", --source points the harness at a pre-fix ds4.c, and the report
line prints observed_negative so a run against the fixed tree and a run
against the old tree are distinguishable. That is the shape this issue asks
for elsewhere.
The comparators without one (line numbers on main at 0aaea5a):
tests/ds4_test.c:5964test_local_golden_overlapand:5975test_local_golden_max_abs, used by--local-golden-vectors(:6036-6062). Thresholds: top-1 equal, top-5 overlap >= 4, top-20 overlap >= 15, top-64 overlap >= 40, top-20 max-abs logit delta <= 8.0. The comment says it is "intentionally tolerant" and meant to catch "wrong tiling, skipped work, bad dispatch". Nothing in the tree shows that a wrong-tiling or skipped-work backend actually lands outside those bounds; 8.0 logits and 40/64 could be wide enough to pass a mis-dispatched layer on a long prompt.tests/ds4_test.c:5301test_glm53_continued_prefill(:5366-5384): asserts resumed and cold top-1 agree and top-8 sets overlap, and only printsmax same-rank logit delta. A resumed prefill that attends through a wrong schedule can keep the same argmax and still be a different model; the number that would show it is logged, not asserted.--logprob-vectors(CONTRIBUTING's "catches tokenizer, template, attention, and logits regressions"): same question, which class of fault has it been shown to catch, at what margin.
Proposal
For each comparator, one control that runs the comparator against a variant known to be wrong and asserts the comparator fails at the calibrated floor. The control must be a real, shipped drift path, not a synthetic perturbation of the reference, otherwise it only tests the assertion, not the floor.
--local-golden-vectors: addDS4_TEST_LOCAL_GOLDEN_EXPECT_FAIL=1(or a--local-golden-negativeselector) that runs the same cases with a known-bad backend knob and requires at least one of the five assertions to trip on every case. Candidate knobs that already exist and change numerics:DS4_METAL_MATH_SAFE, the pre-M5 router transform switch (DS4_METAL_DISABLE_PRE_M5_ROUTER_TRANSFORM_FINALIZE_FUSION), and the prefill chunk override. If none of those trips the floor, the floor is not calibrated and that is the finding: the control then documents the smallest margin (top-20 max-abs, overlap counts) each knob produces, so the thresholds can be tightened to sit between "sane kernel change" and "wrong dispatch".--glm53-continued-prefill: promotemax same-rank logit deltafrom a log line to an assertion with a floor chosen from a cold-vs-cold repeat (the noise floor), then add the negative: resume with the split placed one token too far (reuse one token too many) and require the assertion to trip. That fault is the first of the four colibri #1453 used to qualify its resumed-prefill test ("reuse one token too many, the old schedule condition, no rollback truncation, unguarded undo buffers, all four are caught"); it is the one that maps directly onto ds4'sds4_session_syncresume path without a new fixture.--logprob-vectors: record, indocs/TESTING.md, one fault class the test was run against and the margin it failed by (for example the Q8 output-head tile vs the few-row matvec, both already in the tree under env switches). If the run does not exist, the control is that run.
Each control follows test_dspark_eos_contract.py's convention: a flag or
env var selects the negative variant, the report line says
observed_negative=true/false, and the default make test path is
unchanged. No new model files; every control reuses the same GGUF the
positive test already needs, so the cost is one extra pass per comparator.
Why now
The thresholds in test_local_golden_case_run are reused as the acceptance
gate for new Metal work (router softplus in 0719a0b, Q8 tiles, TP paths).
A comparator that has never been shown to fail on a wrong backend is not a
gate, it is a log. One negative control per comparator makes the tolerance
numbers falsifiable and gives contributors a way to state "my change is
inside the floor" with something behind it.
I can send the --glm53-continued-prefill piece as a PR first if the
approach is acceptable; it is the smallest (an assertion plus one
mis-split resume) and needs only the GLM 5.3 GGUF the test already loads.
Source: antirez/ds4