Binary Independence Model

The classic probabilistic retrieval model. It represents documents as sets of terms, assumes terms are independent given relevance, and turns the Probability Ranking Principle into a sum of per-term weights. The derivation step by step, the Robertson–Spärck Jones weight computed for a real Cranfield query with and without relevance judgments, and how IDF emerges.

The Binary Independence Model (BIM; Robertson and Spärck Jones, 1976) applies the Probability Ranking Principle under two assumptions: a document is a set of terms, and terms are independent given relevance. Ranking then reduces to a sum, over the query terms a document contains, of $c_t = \log \frac{p_t (1 - u_t)}{u_t (1 - p_t)}$, the log odds ratio of the term in relevant against nonrelevant documents; it is Bernoulli Naive Bayes with its constant dropped. With relevance judgments $c_t$ is the smoothed Robertson–Spärck Jones weight. Without them, $p_t = 0.5$ and $u_t \approx \mathrm{df}_t/N$ reduce it to IDF. On Cranfield query 185 it puts all nine relevant abstracts in its top 20 of 542, in large ties (average precision 0.659; 0.736 with judgments). Over 225 queries without judgments its mean average precision is 0.220; BM25's is 0.307.

Cranfield query 185 asks for experimental studies on panel flutter. Of the collection's 1,400 aerodynamics abstracts, 542 contain at least one of its content words, and nine are relevant. The Probability Ranking Principle says to rank the 542 by their probability of relevance. But nobody hands the system those probabilities. How can it compute them from the one thing it does know, which query words each abstract contains?

The Binary Independence Model (BIM) is the classic answer, developed by Stephen Robertson and Karen Spärck Jones (1976). It takes the PRP literally: rank documents by $P(R = 1 \mid d, q)$. Two simplifying assumptions, given in its name, make that probability computable. The result is a ranking function that is a plain sum of term weights. In the special case where nothing is known about relevance, those weights become inverse document frequency. That connection matters because it gives a probabilistic justification for a heuristic widely used in practice.

Here is the route. First we state the model's assumptions and see what they leave the model able to distinguish on query 185. Then we derive the ranking function in seven steps. Next we estimate the term weights, first with the query's relevance judgments and then without any, and watch inverse document frequency appear. Finally we take up common misreadings, the course implementation, and the model's limits. The probability primer reviews Bayes' rule, odds, and smoothing. The numbers are computed by tools/experiments/cranfield/bim_example.py, with natural logarithms, and rounded as shown.

Assumptions

Binary. A document is represented only by which vocabulary terms it contains, the same set-of-terms view as the Boolean retrieval model. Over a vocabulary of $M$ terms, document $d$ becomes a vector $\vec{x} = (x_1, \dots, x_M)$ with $x_t = 1$ if term $t$ occurs in $d$ and $x_t = 0$ otherwise. How often a term occurs, where it occurs, and how long the document is are all discarded. The query is represented the same way, as a vector $\vec{q}$.

Independence. Given the relevance class, terms occur independently of one another:

$$P(\vec{x} \mid R, q) = \prod_{t=1}^{M} P(x_t \mid R, q).$$

This is the same conditional independence assumption that underlies Naive Bayes classification, and it is false in the same way. Panel and flutter are not independent: the probability primer counts them together in 20 Cranfield abstracts, eleven times as many as independence predicts. Like Naive Bayes, the BIM often ranks well anyway. A ranking needs only the order of the scores to be right, not the probabilities themselves.

A third assumption is easy to overlook: terms that do not appear in the query are distributed identically in relevant and nonrelevant documents, so they cannot affect the ranking.

What the model can see

The binary assumption has a concrete consequence worth seeing before any algebra. Query 185 has four terms after stemming and stopping: experiment, studi, panel, and flutter. Under the third assumption, only these four matter.

Example (fifteen possible scores). However the weights turn out, the BIM can give the 1,400 Cranfield abstracts at most 16 different scores for this query, and in fact 15. The BIM sees each document as one of $2^4 = 16$ presence-absence patterns, and every document with the same pattern receives the same score. The abstracts fall into 15 of the 16 patterns (one, studi and flutter without the other two, is empty), and 858 of them contain none of the four terms. Whatever weights the model assigns, all it can do is put these 15 groups in some order. The rest of the derivation decides which order.

Deriving the ranking function

The derivation follows Manning, Raghavan, and Schütze (2008, §11.3.1). Here is the plan. We start from the probability of relevance and transform it until it becomes a sum over the query terms a document contains. Each step either uses a rule of probability or discards something that is the same for every document and so cannot change the ranking.

