learn-entity-resolution-with-phoebe / Session 4 of 6
Learn Entity Resolution with Phoebe · Session 4 of 6

Blocking, before anything gets compared

Session 1 showed that comparing every pair grows with the square of the record count. Blocking is the answer, and it is not free: every scheme that makes comparison affordable also throws some true pairs away before they are ever scored, permanently. Tonight is the arithmetic that forces the decision, four real schemes, and the three measured metrics that tell you exactly what each one costs.

🟠 Hands-on Data engineers Platform and infrastructure owners 45 min
0-3 · Welcome 3-23 · Four schemes 23-40 · Build-along: choose Meridian's blocker 40-45 · Q&A
Part 0

Where we are

Sessions 2 and 3 built the machinery to score a pair well: seven string measures and a Fellegi-Sunter weight that turns field agreements into evidence, with a clerical band for the pairs that stay genuinely undecidable. None of that machinery is cheap enough to run on all 1,953 possible Meridian pairs at real scale. Tonight is the stage that runs before scoring: deciding which pairs are even worth the expensive comparison. Session 5 then judges the whole pipeline, blocking included, against the labelled truth.

Live = presented in the 45 minutes Self-study = the full depth, after class 🔍 Every diagram zooms

★ What you walk out with tonight. Four blocking schemes with what each one actually does to a set of records, the three metrics that measure a blocker honestly - pair completeness, reduction ratio, pairs quality - and the real numbers from running all four on Meridian. Also the single rule that should decide which one you ship: a pair a blocker discards can never come back, so completeness comes first.

LiveWhy scoring alone does not scale4 min▶

A Fellegi-Sunter weight, or any of session 2's seven string measures, is cheap to compute once. It is not cheap to compute 1,953 times, and 1,953 is Meridian at 63 records. The moment a real customer table crosses somewhere between a hundred thousand and a million records per side, all-pairs comparison stops being slow and starts being infeasible on any budget - that is the arithmetic from session 1, and it does not go away just because your scoring got better.

Blocking is the answer to a specific question: can you decide, cheaply, that most pairs are obviously not worth the expensive comparison at all? The four schemes tonight are four different cheap questions to ask first.

Real world

Meridian's support system alone has tens of thousands of tickets, each with a name and a partial address. Running Fellegi-Sunter on every ticket against every CRM contact would mean scoring hundreds of millions of pairs to find a few thousand true matches. Nobody ships that. Everybody ships a cheap filter first.

Self-studyThe number that forces the conversation4 min▶

Restating session 1's arithmetic in one place, because it is the entire reason this session exists: all-pairs comparison is O(N × M) for two tables of size N and M, or O(N²) when comparing a table against itself. That stops being comfortable well before most people expect.

Records per sidePairs to compare
63 (Meridian)1,953
1,000499,500
10,00049,995,000
100,0004,999,950,000
1,000,000499,999,500,000

Somewhere between the 100,000 and 1,000,000 row, all-pairs comparison becomes infeasible on any realistic compute budget, however cheap each individual comparison is. Meridian sits at the top of this table on purpose - it is small enough to compare exhaustively in class, which makes it a good teaching set and a slightly misleading one about what production actually requires.

Part 1 · covers the arithmetic that forces blocking

Every scheme is a bet on a cheap first question

6 min live

A blocking scheme does not decide whether two records match. It decides whether they are even allowed to be compared. That is a much cheaper decision, and cheap decisions are always approximate - which is exactly why blocking has a cost, not just a benefit.

LiveWhat a blocking key actually buys you6 min▶

Every scheme below reduces the same underlying question to one sentence: group records by something cheap to compute, and only compare records inside the same group. The cheap thing might be an exact field, a sorted position, an approximate distance, or a hashed shingle set. What they share is the trade they make: anything that groups two true-match records apart is a pair lost before Fellegi-Sunter, session 2's string measures, or anything else ever sees it.

