research(knowledge): semantic KG retrieval + question-blind extraction
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.
This commit is contained in:
@@ -169,6 +169,7 @@ _STAGE_BY_MODULE = {
|
||||
"SelectTableSignature": "SELECT_TABLE",
|
||||
"VerifyCountSignature": "VERIFY_COUNT",
|
||||
"SkimPromoteSignature": "PROMOTE",
|
||||
"SkimTableSignature": "SKIM_TABLE",
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user