Five assumptions are used, each named at the step that needs it: the binary representation (steps 1 and 4), conditional independence of terms given relevance (step 3), the neutrality of terms outside the query (step 5), and, from the Probability Ranking Principle itself, that a document's relevance does not depend on the other documents retrieved and that ranking by probability of relevance is the goal (step 1). The first of those two is the one that makes a ranked list repeat itself when many documents say the same thing; Result Diversification drops it and chooses each result in view of those already chosen.

Step 1. Bayes' rule. By the binary assumption the document enters only as its vector $\vec{x}$, so the quantity the PRP says to rank by is $P(R = 1 \mid \vec{x}, \vec{q})$. The PRP's own assumptions are what allow each document to be scored alone. Start from the quantity the PRP says to rank by and turn it around, so that it is expressed through how documents look in each relevance class:

$$P(R = 1 \mid \vec{x}, \vec{q}) = \frac{P(\vec{x} \mid R = 1, \vec{q}) \, P(R = 1 \mid \vec{q})}{P(\vec{x} \mid \vec{q})}.$$

Step 2. Rank by odds. The denominator $P(\vec{x} \mid \vec{q})$, the probability of seeing exactly this document vector, is hard to estimate. It disappears if we rank by the odds of relevance instead. The odds $O = P/(1 - P)$ increase whenever the probability $P$ does, so they give the same ordering; no assumption is needed for this step. Writing Bayes' rule for $R = 0$ as well and dividing, the denominators cancel:

$$O(R \mid \vec{x}, \vec{q}) = \frac{P(R = 1 \mid \vec{x}, \vec{q})}{P(R = 0 \mid \vec{x}, \vec{q})} = \underbrace{\frac{P(R = 1 \mid \vec{q})}{P(R = 0 \mid \vec{q})}}_{O(R \mid \vec{q})} \cdot \frac{P(\vec{x} \mid R = 1, \vec{q})}{P(\vec{x} \mid R = 0, \vec{q})}.$$

The prior odds $O(R \mid \vec{q})$ are the same for every document, so they do not affect the ranking.

Step 3. Independence. The remaining ratio compares the probability of a whole vector in the two classes, which would need an estimate for each of $2^M$ vectors. The independence assumption factors it into one ratio per term:

$$O(R \mid \vec{x}, \vec{q}) = O(R \mid \vec{q}) \cdot \prod_{t=1}^{M} \frac{P(x_t \mid R = 1, \vec{q})}{P(x_t \mid R = 0, \vec{q})}.$$

Step 4. Name the two probabilities per term. By the binary assumption each $x_t$ is 0 or 1, so each term needs only two numbers:

  • $p_t = P(x_t = 1 \mid R = 1, \vec{q})$, the probability that term $t$ appears in a relevant document.
  • $u_t = P(x_t = 1 \mid R = 0, \vec{q})$, the probability that it appears in a nonrelevant document.

A present term contributes the ratio $p_t / u_t$, and an absent term contributes $(1 - p_t)/(1 - u_t)$.

Step 5. Drop the terms not in the query. This is where the third assumption enters. Assuming $p_t = u_t$ for terms not in the query ($q_t = 0$), those terms contribute a factor of $p_t/u_t = 1$ when present and $(1 - p_t)/(1 - u_t) = 1$ when absent. For query terms, split the product by whether the term is present in the document:

$$O(R \mid \vec{x}, \vec{q}) = O(R \mid \vec{q}) \cdot \prod_{t:\, x_t = q_t = 1} \frac{p_t}{u_t} \cdot \prod_{t:\, x_t = 0,\, q_t = 1} \frac{1 - p_t}{1 - u_t}.$$

Step 6. Move the absent terms into a constant. The second product runs over query terms the document lacks, which is awkward to compute because it depends on what is missing. Multiply and divide by $\frac{1 - p_t}{1 - u_t}$ for the query terms the document does contain. The multiplied copies complete the second product so that it runs over all query terms, and the divided copies join the first product:

$$O(R \mid \vec{x}, \vec{q}) = O(R \mid \vec{q}) \cdot \prod_{t:\, x_t = q_t = 1} \frac{p_t (1 - u_t)}{u_t (1 - p_t)} \cdot \prod_{t:\, q_t = 1} \frac{1 - p_t}{1 - u_t}.$$

The last product depends only on the query, so it is constant across documents and can be dropped along with the prior odds. The absent terms have not been ignored. Their evidence has been folded into the weight of the present ones. Each present term's factor now records both "present rather than absent in a relevant document" and "present rather than absent in a nonrelevant one".

Step 7. Take logarithms. The logarithm preserves order and turns the product into a sum, giving the retrieval status value:

$$\mathrm{RSV}_d = \sum_{t:\, x_t = q_t = 1} c_t, \qquad c_t = \log \frac{p_t (1 - u_t)}{u_t (1 - p_t)} = \log \frac{p_t}{1 - p_t} + \log \frac{1 - u_t}{u_t}.$$

