Remove the TRANSLATE LLM: deterministic query composition #19

Merged
onibot merged 1 commits from feature/deterministic-translate into main 2026-10-23 15:15:19 +02:00
Owner

Removes the TRANSLATE LLM: search queries are now composed by fixed code from question ∪ evidence only.

Why (his 23/10 weights-tightness audit): the TRANSLATE step was composing queries from its own knowledge of the entities — 'Pedro Sánchez 2018 investiture…' for a term-start question (the '2018' IS the answer, injected into retrieval from weights), 'Po, Adige, Tiber' proposed for a question that named only Italy. Measured over every logged TRANSLATE call of runs 22-23/10: 5/10 calls had untraceable query terms. A live probe against Wikipedia showed deterministic composition retrieves the decisive article at top-1/2 in 8/9 logged cases — the LLM's world knowledge was never load-bearing, so the step became code.

What changed:

  • knowledge/queries.py (new): compose_queries() — deterministic queries/entities from the question's NEs + keywords + the evidence's resolved entities. Top-N asks slice the first N evidence members by source order; enumerations get the 'List of…' article shape; every query token traces to question ∪ evidence (weights-tightness as structure, not prompt).
  • TranslateSignature, its Predict and stage entry deleted; one LLM call less per gather.
  • expert.py: proper_nouns/keywords moved to queries.py (single source, semantics unchanged — the guards' contract holds).
  • DESIGN.md §4 + code/README updated; 12 new tests; suite 17/17.

How to test: cd code && uv run python knowledge/tests/queries.py, then a cold E2E of your choice (rm code/knowledge_store/kg.sqlite*; the log line is now compose -> queries … entities …).

Removes the TRANSLATE LLM: search queries are now composed by fixed code from question ∪ evidence only. **Why (his 23/10 weights-tightness audit):** the TRANSLATE step was composing queries from its own knowledge of the entities — 'Pedro Sánchez 2018 investiture…' for a term-start question (the '2018' IS the answer, injected into retrieval from weights), 'Po, Adige, Tiber' proposed for a question that named only Italy. Measured over every logged TRANSLATE call of runs 22-23/10: 5/10 calls had untraceable query terms. A live probe against Wikipedia showed deterministic composition retrieves the decisive article at top-1/2 in 8/9 logged cases — the LLM's world knowledge was never load-bearing, so the step became code. **What changed:** - `knowledge/queries.py` (new): `compose_queries()` — deterministic queries/entities from the question's NEs + keywords + the evidence's resolved entities. Top-N asks slice the first N evidence members by source order; enumerations get the 'List of…' article shape; every query token traces to question ∪ evidence (weights-tightness as structure, not prompt). - `TranslateSignature`, its Predict and stage entry deleted; one LLM call less per gather. - `expert.py`: proper_nouns/keywords moved to queries.py (single source, semantics unchanged — the guards' contract holds). - DESIGN.md §4 + code/README updated; 12 new tests; suite 17/17. **How to test:** `cd code && uv run python knowledge/tests/queries.py`, then a cold E2E of your choice (`rm code/knowledge_store/kg.sqlite*`; the log line is now `compose -> queries … entities …`).
onibot added 1 commit 2026-10-23 15:15:10 +02:00
His 23/10 weights-tightness audit found the TRANSLATE step composing
search queries from its own knowledge of the entities: 'Pedro Sánchez
2018 investiture President of the Government of Spain' for a term-start
question (the '2018' IS the answer, steered into retrieval from weights),
'Po, Adige, Tiber' proposed as entities for a question that named only
Italy. Measured over every logged TRANSLATE call of runs 22-23/10: 5/10
calls carried untraceable query terms, 6/10 untraceable entity terms.

Probed against real Wikipedia before deciding: queries composed
deterministically from question ∪ evidence put the decisive article at
top-1/2 of the search in 8 of 9 cases — the LLM's world knowledge was
never load-bearing; the search engine's own relevance was. So the step
becomes code (the law: LLMs translate, fixed code composes — and here
nothing is left to translate).

- NEW knowledge/queries.py: compose_queries() + proper_nouns/keywords
  (moved here, single source — the expert delegates). Laws: every query
  token traces to the question or an evidence row; deterministic; never
  empty. Top-N asks slice the FIRST N evidence members by source order
  (never dump all members); enumerations with one subject NE get the
  list-article shape ('List of rivers of Italy'); sentence-initial
  capitals are dropped when other NEs exist ('During', 'Ranked').
- DELETED TranslateSignature + the Predict + the stage map entry;
  the gather charges one LLM call less.
- expert.py: COMPOSE at the gather head; the context var (rendered
  only for the dead prompt) removed — evidence feeds the probe seeds,
  the composer and the guards directly.
- Tests: knowledge/tests/queries.py (12) — the sonde's cases as the
  contract, incl. the traceback law over the logged questions.
- DESIGN.md §4 + code/README honest map updated.

Suite 17/17. Live probe (real Wikipedia): rivers/Pedro/France/Po all
fetch the decisive article at top-1.
onibot merged commit bb4afb6a66 into main 2026-10-23 15:15:19 +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#19