This is why blocking is discussed as its own pipeline stage rather than folded into scoring. Scoring can be re-run with a different threshold at any time, cheaply, because the comparison already happened. Blocking cannot be re-run after the fact without redoing the expensive part it exists to avoid - which is the same irreversibility session 1 flagged for the pipeline as a whole, now landing on a specific stage.

Part 2 · covers the four schemes

Exact keys, sliding windows, loose clusters, and hashed shingles

9 min live

The four schemes below range from "group by an exact field" to "hash the text and let similar hashes collide". None of them requires the expensive comparison to run first - that is the entire point.

STANDARD - POSTCODE KEY r12010 r23000 r32010 r43000 r54870 r2 and r4 share a postcode and are compared. r5 is alone, so never compared. SORTED NEIGHBOURHOOD, W=3 r3 r1 r4 r2 sorted by surname key Window slides down the sorted list. r1 and r4 land together; r2 drops. CANOPY - LOOSE GROUPS r1 r2 r3 r4 Cheap distance makes wide, overlapping groups. r3 sits in both, so it is compared twice. LSH - HASH BUCKETS bucket 07 bucket 12 r1 r2 r5 Minhash estimates Jaccard on shingles. Same bucket: r1 and r2 pair, r5 does not. All four ask a cheap question before the expensive one. All four can put a true match on the wrong side of it.
🔍 Click to zoom - four cheap first questions, each with its own way of losing a true pair
LiveStandard blocking and sorted neighbourhood5 min▶

Standard blocking picks a field, or a derived key, and only compares records that share it exactly - postcode, a truncated surname, a birth year. It is the oldest and simplest approach in production use, so widespread it is field practice rather than a single citable paper. Its failure mode is the flip side of its simplicity: any pair where the key genuinely differs is invisible to it, no matter how similar every other field is.

Sorted neighbourhood (Hernandez and Stolfo, SIGMOD 1995) sorts all records by a chosen key, slides a fixed-size window across the sorted list, and compares every pair that falls inside the same window together. It recovers some of standard blocking's blind spot, because two records with a slightly different key can still land near each other in sort order and end up in the same window. It trades that for more candidate pairs per true pair recovered, which shows up directly in the measured numbers below.

Verification honesty. The sorted neighbourhood citation above (Hernandez and Stolfo, SIGMOD 1995) is reported secondhand - the original paper was not fetched for this course. Treat the method description as standard and well established in the field, and treat the specific citation as unverified against the primary text.

LiveCanopy clustering and LSH5 min▶

Canopy clustering (McCallum, Nigam and Ungar, KDD 2000, pages 169-178) runs a cheap approximate distance measure over the whole dataset first, forming loose, deliberately overlapping groups called canopies. The expensive, accurate distance measure - session 2's string measures, or Fellegi-Sunter's weight - then only runs on pairs that share a canopy. Because canopies overlap on purpose, a record can sit in more than one, which is exactly what protects it from being blocked out by a single bad key. The original paper reported more than a 10x speedup and about a 25 percent reduction in error on bibliographic matching, and this citation is primary-verified.

LSH and MinHash (Broder, "On the Resemblance and Containment of Documents", SEQUENCES 1997) take a different cheap distance entirely: break each string into overlapping character shingles, compute a small set of minimum hash values over those shingles, and use those minhash values to estimate Jaccard resemblance without ever comparing the full strings. Records whose hashes collide into the same bucket become a candidate pair. It scales to enormous text collections precisely because the expensive comparison never has to run on most of the data.

Verification honesty. The LSH and MinHash citation above (Broder, SEQUENCES 1997) is also reported secondhand - the original paper was not fetched for this course. The mechanism description reflects standard usage across current tooling, not a checked reading of the primary text.

Part 3 · covers measuring a blocker, and the metric that wins

Pair completeness, reduction ratio, pairs quality

9 min live

Choosing a blocking scheme by instinct is exactly the mistake session 1 warned against for scoring: you cannot tune what you cannot measure. Three metrics, all from Christen's work on data-linkage quality measures, make a blocker's cost visible instead of assumed.

LiveThe three metrics, defined properly5 min▶