Each matching query term adds a fixed weight $c_t$. The weight is a log odds ratio: the log odds of the term appearing in a relevant document, minus the log odds of it appearing in a nonrelevant one. Its sign follows the evidence:

  • a term that appears much more often in relevant documents gets a large positive weight;
  • a term that appears equally often in both gets a weight near zero;
  • a term that is more common in nonrelevant documents gets a negative weight.

Because the score is a sum over terms the document contains, it can be computed directly from the postings lists of an inverted index, visiting only documents that contain at least one query term.

The RSV is not a probability, and nothing in steps 2, 6, and 7 tried to keep it one. Three quantities were dropped or transformed: the prior odds, the product over all query terms, and the scale, through the logarithm. Each is harmless for ranking and fatal for calibration.

The same model as a classifier

The derivation never used the fact that the task is ranking until it dropped constants. Keep the constants, and the BIM is a two-class classifier with the classes "relevant" and "nonrelevant": the Bernoulli form of Naive Bayes, which the text classification topic treats in full. That model scores a class $c$ by its prior times one factor per vocabulary term, $P(x_t = 1 \mid c)$ if the term is present and $1 - P(x_t = 1 \mid c)$ if it is absent, under the same conditional independence. With two classes it decides by the sign of the log odds, and steps 2 to 6 above computed exactly those log odds:

$$\log O(R \mid \vec{x}, \vec{q}) = \underbrace{\log O(R \mid \vec{q}) + \sum_{t:\, q_t = 1} \log \frac{1 - p_t}{1 - u_t}}_{\text{the same for every document}} \; + \; \mathrm{RSV}_d.$$

So the retrieval status value is the Bernoulli Naive Bayes decision function with its constant removed (Manning, Raghavan, and Schütze, 2008, §13.3; Lewis, 1998). The two uses differ in what happens next. A classifier compares the log odds with zero, so it needs the constant. A ranker compares documents with each other, so it does not. They differ also in where the parameters come from. A classifier estimates them from labeled training documents for a fixed set of classes. In retrieval the classes are new for every query, and usually no labeled document exists, which is why the estimation of $p_t$ and $u_t$ needs the section that follows.

On query 185 with the judged estimates of the next section, the script checks the identity for all 16 presence patterns. The prior log odds are $\log(9/1391) = -5.041$ and the constant is $-11.594$. An abstract with all four terms then has log odds $-11.594 + 14.676 = 3.082$, a probability of 0.956, and both abstracts with that pattern are in fact relevant. An abstract with only panel and flutter has probability 0.778 under the model, while 4 of the 12 abstracts with that pattern are relevant. The order is right and the probability is too high, as expected of a model that counts two associated terms as independent evidence.

The derivation reduced everything to two numbers per query term, $p_t$ and $u_t$. The next section estimates them, first from relevance judgments and then without any.

Estimating the term weights

With relevance judgments

Suppose that for a query we know which documents are relevant. For each query term, a contingency table summarizes the collection:

Relevant Nonrelevant Total
Term present ($x_t = 1$) $s$ $\mathrm{df}_t - s$ $\mathrm{df}_t$
Term absent ($x_t = 0$) $S - s$ $(N - \mathrm{df}_t) - (S - s)$ $N - \mathrm{df}_t$
Total $S$ $N - S$ $N$

Here $N$ is the collection size, $S$ the number of relevant documents, $\mathrm{df}_t$ the number of documents containing $t$, and $s$ the number of relevant documents containing $t$. The maximum likelihood estimates are $p_t = s/S$ and $u_t = (\mathrm{df}_t - s)/(N - S)$. These break down whenever a cell is zero. For example, a term that appears in every relevant document makes $1 - p_t = 0$. The standard fix adds $\tfrac{1}{2}$ to each cell, giving the Robertson–Spärck Jones weight:

$$c_t = \log \frac{(s + \tfrac12) \,/\, (S - s + \tfrac12)}{(\mathrm{df}_t - s + \tfrac12) \,/\, (N - \mathrm{df}_t - S + s + \tfrac12)}.$$

It is still the log odds ratio of step 7, with $p_t$ and $u_t$ now smoothed estimates. Adding $\tfrac12$ to each of the four inner cells raises each column total by 1, so the estimates are

$$p_t = \frac{s + \tfrac12}{S + 1}, \qquad u_t = \frac{\mathrm{df}_t - s + \tfrac12}{N - S + 1}.$$

Substituting them shows that the column totals cancel. For the relevant column, $1 - p_t = \frac{S - s + \frac12}{S + 1}$, so

