Run J answered 'What office is Pedro Sanchez associated with as
President?' with Socialist International — a literally defensible
reading, but the KG ALSO held prime minister of Spain and
secretary-general of PSOE, and the machine never learned they existed.
The fix is not prompt tuning: it is a data type the pipeline could not
express — 'this answer is one of several defensible readings'.
Layer 1 (this PR) — knowledge/ambiguity.py, zero LLM, zero network:
- GATE: role_in_text(question) — only questions naming an office-class
role (president, prime minister, secretary general, chancellor, ...)
enter the audit. 'second most populated country in European Union'
and 'three longest rivers in Italy' never even run it.
- ref_entity: the question's proper-noun run, broken at lowercase words
and role words — 'Pedro Sanchez' (not 'President'), 'France' in
'Who is the President of France?'.
- audit_role_multiplicity: rows about the entity whose role lives in
the relation OR the object (extraction shape varies); dates and bare
numbers never become alternatives; same office in two shapes merges
by token containment (quote kept, corroboration summed); the PICKED
reading is excluded from the report. Fires only at >= 2 alternatives.
- _maybe_ambig wires the audit at the three scalar return paths of
answer_question; a clean answer is byte-identical (gate is cheap and
the single-reading path changes nothing).
Propagation up (flag, never choose):
- payload carries {ambiguous, axis, alternatives[{value, role, quote,
url}]}; provenance note says the choice among readings is NOT
verified.
- OUTPUT EXPERT line: 'Q1 -> ANSWER value=... AMBIGUOUS ([prime
minister] Spain; [secretary-general] PSOE) quote=...'.
- machine: run notes carry the axis + other readings; the evidence
render shows them so the ANSWER step (and later the user) can decide.
Tests: knowledge/tests/ambiguity.py — the two agreed positives (both
Pedro phrasings), the two agreed counterexamples (silent), single
office, dates-as-values, duplicate shapes, role-in-object, wiring
(expert flags + clean untouched), engine log/payload/provenance,
machine notes/render. Suite 70/70. Live smoke: the full pipeline over
a run-J-shaped page flags the 3 offices; the rivers question over the
same KG stays silent.