Skip to main content
Version: 0.0.8 (stable)

Entity resolution

Entity resolution decides whether extracted entities refer to the same real-world entity. The ingestion pipeline records those decisions and derives resolved entities without rewriting the original entities' facts. See Matching and resolved entities for how those records work.

Why it exists​

Resolution is the deduplication step of the pipeline. One thing has many names. A corpus can say "Charles Babbage", "Babbage Charles", and "C. Babbage". A graph with three nodes splits the evidence. A search then finds only a part of it.

A wrong match can mix facts from two entities, while a missed match can be reconsidered later. The resolver therefore treats uncertain pairs differently from rejected pairs. If no tier can decide, such as when an LLM request fails, the pair stays undecided and an existing match remains in place.

How it works​

Extracted entities with the same label and text collapse into one entity. Other pairs go down tiers: a name gate, fuzzy match, embedding similarity, clustering, and LLM review. A match is stored as a link between entities, and linked entities are grouped under one resolved entity.Extracted entities with the same label and text collapse into one entity. Other pairs go down tiers: a name gate, fuzzy match, embedding similarity, clustering, and LLM review. A match is stored as a link between entities, and linked entities are grouped under one resolved entity.
A pair of extracted entities with the same label goes down five tiers: exact, fuzzy, embedding, cluster, and LLM review. The first tier that is sure decides. A match is stored as a link. A pair that no tier can decide stays undecided.A pair of extracted entities with the same label goes down five tiers: exact, fuzzy, embedding, cluster, and LLM review. The first tier that is sure decides. A match is stored as a link. A pair that no tier can decide stays undecided.

A pair goes down the tiers. The first tier that is sure decides.

The exact tier does the deduplication. Entities with the same label and the same normalized text collapse into one entity as they are ingested. That entity counts how often it appears and lists the chunks it came from. Every other match is stored as a MATCHES link between two entities. Linked entities are grouped under one resolved entity, so near duplicates stay separate entities, and a later re-evaluation can deactivate a link.

  • Only extracted entities with the same label are compared.
  • The first step that is sure decides the pair, and later steps do not run for it.
  • Only the pairs that stay unclear after the cheaper steps reach the LLM.
  • A pair that no step can decide stays undecided. An undecided pair is never a rejection, and an existing match stays in place.
  • Graph.consolidate runs the same steps over every entity in the graph. It is a dry run that shows its matches unless you pass apply=True.
  1. Only extracted entities with the same label are compared. The label is the type of the extracted entity, not a parent type. A Vendor is never compared with an Organization. A Person is never compared with a Location.
  2. Exact tier. Two extracted entities match when their text is equal after trimming spaces and ignoring letter case.
  3. Name gate. Two names that differ after trimming spaces and ignoring case are blocked when either of two checks fails. The first check fails when both names contain numbers and the sets of numbers differ, as in "Apollo 11" and "Apollo 13". The second check fails when either name is longer than 80 characters. A blocked pair skips the remaining tiers and never merges, not even through a chain of other matches. The resolver lists it in unresolved_pairs.
  4. Fuzzy tier. The tier compares the words of both names and ignores their order. A score of 0.97 or more is a match. A lower score is not a rejection. It only means that the fast path does not apply.
  5. Embedding tier. Each name becomes a vector. A cosine similarity of 0.95 or more is a match. A similarity below 0.80 drops the pair. A similarity from 0.80 to 0.95 makes the pair ambiguous.
  6. Cluster tier. Ambiguous pairs are grouped by average similarity. A tight group is a match without an LLM call.
  7. LLM tier. An LLM reads each remaining pair with its context. For an entity that is already in the graph, the context is the entity name and its neighboring relations. It answers match, no match, or uncertain. Only a match merges. A failed request also leaves the pair undecided. The LLM sees at most 500 pairs for each label, most similar first; entity indices break ties. Pairs over the cap stay undecided and are counted in the resolution result.

Without an LLM, the remaining pairs stay undecided too. A resolution call logs one warning, and reevaluate keeps existing match edges for those pairs.

Two scopes​

Graph.add compares the extracted entities of one call with each other and with similar entities that the graph already stores. Graph.consolidate runs the same tiers over every entity in the graph, when you ask for it. If you added data before an LLM was configured, use it. The guide Consolidate duplicates shows how.

Entities that two documents create at the same time are resolved after both jobs commit. Each add resolves its extracted entities only against data that is already committed, so a concurrent add cannot see an entity that has not committed yet. After a job commits, it resolves the entities it created against everything committed so far, so near-duplicate names such as "Acme Corporation" and "Acme Corp" still end in one resolved entity.

Example​

PairDeciding tierResult
"Babbage Charles" and "Charles Babbage"Fuzzy (score 1.0)Match
"C. Babbage" and "Charles Babbage"LLMMatch: "C." is a standard short form of "Charles"
"Analytical Engine" and "Difference Engine"LLMNo match: two different machines
"Cambridge" (Location) and "Cambridge" (Organization)Not comparedDifferent labels
Design choices

The tiers use zones instead of a chain of vetoes, because a low fuzzy score never rejects a pair. "Ada King" and "Ada Lovelace" share few characters, but they name one person. The embedding and LLM tiers still get to see the pair. The name gate is the only hard block, and it covers only the two checks in step 3.

The cluster tier runs before the LLM because a tight group of similar names needs no judgment. Grouping first sends fewer pairs to the LLM.

The per-label cap bounds the cost. One call makes at most ceil(L × 500 ÷ 10) LLM requests for L labels.

A missed match is recoverable with Graph.consolidate. An uncertain answer is not a rejection, so Graph.reevaluate does not remove a match because the model was unsure.

A city and a company can have the same name. Keeping labels apart stops a merge across types.