$$\frac{p_t}{1 - p_t} = \frac{s + \tfrac12}{S - s + \tfrac12}.$$

For the nonrelevant column, $1 - u_t = \frac{(N - S + 1) - (\mathrm{df}_t - s + \frac12)}{N - S + 1} = \frac{N - \mathrm{df}_t - S + s + \frac12}{N - S + 1}$, so

$$\frac{u_t}{1 - u_t} = \frac{\mathrm{df}_t - s + \tfrac12}{N - \mathrm{df}_t - S + s + \tfrac12}.$$

The weight $c_t = \log \frac{p_t}{1 - p_t} - \log \frac{u_t}{1 - u_t}$ is the logarithm of the first ratio over the second, which is the formula above. Each of the two estimates is the add-a-half estimate of the probability primer, the posterior mean under a Beta prior with parameter $\tfrac12$. The pseudo-counts keep every cell positive, so the weight is finite for any counts.

A warm-up. Before the real query, a small hypothetical case shows the effect of judgments in two rows. A collection has $N = 1000$ documents, and for the query tropical fish we know $S = 10$ are relevant. The $p_t$ and $u_t$ columns are the unsmoothed estimates; the weights use the smoothed formula, with natural logarithms:

Term $\mathrm{df}_t$ $s$ $p_t$ $u_t$ $c_t$ with judgments $c_t$ without
tropical 50 8 0.80 0.042 4.33 2.94
fish 200 9 0.90 0.193 3.28 1.38

Without relevance information, fish looks like a weak term because it appears in a fifth of the collection. The judgments show it appears in nine of the ten relevant documents, and its weight more than doubles. This is exactly the evidence relevance feedback supplies.

A real query: Cranfield query 185

Back to query 185, where the counts are real. It has $S = 9$ relevant abstracts among $N = 1400$. The four contingency tables, written as one row per term with the four cells in the order of the table above:

Term $\mathrm{df}_t$ Relevant, present ($s$) Nonrelevant, present Relevant, absent Nonrelevant, absent
experiment 339 5 334 4 1,057
studi 240 2 238 7 1,153
panel 45 9 36 0 1,355
flutter 56 9 47 0 1,344

Every relevant abstract contains both panel and flutter, so for those two terms the maximum likelihood estimate is $p_t = 9/9 = 1$ and the unsmoothed weight is infinite. Smoothing gives $p_t = 9.5/10 = 0.95$. The estimates and the two halves of each weight:

Term $p_t$ $u_t$ $\log \frac{p_t}{1 - p_t}$ $\log \frac{1 - u_t}{u_t}$ $c_t$ with judgments $c_t$ without
experiment 0.550 0.240 0.201 1.151 1.352 1.140
studi 0.250 0.171 −1.099 1.576 0.478 1.574
panel 0.950 0.026 2.944 3.615 6.559 3.394
flutter 0.950 0.034 2.944 3.343 6.287 3.170

The second half of each weight, $\log \frac{1 - u_t}{u_t}$, changes little when judgments are added: by at most 0.22, for panel. Removing 9 relevant documents from 1,400 hardly alters the nonrelevant statistics. The judgments act mainly through the first half, which is 0 without judgments. It contributes 2.94 to panel and flutter, since the judgments show they are close to necessary, and each of their weights rises by 3.1 to 3.2 in all. Studi loses 1.1. It appears in only 2 of the 9 relevant abstracts, a lower rate than its 0.5 default assumes, and its log odds in relevant documents turn negative.

The four term weights for Cranfield query 185, without relevance judgments (circles) and with the nine judged relevant documents (squares). Notice that panel and flutter nearly double, while studi falls from 1.57 to 0.48 because only two of the nine relevant abstracts contain it. Experiment barely moves.
The four term weights for Cranfield query 185, without relevance judgments (circles) and with the nine judged relevant documents (squares). Notice that panel and flutter nearly double, while studi falls from 1.57 to 0.48 because only two of the nine relevant abstracts contain it. Experiment barely moves.

Now the 15 groups of documents can be ordered. The table lists each presence pattern in the order the no-judgment weights rank it, with the number of abstracts that have the pattern and how many of them are relevant:

Query terms present Abstracts Relevant RSV without judgments RSV with judgments
experiment, studi, panel, flutter 2 2 9.28 14.68
studi, panel, flutter 2 0 8.14 13.32
experiment, panel, flutter 4 3 7.70 14.20
panel, flutter 12 4 6.56 12.85
experiment, studi, panel 3 0 6.11 8.39
experiment, studi, flutter 4 0 5.88 8.12
studi, panel 4 0 4.97 7.04
experiment, panel 6 0 4.53 7.91
experiment, flutter 12 0 4.31 7.64
panel 12 0 3.39 6.56
flutter 20 0 3.17 6.29
experiment, studi 72 0 2.71 1.83
studi 153 0 1.57 0.48
experiment 236 0 1.14 1.35
none 858 0 0.00 0.00