These come from Christen, "Quality and Complexity Measures for Data Linkage and Deduplication", and the citation is primary-verified.

  • Pair completeness (PC) - the recall analogue for blocking. The share of true pairs that survive into the candidate set. If a blocker keeps 91 percent of true pairs, the other 9 percent are gone before scoring even starts.
  • Reduction ratio (RR) - one minus the candidate pairs divided by all possible pairs. It measures how much work the blocker saved, independent of whether the work it saved was worth saving.
  • Pairs quality (PQ) - the precision analogue for blocking. The share of surviving candidate pairs that are actually true matches. A low PQ means the expensive scoring stage still has to wade through a lot of pairs that were never going to match.

The trade-off is direct: push RR higher by shrinking the candidate set further, and PC usually falls, because a tighter key or a narrower window is more likely to split a true pair apart. The rule that follows is not a preference, it is a consequence of session 1's irreversibility argument applied to this exact stage: prioritise pair completeness. A pair discarded at blocking can never be recovered downstream, however good the scorer is. A false candidate that survives blocking is merely inefficient - the scorer filters it out later, at a cost in compute, not in truth.

PAIR COMPLETENESS REDUCTION RATIO 100% 50% 0% 0% 50% 100% None - all pairs PQ 2% Sorted neighbourhood PQ 13% Soundex of surname PQ 73% Postcode - PQ 78%, best here Every real scheme sits at 91% completeness here, never 100. That 9 points is gone for good.
🔍 Click to zoom - three schemes buy the same completeness for very different pairs quality
LiveThe measured numbers on Meridian, and the honest reading of them6 min▶

These four schemes were run against Meridian's actual 1,953 possible pairs, and the numbers below are measured, not estimated.

SchemeCandidate pairsPair completenessReduction ratioPairs quality
None (all pairs)1,953100%0%2%
Postcode4191%98%78%
Soundex of surname4491%98%73%
Sorted neighbourhood, window 524291%88%13%

The plain point first: every scheme costs 9 percent of the true pairs, permanently. None of the three real schemes reaches the 100 percent completeness that "no blocking at all" has by definition, because none of them is lossless - that was true before Meridian was measured and the measurement confirms it. Blocking is a genuine trade, not a free optimisation, and pretending otherwise is how a matcher quietly loses matches nobody notices until someone asks why a known customer pair never got compared.

Among the three real schemes, postcode is the best trade here: it reaches the same 91 percent completeness and 98 percent reduction as Soundex of surname, but at 78 percent pairs quality against Soundex's 73 percent, meaning fewer of its candidate pairs are wasted on non-matches. Sorted neighbourhood is the clearest illustration of reduction ratio without pairs quality: it does far more comparisons for the same 91 percent completeness - 242 candidate pairs against postcode's 41 - and its pairs quality collapses to 13 percent as a direct result. More candidates is not automatically safer if most of them were never going to match.

Sarah Whitfield, r13 postcode 2010, old address true id e09 Sarah Whitfield, r63 postcode 3000, new address true id e09 - same person Block: postcode 2010 Block: postcode 3000 Different blocks - never compared no scorer, no threshold, ever sees this pair Sarah changed address between the two systems. Postcode blocking, tuned for its best trade-off, still misses exactly this. This is one of the 9 percent - lost before session 3's weights, session 5's evaluation, or a human ever gets a chance.
🔍 Click to zoom - the same postcode key that gives the best trade-off on average still loses a specific true pair
Build-along

Choose Meridian's blocker, and defend it on the numbers

★ 17 min · everyone builds

Blocking choices are defensible or they are not, and the three metrics above are what makes the difference visible. Work through the numbers from the table before you pick.

By hand: sorted neighbourhood produces 242 candidate pairs out of 1,953 possible ones. Compute its reduction ratio yourself as 1 minus 242/1,953, and check it against the 88 percent in the table.

Do the same for postcode: 41 candidate pairs out of 1,953. Confirm you get 98 percent, and notice how much smaller a candidate set gets you the same completeness that sorted neighbourhood needed six times as many pairs to reach.

