knowledge: subject guard + boundary matching + answer log (run H) #5

Merged
onibot merged 1 commits from feature/subject-guard into main 2026-10-21 09:43:04 +02:00
Owner

Run H fixes — his E2E answered "three longest rivers of Italy" with the WORLD list (Nile/Amazon/Yangtze fanned out). Three deterministic fixes, live-verified on real Wikipedia.

  1. Subject guard (_list_from_page): proper nouns of the question ("Italy") must appear in the article title or the tables' caption/headers — token, stem, or word prefix ("Europe" → "European"). The disjointness guard was vacuous (first hop, empty evidence) and the world list was fetch-order #1. Now refused before SELECT_TABLE — zero budget spent. Live: world article refused, Italy article → 22 members, top-3 = Po, Adige, Tiber.

  2. Word-boundary matching: the harvest ingested 227 world rows as "Outflow" edges because goal term flow matched Outflow by substring (and 929 more from the discharge list). All goal-term matches (harvest, promote, skim notices) now go through _term_hits/_col_hits — whole tokens/stems only; the keyword fallback column is gone. Live: 0 Outflow edges.

  3. The answer is in the log (your ask): OUTPUT EXPERT: Q1 -> ANSWER value=3 (list of 3 members: Po, Adige, Tiber) quote=... url=... [knowledge_graph]. No more deducing the expert's answer from the fan-out that follows.

Suite 52/52 (5 new tests in knowledge/tests/guards.py; store.py fixture now names its subject).

**Run H fixes** — his E2E answered "three longest rivers of Italy" with the WORLD list (Nile/Amazon/Yangtze fanned out). Three deterministic fixes, live-verified on real Wikipedia. 1. **Subject guard** (`_list_from_page`): proper nouns of the question ("Italy") must appear in the article title or the tables' caption/headers — token, stem, or word prefix ("Europe" → "European"). The disjointness guard was vacuous (first hop, empty evidence) and the world list was fetch-order #1. Now refused **before** SELECT_TABLE — zero budget spent. Live: world article refused, Italy article → 22 members, top-3 = **Po, Adige, Tiber**. 2. **Word-boundary matching**: the harvest ingested 227 world rows as "Outflow" edges because goal term `flow` matched `Outflow` by substring (and 929 more from the discharge list). All goal-term matches (harvest, promote, skim notices) now go through `_term_hits`/`_col_hits` — whole tokens/stems only; the keyword fallback column is gone. Live: 0 Outflow edges. 3. **The answer is in the log** (your ask): `OUTPUT EXPERT: Q1 -> ANSWER value=3 (list of 3 members: Po, Adige, Tiber) quote=... url=... [knowledge_graph]`. No more deducing the expert's answer from the fan-out that follows. Suite **52/52** (5 new tests in `knowledge/tests/guards.py`; store.py fixture now names its subject).
onibot added 1 commit 2026-10-21 09:43:00 +02:00
Run H (his E2E of run G's fixes) answered Q1 'three longest rivers of
Italy' with the WORLD list (Nile/Amazon/Yangtze fanned out, 226 rows).
Three root causes, all deterministic code (one is an LLM-side miss the
code now guards):

1. THE SUBJECT GUARD (new, _list_from_page): proper nouns of the
   question ('Italy') must appear in the article title or the tables'
   caption/headers — whole token, stem, or word prefix ('Europe' ->
   'European', the gentilici pattern). The disjointness guard was vacuous
   (first hop, empty evidence) and the fetch order put the world list
   first; the guard now refuses it BEFORE the SELECT_TABLE call (zero
   budget spent), logged as 'subject guard: ... refusing LIST'. Live
   verified: world article refused, Italy article answered 22 members,
   top-3 by table order = Po, Adige, Tiber.

2. WORD-BOUNDARY MATCHING (run H's KG pollution): the harvest ingested
   227 world rows as 'Outflow' edges because goal term 'flow' matched
   'Outflow' by substring; the discharge-list page did the same with 929
   rows. _term_hits/_tokens/_col_hits replace every substring goal-term
   match (harvest goal_hit + val_i, promote val_i, skim notice filter);
   the keyword fallback ('flow'/'discharge' in ANY header) is gone — the
   column must carry a goal term. Live: 0 Outflow edges.

3. THE EXPERT ANSWER LOG (his ask): 'OUTPUT EXPERT: Q1 -> ANSWER
   value=3 (list of 3 members: Po, Adige, Tiber) quote=... url=...
   [knowledge_graph]' — the answer is now IN the log, not deduced from
   the fan-out that follows. Every expert output line carries the qid.

Tests: knowledge/tests/guards.py (boundary matching incl. flow !=
Outflow, proper-noun extraction, subject guard both ways, harvest
boundary, the new ANSWER log format). store.py fixture now names its
subject in the title (predates the law). Suite 52/52. Live smoke: the
full run-H regression chain on real Wikipedia.
onibot merged commit dcd189057e into main 2026-10-21 09:43:04 +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#5