Skip to main content
When data from two sources is combined, the same person, product, place, or work often appears on both sides, described differently on each. Entity alignment decides which record on one side describes the same entity as a record on the other. In a knowledge graph, each entity has facts and links to other entities. Comparing every record with every other is slow, so a cheap first step usually picks out pairs worth a closer look, such as records with similar names. Each of those candidate pairs then needs a decision, which we make here. A wrong merge combines facts and links from different entities. Undoing it means working out where each fact came from. A missed match leaves a duplicate. Pairs that need review get a third outcome: send them to a curator, a person who decides by hand. Jev makes this decision with a Score question: you describe one level per outcome, and the answer is a score along those levels. Here the levels are leave unlinked, send for review, and recommend a merge (assert sameAs). On 450 album pairs from two public music catalogs, we got 57 merge recommendations, 79 pairs for review, and 314 left unlinked. The dataset records 48 of the 57 recommended merges as matches.

Setup

Run in Colab

Runs as published without an API key.

Python file

This page as one .py file, to run locally.

Open in playground

Edit one request and run it live. Needs a TypeSafe account.
To run it on your own machine instead:
With uv, uv run entity_alignment.py installs the dependencies for you. The code downloads the published answers into entity_alignment_cache.json, so it runs as published without an API key; to run live, set DOWNLOAD_CACHE = False and delete that file. To change a request, set TYPESAFE_API_KEY; in Colab, add it in the Secrets panel. Numbers below came from jev-1.14.0 on 2026-10-16.

Load the candidate pairs

The pairs in candidate_pairs.json come from two public music catalogs, Wikidata and MusicBrainz. Both release this data under CC0, which puts it in the public domain. In each pair, entity_a is an album record from Wikidata and entity_b is a release from MusicBrainz. Each entity has four fields: title, artist, year, and label. DATA_LICENSE.md credits both sources. Each pair also has known_same_as. It is true when a Wikidata editor linked the album to the MusicBrainz release group that the release belongs to. Wikidata is a knowledge graph, and that link is an entity alignment link. The 70 pairs marked true are called known matches here. In the other 380, the Wikidata album links to a different MusicBrainz entry. Nobody checked each pair by hand. The text is left exactly as the catalogs publish it, with no cleanup: mixed casing and alphabet systems, straight and curly apostrophes, and placeholders such as [no label]. A missing value is -. We send one request per pair, so the number of requests depends on the number of candidate pairs, not the size of either catalog.

Ask one Score question and three Noul questions per candidate pair

The decision is a Score question because a Score attaches a written description to each outcome in LEVELS, including the uncertain middle one, and keeps the three outcomes in order. A Noul question could reach the middle outcome only indirectly, by thresholding its output. A Choice question would lose the order of the three outcomes. Put both entities into one state, as entity_a and entity_b, so each question is about the pair. All four questions go in one request. Title, artist, and label each get a Noul question to indicate where the records disagree. We round the score to the nearest level in route(). Write the level descriptions before looking at the scores; the cut points follow from rounding rather than being fitted to this dataset. The middle level’s wording decides which pairs reach a curator instead of being merged or left unlinked, so it names the cases that need one: a reissue, a compilation, a special or live edition, or a title that could refer to either album. The merge recommendation is called assert sameAs: a recommendation to record that the two entities are the same thing. That label is all route() returns; applying it to a graph is a separate step. There is no Noul question for the year, but the year is in the state. For a year check, compare the two years in code and allow for a missing -. The label question needs a rule, because catalogs disagree about which company to name. We count a shortened name or a regional branch as the same label (Columbia Records and Columbia, EMI and EMI Music Brasil). An imprint is a brand name a record company releases under. We count an imprint and its parent company as different labels (RCA Victor and BMG), because sharing a parent company does not establish that two albums are the same. To use this on another kind of data, swap in your own pairs and rewrite QUESTIONS and LEVELS. The only other code that knows about albums is show(), which prints a pair and names its fields.
In c115 both sides are the same album, with the same title and artist. The label is V2 Records on one side and V2 Records Japan on the other. In c133 the two sides are different albums that share a title. The other two round to the middle level for different reasons. In c190 one side is a 2008 reissue of a 1973 album, with the title spelled as one word. In c159 one side is an album and the other is a remix album made from it.

Route every candidate pair

output output The cut points are the two scores where route() changes its answer: 0.5 and 1.5. Most pairs were routed without the curator: 314 scored below 0.5 and 57 scored at least 1.5, which left 79 for the curator. On this set, 257 of the 450 scores are between 0.1 and 0.4. Two different albums can share a title, and a label name is weak evidence on its own, so the model gives the middle level some probability even when a pair looks different. Routing depends only on which side of a cut point the score falls: a pair at 0.4 is left unlinked, the same as a pair at 0. The three Noul answers help a curator inspect a pair, but only the Score decides its route. Here are two pairs from the curator queue: In c190 the artist and label agree and the title nearly does, and the 35 years between the two releases point to a reissue. In c159 everything agrees except the title, which suggests a related album rather than the same one.

Compare with the catalogs’ own answer

Nothing above used known_same_as. We count it for each outcome to compare the routing with what the catalogs recorded.
The “known non-match” column counts the pairs where known_same_as is false. Of the 57 merges, 48 are known matches. Of the 314 pairs left unlinked, 311 are known non-matches. The curator queue has 19 known matches and 60 known non-matches. The known_same_as flag is not a checked answer, so this agreement is not a verified accuracy figure. Some of the disagreements are mistakes in the catalogs. We looked up two of them in MusicBrainz. In c088, both titles read Um Novo Coração, but the artists are Jozyanne and Maíra. MusicBrainz has a separate entry for Jozyanne’s album, and the Wikidata item links to Maíra’s instead, so known_same_as is true for two different albums. The model left the pair unlinked. In c415, both sides are Tonight: In Person by The Limeliters, from 1961 on RCA Victor. MusicBrainz lists the album twice and Wikidata links to the other entry, so known_same_as is false. The model merged the pair. Six of the nine merged known non-matches have the same title, artist, and year once case, punctuation, and accents are ignored. The model gets some pairs wrong too. It left two other known matches unlinked, including c444, where one side credits Justin Lo and the other 側田, the same singer’s Chinese name. Its same_artist answer is 0.03, and the pair scored 0.44, just under the lower cut point.

Open it in the playground

The link below opens c190 in the playground, with all four questions. The pair scored 1.27 and went to the curator. It’s Herbie Hancock’s Head Hunters from 1973 and the 2008 reissue Headhunters: the same artist, and the same label written two ways. The playground runs jev-latest, so its score can differ from the 1.27 here.
Open in the TypeSafe playground →