Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

Relevance feedback

Relevance feedback refines user queries by using judged or assumed relevance of retrieved documents to improve retrieval accuracy, commonly implemented by the Rocchio algorithm and pseudo‑relevance expansion.

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Relevance feedback is used by engineers to improve search results after an initial query: the system adjusts the query or ranking using documents the user marks (or the top-ranked documents assumed) as relevant. This increases precision and recall for difficult queries and powers query expansion in search engines and many IR pipelines (see Vector space model, Query processing, and Query optimisation chapters).

Key ideas

Start from the vector space model: queries and documents are vectors in a common term space. Relevance feedback changes the query vector to better represent the user's information need using information from judged documents.

  • Relevance feedback — the general process where the system updates the query or ranking using user judgements about which returned documents are relevant or non-relevant. Assumes user can mark some documents or that top results are likely relevant.

  • Query modification — any change to the query (adding terms, reweighting terms) made by relevance feedback.

  • Relevance set (Dr) — the set of documents judged relevant by the user. Non-relevance set (Dnr) — documents judged non-relevant.

  • Pseudo‑relevance feedback (also called blind relevance feedback) — assume the top-k retrieved documents are relevant without user input; expand the query using terms from these documents. Common when explicit feedback is unavailable.

  • Query expansion — adding new terms to the query (with weights) derived from relevant documents or external sources (thesauri, WordNet, embeddings). Expansion aims to increase recall by including synonyms and related terms, but may reduce precision if noisy.

  • Rocchio algorithm — a classical, linear method for updating the query vector in the vector space model. It assumes relevance can be modeled by moving the query vector nearer to the centroid of relevant documents and away from the centroid of non-relevant documents. Assumptions: linear vector space, term vectors are meaningful, relevance is captured by Euclidean distance or direction in the space.

Derivation of Rocchio (standard university-style):

  1. Represent original query as vector q0 and documents as vectors d in the same term space. Define Dr and Dnr as above.
  2. Define a loss (objective) to make the modified query vector qm close to relevant documents and far from non-relevant ones while not straying too far from the original query: J(qm) = α||qm − q0||^2 + β(1/|Dr|) Σ_{d∈Dr} ||qm − d||^2 − γ(1/|Dnr|) Σ_{d∈Dnr} ||qm − d||^2. (α, β, γ ≥ 0; larger β pulls qm toward relevant, larger γ pushes it away from non‑relevant.)
  3. Take gradient ∂J/∂qm, set to zero and solve for qm. This yields: qm = [α q0 + β (1/|Dr|) Σ_{d∈Dr} d − γ (1/|Dnr|) Σ_{d∈Dnr} d] / (α + β − γ). In practice, this normalising factor is absorbed into α, β, γ to give the familiar Rocchio form.
  4. Normalisation or clipping may follow (e.g., drop negative weights, L2-normalise) depending on implementation.

Diagram to draw for an exam: sketch a 2D term space. Draw the original query vector q0 from origin. Plot points for relevant documents and non-relevant documents. Draw the centroid of relevant documents (label Cr) and centroid of non-relevant (label Cnr). Show qm as a point moved from q0 towards Cr and away from Cnr. Label axes as term1 and term2.

Variants and practical points:

  • When no explicit non-relevant docs are given, γ term is omitted (γ = 0).
  • Pseudo-relevance feedback uses top-k documents as Dr with no Dnr.
  • Modern systems combine expansion with language models (e.g., relevance models, RM3) or word embeddings to select expansion terms.

Assumptions to state explicitly in answers: vector (bag‑of‑words) representation and linear combination in a vector space, and that centroids represent relevance adequately; term independence is not required for Rocchio. If these assumptions fail (e.g., non‑linear manifolds, polysemy), results may be poor.

Formulas

qm = α·q0 + β·(1/|Dr|)·Σ_{d ∈ Dr} d − γ·(1/|Dnr|)·Σ_{d ∈ Dnr} d
where qm = modified query vector (unitless), q0 = original query vector (unitless), d = document vectors (unitless), Dr = set of judged relevant documents, Dnr = set of judged non‑relevant documents, |·| = cardinality, α, β, γ = scalar weights (unitless). Applies under the vector space model; derived by minimising a quadratic objective (see Key ideas). Common parameter choices (SMART): α≈1.0, β≈0.75, γ≈0.15 (tuned per collection).

Cr = (1/|Dr|)·Σ_{d ∈ Dr} d
Cr = centroid (mean vector) of relevant documents (unitless); used when updating towards relevant documents.

