knowledge+llm: dst-first ablation mask (run L) + re-ask budget meter #9

Merged
onibot merged 1 commits from feature/ablation-dst-fix into main 2026-10-22 11:21:39 +02:00
Owner

Two deterministic fixes from his 22/10 re-run log:

1. Dst-first ablation mask (run L — Q1 stayed silent). The Pedro paragraph interleaves all three readings in ONE quote; the old _carries matched the pick by substring over dst OR quote, so masking SI masked PM/PSOE too — round 1 UNKNOWN, audit silent. Now: a row with a meaningful dst (non-empty, non-numeric) is masked by ITS dst; quote only for empty/numeric dsts. Each round's surviving value may be an office description ("prime minister of Spain") while the row's dst is the entity ("Spain") — resolved by reciprocal token containment. Regression test: the interleaved one-paragraph quote flags all three readings.

2. Re-ask budget meter (run L — 10 wire calls, 9/80 charged). Prompts #9/#10 were both ANSWER: the ChatAdapter's JSON-fallback second call after a parse failure (340s). The prompt-log callback now detects a second LM call with no new module forward between them, logs re-ask detected: stage=..., and charges the budget through a meter hook the machine wires at construction. Ceiling charge never kills the run. dspy's behaviour untouched — the fallback stays as future self-improvement signal (which prompts the model formats badly).

Tests: knowledge/tests/ablation.py +3 (run-L regression, description-resolution, numeric-dst fallback); tests/reask_meter.py new (+3: real-adapter-path fallback detection, separate-forwards-not-flagged, ceiling survives). Suite 12/12 files green (74 tests). Smokes: run-L interleaved page flags SI+PM+SG through the full pipeline; run-J smoke still passes.

Two deterministic fixes from his 22/10 re-run log: **1. Dst-first ablation mask (run L — Q1 stayed silent).** The Pedro paragraph interleaves all three readings in ONE quote; the old `_carries` matched the pick by substring over dst OR quote, so masking SI masked PM/PSOE too — round 1 UNKNOWN, audit silent. Now: a row with a meaningful dst (non-empty, non-numeric) is masked by ITS dst; quote only for empty/numeric dsts. Each round's surviving value may be an office *description* ("prime minister of Spain") while the row's dst is the entity ("Spain") — resolved by reciprocal token containment. Regression test: the interleaved one-paragraph quote flags all three readings. **2. Re-ask budget meter (run L — 10 wire calls, 9/80 charged).** Prompts #9/#10 were both ANSWER: the ChatAdapter's JSON-fallback second call after a parse failure (340s). The prompt-log callback now detects a second LM call with no new module forward between them, logs `re-ask detected: stage=...`, and charges the budget through a meter hook the machine wires at construction. Ceiling charge never kills the run. **dspy's behaviour untouched** — the fallback stays as future self-improvement signal (which prompts the model formats badly). Tests: `knowledge/tests/ablation.py` +3 (run-L regression, description-resolution, numeric-dst fallback); `tests/reask_meter.py` new (+3: real-adapter-path fallback detection, separate-forwards-not-flagged, ceiling survives). Suite 12/12 files green (74 tests). Smokes: run-L interleaved page flags SI+PM+SG through the full pipeline; run-J smoke still passes.
onibot added 1 commit 2026-10-22 11:21:35 +02:00
Two fixes from his 22/10 re-run log, both small and deterministic:

1. THE ABLATION MASK WAS QUOTE-BLINDED (run L: Q1 stayed silent over
   the Pedro page that run J flags). The Pedro paragraph interleaves
   all three readings in ONE quote ('...Secretary-General ... ninth
   president of Socialist International...'), and _carries matched
   the picked value by substring over dst OR quote — so masking SI's
   support masked the PM/PSOE rows too; round 1 answered UNKNOWN and
   the audit died silent. The DST-FIRST LAW: when a row has a
   meaningful dst (non-empty, non-numeric) it is the VALUE BEARER and
   the mask matches IT; the quote is a fallback only for
   empty/numeric dsts. Same law in _carries_target for each round's
   surviving value, with one addition: the judge's round value may be
   an OFFICE DESCRIPTION ('prime minister of Spain') while the row's
   dst is the ENTITY ('Spain') — resolve by reciprocal token
   containment, or the loop dies after one alternative.

2. THE ADAPTER RE-ASK WAS INVISIBLE TO THE BUDGET (run L: prompts #9
   and #10 were both ANSWER — #10 5 chars shorter, 340s, the
   ChatAdapter's JSON-fallback second wire call after a parse
   failure; llm_calls said 9/80 while 10 hit the wire). THE METER:
   the prompt-log callback already sees every LM call — a second LM
   call with NO new module forward between them is the adapter
   fallback re-firing inside the same Predict. Count it, log the
   line, and charge the budget through a meter hook the machine
   wires at construction. A re-ask at the ceiling does not kill the
   run (the call already happened). dspy's BEHAVIOUR IS UNTOUCHED —
   his call: the fallback stays, it is future self-improvement
   signal (which prompts the model formats badly), not a bug.

Tests: knowledge/tests/ablation.py +3 — run-L regression (interleaved
one-paragraph quote flags all three readings), office-description
resolution, numeric-dst quote fallback. tests/reask_meter.py +3 —
fallback detected and charged on the REAL adapter path (custom engine
returning raw text, marker-less first response), separate forwards NOT
flagged (the ablation-rounds shape), ceiling charge survives. Suite
12/12 files green (74 tests). Live smokes: the run-L interleaved-quote
page flags SI+PM+SG through the full pipeline; the run-J
separate-quotes smoke still passes.
onibot merged commit 5c97fbf50a into main 2026-10-22 11:21:39 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: onibot/floop#9