Repository navigation
Description
er-compile's DEFAULT_FULL_AGREEMENT_BITS = 60 was calibrated on a person corpus and is applied to every config. #623 made thresholds.full_agreement_bits declarable; nothing sets it, so accounts still compile at 60. This ticket is the decision about what they should compile at.
It is not a matter of picking a better number, and that is the substance of what was measured.
What 60 costs, measured
fixtures/static/acct_10 is an account corpus with declared truth: 20 records across three sources, 10 accounts, ten designed traps. Grid over full_agreement_bits, config compiled from acct_10/config.yaml:
| bits | clusters (truth = 10) |
|---|---|
| 10, 15 | 20 — nothing merges |
21.8 — what acct_model_v1 itself measures |
13 |
| 30 – 43 | 11 |
| 44 – 90 | 9 — over-merges |
| 120 | 8 |
At the shipped 60, Hooli Systems and Vandelay Industries become one account — two distinct companies that share a switchboard number and a coworking address. That is a false merge, the direction the constant's own doc comment calls the more expensive mistake.
Why no constant fixes it
No value reproduces 10. The jump from 11 to 9 happens between 43 and 44 bits, skipping it — because two pairs flip together:
billing:b4 <-> crm:c4 postal=1 name=0 domain=0 phone=1 mw=4.3124318971685955
crm:c8 <-> crm:c9 postal=1 name=0 domain=0 phone=1 mw=4.3124318971685955
The first is a true duplicate (Initech / "ITCH Systems" on the transposed domain intiech.io). The second is the false shared-switchboard pair. Against the four comparisons this model has they agree on the same fields, disagree on the same fields, and carry byte-identical evidence. No monotone rescaling and no threshold can accept one and reject the other.
What does fix it
A near-match level on domain_norm. intiech.io vs initech.io is one transposition; hooli.com vs vandelay.com is unrelated. Adding jaro_winkler:0.90 separates them — 12.0 bits against 4.3 — where exact | else cannot.
But the level alone still resolves to 9, because auto_merge: 0.95 admits both (p=0.999758 and p=0.952082). And a stricter threshold alone cannot rescue 60 bits: at 60 the false pair clears even auto_merge: 0.995.
All three have to move together. full_agreement_bits: 44 + the domain near-match level + auto_merge: 0.99 resolves acct_10 exactly, 10 of 10. That combination is now a gate in er-cli/tests/acct_e2e.rs.
The decision
- Ship an entity-type-aware default —
CompileOptions::from_configconsultsconfig.entity_typeand accounts get their own scale — or treat the scale as per-tenant config and document that an account tenant must declare it. feat(matching): a config can declare its own score scale, and the calibration is now a gate #623 built the seam for either; this is the choice of which. - Decide whether a domain near-match level belongs in the recommended account config shape, since without it the comparison space provably cannot separate a real class of true duplicate from a real class of false merge.
- Evaluate TF adjustment on
phone_e164as the alternative (or additional) discriminator. The switchboard number is shared across two distinct domains while Initech's is not, so term frequency is exactly the signal that distinguishes them — andconfig_check'sunused_tf_payoffadvisory already exists to point at cases like it.
Caveat worth stating
44 is fitted to one 20-record corpus and should not be shipped as a constant on that evidence alone. The person 60 earned its value from two independent legs — the reference-model Bayes-factor sum and a cluster-count grid. For accounts the reference-model leg says 21.8 and the grid says 44, and those disagree by 2x; understanding why is part of this ticket. The acct_10 grid is reproducible, so a second account corpus is the cheapest way to tell a corpus artefact from a real figure.
Product context (2026-11-26)
Why this matters for the API product: Configure. A customer who declares entity_type: account and accepts the defaults gets a model that false-merges distinct companies. The API has no way to warn them today.
Current state: Unchanged since filing. DEFAULT_FULL_AGREEMENT_BITS = 60.0 (rust/crates/er-compile/src/lib.rs:174). CompileOptions::from_config (lib.rs:226-240) reads thresholds.full_agreement_bits and falls back to 60. It never looks at entity_type, and the compiler's own comment says so (lib.rs:1245-1247). No committed config sets the knob: git grep 'full_agreement_bits:' finds only a comment in fixtures/static/acct_10/config_domain_jw.yaml:15. The three gates named in the body are live in rust/crates/er-cli/tests/acct_e2e.rs:382, :427 and :458. There is still only one account corpus with declared truth (fixtures/static/acct_10), so the caveat about a second corpus still stands.
Definition of done: as above, plus: whichever option is chosen, the documented account config shape in the OpenAPI/config docs states the scale and the domain near-match level.
Dependencies / sequencing: Pairs with #671. Do that first, since a second calibration needs coherent account configs.
Open product decision: Does the product ship per-entity-type defaults, or does it require account tenants to declare the scale? This decides what "configure matching" means for a customer who never tunes anything.
Size: about 1 engineer-week, mostly a second account corpus and its grid. The code change for either option is small.
Activity
test(matching): an account corpus with declared truth, and what it sa…
feat(match): accounts compile at their own score scale, bounded by tw…