The cluster hypothesis (van Rijsbergen, 1979) says that similar documents tend to be relevant to the same information needs. On the Cranfield collection (1,400 abstracts, length-normalized TF-IDF vectors, cosine similarity) it holds strongly, but as a tendency. A relevant document's five nearest neighbors hold on average 1.33 documents relevant to the same query, about 36 times the 0.037 that chance gives, yet 31.5% of the 1,606 relevant documents tested have none. Under k-means (medians of 30 seeds), 44.8% of co-relevant pairs share a cluster at $K = 10$ and 23.0% at $K = 50$, 3.6 and 7.7 times the rate for random pairs. Cluster pruning with 37 random leaders, probing one, scores about 6% of the collection and returns 24.5% of the exhaustive top ten; probing eight scores 27% and returns 62%.
A search for jaguar returns pages about the animal, the car, and a version of the Mac operating system, interleaved in one ranked list. If the results were grouped by subject, the searcher could go straight to the group they meant. But grouping by similarity helps only if documents that look alike are also useful to the same searcher. Are they? On the Cranfield collection, the test collection of this article, they largely are. A relevant document's five most similar documents hold about 36 times as many documents relevant to the same query as chance would give. The tendency is not a rule, though: nearly a third of the relevant documents have no relevant document among those five.
Grouping documents by similarity, with no list of categories given in advance, is clustering. The assumption that makes it useful for search is the cluster hypothesis: similar documents tend to be relevant to the same information needs.
Here is the plan. First we define clustering and its kinds, which the later articles of the unit build on. Then we list its uses in retrieval, with the formula for cluster-based smoothing and a measurement of cluster pruning. Then we test the cluster hypothesis on the Cranfield collection four ways, from a document's nearest neighbors up to whole k-means clusters. Worked problems close the article.
Clustering as unsupervised learning
A clustering algorithm takes a set of documents and a measure of similarity and partitions the documents into groups, or clusters. Documents within a cluster should be similar to each other, and documents in different clusters dissimilar (Manning, Raghavan, and Schütze, 2008, chapter 16). No labels are given. The algorithm discovers the structure. Its output is only as meaningful as the similarity measure and representation behind it.
That is the essential difference from classification. A classifier learns categories that people defined and labeled. A clustering finds groups that people must then interpret. The groups need not correspond to any categories a person would have chosen.
Clusterings differ along two dimensions:
- Hard or soft. A hard clustering assigns each document to exactly one cluster. A soft clustering gives each document a degree of membership in every cluster. That suits documents that cover several subjects. Model-based clustering and the EM algorithm treats the soft clustering of this unit, a mixture model in which each document has a probability of belonging to each cluster. The topic models of a later topic are soft clusterings of words and documents.
- Flat or hierarchical. A flat clustering produces one set of clusters with no relation among them, as k-means does. A hierarchical clustering produces a tree, from small, tight clusters at the bottom to large, general ones at the top.
What clustering is for
A search system can use clusters to present results, to estimate term statistics, and to decide which documents to score. Manning, Raghavan, and Schütze (2008, §16.1, Table 16.1) list these uses in retrieval:
- Search result clustering. Group the top results for a query by subject, so that an ambiguous query's different senses become visible. Scatter/Gather applied this idea to retrieval results (Hearst and Pedersen, 1996). The course text's example is a commercial search engine, Vivísimo, that showed a panel of clustered results beside the ranked list. For the query
jaguarits panel offered a cluster for the animal although none of the top-ranked results was about it (§16.1, Figure 16.2). - Collection browsing. Organize a collection into clusters, or a hierarchy of them, that people can explore without knowing what to search for. The original Scatter/Gather system clustered whole collections and reclustered the groups a user selected (Cutting, Karger, Pedersen, and Tukey, 1992).
- Language modeling and smoothing. Estimate a document's term statistics partly from the documents in its cluster, which helps for short documents with few words of their own. The formula follows the list.
- Cluster-based retrieval. Use a clustering of the whole collection when answering a query. The course text describes two forms. In the first, documents that match the query bring along other documents of their clusters, even ones with low similarity to the query. If similar documents share relevance, this finds relevant documents that share little vocabulary with the query, and so raises recall. In the second, the query is compared with a representative of each cluster rather than with every document, and only the documents of the nearest clusters are scored. This saves work. It is described under "Cluster pruning" below.
Clustering is also widely used outside retrieval. It can find groups of similar customers, as the Goodreads reviewer clustering does, and detect near-duplicate documents. Clusters can also stand in for a corpus when a question is about the whole of it: GraphRAG partitions a graph of entities extracted from the corpus into nested communities and writes a summary of each in advance, so that a question such as "what are the main themes?" is answered from the summaries rather than from a few retrieved passages.
Cluster-based smoothing
Here is the idea in one sentence: a document too short to say much about a term borrows evidence first from the documents most like it, and only then from the collection as a whole.
Language models for retrieval ranks documents by the probability that a model estimated from each document generates the query. A term absent from the document would get probability zero, so the document's estimate is mixed with the collection's. In Jelinek-Mercer smoothing the mixture is
$$P(t \mid d) = \lambda\, \hat P_{\mathrm{mle}}(t \mid M_d) + (1 - \lambda)\, P(t \mid M_c),$$
where $\hat P_{\mathrm{mle}}(t \mid M_d)$ is the share of the document's tokens that are the term $t$, $P(t \mid M_c)$ is the same share in the whole collection, and $\lambda$ between 0 and 1 is the weight on the document.
The collection is a blunt source of evidence, because most of its documents are about something else. Liu and Croft (2004, equation 5) put the document's cluster between the two. The document is smoothed with its cluster, and the cluster with the collection:
$$P(t \mid d) = \lambda\, \hat P_{\mathrm{mle}}(t \mid M_d) + (1 - \lambda)\big[\beta\, \hat P_{\mathrm{mle}}(t \mid M_{\mathrm{cl}(d)}) + (1 - \beta)\, P(t \mid M_c)\big].$$
Here $\mathrm{cl}(d)$ is the cluster that holds $d$, and $\hat P_{\mathrm{mle}}(t \mid M_{\mathrm{cl}(d)})$ is the share of the term among all tokens of that cluster's documents, the cluster being treated as one long document. The new weight $\beta$, between 0 and 1, sets how far the cluster is trusted over the collection. With $\beta = 0$ the formula is Jelinek-Mercer smoothing again. Liu and Croft write $\lambda$ and $\beta$ as general smoothing weights, which may also depend on the document's length as in Dirichlet smoothing. Multiplying out, the estimate is a mixture of three sources with weights $\lambda$, $(1 - \lambda)\beta$ and $(1 - \lambda)(1 - \beta)$, which sum to one.
Liu and Croft clustered several TREC collections with k-means and ranked by query likelihood. They report that, in query-likelihood retrieval with static k-means clusters, this document model performed significantly better than the document model smoothed with the collection alone on all four of their test collections. Worked problem 4 computes both estimates for one term.
Cluster pruning
The second form of cluster-based retrieval has a simple version in the course text (§7.1.6) called cluster pruning. Before any query arrives, $\sqrt{N}$ of the $N$ documents are picked at random as leaders, and every other document, a follower, is attached to its nearest leader. Each leader then has about $\sqrt{N}$ followers. At query time the query is compared with the $\sqrt{N}$ leaders, and exact cosine scores are computed only for the nearest leader and its followers. That is about $2\sqrt{N}$ comparisons in place of $N$. Variants attach each follower to its $b_1$ nearest leaders and score the followers of the $b_2$ leaders nearest the query; the basic scheme is $b_1 = b_2 = 1$. The method is approximate, unlike the dynamic pruning of MaxScore and WAND, which skips a document only when an upper bound shows it cannot enter the top $k$ and so returns exactly the exhaustive ranking. The documents truly nearest the query may be followers of a leader that was not probed, and then they are never scored. How often similar documents sit in different clusters is what the section "Do relevant documents land in the same cluster?" measures below, and the section after it measures cluster pruning itself on Cranfield. The same design is the inverted-file index of present-day vector search; the article on that index opens with Problem 2 below. Jégou, Douze, and Schmid (2011, section IV) partition a collection of vectors with k-means, so that the centroids play the part of the leaders. They store with each centroid the list of vectors assigned to it, in compressed form, and at query time scan only the lists of the $w$ centroids nearest the query.
The cluster hypothesis
All of these uses depend on one assumption, stated by van Rijsbergen (1979) as the cluster hypothesis:
Closely associated documents tend to be relevant to the same requests.
If it holds, a document's neighbors are a good guide to whether it is relevant, and grouping documents by similarity groups them by relevance. If it fails, clustering organizes documents in a way that has nothing to do with what searchers want.
The hypothesis can be tested with relevance judgments. Voorhees (1985) proposed a nearest-neighbor test. For each relevant document, look at its few most similar documents in the collection, and count how many are also relevant to the same query. If the hypothesis holds, the count should be far higher than chance would give.
A test on Cranfield
The test was run on the Cranfield collection of 1,400 aerodynamics abstracts, with its 225 queries and their relevance judgments. Documents were represented as length-normalized TF-IDF vectors (logarithmic term frequency), after the text processing described in comparing ranking models. The test covers the 1,606 relevance judgments (query and relevant document pairs) that belong to queries with at least two relevant documents. For each, the five most similar other documents in the collection were found by cosine similarity:
| Measure | Value |
|---|---|
| Relevant documents among the five nearest neighbors, on average | 1.33 |
| The same, expected by chance | 0.037 |
| Relevant documents with at least one relevant neighbor among the five | 68.5% |
| Mean cosine between two documents relevant to the same query | 0.153 |
| Mean cosine between a relevant and a nonrelevant document | 0.044 |
A relevant document's nearest neighbors are about 36 times as likely to be relevant to the same query as a randomly chosen document is. Documents relevant to the same query are, on average, about three and a half times as similar to each other as they are to the rest of the collection. On Cranfield, the cluster hypothesis holds strongly.
Example (the chance count for one query). For a query with 8 relevant documents, five documents picked at random from the rest of the collection are expected to include about 0.025 relevant ones. Take one of the 8. Seven of the other 1,399 Cranfield documents are relevant to the same query, each pick is relevant with probability $7/1{,}399$, and five picks give $5 \times 7 / 1{,}399 = 0.025$.
Where the chance figure comes from
Take a query with $R$ relevant documents and one of them, $d$. Its five nearest neighbors are five of the other $1{,}399$ documents, and $R - 1$ of those are relevant. If similarity carried no information about relevance, the five would be a random sample. Each of the five would be relevant with probability $(R - 1)/1{,}399$, so the expected number of relevant ones is $5(R - 1)/1{,}399$, as in the example. Averaging this over all 1,606 tested documents gives the 0.037 in the table.
The full distribution under chance is hypergeometric: five documents drawn without replacement from $1{,}399$, of which $R - 1$ are relevant. The probability that exactly $j$ of the five are relevant counts the ways to choose $j$ of the relevant documents and $5 - j$ of the others, out of all ways to choose five:
$$P(j) = \frac{\binom{R-1}{j}\binom{1{,}400 - R}{5 - j}}{\binom{1{,}399}{5}}, \qquad j = 0, 1, \dots, \min(5, R - 1).$$
Example (the chance distribution for a query with five relevant documents). With $R = 5$, a relevant document has no relevant document among five random neighbors with probability 0.9858. Four of the other 1,399 documents are relevant and 1,395 are not, so
$$P(0) = \frac{\binom{1{,}395}{5}}{\binom{1{,}399}{5}} = \frac{1{,}394 \times 1{,}393 \times 1{,}392 \times 1{,}391}{1{,}399 \times 1{,}398 \times 1{,}397 \times 1{,}396} = 0.9858.$$
The remaining probability, 0.0142, is almost all $P(1) = 0.0142$; two or more relevant neighbors have probability $6.1 \times 10^{-5}$. Under chance, then, 98.6 percent of such documents would have no relevant neighbor. Query 82, traced below, is such a query.
Adding these distributions over all 1,606 tested documents gives the counts expected by chance: 1,548.5 documents with no relevant neighbor (96.4 percent), 56.3 with one, 1.2 with two, and less than 0.02 with three or more. The observed counts are nothing like it. They are 506 with none (31.5 percent), 511 with one, 300 with two, and 289 with three or more:
One query traced
Query 82 of the collection asks how the methods of Küchemann and Multhopp for calculating lift distributions on swept wings in subsonic flow compare with each other and with experiment. It has five relevant documents. It was chosen as the query with the median neighbor count among queries with four to six relevant documents, so it is typical rather than flattering. Each row lists the five nearest neighbors of one relevant document, by document number, with the cosine similarity. A neighbor in bold is itself relevant to query 82:
| Relevant document | Its five nearest neighbors (cosine) |
|---|---|
| 205: airfoil section data correlated with loads measured on a 45° sweptback wing | 1290 (0.239), 679 (0.235), 793 (0.229), 204 (0.225), 674 (0.201) |
| 676: a simple method for calculating span and chordwise loading on straight and swept wings | 783 (0.257), 247 (0.249), 203 (0.247), 287 (0.209), 674 (0.207) |
| 677: methods for calculating the lift distribution of wings | 1280 (0.246), 1342 (0.176), 637 (0.167), 204 (0.165), 704 (0.153) |
| 678: the effect of end plates on swept wings | 247 (0.215), 1343 (0.192), 676 (0.187), 794 (0.185), 287 (0.181) |
| 679: low speed tests on 45° sweptback wings | 674 (0.254), 205 (0.235), 513 (0.214), 675 (0.195), 676 (0.184) |
Four of the 25 neighbor slots hold a relevant document. That is an average of 0.8 per document, against a chance expectation of $5 \times 4 / 1{,}399 = 0.014$. Three of the five documents (205, 678 and 679) have at least one relevant neighbor and two (676 and 677) have none. By the chance distribution computed above for a query with five relevant documents, each would have none with probability 0.9858, so chance expects $5 \times 0.9858 = 4.93$ of the five to have none. Several of the other neighbors, such as 674 and 204, appear in more than one row. They are documents about swept wings (674 on their drag, 204 on estimating their characteristics from airfoil section data) that the judges did not mark relevant to this particular comparison of two methods. The relevant documents sit in a neighborhood of related work, not in a tight group of their own.
How large a neighborhood
The choice of five neighbors is Voorhees's, and she calls it arbitrary herself, so the test was repeated with 1, 10 and 20.
Example (widening the neighborhood). As the neighborhood grows from 1 to 20 documents, the fraction of neighbors that are relevant falls, and the share of documents with at least one relevant neighbor rises. The second is certain in advance: a document that has a relevant document among its $k$ nearest also has one among its $k + 1$ nearest. The first is what the measurement shows. A query has only a handful of relevant documents, so a wider neighborhood soon fills with nonrelevant ones. On average a tested document has 10.2 other documents relevant to its query, which is the chance figure for $k = 1$ before rounding, 0.00732, times 1,399.
| $k$ | Relevant among the $k$ nearest | Fraction relevant | Expected by chance | Ratio | At least one relevant |
|---|---|---|---|---|---|
| 1 | 0.382 | 0.382 | 0.007 | 52 | 38.2% |
| 5 | 1.328 | 0.266 | 0.037 | 36 | 68.5% |
| 10 | 2.044 | 0.204 | 0.073 | 28 | 78.6% |
| 20 | 2.965 | 0.148 | 0.146 | 20 | 87.0% |
The single nearest neighbor of a relevant document is itself relevant 38 percent of the time, 52 times the chance rate. Wider neighborhoods catch more relevant documents but dilute them. The fraction relevant falls from 0.38 to 0.15 as $k$ grows from 1 to 20, while staying 20 or more times above chance.
Van Rijsbergen's test
An older test looks at every pair at once. Van Rijsbergen (1979, chapter 3) described it as follows:
- for each query, compute the similarity of every pair of documents that are both relevant (R-R pairs);
- compute it also for every pair with one relevant and one nonrelevant document (R-N pairs);
- pool the values over all queries and compare the two distributions.
If the hypothesis holds, the R-R distribution should lie well to the right of the R-N one. The less the two overlap, the more a clustering can separate relevant documents from the rest.
Pooled this way, R-R pairs have mean similarity 0.120 and median 0.105, against 0.045 and 0.039 for R-N pairs. The separation is clearest in the tail: 13.2 percent of R-R pairs have similarity above 0.2, against 0.3 percent of R-N pairs.
The means in the earlier table, 0.153 and 0.044, differ from these because they average each query's mean, so every query counts equally. Pooling counts every pair equally. That gives more weight to queries with many relevant documents, and on Cranfield their relevant documents are less alike. Of the 219 queries with at least two relevant documents, the 95 with more than six (the median) supply 90 percent of the pooled R-R pairs. Their mean R-R similarity, averaged over queries, is 0.134, against 0.168 for the 124 queries with six or fewer.
The large overlap repeats the caution of the third of relevant documents with no relevant neighbor: similarity is evidence of shared relevance, not proof.
Do relevant documents land in the same cluster?
The tests so far look at neighborhoods. Retrieval systems that use clusters see something coarser: whether two documents fall in the same cluster. To measure that, Cranfield was clustered with k-means (the same vectors, k-means++ seeding, 30 seeds for each $K$). The table counts how often a pair of documents relevant to the same query ends up in one cluster, compared with a pair of documents chosen at random.
Example (ten clusters against fifty). Going from 10 clusters to 50, a pair of co-relevant documents becomes less likely to share a cluster, but its advantage over a random pair grows. Smaller clusters keep any two documents apart more often. In this experiment random pairs lose more from that than co-relevant ones: their share falls by a factor of about four, the co-relevant share by about two.
| Clusters $K$ | Co-relevant pairs in the same cluster | Random pairs in the same cluster | Ratio |
|---|---|---|---|
| 10 | 44.8% (42.5 to 48.3) | 12.6% (11.6 to 13.3) | 3.6 |
| 25 | 33.2% (31.3 to 34.8) | 5.6% (5.3 to 6.4) | 5.8 |
| 50 | 23.0% (22.0 to 24.3) | 3.0% (2.8 to 3.2) | 7.7 |
Values are medians over the 30 runs, with the interquartile range in parentheses, over 6,484 distinct pairs of co-relevant documents. The ratio is the median of the 30 per-run ratios, so it differs slightly from the ratio of the two medians.
Co-relevant documents share a cluster several times more often than chance. In this experiment the advantage grows with $K$: the ratio rises from 3.6 to 7.7. But even with only ten clusters, more than half of the co-relevant pairs are split, and with fifty, more than three quarters are. A system that retrieves only the best-matching cluster will miss many relevant documents. Any cluster-based retrieval method has to work around that limit. Worked problem 3 derives the smallest value the random-pair column can take.
Cluster pruning measured
The split pairs have a direct cost for the cluster pruning described under "What clustering is for". To measure it, the scheme of the course text was run on Cranfield as stated there: 37 leaders chosen at random (the integer part of $\sqrt{1{,}400} = 37.4$), every other document attached to its nearest leader by cosine, and each of the 225 queries, weighted and normalized as the documents are, scored against the leaders and then against the followers of the $b_2$ nearest leaders. The reference is exhaustive search, which scores all 1,400 documents and reaches a precision at 10 of 0.211 with these vectors.
| Leaders probed $b_2$ | Collection scored | Exhaustive top 10 found | Precision at 10 |
|---|---|---|---|
| 1 | 5.9% (5.7 to 6.1) | 24.5% (23.0 to 25.5) | 0.101 (0.093 to 0.109) |
| 2 | 9.2% (8.9 to 9.4) | 35.4% (33.9 to 36.6) | 0.133 (0.124 to 0.139) |
| 4 | 15.4% (15.0 to 15.6) | 47.9% (45.6 to 48.7) | 0.156 (0.150 to 0.162) |
| 8 | 27.0% (26.7 to 28.0) | 61.9% (59.8 to 63.1) | 0.180 (0.176 to 0.184) |
| all 37 | 100% | 100% | 0.211 |
Values are averages over the 225 queries, then medians over 30 random choices of leaders, with the interquartile range in parentheses. "Collection scored" counts the 37 leaders and the followers of the probed leaders. "Exhaustive top 10 found" is the share of the ten documents ranked highest by exhaustive search that pruning also returns in its top ten.
With one leader probed, pruning scores about 6 percent of the collection and returns a quarter of the true top ten. The single highest-ranked document is among the documents scored for 31.3 percent of queries (28.1 to 32.9). Probing eight leaders scores 27 percent of the collection and recovers 62 percent of the top ten. On this collection, then, the saving is real and so is the loss, and the parameter $b_2$ trades one for the other. These figures describe sparse TF-IDF vectors of 1,400 short abstracts with randomly chosen leaders; they are a measurement of this setting and not a general property of the method. Generative Retrieval makes the same bet when it searches by cluster identifiers: on Cranfield query 185 all ten of its top results come from one cluster of twelve abstracts, and the three relevant abstracts in other clusters are not retrieved.
What the test shows and does not show
A tempting reading of these results is "the hypothesis holds on Cranfield, so cluster-based retrieval will work there." The test supports only the first half.
Nearly a third of the relevant documents had no relevant document among their five nearest neighbors, so similarity is a strong signal but far from a guarantee. Voorhees (1985) ran her test on four collections (MED, CACM, CISI and INSPEC) and compared searches of clustered collections with a sequential search of all the documents. Her abstract reports two findings. How well a search performed on a collection depended on how similar its relevant documents were to each other, but whether clustered retrieval did better or worse than sequential retrieval did not depend on that similarity. And retrieving whole clusters in response to a query usually performed worse than retrieving individual documents from within clusters. The cluster test and the pruning measurement above show one reason why a clustered search can fall short of a sequential search on Cranfield: most co-relevant pairs end up in different clusters, so a search confined to the nearest clusters never sees many relevant documents. Federated Search applies the same idea to whole engines: it splits Cranfield into ten spherical k-means clusters, each searched by its own engine, and asking only the three that the CORI method selects for a query keeps an nDCG@10 of 0.364 against the single index's 0.368 (medians over 30 splits, the engines scoring with shared statistics).
A related property is used constantly without being called clustering. Pseudo-relevance feedback, the automatic form of relevance feedback, assumes that the top-ranked documents are relevant and retrieves more documents like them. That is the cluster hypothesis applied to a ranking.
The Cranfield tests are computed by tools/experiments/clustering/cluster_hypothesis.py and cluster_hypothesis_more.py in the site repository. The chance distribution, the cluster pruning measurement and the worked problems are checked by cluster_hypothesis_worked.py in the same folder.
Worked problems
Problems 1 and 2 are Exercises 16.1 and 16.2 of the course text (Manning, Raghavan, and Schütze, 2008, §16.1), restated in our own words and solved here. Problems 3 and 4 are posed on this article's own results: the k-means table and the smoothing formula.
Problem 1 (Exercise 16.1 of the course text). Call two documents similar if they have at least two proper names, such as Clinton or Sarkozy, in common. Give an information need and two documents for which the cluster hypothesis does not hold under this notion of similarity.
Solution. The hypothesis says that similar documents tend to be relevant to the same information needs. It fails for a pair when the two documents are similar and yet one is relevant and the other is not. Take the information need "What did the health care reform plan proposed by the Clinton administration in 1993 contain?" and these two documents:
- Document A describes the provisions of the health care plan that the Clinton administration proposed in 1993, naming President Clinton, and reports Senator Dole's objections to it.
- Document B reports the result of the 1996 presidential election, in which Clinton defeated Dole.
Both documents contain the proper names Clinton and Dole, so they are similar under the definition. Document A is relevant to the information need and document B is not: it says nothing about health care. The hypothesis fails for this pair.
The reason is general. Proper names record who a document mentions, and the same people appear in documents about unrelated subjects, so sharing two names says little about sharing a subject. The definition also misses relationships the hypothesis would need. A third document that explains the plan's employer mandate without naming any person is relevant to the same need, yet under the definition it is similar to neither A nor B. That is not a counterexample to the hypothesis, which speaks only about similar documents. But it means clusters built on this similarity would separate documents that share relevance. The cluster hypothesis is a claim about a particular similarity measure, and it can hold for one measure and fail for another on the same documents.
Problem 2 (Exercise 16.2 of the course text). Construct a one-dimensional example, points on a line, with two clusters in which cluster-based retrieval is inexact: retrieving from the cluster nearest the query does worse than a direct nearest-neighbor search.
Solution. Put six documents on the line at 0, 1, 2, 4, 5 and 9, and take the clusters $A = \{0, 1, 2\}$ and $B = \{4, 5, 9\}$. Their centroids are
$$\mu_A = \frac{0 + 1 + 2}{3} = 1, \qquad \mu_B = \frac{4 + 5 + 9}{3} = 6.$$
This is a clustering k-means could return. A point is nearer $\mu_A$ than $\mu_B$ exactly when it lies below their midpoint 3.5; the points 0, 1 and 2 do and the points 4, 5 and 9 do not, so every document is in the cluster of its nearer centroid.
Let the query be at 3.4. Cluster-based retrieval first finds the nearer centroid. The distances are $|3.4 - 1| = 2.4$ and $|3.4 - 6| = 2.6$, so it chooses cluster $A$. Within $A$ the nearest document is the one at 2, at distance $1.4$, and that is what it returns. A direct search over all six documents finds the document at 4, at distance $0.6$. Cluster-based retrieval has returned a document more than twice as far away as the true nearest neighbor, which it never examined.
The same happens for every query strictly between 3 and 3.5, and for no query below 3 or above 3.5. Such a query is nearer $\mu_A$ (it is below 3.5), but nearer the document at 4 than the document at 2 (it is above their midpoint 3). A query below 3 is nearest a document of $A$ and is sent to $A$. A query above 3.5 is sent to $B$, and its nearest document is in $B$, because every document of $A$ is farther from it than the document at 4 is. The error region is the gap between two boundaries: the boundary between the centroids, at 3.5, and the boundary between the nearest documents on either side, at 3. The two differ because the document at 9 pulls $\mu_B$ away from the documents of $B$ that lie near $A$. This is the one-dimensional picture of what the cluster pruning table measures.
Problem 3 (the chance that two documents share a cluster). A collection of $N$ documents is partitioned into $K$ clusters of sizes $n_1, \dots, n_K$. Find the probability that two distinct documents chosen at random are in the same cluster, show that it is smallest when the clusters have equal sizes, and compare that minimum with the "Random pairs" column of the k-means table for $N = 1{,}400$.
Solution. There are $N(N - 1)$ ordered pairs of distinct documents, and $n_i(n_i - 1)$ of them lie within cluster $i$. The probability is therefore
$$p = \frac{\sum_{i=1}^{K} n_i(n_i - 1)}{N(N - 1)} = \frac{\sum_{i} n_i^2 - N}{N(N - 1)},$$
using $\sum_i n_i = N$. Only $\sum_i n_i^2$ depends on how the documents are divided. Write $n_i = N/K + e_i$, where $e_i$ is the amount by which cluster $i$ exceeds the average size. The $e_i$ sum to zero, because the $n_i$ sum to $N$. Then
$$\sum_i n_i^2 = \sum_i \left(\frac{N}{K}\right)^2 + \frac{2N}{K}\sum_i e_i + \sum_i e_i^2 = \frac{N^2}{K} + \sum_i e_i^2 \ge \frac{N^2}{K},$$
with equality exactly when every $e_i = 0$, that is, when all clusters have size $N/K$. Substituting the minimum,
$$p \ge \frac{N^2/K - N}{N(N - 1)} = \frac{N/K - 1}{N - 1}.$$
For $N = 1{,}400$ the three values of $K$ in the table all divide $N$, so the bound is attained by equal clusters:
| $K$ | Equal cluster size | Smallest possible $p$ | Median $p$ observed |
|---|---|---|---|
| 10 | 140 | $139/1{,}399 = 9.94\%$ | 12.6% |
| 25 | 56 | $55/1{,}399 = 3.93\%$ | 5.6% |
| 50 | 28 | $27/1{,}399 = 1.93\%$ | 3.0% |
The observed values are above the minimum in every row, as they must be, and the excess measures how unequal the k-means clusters are. For comparison, ten clusters of sizes 500 and nine times 100 give
$$p = \frac{500 \times 499 + 9 \times 100 \times 99}{1{,}400 \times 1{,}399} = \frac{338{,}600}{1{,}958{,}600} = 17.3\%.$$
The bound also shows why the "Ratio" column should be read with the random-pair column and not alone. For clusters of roughly equal size, $p$ is close to $1/K$, so the random-pair share falls in proportion as $K$ grows whatever the documents are.
Problem 4 (cluster-based smoothing of one term). A document of 50 tokens does not contain the term lift. Its cluster holds 1,000 tokens, 30 of them lift, and the collection holds 100,000 tokens, 200 of them lift. With $\lambda = 0.7$ and $\beta = 0.8$, find the document's probability of lift under the cluster-based formula and under Jelinek-Mercer smoothing with the collection alone. Do the same for wing, which occurs 2 times in the document, 40 times in the cluster and 1,500 times in the collection.
Solution. The maximum-likelihood estimates for lift are $0/50 = 0$ in the document, $30/1{,}000 = 0.03$ in the cluster and $200/100{,}000 = 0.002$ in the collection. The cluster smoothed with the collection gives
$$0.8 \times 0.03 + 0.2 \times 0.002 = 0.024 + 0.0004 = 0.0244,$$
and the cluster-based estimate is
$$P(\textit{lift} \mid d) = 0.7 \times 0 + 0.3 \times 0.0244 = 0.00732.$$
With the collection alone, $P(\textit{lift} \mid d) = 0.7 \times 0 + 0.3 \times 0.002 = 0.0006$. The cluster-based estimate is $0.00732 / 0.0006 = 12.2$ times as large. The document does not use the word, but the documents most like it use it fifteen times as often as the collection does ($0.03$ against $0.002$), and the estimate now reflects that. Other things equal, a query containing lift will rank this document above a document that also lacks the word and sits in a cluster where the word is rare.
For wing the estimates are $2/50 = 0.04$, $40/1{,}000 = 0.04$ and $1{,}500/100{,}000 = 0.015$. The smoothed cluster model gives $0.8 \times 0.04 + 0.2 \times 0.015 = 0.032 + 0.003 = 0.035$, so
$$P(\textit{wing} \mid d) = 0.7 \times 0.04 + 0.3 \times 0.035 = 0.028 + 0.0105 = 0.0385,$$
against $0.7 \times 0.04 + 0.3 \times 0.015 = 0.028 + 0.0045 = 0.0325$ with the collection alone. The change is small, a factor of about 1.2, because the document's own evidence carries weight 0.7 in both formulas. Cluster-based smoothing matters most for the terms a document lacks, which is where the collection-only estimate has nothing but the collection to go on. The three sources have weights $0.7$, $0.3 \times 0.8 = 0.24$ and $0.3 \times 0.2 = 0.06$, which sum to one.
What we have learned
Clustering's uses in retrieval all rest on the cluster hypothesis. On Cranfield the hypothesis holds strongly: a relevant document's five nearest neighbors hold 36 times as many relevant documents as chance predicts, and co-relevant pairs share a k-means cluster several times as often as random pairs. It holds as a tendency, not a rule. A third of relevant documents have no relevant neighbor, and most co-relevant pairs are split between clusters. Cluster pruning with one leader probed, which scores about 6 percent of the collection, returned a quarter of the documents an exhaustive search ranks in its top ten.
The cluster test used k-means as a black box. The k-means algorithm defines the quantity it minimizes, the residual sum of squares, and proves that the algorithm stops after finitely many steps, on six points traced by hand. Then come K-means in practice, model-based clustering and the EM algorithm, evaluating clusterings, and hierarchical clustering, the main alternative.
References
- Cutting, D. R., Karger, D. R., Pedersen, J. O., and Tukey, J. W. (1992). Scatter/Gather: A cluster-based approach to browsing large document collections. In Proceedings of SIGIR 1992, 318–329. record · 3 pages
- Hearst, M. A., and Pedersen, J. O. (1996). Reexamining the cluster hypothesis: Scatter/Gather on retrieval results. In Proceedings of SIGIR 1996, 76–84. record · 2 pages
- Jégou, H., Douze, M., and Schmid, C. (2011). Product quantization for nearest neighbor search. IEEE Transactions on Pattern Analysis and Machine Intelligence, 33(1), 117–128. record · 6 pages
- Liu, X., and Croft, W. B. (2004). Cluster-based retrieval using language models. In Proceedings of SIGIR 2004, 186–193. record
- Manning, C. D., Raghavan, P., and Schütze, H. (2008). Introduction to Information Retrieval, section 7.1.6, chapter 16 introduction and section 16.1. Cambridge University Press. record · 102 pages
- van Rijsbergen, C. J. (1979). Information Retrieval, 2nd edition, chapter 3. Butterworths. record · 8 pages
- Voorhees, E. M. (1985). The cluster hypothesis revisited. In Proceedings of SIGIR 1985, 188–196. record
Reviewed: verified, 16 Nov 2026 · checked against sources, 23 Nov 2026 · citations checked, 16 Nov 2026 · editorial review, 23 Nov 2026 · 12 revisions