Several things are visible here that the formulas alone do not show.

  • All nine relevant abstracts are in the top four groups, the twenty abstracts containing both panel and flutter. Even without judgments the model puts them in the top 20 of 542 candidates, because the two rare terms dominate the score.
  • Within the top 20, the order is decided by the common terms. Without judgments, studi outweighs experiment (1.57 against 1.14, because it is rarer). So the two "studies on panel flutter" abstracts, neither relevant, rank above the four "experiment panel flutter" abstracts, three of them relevant. The judgments reverse those weights (0.48 against 1.35) and swap the two groups.
  • Ties are large. The fourth group holds 12 abstracts with identical scores, four of them relevant. The BIM cannot separate an abstract that mentions flutter once in passing from one devoted to it.

Breaking ties by document number, the relevant abstracts land at ranks 1, 2, 6, 7, 8, 10, 11, 16, 18 without judgments, an average precision of 0.659. With judgments they land at 1, 2, 4, 5, 6, 10, 11, 16, 18 (0.736). Term frequency is exactly the information that would break the ties, and it is what BM25 adds. On the same query BM25 reaches 0.784.

Using a query's own judgments to score that same query, as here, shows what the weights mean. It overstates what feedback achieves, though, since the judged documents are counted in the evaluation. The fair version, which evaluates only on documents the user has not judged, is in relevance feedback.

Without relevance judgments

At query time there are usually no judgments at all. Two approximations recover a usable model.

  • Nonrelevant documents look like the collection. Relevant documents are a tiny fraction of most collections, so the term statistics of nonrelevant documents are close to those of the collection as a whole: $u_t \approx \mathrm{df}_t / N$. The query 185 table shows how good this is: the judged $u_t$ for panel is 0.026, and $\mathrm{df}_t / N = 45/1400 = 0.032$.
  • A neutral guess for $p_t$. With no evidence about relevant documents, Croft and Harper (1979) assumed that $p_t$ is the same for every query term. The usual choice is $p_t = 0.5$, which makes $\log \frac{p_t}{1 - p_t} = 0$.

The weight then reduces to

$$c_t = \log \frac{1 - u_t}{u_t} = \log \frac{N - \mathrm{df}_t}{\mathrm{df}_t} \approx \log \frac{N}{\mathrm{df}_t},$$

which is inverse document frequency. The last step is an approximation, and its error is exact to state: $\log \frac{N - \mathrm{df}_t}{\mathrm{df}_t} = \log \frac{N}{\mathrm{df}_t} + \log\bigl(1 - \frac{\mathrm{df}_t}{N}\bigr)$. The second term is close to $-\mathrm{df}_t / N$ when $\mathrm{df}_t$ is a small fraction of $N$, so the approximation holds for rare terms and fails for common ones. For panel, in 45 of 1,400 abstracts, the two forms are 3.405 and 3.438, a gap of 0.033. For experiment, in 339, they are 1.141 and 1.418, a gap of 0.277. The heuristic weight of TF-IDF falls out of a probabilistic derivation as the special case of knowing nothing about relevance. The column "without" in the tables above uses the smoothed form, which is what the Robertson–Spärck Jones weight gives with $S = s = 0$: $\log \frac{N - \mathrm{df}_t + 0.5}{\mathrm{df}_t + 0.5}$ (Manning, Raghavan, and Schütze, 2008, eq. 11.31).

Three forms of the no-relevance term weight against the fraction of the 1,400 Cranfield abstracts that contain the term. For rare terms, at the left, they agree, which is where query 185's four terms sit (dots). Notice where they part as terms become common: log N/df falls to zero at df = N, while the RSJ form crosses zero at df = N/2 and becomes negative. Lucene's form adds 1 inside the logarithm and stays positive, almost exactly on top of log N/df.
Three forms of the no-relevance term weight against the fraction of the 1,400 Cranfield abstracts that contain the term. For rare terms, at the left, they agree, which is where query 185's four terms sit (dots). Notice where they part as terms become common: log N/df falls to zero at df = N, while the RSJ form crosses zero at df = N/2 and becomes negative. Lucene's form adds 1 inside the logarithm and stays positive, almost exactly on top of log N/df.

Example (a term in half the collection). With no judgments, a term that appears in exactly half the collection gets a weight of zero, since $N - \mathrm{df}_t = \mathrm{df}_t$ makes the fraction 1 (the smoothed form gives the same). The model assumes the term is in half the relevant documents, and it is in half of all documents, so its presence says nothing either way.