Using only the table, choose one blocking scheme for Meridian and write two sentences defending it: one citing pair completeness, one citing pairs quality. If you would not ship postcode, say specifically what you know about Meridian's data that the numbers above do not capture.

Design a two-pass scheme: take the union of postcode blocking and Soundex-of-surname blocking, so a pair is a candidate if either key matches. Reason through what this does to pair completeness - can it go down relative to postcode alone? Can it go up? What happens to the candidate count and to pairs quality as a result?

Name one true pair from session 1's labelled set that you would expect postcode blocking to lose, the way the figure above loses Sarah Whitfield's pair. What field changed between her two records that a postcode key cannot see past?

Decide, in one sentence: for Meridian specifically, is the union scheme from step 4 worth the extra candidate pairs it costs, or does postcode alone already sit close enough to the best available trade-off? There is no single correct answer - the point is that you can now argue it with numbers instead of instinct.

Keep your two-pass reasoning from step 4. Session 5 measures full pipelines end to end, including blocking, so you will be able to check whether the union scheme's extra candidates actually bought back any of the recall postcode alone gave up.

Homework

Before session 5

25 min
Check yourself

Three questions

A blocking scheme drops pair completeness to raise its reduction ratio further. Which metric should you protect first, and why?

A false candidate that survives blocking is merely inefficient - the scorer filters it out later at a cost in compute, not in truth. A true pair that blocking discards is gone permanently, with no later stage able to recover it. That asymmetry is why pair completeness is protected first, even at the cost of a larger, less efficient candidate set.

On Meridian, postcode and Soundex-of-surname blocking both reach 91 percent pair completeness and 98 percent reduction ratio. What separates them?

The two schemes tie on completeness and reduction ratio but not on pairs quality: postcode's 41 candidate pairs include a higher share of true matches (78 percent) than Soundex's 44 candidates (73 percent). That is precisely why postcode is called the best trade here - not because it recovers more true pairs, but because less of its candidate set is wasted work.

Sorted neighbourhood on Meridian produces 242 candidate pairs at the same 91 percent completeness postcode reaches with 41. What is the direct consequence for pairs quality?

Pairs quality is the share of candidates that are true matches. Holding the count of true pairs found roughly constant while multiplying the candidate set by six means the extra candidates are overwhelmingly non-matches, which is exactly what drags sorted neighbourhood's pairs quality down to 13 percent against postcode's 78 percent.

Sources covered

What this session teaches, and where it came from

✓The n-squared arithmetic and the O(N×M) pair countComputed directly, restated from session 1; not a citation
✓Standard blocking on an exact keyField practice, not a single citable paper - presented as such deliberately
◐Hernandez and Stolfo, sorted neighbourhood, SIGMOD 1995Secondary - the original paper was not fetched for this course
✓McCallum, Nigam and Ungar, canopy clustering, KDD 2000, pages 169-178Primary-verified, including the reported 10x speedup and 25 percent error reduction
◐Broder, LSH and MinHash, SEQUENCES 1997Secondary - the original paper was not fetched for this course
✓Christen, pair completeness, reduction ratio, pairs qualityPrimary-verified; the three metrics and the completeness-first rule taught in full, with measured Meridian numbers

Every fact on this page, and its verification tier, is recorded in the course's source map.

Session 4 cheat sheet · pin this

Why block at allAll-pairs is O(N×M), infeasible past roughly 100,000 to 1,000,000 records per side.
Four schemesStandard (exact key), sorted neighbourhood (window), canopy (overlapping loose groups), LSH/MinHash (hashed shingles).
The three metricsPair completeness (recall analogue), reduction ratio (work saved), pairs quality (precision analogue).
Completeness firstA pair blocking drops is gone forever. A false candidate is just filtered later, at a compute cost only.
Meridian's numbersPostcode: 41 pairs, 91% PC, 98% RR, 78% PQ - the best trade among the three real schemes.
The honest costEvery real scheme here loses 9 percent of true pairs, permanently. Blocking is a trade, not a free win.