Elffuss BraidHub

kikocis/utopia public

dev · 6.7 KiBRenderedRawPermalink
1# 0007 · Counting decides what becomes a relation
2
3- **Status**: Built · adoption by counting (`MIN_DOCS = 2`; an LLM run needs `MIN_SIGNALS
4 = 3`); six defects fixed; proposals persist in `ontology_proposals` (#112); open:
5 narrative verbs in the ontology, `merge_key` not folding `_by`; the starting point (10
6 seeds, the `related_to` share) no longer exists.
7- **Written**: 2026-08-30 · condensed into English 2026-09-03
8- **Related**: [0006](0006-ontology-scale-and-the-prompt.md) for the bench and its
9 caveats; [0010](0010-no-relation-is-no-relation.md) and
10 [0011](0011-a-mapping-is-not-a-fact.md) removed the seed relations this record started
11 from; [0008](0008-ontology-packs-as-cold-start.md) packs are now the start;
12 [0012](0012-the-ontology-is-a-contract-not-a-suggestion.md) has the successor metric.
13
14## The problem
15
16A new knowledge base started with 10 seed relations. Most relations the model produced
17were not among them and degraded to `related_to`, a predicate that says nothing: 49.8% of
18facts on the ai-timeline corpus (15 Wikipedia articles on AI companies, 348 chunks).
19`bootstrap_ontology` existed for exactly this and worked badly, for six independent
20reasons:
21
221. Exact-string matching discarded vocabulary already in the ontology: `produced_by |
23 ChatGPT → OpenAI` missed `produces`. Fix: `predicate_match` (spelling, inflection, and
24 a trailing `by` that swaps subject and object).
252. If the last document failed, the KB stuck forever: auto-extension was enqueued on the
26 success path only. Fix: enqueue on both paths.
273. The ≥ 2 documents threshold only gated the LLM run; `build_proposals` re-queried the
28 unfiltered set, so 86.7% of the phrasings shown to the model came from one document.
294. `doc_count` counted leftovers still on the fallback predicate, so a KB fed one document
30 at a time never reached two. Fix: prevalence counts all evidence.
315. "Ignore" was a one-way door: `record_miss` skipped dismissed phrasings, so counts froze
32 at 1 while twenty later documents used them. Fix: count everything; list dismissed
33 apart, undoable.
346. Undated facts claimed day precision (`valid_precision NOT NULL DEFAULT 'day'`; 728 and
35 843 live rows). Fix: nullable, CHECK-tied to a date (`facts.valid_from_precision`).
36
37## Decisions
38
391. **Counting decides adoption.** The model is not asked: the data answers "which
40 phrasings deserve to become relations", and the model got it wrong: it skipped
41 `runs_on` (8 documents, 13 facts) and adopted a single-document `pledged_capital`.
42 Three deterministic steps: group by inflectional base (`predicate_match::merge_key`:
43 `sued` and `sues` are one), take the union of documents per group (never a sum), pass
44 `MIN_DOCS = 2`; the group is named by its most frequent phrasing. From 10 seeds,
45 `related_to` went 55.5% with auto-extension off, 39.1% with LLM adoption (17
46 relations), 25.8% with counted adoption (104).
472. **The model keeps the question that needs meaning**: synonym merging (is
48 `collaborates_with` the same as `partnered_with`), reversible with `unadopt`.
493. **Deterministic adoption is the most valuable side effect**: the same corpus produces
50 the same ontology, so the bench can compare this stage at all.
514. **`_by` is the only inverse marker worth handling** (#109): 31 forms (`founded_by` 42
52 facts), nearly all coexisting with an active form (`produces` 265). Before adopting,
53 `PredicateIndex` is consulted; an existing equivalent, `_by` inverse included, is
54 rewritten to with subject and object swapped. `has_X`/`X_of` had two pairs, not enough
55 evidence.
56
57Caveats: differences between LLM groups are within run variance (25 vs 18 entities on the
58same input); only the deterministic part is certain (single-document adoptions 5 → 0). The
59`related_to` share is no quality metric, since adopting everything lowers it fastest, and
60the corpus is dense in training data.
61
62## Dead ends
63
64- **Snowball stemming** (`rust-stemmers`) went the wrong way: 49 matches with a 10-word
65 vocabulary, 18 with schema.org's 629, because it strips derivational suffixes too;
66 `producer` and `produces` both become `produc` and the collision rule refuses to match.
67 Inflectional suffixes only: 49 → 59.
68- **Subject diversity instead of document count**: stricter in practice (6 gained, 33
69 lost), and most of the 6 were coordinated subjects ("A, B and C proposed X" split into
70 three facts). `docs >= 2 OR subjects >= 3` fell to the same problem.
71- **Auto-extension after every document**: "≥ 2 documents" becomes a so-far property, and
72 merging degrades, since the LLM merges `acquired`/`acquires`/`acquisition_of` only when
73 it sees them together.
74- **A fact-count threshold (≥ 3) for new single-document relations**: the top two it
75 admits are the worst two (`has_property` 11, `intends_to` 5); about 5 of 20 groups look
76 like relations, 1.2% of the KB. Growing KBs solve this themselves; static corpora have
77 the manual panel (`min_docs = 0`).
78
79## Revisions
80
81- 2026-09-02: both premises are gone. Seed relations left in three steps (`related_to` in
82 [0010](0010-no-relation-is-no-relation.md), eight more in #125, `mapped_to` in
83 [0011](0011-a-mapping-is-not-a-fact.md)) and the seeding function with them (#128); a
84 new KB starts from a pack ([0008](0008-ontology-packs-as-cold-start.md)). The numbers
85 above are not comparable with anything measured today: a fact may now have no predicate
86 (the original word goes to `fact_evidence.proposed_predicate`), and the successor
87 metric, empty-predicate share, measured 25.6% in
88 [0012](0012-the-ontology-is-a-contract-not-a-suggestion.md) under a different start and
89 definition. The decisions are unaffected and all live.
90- 2026-09-02: the ontology can declare inverses (#177/#179) and direction is corrected on
91 write (#138, leaving a `direction_corrected` trace). That does not close the `merge_key`
92 gap below.
93
94## Open questions
95
96- **Narrative verbs enter the ontology.** Among the 104 relations: `reported/report` 11,
97 `states/stated` 6, `describes/described` 5, `criticizes/criticized` 6: the article
98 citing sources, no structure between companies. They recur across documents, so counting
99 cannot stop them, and the ontology feeds back into the prompt. Candidate: ask the
100 synonym-merging LLM call "which of these are the article's voice", small and reversible;
101 a verb list would break with the next corpus.
102- **`merge_key` does not fold `_by`.** When neither direction is in the ontology
103 (`founded_by` 42 vs `founded` 4, both qualifying), two opposite relations are still
104 created. The original reason, "the adoption path cannot swap", no longer holds; fold
105 `_by` into the group and mark it for swapping.
106- **What a 1,500-term start does to the adoption loop** has not been measured; no
107 threshold has moved.