The exact form $\log \frac{N - \mathrm{df}_t}{\mathrm{df}_t}$ has a property the approximation hides: it is negative for any term that appears in more than half the collection. Under the model, a document containing such a term is slightly less likely to be relevant. That follows from the $p_t = 0.5$ assumption. A term in 70 percent of all documents but assumed to be in only 50 percent of relevant ones is evidence against relevance. Implementations usually either remove those terms as stopwords or switch to a variant that is always positive, a choice that resurfaces in BM25.

The $p_t = 0.5$ guess is the weak point of the no-judgment model, and query 185 shows it both ways. It underrates panel and flutter, which real relevant documents nearly always contain, and it overrates studi. Manning, Raghavan, and Schütze (2008, §11.3.3) report Greiff's (1998) finding that $p_t$ rises with $\mathrm{df}_t$, since common terms are also more likely to appear in relevant documents. From it they propose the estimate $p_t = \tfrac13 + \tfrac23\, \mathrm{df}_t / N$.

Example (Greiff's estimate on query 185). The proposal lowers all four weights and leaves the ranking of query 185 unchanged. It gives $p_t$ = 0.495, 0.448, 0.355 and 0.360 for experiment, studi, panel and flutter, so every term's first half $\log \frac{p_t}{1 - p_t}$ is now negative: −0.021, −0.210, −0.598 and −0.575. The weights become 1.119, 1.364, 2.796 and 2.594. Studi still outweighs experiment, the 15 patterns keep their order, and the relevant abstracts stay at ranks 1, 2, 6, 7, 8, 10, 11, 16 and 18, an average precision of 0.659. For this query the estimate moves $p_t$ the wrong way for the two terms that matter, since the judged value for panel and flutter is 0.95. That is one query, not an evaluation of the proposal.

Between the two

Between full judgments and none, the model can bootstrap its own evidence by assuming the top-ranked documents are relevant and re-estimating $p_t$ from them. That is pseudo-relevance feedback. Using judgments from a real user is relevance feedback, which on the Cranfield collection raised the BIM's effectiveness on the documents the user had not yet seen by nearly half.

Common misreadings

The model is short enough to summarize in a sentence, and the summaries are where it is most often misread.

  • "The BIM is TF-IDF with binary term frequency." The two share an IDF-like weight only in the no-judgment case. The BIM's weight is a log odds ratio that changes with relevance information, and its derivation says how; TF-IDF has no such mechanism.
  • "Absent query terms are ignored." Their evidence is folded into the weights of the present terms in step 6. A document lacking panel loses the 3.39 that panel would have added, which is the same as being penalized for its absence relative to one that has it.
  • "The RSV is the log odds of relevance." It is the log odds up to two dropped constants, the prior odds and the product over all query terms, so it differs from the true log odds by an unknown amount that depends on the query. Scores can be compared across documents for one query, not across queries.

In practice

My implementation for CSC 790 (HW04 on GitHub) uses the no-judgment form: $p_t = 0.5$ and a smoothed $u_t = (\mathrm{df}_t + 0.5)/(N + 1)$, which makes each term's weight $\log_{10} \frac{N - \mathrm{df}_t + 0.5}{\mathrm{df}_t + 0.5}$. The program collects every document that appears in at least one query term's postings and computes a score for each. Three details are worth noting for anyone reusing the code:

  • Negative weights. As described above, any term in more than half the collection gets a negative weight. A stop list removes most such terms, but not all.
  • Unused judgments. The assignment supplied relevance labels for each query's documents. The program loads them only to print beside each result. Feeding them into the Robertson–Spärck Jones weight above would turn the same code into relevance feedback.
  • Comment labels. The code's comments describe $p_t$ as the probability of the term "in the collection" and $u_t$ as the probability "in the document". In the model they are the probabilities of the term in relevant and nonrelevant documents, respectively.

The same model later served as the search engine in the Goodreads project, where it answered single queries over an index of 1,260,776 book reviews and 540,135 distinct terms in about 1.8 seconds on one machine, in Python.

Strengths and limitations

The BIM has a clear derivation in which every assumption is stated, and it shows that IDF has a probabilistic meaning. It can use relevance information when it has some and degrade gracefully when it has none.

Its weaknesses come straight from the binary representation:

  • A document that mentions flutter forty times scores the same as one that mentions it once in passing.
  • A long document has more chances to contain any given term, and the model does nothing to correct for that.

The independence assumption is a third limit, shared with every model of this unit that scores one term at a time: the model cannot tell an abstract in which panel and flutter stand together from one in which they are far apart. Term dependence models relax it.

The large tie groups of query 185 are the same weakness seen from the inside. In experiments on TREC topics 101 to 150 with queries built from the title and concepts fields, binary weights reached an average precision of 0.199, against 0.300 once term frequency and document length were added (Robertson and Walker, 1994, Table 1, functions BM1 and BM11). The same happens on the Cranfield collection. Without relevance information, the BIM reaches a mean average precision of 0.220, against 0.294 for TF-IDF and 0.307 for BM25 (see comparing ranking models). Fixing those two weaknesses within the probabilistic framework is what produced Okapi BM25.

Worked problems

Problems 1 and 2 are Exercises 11.1 and 11.2 of the course text (Manning, Raghavan, and Schütze, 2008). Problem 3 is posed on query 185, and Problem 4 is the course's programming assignment on the model. The script recomputes every number.

Problem 1 (Exercise 11.1 of the course text). Derive the unsmoothed weight

$$c_t = \log \frac{s / (S - s)}{(\mathrm{df}_t - s) / \bigl((N - \mathrm{df}_t) - (S - s)\bigr)}$$

from the log odds ratio $c_t = \log \frac{p_t (1 - u_t)}{u_t (1 - p_t)}$ and the contingency table.

Read the two estimates off the table's columns. In the relevant column, $s$ of $S$ documents contain the term, so $p_t = s/S$ and $1 - p_t = (S - s)/S$. In the nonrelevant column, $\mathrm{df}_t - s$ of $N - S$ documents contain it, so $u_t = (\mathrm{df}_t - s)/(N - S)$ and $1 - u_t = \bigl((N - \mathrm{df}_t) - (S - s)\bigr)/(N - S)$, the bottom cell of that column over its total. In each odds the column total cancels:

$$\frac{p_t}{1 - p_t} = \frac{s}{S - s}, \qquad \frac{u_t}{1 - u_t} = \frac{\mathrm{df}_t - s}{(N - \mathrm{df}_t) - (S - s)}.$$

The weight is the logarithm of the first over the second, which is the formula. Each odds is simply the top cell of a column over its bottom cell, so the weight is the log of the table's cross-product ratio. For experiment in query 185 the cells are 5, 334, 4 and 1,057, and the unsmoothed weight is $\log \frac{5/4}{334/1057} = 1.375$; for studi it is $\log \frac{2/7}{238/1153} = 0.325$. For panel and flutter the cell $S - s$ is 0 and the formula divides by zero, which is the reason for the smoothed form (1.352 and 0.478 for the first two terms).

Problem 2 (Exercise 11.2 of the course text). State the differences between standard vector space TF-IDF weighting and the BIM when no relevance information is available.

Both score a document by a sum over the query terms it contains, and both give rarer terms more weight. They differ in four ways.

  • Term frequency. The BIM uses only presence. TF-IDF multiplies the term's weight by a function of its count in the document, such as $1 + \log \mathit{tf}$ (TF-IDF Weighting). On query 185 the BIM therefore has 15 distinct scores for 542 matching abstracts, with 12 abstracts tied across ranks 9 to 20, where a count-based score separates them.
  • Document length. The BIM has no length normalization. The vector space score divides by the document vector's length (Cosine Similarity).
  • The form of the rarity weight. The BIM's weight is $\log \frac{N - \mathrm{df}_t}{\mathrm{df}_t}$, or its smoothed form, which is zero at $\mathrm{df}_t = N/2$ and negative above it. TF-IDF uses $\log \frac{N}{\mathrm{df}_t}$, which is never negative. The two agree for rare terms, as the figure above shows.
  • Where the weight comes from. The BIM's weight is derived: it is the log odds ratio under $p_t = 0.5$ and $u_t = \mathrm{df}_t / N$, and relevance information changes it by a stated rule. The TF-IDF weight is a heuristic with no such rule. Query term frequency and query normalization likewise appear in the vector space score and not in the BIM, whose query is a set.

The consequence for effectiveness is measured in comparing ranking models: on Cranfield the BIM without relevance information reaches a mean average precision of 0.220 and TF-IDF 0.294.

Problem 3. For query 185 ($N = 1400$, $S = 9$), find the Robertson–Spärck Jones weight of a hypothetical term that occurs in 100 abstracts, none of them relevant, and compare it with the weight the term would get without judgments.

Here $\mathrm{df}_t = 100$ and $s = 0$. The four smoothed cells are $s + \tfrac12 = 0.5$, $S - s + \tfrac12 = 9.5$, $\mathrm{df}_t - s + \tfrac12 = 100.5$ and $N - \mathrm{df}_t - S + s + \tfrac12 = 1291.5$. Then

$$c_t = \log \frac{0.5 / 9.5}{100.5 / 1291.5} = \log \frac{0.0526}{0.0778} = \log 0.676 = -0.391.$$

Without judgments ($S = s = 0$) the weight is $\log \frac{1300.5}{100.5} = 2.560$. The term looked like good evidence because it is fairly rare. The judgments show that no relevant abstract contains it, so its presence now counts against a document, and the smoothing keeps the penalty finite: the unsmoothed estimate $p_t = 0$ would give $-\infty$ and exclude every abstract containing the term.

Problem 4 (the course's programming assignment). Implement ranked retrieval by the Binary Independence Model for a collection with no relevance information used in scoring, and report the ranking for each query.

Approach. With no judgments the model is the one derived under "Without relevance judgments": $p_t = 0.5$, and $u_t$ estimated from the collection. The implementation smooths $u_t = (\mathrm{df}_t + 0.5)/(N + 1)$, so that

$$c_t = \log_{10} \frac{1 - u_t}{u_t} = \log_{10} \frac{N - \mathrm{df}_t + 0.5}{\mathrm{df}_t + 0.5}, \qquad \mathrm{RSV}_d = \sum_{t \in q \cap d} c_t.$$

The program has four parts. It builds an inverted index of the documents after tokenizing them and removing stopwords. For each distinct query term found in the index it computes $c_t$ once from $N$ and $\mathrm{df}_t$. It walks that term's postings list and adds $c_t$ to an accumulator for each document on the list. Finally it sorts the accumulators by decreasing score. Only documents on at least one query term's postings list receive a score, so the work is proportional to the total length of those lists and not to the size of the collection. Because the score is a sum of fixed per-term weights, each term also has an upper bound on its contribution, and Dynamic Pruning with MaxScore and WAND uses such bounds to skip documents that cannot reach the current top $k$ without changing it.

Why it works. Each step of the derivation above either applied a rule of probability or dropped a factor common to all documents, so the sum of $c_t$ over matching terms orders documents exactly as the model's probability of relevance does. The base of the logarithm multiplies every score by the same constant and cannot change the order. A term count is never consulted, because the model's documents are sets.

Result on query 185. The base-10 weights are 0.495 for experiment, 0.684 for studi, 1.474 for panel and 1.377 for flutter, each the natural-log weight of the table above divided by $\ln 10 = 2.303$. An abstract with all four terms scores 4.03. The ranking is the one in the pattern table: 542 abstracts scored, the relevant ones at ranks 1, 2, 6, 7, 8, 10, 11, 16 and 18 with ties broken by document number, an average precision of 0.659. Over all 225 Cranfield queries the same function reaches a mean average precision of 0.220 (comparing ranking models). The assignment's own collection came with relevance labels for each query, which the submitted program prints beside each result and does not use in scoring, as described under "In practice". Using them in the weight is Problem 3's calculation applied to every query term.

What we have learned

Two assumptions, binary terms and independence given relevance, turn the PRP's probability into a sum of term weights. Each weight is a log odds ratio, built from how often the term appears in relevant and in nonrelevant documents, and the evidence of absent terms is folded into it. With judgments, the Robertson–Spärck Jones weight can be computed directly; on query 185 it nearly doubles panel and flutter and demotes studi. Without judgments, the guesses $p_t = 0.5$ and $u_t \approx \mathrm{df}_t / N$ reduce the weight to inverse document frequency. On query 185 the model found all nine relevant abstracts among its top 20. But it left them in large ties that only term frequency could break.

Term frequency is the missing evidence, but it cannot enter simply as a count, which would reward repetition without limit. The 2-Poisson model treats a term's count as evidence of whether a document is about the term, and establishes that the evidence levels off after a few occurrences.

References

  • Croft, W. B., and Harper, D. J. (1979). Using probabilistic models of document retrieval without relevance information. Journal of Documentation, 35(4), 285–295. record · 2 pages
  • Greiff, W. R. (1998). A theory of term weighting based on exploratory data analysis. In Proceedings of SIGIR 1998, 11–19. record
  • Lewis, D. D. (1998). Naive (Bayes) at forty: The independence assumption in information retrieval. In Proceedings of ECML-98, 4–15. record · 2 pages
  • Manning, C. D., Raghavan, P., and Schütze, H. (2008). Introduction to Information Retrieval, sections 11.3–11.4. Cambridge University Press. record · 102 pages
  • Robertson, S. E., and Spärck Jones, K. (1976). Relevance weighting of search terms. Journal of the American Society for Information Science, 27(3), 129–146. record · 4 pages
  • Robertson, S. E., and Walker, S. (1994). Some simple effective approximations to the 2-Poisson model for probabilistic weighted retrieval. In Proceedings of SIGIR 1994, 232–241. record · 4 pages

Reviewed: verified, 16 Nov 2026 · checked against sources, 23 Nov 2026 · citations checked, 16 Nov 2026 · editorial review, 23 Nov 2026 · 10 revisions