The research branch, live-verified end to end: semantic KG + the
conflict taxonomy + temporal restrictions + the derived-answer prover.
What ships:
Semantic probe (lexical UNION embeddings, tau=0.45 calibrated) +
question-blind extraction (per-entity, cacheable fat KG)
Conflict taxonomy (phase 1): co-asserted by provenance, paraphrase by
tail resolution (same_as merge), alternatives for co-true readings
(THE three presidencies), real contradiction only for functional
values. The 20-pair live inventory became 0 conflicts / queryable
alternatives (live run verified).
The prover (phase 3): TranslateToDSL (one structured call, store
vocabulary in, typed term out) -> validate_query (the shared grammar
gate; live-caught an invalid term) -> evaluate (goal-directed, proof
term cites every edge) -> re_execute (the check: a stale proof fails
after retraction). Multi-binding = the ambiguity SET, flagged, never
chosen. The judge stays only as honest fallback.
Verified live (cold KG, glm-5.3-flash): Rajoy answered correct across
runs; the three presidencies queryable as alternatives; the (K5) class
of bugs gone on proven paths (no judge value to contaminate — the
interface is gone, not patched).
Includes main's phase 0 (judge value cleanup, --no-cache, import
assert) via the merge commit. Suite: 20/20 test files green.
The research branch, live-verified end to end: semantic KG + the
conflict taxonomy + temporal restrictions + the derived-answer prover.
What ships:
- Semantic probe (lexical UNION embeddings, tau=0.45 calibrated) +
question-blind extraction (per-entity, cacheable fat KG)
- Conflict taxonomy (phase 1): co-asserted by provenance, paraphrase by
tail resolution (same_as merge), alternatives for co-true readings
(THE three presidencies), real contradiction only for functional
values. The 20-pair live inventory became 0 conflicts / queryable
alternatives (live run verified).
- Temporal layer (phase 2): Fact gains start/end/point/granularity +
order restrictions {before, after, concurrent}; containment-checked
dates (invented dates REJECTED live); _classify consumes interval
arithmetic (overlap -> alternatives, touch-at-year -> succession).
- The prover (phase 3): TranslateToDSL (one structured call, store
vocabulary in, typed term out) -> validate_query (the shared grammar
gate; live-caught an invalid term) -> evaluate (goal-directed, proof
term cites every edge) -> re_execute (the check: a stale proof fails
after retraction). Multi-binding = the ambiguity SET, flagged, never
chosen. The judge stays only as honest fallback.
Verified live (cold KG, glm-5.3-flash): Rajoy answered correct across
runs; the three presidencies queryable as alternatives; the (K5) class
of bugs gone on proven paths (no judge value to contaminate — the
interface is gone, not patched).
Includes main's phase 0 (judge value cleanup, --no-cache, import
assert) via the merge commit. Suite: 20/20 test files green.
His diagnosis after the local qwen run (no ambiguity flagged, 'Spain'
after a long search, '15' as a term-start): the question-conditioned
extractor filters rows BEFORE the audit can see them — alternative
readings never enter the store.
The redesign (his proposal + agreed refinements, OPEN QUESTIONS, and
a verification plan) lives in knowledge/RESEARCH-semantic-kg.md.
Research branch by design: parkable — if it stalls we continue from
main (other experts / pending backtracking). No code yet.
Implements his design (RESEARCH-semantic-kg.md) on the research branch:
1. EMBEDDINGS (knowledge/embeddings.py): local ollama /api/embed,
nomic-embed-text 768d — the only proven endpoint (ollama.com has
NO embeddings API). Honest failure: EmbedderDown -> lexical probe
fallback, never a dead run.
2. SEMANTIC PROBE: edge_vectors cache in the store (keyed edge_id +
model + text_hash; upsert, last model wins), cosine rank over all
cached edges, tau=0.45 from real calibration (rivers 0.49-0.52 must
pass; cross-question Pedro-vs-rivers 0.35-0.38 must not). Hybrid
_probe: lexical UNION semantic, dedup by eid. EdgeView gains eid.
3. QUESTION-BLIND EXTRACTION: ExtractSignature loses 'question' and
stop_table — it receives ENTITIES only (from TRANSLATE + evidence
+ proper nouns) and transcribes their facts, capped per chunk
(max_facts_per_chunk=12). Facts cache vectors at ingest. The KG
fattens per-entity, reusable across questions (his cacheability
argument).
4. STOP MOVES TO THE SKIM: SkimTableSignature decides per table from
caption+header+row count+first rows (one LLM call per page) BEFORE
any extraction spend; tables that literally name an entity skip the
call. The extractor itself never judges relevance.
VERIFIED: knowledge suite 8/8 (semantic.py new 4/4: lexical-missed edge
surfaced, hybrid dedup, embedder-down degradation, cache upsert;
tablefrags adapted: skim kills tables pre-extract). floop suite 9/9.
Live E2E (glm): semantic probe fires live (+1 lexical-missed edge);
blind extractor ingests 12-fact chunks; Pedro run answers 'himself'
(3rd gov succeeded his 2nd — a reading trap, NOT a retrieval failure;
INIT degraded honestly on garbage); rivers run burned budget on
fan-out ROUTE calls (22x2) — both findings logged as open work on the
research doc, not regressions of this PR.
Pedro run: semantic probe + blind extraction live; answer fell into a
reading trap (3rd gov succeeded his own 2nd -> 'himself'), the Pedro
article was fetched-but-starved by early exit. Rivers run: LIST path
green; budget death by fan-out ROUTE spending (22x2 calls for data the
parent table held; join never ran). Both are machine-level issues
logged as next work on this branch, not regressions of the redesign.
Findings from the 24-25/10 session (live runs, glm-5.3-flash):
- The A/B (his question, cold KG): glm cloud 148s -> Rajoy; qwen local
50min -> honest UNKNOWN (KG held Rajoy; a noise row misled it).
- The (K5) bug: judge value contamination kills the ablation audit
silently; repro shows the detector works with a clean value.
- dspy disk cache replays repeated runs (measurement law recorded).
- The conflicts inventory: 20 pairs, zero real contradictions — the
4-case classifier conflates conjunction/paraphrase/temporal/polisemia.
RESEARCH-derived-answers.md: the design growing from all of it:
merge-time taxonomy (co-asserted / temporal / alternatives / real),
temporal restrictions (not Allen labels) on the typed Fact extractor,
and a derived-answer engine (typed query DSL + goal-directed proof,
no LLM judge in the loop). Span: knowledge/ + floop/ — doc at code/.
- RESEARCH-semantic-kg: measurement note reworded per his call — the
disk cache is caching doing its job; --no-cache CLI flag for test
runs, default unchanged.
- RESEARCH-derived-answers: the 5-phase plan appended (hygiene →
taxonomy → temporal → prover → consumers), open decisions listed
(DSL vocabulary, order primitives placement, translator location).
Awaiting his approval; no code.
Conflict resolutions, the honest way:
- extract/expert gap-step: main's deterministic COMPOSE wins over the
branch's TRANSLATE LLM (main removed it 23/10 with measurement: the
model was putting the ANSWER into retrieval queries). The branch's
_extract_entities contract (question-blind extractor) is fed from
compose's entities.
- tablefrags/semantic tests: restored the branch's adapted versions +
fixed their single-insert sys.path bug (parent.parent resolved to
knowledge/, not code/ — the tests were silently importing MAIN's
expert.py through the venv pth; same class as the run-085457 trap).
The four-case classifier conflated conjunction, paraphrase and polisèmia
into "contradiction" — the live KG after one Pedro run held 20 conflict
pairs, ZERO real ones. The taxonomy (deterministic, cost-ordered):
co-asserted same quote_id — one trusted sentence asserts both values
(the platform sentence split into 5 "called for" facts)
paraphrase tails resolve to the same node — the same fact in two
surfaces: MERGE (same_as alias, append-only; the canonical
edge's corroboration goes up, no conflict row)
alternatives entity-ish values, different tails — co-true readings of a
multi-valued relation (THE three presidencies). New table
+ alternatives_of(src, rel): the ambiguity substrate,
detected at INGEST, deterministically — the audit no
longer needs to re-derive it at judge time
temporal both dated — unchanged
contradiction the residue: functional values (dates/quantities —
_looks_functional: numbers with at most unit/month words;
pure entity words are readings, not data)
Files: store.py (_classify 4->7 cases, migrations for alternatives +
same_as, alternatives_of), tests taxonomy.py (6/6: the 20-pair inventory
as fixtures), store.py test updated to the new law (different quotes for
the contradiction pair — same-quote is co-asserted by law).
Known scope notes: same_as is recorded but not yet consumed by the
probe/render (phase 4); the three-presidencies-in-one-sentence shape
stays conjunction (the live readings came from different quotes).
The extractor's temporal vocabulary is RESTRICTIONS, never Allen labels:
typed Fact gains start/end/point (optional, ISO-ish) + granularity +
orders [{rel: before|after|concurrent, other: <sibling index>}] — the
text's connectives transcribed, not classified. The Allen algebra stays
a COMPUTED VIEW over endpoints.
- checks.py: every stated date must be CONTAINED IN THE QUOTE — an
invented date rejects the whole candidate (LLM proposes, code
verifies against the source surface).
- store.py: edges gain t_start/t_end (valid-time window, None end =
OPEN, honest to 'since 2018'); fact_order table (order assertions
between addressable facts — reification is free); _classify consumes
interval arithmetic: overlapping open windows -> alternatives
(coexistence provable, no statistics), disjoint windows ->
succession (never a conflict). Boundary law at year granularity:
[2014,2018) vs [2018,None) = succession — the mandate changed hands
in 2018. add_fact_order validates rel in {before, after, concurrent}.
- expert.py: _ingest_candidate returns (merged, eid) and passes the
windows; the prose path collects positional fact_ids and wires the
orders' sibling references to real edge ids (malformed refs skip
honestly).
Tests: temporal.py 6/6 (typed fields, containment rejection, open-
window overlap -> alternatives, touch-at-year -> succession, empty
stays empty, fact_order ingest) + 7/7 interval cases incl. the
open-past degenerate. Suite: all green.
LIVE (run 20261025-205018, cold KG, glm-5.3-flash): 29 edges carry
windows (Spain 2018 / PSOE 2017 / SI 2022 all open-ended), 25
fact_order rows (Madrid before Congress of Deputies...), 8 invented
end-dates REJECTED by the containment check (the footballer Pedro
articles — the check catching exactly what it should), 0 conflicts.
The run itself answered UNKNOWN on its Q1 ("what DATE did he take
office") — honest: the blind extractor did not transcribe the exact
date this run and the noisy re-probe view (four Pedros) is the known
branch weakness, not a phase-2 regression. Design note for phase 4:
the three presidencies live under DIFFERENT rels, so the alternatives
substrate must be queried trans-rel by the consumer (alternatives_of
is per-rel by construction).
No LLM in the loop. The query is a small typed DSL (conjunctive +
temporal, hand-writable); evaluation is goal-directed over the store;
THE ANSWER IS THE PROOF TERM — every step names its operator and the
edge ids it consumed — and re-execution over the store IS the
verification (deterministic; a stale proof fails after a retraction —
the check is real, not a flag).
Operators pinned by tests (the fixture = the live three-presidencies
shape): lookup (subject + rel_any -> bindings), value-join
(same_value_as — the SAME office, ANY holder), open_now (window open),
before (window a ended before window b started — both endpoints real,
an open end is never 'before' anything), neq_value (exclude the
queried entity), select all (the binding SET — multi-binding IS the
ambiguity) / latest_end (the predecessor).
Proven end-to-end on the fixture: "of what is Sánchez president?"
returns the three bindings (Spain, PSOE, SI); "who was President
before him?" proves RAJOY as a closed path citing both edges, rejects
the structural distractor (Feijóo holds a different office), returns
empty = UNKNOWN when no path exists, and re-execution fails after
Rajoy's edge is retracted.
The LLM translator (question -> DSL, one structured-output call) and
the machine wiring (prover as the real stop-check) arrive in 3b.
The LLM at the INPUT boundary only: one structured-output call
(TranslateToDSL — question + the store's relation vocabulary in, typed
DSL out), VALIDATED before execution (validate_query: the shared
grammar — unknown filter/select, empty rel_any, malformed lookup are
rejected deterministically; a mistranslation can never reach
evaluate()). The evaluator (3a) closes the path; re-execution IS the
check. _prover_answer runs BEFORE any judge: a closed path returns the
answer with verified=True and the proof term; a multi-binding returns
the SET with ambiguous=True + alternatives (the three readings as what
they are — deterministic, no ablation rounds, no (K5) surface: the
judge never sees these questions). No translation / no closed path /
re-execution mismatch -> the judge path, unchanged; the prover can
never kill a run.
Wiring is additive: answer_question tries the prover first, falls
back honestly. Tests: translate_dsl.py 4/4 (signature, live-shape
translation, mistranslation rejection, honest decline -> None).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The research branch, live-verified end to end: semantic KG + the
conflict taxonomy + temporal restrictions + the derived-answer prover.
What ships:
question-blind extraction (per-entity, cacheable fat KG)
tail resolution (same_as merge), alternatives for co-true readings
(THE three presidencies), real contradiction only for functional
values. The 20-pair live inventory became 0 conflicts / queryable
alternatives (live run verified).
order restrictions {before, after, concurrent}; containment-checked
dates (invented dates REJECTED live); _classify consumes interval
arithmetic (overlap -> alternatives, touch-at-year -> succession).
vocabulary in, typed term out) -> validate_query (the shared grammar
gate; live-caught an invalid term) -> evaluate (goal-directed, proof
term cites every edge) -> re_execute (the check: a stale proof fails
after retraction). Multi-binding = the ambiguity SET, flagged, never
chosen. The judge stays only as honest fallback.
Verified live (cold KG, glm-5.3-flash): Rajoy answered correct across
runs; the three presidencies queryable as alternatives; the (K5) class
of bugs gone on proven paths (no judge value to contaminate — the
interface is gone, not patched).
Includes main's phase 0 (judge value cleanup, --no-cache, import
assert) via the merge commit. Suite: 20/20 test files green.
The four-case classifier conflated conjunction, paraphrase and polisèmia into "contradiction" — the live KG after one Pedro run held 20 conflict pairs, ZERO real ones. The taxonomy (deterministic, cost-ordered): co-asserted same quote_id — one trusted sentence asserts both values (the platform sentence split into 5 "called for" facts) paraphrase tails resolve to the same node — the same fact in two surfaces: MERGE (same_as alias, append-only; the canonical edge's corroboration goes up, no conflict row) alternatives entity-ish values, different tails — co-true readings of a multi-valued relation (THE three presidencies). New table + alternatives_of(src, rel): the ambiguity substrate, detected at INGEST, deterministically — the audit no longer needs to re-derive it at judge time temporal both dated — unchanged contradiction the residue: functional values (dates/quantities — _looks_functional: numbers with at most unit/month words; pure entity words are readings, not data) Files: store.py (_classify 4->7 cases, migrations for alternatives + same_as, alternatives_of), tests taxonomy.py (6/6: the 20-pair inventory as fixtures), store.py test updated to the new law (different quotes for the contradiction pair — same-quote is co-asserted by law). Known scope notes: same_as is recorded but not yet consumed by the probe/render (phase 4); the three-presidencies-in-one-sentence shape stays conjunction (the live readings came from different quotes).The extractor's temporal vocabulary is RESTRICTIONS, never Allen labels: typed Fact gains start/end/point (optional, ISO-ish) + granularity + orders [{rel: before|after|concurrent, other: <sibling index>}] — the text's connectives transcribed, not classified. The Allen algebra stays a COMPUTED VIEW over endpoints. - checks.py: every stated date must be CONTAINED IN THE QUOTE — an invented date rejects the whole candidate (LLM proposes, code verifies against the source surface). - store.py: edges gain t_start/t_end (valid-time window, None end = OPEN, honest to 'since 2018'); fact_order table (order assertions between addressable facts — reification is free); _classify consumes interval arithmetic: overlapping open windows -> alternatives (coexistence provable, no statistics), disjoint windows -> succession (never a conflict). Boundary law at year granularity: [2014,2018) vs [2018,None) = succession — the mandate changed hands in 2018. add_fact_order validates rel in {before, after, concurrent}. - expert.py: _ingest_candidate returns (merged, eid) and passes the windows; the prose path collects positional fact_ids and wires the orders' sibling references to real edge ids (malformed refs skip honestly). Tests: temporal.py 6/6 (typed fields, containment rejection, open- window overlap -> alternatives, touch-at-year -> succession, empty stays empty, fact_order ingest) + 7/7 interval cases incl. the open-past degenerate. Suite: all green. LIVE (run 20261025-205018, cold KG, glm-5.3-flash): 29 edges carry windows (Spain 2018 / PSOE 2017 / SI 2022 all open-ended), 25 fact_order rows (Madrid before Congress of Deputies...), 8 invented end-dates REJECTED by the containment check (the footballer Pedro articles — the check catching exactly what it should), 0 conflicts. The run itself answered UNKNOWN on its Q1 ("what DATE did he take office") — honest: the blind extractor did not transcribe the exact date this run and the noisy re-probe view (four Pedros) is the known branch weakness, not a phase-2 regression. Design note for phase 4: the three presidencies live under DIFFERENT rels, so the alternatives substrate must be queried trans-rel by the consumer (alternatives_of is per-rel by construction).