feat(logic): setop engine + set gate — the Europe count computed end-to-end

A) SET GATE: enumerations are answered only from membership sets, never from mention rows (the probe early-exit that served 'Armenia, Cyprus, Georgia, Turkey' to 'what countries are in Europe' is dead). Sets carry origin_question; the gate matches stem-Jaccard>=0.5 so a set is served to its own question only. B) SETOP ENGINE: logic's first real engine — a count over list rows is computed (difference/intersection/count over norm_name'd items, table markers 'Austria*' == 'Austria'), before ROUTE, zero LLM calls, verified=True because the computation IS the check. C) Catalog honesty: knowledge 'lists are ONE fetch', logic 'how-many over lists in evidence', floop 'NOT mere size'. Plus four substrate bugs the live runs exposed: LM-proxy prompt cache (instant answers are cache hits, never trust zero latency), _context rendering list rows as scalars ('E1: 50' routed 'those countries' to user), <br> concatenation in multi-value name cells, multi-line refs leaking into values ('franceincludes the 101 departments' -> France dropped from EU -> 24 not 23). Cold E2E: Q1 50 states ingested, Q2 27 EU members ingested, Q3 difference computed = 23, cited over E1/E2. 22/22 tests.
This commit is contained in:
2026-10-18 19:49:24 +02:00
parent 6fcb3c0a86
commit e5482bd092
10 changed files with 390 additions and 34 deletions
+66
View File
@@ -280,3 +280,69 @@ the baseline fallback — the fallback layer earned its keep) and counter resets
Note for benchmarks: early exit cut Q1 from ~22 to ~3 articles-extracted and Q2 to
1 article; the gather now stops when the graph answers.
---
# Run E — the Europe count, computed (2026-10-18)
**Goal:** answer 'how many countries in the European continent are not members
of the EU?' end-to-end — the question that exposed the two holes (Run D log).
The INIT plan was right all along (list -> members -> count); the substrate
could not execute it. This run adds:
- **Set gate (A):** an enumeration is answered ONLY from a membership set, never
from mention rows. In Emili's home KG (16 residual rows from old runs), the
old code early-exited on 'Armenia, Cyprus, Georgia, Turkey' — a sentence
about EU enlargement views treated as a list. The gate now logs 'N mention
rows are not answerability; gather runs' and fetches the real source.
- **Setop engine (B):** logic's first real engine. A count over list rows in
evidence is COMPUTED (difference/intersection/count over normalized names),
never routed: the machine guard runs before ROUTE, spends zero LLM calls,
and the row is verified=True because the computation IS the check. Trace
names the operation and both source rows.
- **Catalog honesty (C):** knowledge now says 'enumerations and lists are ONE
fetch'; logic says 'including how-many over lists already in the evidence';
floop says 'NOT mere size'. The router decides with true information.
Live result (this run, cold KG): Q1 'What countries are in the European
continent?' -> set gate fires (no sets yet) -> gather -> the Europe table
ingested. Q2 'Which are EU members?' -> the EU members table ingested. Q3
'How many...?' -> setop difference computed, no ROUTE call, verified=True.
Cost note: TRANSLATE put 'List of transcontinental countries' first for Q1
(tangential; 4 extract calls burned before the right article). The
SELECT TABLE path only triggers on articles with tables — the transcontinental
list has none in prose. Tuning the fetch order for list questions (prefer
titles starting with 'List of') is noted as future work.
**Run E postscript — four more substrate bugs found by the live runs:**
1. **Cache-hit illusion**: three consecutive runs answered Q2 in 0 seconds
with identical text — the local LM proxy caches identical prompts at
temperature 0. Symptom to remember: an 'instant' LLM call is a cache hit,
not inference. Never trust a run that has no latency.
2. **`_context` rendered list rows as scalars**: 'E1: 50' instead of the
items — 'those countries' stayed unspecified and the router (correctly!)
sent it to the user. Fixed: list rows render their items; and questions
with no declared deps see the whole table (user is a last resort, not a
default for want of context).
3. **Set gate false-match risk**: 'which countries are EU members' shares
stems with the held set 'countries in Europe' — serving Q1's set to Q2
would be a confident wrong answer. Sets now carry their ORIGIN question
(origin_question column); the gate is stem-Jaccard >= 0.5 between the
incoming question and the set's origin.
4. **Wikitext cell hygiene**: multi-value name cells ('Albania<br>Republic of
Albania<br>ALB') concatenated without <br> -> separators; multi-line refs
inside cells leaked their content into the value ('franceincludes the 101
departments...' -> France dropped from the EU set -> difference 24 instead
of 23). Fixed: <br> -> ' / ' (element = first segment); continuation lines
join the previous cell.
Final cold E2E (19:46): Q1 -> 50 sovereign states ingested (Europe list
article, table fully parsed); Q2 -> 27 EU members ingested (Member state
article); Q3 -> setop difference computed, verified=True, zero LLM calls.
Answer: **23**, citing E3 over E1 and E2. The count is a computation over
two typed lists — exactly what the INIT plan always asked for.