fix(knowledge): cold-start gather — vertical tables, global rank, early exit
Emili's home run failed where the VPS seemed to work: warm-KG illusion; cold path never validated. Reproduced with a wiped KG. Fixes: (1) tables_as_text parses BOTH wikitext layouts (horizontal pipes and one-cell-per-line with row separators) + _clean_cell drops attrs/links/templates; (2) gather searches all queries, dedupes, ranks globally by title relevance, fetches ONE article at a time with EARLY EXIT when the KG answers; (3) hybrid order keeps each query's top-1 slot guaranteed (title relevance buries entity pages like 'Loire'). Also: NameError from refactor caught by baseline fallback; counters accumulate. Cold E2E verified: France (table quote) -> Loire (early exit, 1 article) in 2hops. RUNLOG Run D.
This commit is contained in:
@@ -246,3 +246,37 @@ state" resolved to France -> **KG hit: The Loire River (E2)** -> answer cites bo
|
||||
- dspy 3.4 `dspy.LM(...)` returns a list of AttributeDicts on raw call (`text` key) —
|
||||
wrapped in `floop/llm.py:active_lm`.
|
||||
- Tests at this point: 9 state + 5 machine + 3 knowledge = 17/17.
|
||||
|
||||
|
||||
---
|
||||
|
||||
# Run D — cold-start fixed (2026-10-17)
|
||||
|
||||
**Trigger:** Emili's home run failed on the same question that worked on the VPS.
|
||||
The log was conclusive — and honest: the VPS success had been a warm-KG illusion;
|
||||
the cold-start path had never been validated end-to-end. Reproduced 1:1 on the VPS
|
||||
with a wiped KG (same queries, same articles, same UNKNOWN).
|
||||
|
||||
Root causes (three, all in the gather):
|
||||
|
||||
1. **Vertical wikitext tables unparsed.** 'Demographics of the European Union' holds
|
||||
the ranking table with ONE CELL PER LINE; the parser assumed horizontal pipes.
|
||||
The article was fetched, chunked, extracted — and its table was garbage rows.
|
||||
Fix: `tables_as_text` handles both layouts + cell attributes (`_clean_cell`).
|
||||
Verified live: `France | 69,112,309 | 15.29% | 638,475 | 15.1% | 107`.
|
||||
2. **Quota eaten by per-query fetch order.** 'List of EU member states by
|
||||
population' appeared in search results but never got a slot (quota spent on the
|
||||
first query's generic articles). Fix: search ALL queries, dedupe, rank globally,
|
||||
fetch one at a time with **early exit** when the KG starts answering.
|
||||
3. **Pure title-relevance rank buried entity pages.** 'Loire' shares no word with
|
||||
'longest river in France' — lexical rank 0. Fix: hybrid order — each query's #1
|
||||
keeps a guaranteed slot (the engine's own relevance), the rest ranked by title
|
||||
relevance.
|
||||
|
||||
Cold-run result (KG empty at start): Q1 France (table row quote, source-verified)
|
||||
-> Q2 The Loire (early exit after ONE article) -> final answer cites E1+E2.
|
||||
Two bugs of my own found during the fix: a NameError from the refactor (caught by
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user