query_expansion_score(t) = Σ_{d ∈ topK} w(d,t)
where t = candidate expansion term, topK = top-k retrieved documents treated as relevant in pseudo-relevance feedback, w(d,t) = weight of term t in document d (e.g., term frequency or tf–idf). All symbols unitless. Applies when selecting expansion terms from top documents.

(Relevance model / RM3 mix formula commonly used in language-model-based expansion): P_rm3(w|q) = λ·P_ml(w|q) + (1−λ)·Σ_{d ∈ topK} P(w|d)·P(d|q)
P_ml(w|q) = maximum-likelihood probability of term w in query q (unitless), P(w|d) = probability of w in document d (unitless), P(d|q) ∝ P(q|d)·P(d) (unitless), λ ∈ [0,1] interpolation weight. Applies in language‑model expansion.

Worked examples

Example 1 — Rocchio numeric update (vector space, small vocabulary) Vocabulary: {t1, t2, t3}. Represent vectors as [w1, w2, w3]. Let original query q0 = [1, 0, 1]. Relevant documents Dr: d1 = [2, 1, 0], d2 = [1, 1, 1]. No judged non‑relevant documents. Choose α = 1, β = 0.75, γ = 0.

  1. Compute centroid of Dr: Cr = (1/2)(d1 + d2) = (1/2)([3,2,1]) = [1.5, 1.0, 0.5].
  2. Apply Rocchio: qm = α·q0 + β·Cr = 1·[1,0,1] + 0.75·[1.5,1.0,0.5].
  3. Multiply: 0.75·Cr = [1.125, 0.75, 0.375]. Sum: qm = [2.125, 0.75, 1.375].
  4. Optionally normalise (L2): ||qm|| = sqrt(2.125^2 + 0.75^2 + 1.375^2) ≈ sqrt(4.516 + 0.5625 + 1.8906) = sqrt(6.969) ≈ 2.640. Normalised qm ≈ [0.804, 0.284, 0.521]. Answer: the modified query vector is [2.125, 0.75, 1.375] (or normalised to [0.804, 0.284, 0.521]).

Example 2 — Pseudo‑relevance expansion (term selection) Given top-2 docs treated as relevant. Vocabulary terms and term frequencies in those documents: Doc1 (top1): {a:3, b:1, c:0} Doc2 (top2): {a:1, b:2, d:2} Select expansion terms by summing tf over top docs: score(a)=3+1=4, score(b)=1+2=3, score(d)=0+2=2, score(c)=0+0=0. If we want to add two expansion terms, choose 'a' and 'b'. If original query had terms with weights, combine with interpolation or Rocchio-style weighting. Final expansion: add 'a' and 'b' with chosen weights (e.g., normalized scores or fixed weights).

Example 3 — Model answer style question Question: "Explain and derive the Rocchio update and list two practical issues when using it." Model answer should derive the linear equation by minimising a quadratic objective (show gradient = 0), and mention issues: (1) noisy relevance judgements or wrong pseudo‑relevance top-k leads to drift; (2) high-dimensional sparse vectors make centroids noisy — require smoothing/normalisation.

Common mistakes

  • Not normalising document vectors (or using inner‑product instead of cosine) can bias scores; note that with true cosine similarity, scaling the query does not change rankings.
  • Using pseudo‑relevance without checking top-k quality: if top results are non‑relevant, expansion worsens retrieval (query drift).
  • Confusing query expansion (adding terms) with only reweighting existing terms; both are possible but distinct operations.

For your exam

Question types you will see: definition questions (define relevance feedback, pseudo‑relevance), derivation (derive Rocchio update from objective), short notes (compare relevance feedback vs pseudo‑relevance), numericals (apply Rocchio to small vectors, pick expansion terms from given docs), diagrams (2D vector space, centroids and q update), and system design (how to integrate pseudo‑relevance in a search pipeline). Full‑marks answers include: clear definitions (with bolded term names), assumptions listed, step‑by‑step derivation for Rocchio, a labelled diagram when asked, and a numeric example or explanation of parameter choices and practical pitfalls.

Quick check

  1. What is pseudo‑relevance feedback?
  2. Write the Rocchio formula for the modified query qm.
  3. Give one risk of using pseudo‑relevance feedback. Answers: 1. Assuming top‑k retrieved documents are relevant and using them to expand/reweight the query. 2. qm = α·q0 + β·(1/|Dr|)·Σ_{d ∈ Dr} d − γ·(1/|Dnr|)·Σ_{d ∈ Dnr} d. 3. Query drift when top‑k are not truly relevant.

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?