Negative controls for the reference comparators: a rejected variant must fail

Aperta
#1,146 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c
Ambito
testing-qa

Direzione di ricerca

Start with tests/test_dspark_eos_contract.py to follow the existing negative-control convention, then inspect tests/ds4_test.c at test_local_golden_overlap, test_local_golden_max_abs, and test_glm53_continued_prefill. Run the relevant local-golden, continued-prefill, and logprob-vector selectors with existing backend switches to establish failure margins. Done means each comparator has a documented negative control, reports observed_negative, and leaves the default make test path unchanged.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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:5964 test_local_golden_overlap and :5975
    test_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:5301 test_glm53_continued_prefill (:5366-5384):
    asserts resumed and cold top-1 agree and top-8 sets overlap, and only
    prints max 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.

  1. --local-golden-vectors: add DS4_TEST_LOCAL_GOLDEN_EXPECT_FAIL=1
    (or a --local-golden-negative selector) 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".
  2. --glm53-continued-prefill: promote max same-rank logit delta from 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's
    ds4_session_sync resume path without a new fixture.
  3. --logprob-vectors: record, in docs/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.

Lingua principale
C
Stelle
24.4k
Fork
2.4k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di antirez/ds4

Tutte le issue di antirez/ds4

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.