INFS7410 Revision Hub

Information Retrieval · Weeks 1–9 · Practicals · Projects

A1 ZH
Complete review map

From term matching to evidence-grounded generation

The course forms one connected Information Retrieval (IR) pipeline: index documents, retrieve candidates, rerank them, evaluate and learn from feedback, then provide evidence to a generator. Study sequence: retrieval → reranking → evaluation → RAG → attribution.

Text → terms Terms → index Index → ranking Ranking → evaluation Sparse → dense semantics Dense → learned sparse Qrels → clicks Candidates → BERT / LLM reranking Evidence → RAG answer Claims → attribution
9connected weeks
30+key formulas
35+retrieval, ranking and RAG methods
7 + projectspracticals and assignments
Mental model

What an information retrieval system does

Place each weekly topic inside one software pipeline instead of memorising isolated functions.

Corpus
raw document collection
Analyzer
tokens, stopwords, stems
Inverted index
term → postings
Ranker
BM25 / dense model
Query
user information need
Top-k run
ranking for each query
Qrels
relevance judgements
Evaluation
MAP / nDCG / tests
Four objects to keep separate: the corpus contains all documents; a query expresses a need; a run is the system ranking; and qrels are the reference relevance judgements. Evaluation compares a run with qrels.

Candidate retrieval

BM25, dense and learned sparse models search the full collection.

Ranking

Rerankers and LTR models reorder a manageable candidate set.

Evidence

Qrels support offline metrics; clicks require bias-aware online methods.

Week 1

Indexing, text statistics, and preprocessing

Understand how a search engine converts a large text collection into a structure that can be searched efficiently.

IR, databases, and relevance

Database queries usually require exact matching and return deterministic answers. IR handles natural language and uncertain information needs, so it returns a ranked list. Relevance means whether a document satisfies a user's need in context, not merely whether it shares words with the query.

Core chain: representation + matching + ranking + evaluation.

Corpus, document, token, and term

A corpus/collection is the full set of documents. A document is one record, a token is one occurrence produced by tokenisation, and a term is the normalised unit stored in the index.

tf occurrences in one document df documents containing the term cf total occurrences in the collection

Zipf's law

A small number of terms are extremely frequent, while most terms are rare. Frequency falls approximately as a power law with rank.

frequency(r) ≈ C / rs

This produces a long tail. Very frequent items are often function words; very rare items may be names, spelling variants, or noise.

Text processing

  • Tokenisation: split text into indexable units.
  • Case folding: usually convert text to lowercase.
  • Stopping: remove frequent, weakly discriminative words, with some risk of losing phrase meaning.
  • Stemming: apply rules such as Porter stemming; the result need not be a real word.
  • Lemmatisation: use lexical knowledge to recover dictionary forms.

Inverted index

A forward representation is document → terms. An inverted index stores term → postings list, allowing the engine to find candidate documents without scanning the entire corpus.

LevelPosting contentsSupported capability
BooleandocIDpresence and AND / OR / NOT
CountsdocID + tfTF, TF-IDF, and BM25 ranking
PositionsdocID + tf + positionsphrase and proximity queries
Doc vectorsterms and statistics per documentcustom scorers read tf/df; A1 requires -storeDocvectors
Common error: df is not the total number of occurrences. A term appearing 20 times in one document contributes 1 to df but 20 to cf.
What the Week 1 practical develops
Reading a JSONL corpus, counting and inspecting documents, plotting Zipf-style term distributions, building Lucene indexes with different stemming/stopword configurations, and verifying the index with index_reader.stats().
Week 2

Evaluation: proving that a system is better

Offline evaluation requires queries, qrels, and runs. Each measure represents a different user model.

Precision and Recall

Precision = |Relevant ∩ Retrieved| / |Retrieved|
Recall = |Relevant ∩ Retrieved| / |Relevant|

Precision asks how clean the returned set is. Recall asks how much of the relevant set was found. Web results often emphasise early precision; legal and medical search may place more weight on recall.

F-measure

Fβ = (1 + β²)PR / (β²P + R)
F1 = 2PR / (P + R)

F1 is the harmonic mean of precision and recall. β>1 emphasises recall; β<1 emphasises precision.

AP and MAP

AP = (1 / |Rel|) Σk=1..K P@k × rel(k)
MAP = (1 / |Q|) Σq∈Q AP(q)

P@k contributes only when the item at rank k is relevant. Relevant documents that were never retrieved remain in |Rel|, reducing AP.

RR and MRR

RR(q) = 1 / rank(first relevant result)
MRR = meanq RR(q)

These measures care only about the first relevant answer, making them suitable for question answering and navigational search.

DCG and nDCG

DCG@K = Σk=1..K (2rel(k) − 1) / log2(k + 1)
nDCG@K = DCG@K / IDCG@K

Graded relevance receives exponential gain and lower ranks receive a discount. IDCG is the score of the ideal ordering for the same query.

RBP

RBP = (1 − p) Σi=1..d ri pi−1

p is the probability that the user continues to the next result. Expected viewing depth is 1/(1-p).

Paired t-test

Score the same queries with systems A and B, calculate one difference per query, then test whether the mean difference departs from zero.

dq = metricB,q − metricA,q
H₀: mean(d) = 0

p < .05 is commonly called significant; p < .01 strongly significant.

Interpreting a p-value

It is the probability of observing the current or a more extreme result if H₀ were true. It is not the probability that H₀ is true and does not measure effect size.

Check evaluator keys: KeyError: ndcg_cut_5 normally means that measure was not requested when the evaluator was created.
The Week 2 practical pipeline
search(..., k=1000) creates a run → pytrec_eval.parse_run reads it → the evaluator scores each query → aggregation produces the mean → scipy.stats.ttest_rel compares paired query scores. Here k is the number of retrieved documents, not BM25's k1.
Week 3

Lexical matching and classical ranking

Start with term presence, then add frequency, rarity, length normalisation, and probabilistic reasoning.

Course diagrams: open the course platform (login required)

ModelCore ideaScore / roleMain limitation
BooleanSatisfy logical conditionsAND / OR / NOT postingsLittle or no ranking
CoordinationMatch more distinct query termsnumber of matched query termsIgnores frequency and rarity
TFMore occurrences in a document are betterΣ f(qi,D)Favours common terms and long documents
IDFRare terms are more discriminativelog(N/(1+dfi))Ignores within-document tf
TF-IDFLocal frequency × global rarityΣ tfi,D × idfiLinear tf and crude length treatment
VSMCompare query and document vector directionscosine(q,d)Still depends on lexical overlap
BIMContrast term probability in relevant/non-relevant setsprobabilistic relevance weightTerm independence and probability estimates
BM25IDF + tf saturation + length normalisationstrong sparse baselineNo native synonym or semantic matching

Course TF, IDF, and TF-IDF

TF(D,Q) = Σi=1..|Q| f(qi,D)
IDF(qi) = log(N / (1 + dfi))
TF-IDF(D,Q) = Σ tfi,D × idf(qi)

1 + df smooths the denominator. IDF depends on the term and collection, not on the current document.

Vector Space Model

cos(q,d) = (q · d) / (||q|| ||d||)

A dot product is affected by vector magnitude. Cosine normalises magnitude and compares direction. For L2-normalised vectors, dot product and cosine produce the same ranking.

BM25, factor by factor

score(D,Q) = Σi IDF(qi) × [(k₁+1)tfi] / [tfi + k₁(1 − b + b·|D|/avgdl)]
  • IDF: rewards discriminative rare terms.
  • TF saturation: the gain from tf 1→2 is larger than 100→101.
  • Length normalisation: controls the natural advantage of longer documents.
  • k1: controls how quickly tf saturates; larger values are more nearly linear.
  • b: controls length normalisation, from none at 0 to full at 1.
RSJ-IDF ≈ log((N − df + 0.5) / (df + 0.5))

Several BM25 variants exist. In A1, follow the formula in the supplied notebook and marking sheet rather than mixing definitions.

Why the Week 3 scorer receives three arguments
tf_vector stores each query term's tf in the current document; df_vector stores each term's collection df; and doc_len is the current document length. The scorer returns one total score used to rank and write the run.
What the three assertions test
assert score(tf=3) > score(tf=1) checks tf monotonicity; assert score(short_doc) > score(long_doc) checks length normalisation; and assert np.isfinite(...) catches NaN or infinity. A false condition raises AssertionError.
Week 4

Transformers: from tokens to contextual embeddings

Classical sparse models require lexical overlap. Transformers learn context-dependent representations that support semantic matching.

Tokenisation and embedding

A tokenizer maps text to token IDs. nn.Embedding(V,D) is a trainable lookup table mapping each ID to a D-dimensional vector. D is a model hyperparameter; BERT-base uses 768.

inputi = token_embedi + position_embedi + segment_embedi

The usual shape is N × D: N tokens, each represented by D values.

Position and segment embeddings

Self-attention alone does not encode order, so position embeddings are added. For sentence pairs, BERT uses segment/token-type embeddings and [SEP] boundaries.

WordPiece: rare words can be split into subwords; ## marks a continuation piece.

Self-attention

Q = XWQ,   K = XWK,   V = XWV
Attention(Q,K,V) = softmax(QKT / √dk)V
  1. Each token produces a query (what am I looking for?), key (what can I match?), and value (what content can I provide?).
  2. QKᵀ produces an N×N score matrix.
  3. Division by √d_k prevents large dot products from saturating softmax.
  4. Softmax gives row-wise weights summing to one; multiplying by V forms context-aware representations.

Multi-head attention

Several heads learn relationships in different projection subspaces. Their outputs are concatenated and projected back to D dimensions.

FFN, hidden, and residuals

hidden = GELU(W₁x + b₁)
out = W₂hidden + b₂

The FFN transforms each token independently, often D→4D→D. hidden is an intermediate activation tensor, not a manually chosen parameter. The learned parameters are W and b. Residual connections preserve information; LayerNorm stabilises training.

Encoder and BERT

An encoder can use left and right context, making it suitable for understanding, classification, ranking, and embeddings. BERT's main pretraining objective is masked language modelling.

LMLM = −Σi∈M log P(xi | x\M)

Decoder and GPT

A decoder uses a causal mask and sees only the left prefix, enabling token-by-token generation. An encoder backbone cannot naturally generate in the same way without an added decoder or modified objective and attention mask.

P(y₁…yT) = Πt=1..T P(yt | y<t)
Why the Week 4 practical produced NoneType.shape
If out = tf_block(x) is None, forward() or a called method is missing return x/return out. Python functions without return statements return None, so out.shape fails.
Week 5

Dense retrieval, objectives, and negatives

Map queries and documents into a vector space where “car repair” can be close to “automobile maintenance.”

Course diagrams: open the course platform (login required)

Bi-encoder

score(q,d) = φ(ηq(q), ηd(d))

Queries and documents are encoded separately. Document vectors can be precomputed and indexed for ANN search, making bi-encoders suitable for first-stage retrieval.

Cross-encoder

[query; document] is encoded jointly, allowing deep token interaction. This is accurate but prevents offline document encoding, so it is usually used to rerank a smaller candidate set.

Pooling choices

  • CLS/first token: use the first special token's contextual embedding.
  • Mean pooling: average valid token vectors.
  • EOS/last token: common with decoders because the last token has seen the full prefix.
  • All-token: retain every token vector, as in ColBERT.

Similarity

dot(q,d) = Σ qidi
cos(q,d) = q·d / (||q|| ||d||)

For L2-normalised vectors, dot product and cosine rank identically. “Mean-pooling similarity” is imprecise: mean pooling aggregates a representation; it is not a similarity function.

InfoNCE / contrastive loss

L = −log [ exp(sim(q,d⁺)/τ) / (exp(sim(q,d⁺)/τ) + Σj exp(sim(q,d⁻j)/τ)) ]

The objective raises positive similarity relative to a set of negatives. A lower temperature τ makes softmax sharper. In-batch negatives reuse other queries' positive documents as negatives at little extra encoding cost.

Multi-label margin loss

L = mean(d⁺,d⁻) max(0, 1 − [s(q,d⁺) − s(q,d⁻)])

A pair contributes zero loss once the positive score exceeds the negative score by at least the margin.

ColBERT late interaction

MaxSim(q,d) = Σi=1..m maxj=1..n Eq,i · Ed,j

For each query token, find the most similar document token, then sum those maxima. This is not a single dot product between one query vector and one document vector.

Course diagrams: open the course platform (login required)

Negative typeSourceAdvantageRisk
Randomrandom collection documentscheap and stableoften too easy
In-batchother positives in the batchalmost no extra encodingfalse negatives
BM25 hardhigh-ranked but judged non-relevantlexically similar and challengingdepends on qrel completeness
ANN/self-minedcurrent model's mistaken neighbourstargets current weaknessescostly index refresh
What a smoke query or smoke test means
A smoke test checks that the pipeline runs at all; it does not prove quality. Run one smoke_query through TF and BM25, inspect top-5 output, and check the structure and finite scores. Formal conclusions still require all test queries and qrels.
Week 6

Learned sparse retrieval

Vocabulary-aligned sparse representations retain inverted-index efficiency while neural models learn contextual term weights and expansion.

The missing middle: BM25 is sparse and fast but lexical; DPR is semantic but dense. Learned sparse models use neural encoders while keeping mostly-zero vocabulary dimensions that can be interpreted as terms.
ModelQueryDocumentMatchingOnline cost
BM25observed termsterm statisticshand-crafted weighted sumvery low
DPRdense vectordense vectordot product + ANNquery encoder
TILDEv2token IDscontextual token weights, often expanded offlineexact ID match + max weightno query encoder
SPLADE(v2)learned sparse vocabulary vectorlearned sparse vocabulary vectorsparse dot productquery encoder
PromptRepsdense hidden state + sparse logitssamehybrid interpolationLLM inference

Expansion

doc2query generates likely queries offline and appends them to documents before indexing. This reduces vocabulary mismatch without adding query-time generation.

TILDEv2

score(q,d) = Σt∈q maxi: token(d_i)=t wi,d

The query is only tokenised. Exact query-token matches retrieve learned contextual document weights; repeated terms contribute their maximum weight.

SPLADE

score(q,d) = vq · vd,   v ∈ R|V| and mostly zero

An MLM head activates weighted vocabulary terms, including related terms absent from the text. ReLU, pooling and FLOPS/L1 regularisation control sparsity.

Sparse can still be neural

Sparse/dense describes the output representation. SPLADE uses BERT but emits a sparse vocabulary vector; DPR uses BERT but emits a dense embedding.

Practical pipeline: BM25 + TILDEv2

Retrieve

BM25 searches the full corpus.

Read candidates

Use hit IDs and raw document text.

Rerank

TILDEv2 scores query-document pairs.

The first stage protects efficiency and candidate recall; the second stage improves ordering within the candidate set.

Data flow inside tildev2_scoring
Document text becomes token IDs and learned weights. Query text becomes token IDs with stopwords removed. Equal IDs are matched, repeated matches use the maximum document weight, and matched query-term weights are summed into one reranking score.
Week 7

Learning to rank, click bias, and online evaluation

LTR learns to order candidates. Online LTR replaces scarce static labels with abundant but biased user interactions.

Retriever → features → LTR ranker

Retriever

BM25, dense or learned sparse candidates.

Features

Lexical, neural, freshness and authority signals.

LTR ranker

Learned ordering of the candidate list.

Offline LTR

  • Pointwise: predict one relevance score.
  • Pairwise: predict which of two documents should rank higher.
  • Listwise: optimise an entire ranked list.

Clicks are not labels

Position bias changes examination; selection bias excludes unseen documents; presentation bias changes attraction. No click does not necessarily mean non-relevant.

Inverse Propensity Scoring

Δnaive(f) = Σ λ(ranki)ci
ΔIPS(f) = Σ [λ(ranki)/P(oi=1)]ci

IPS corrects position/exposure bias in expectation by dividing a click by its examination probability. Rarely examined observations receive more weight, which can also increase variance.

Balanced interleaving

Maintain a scan pointer for each ranked list. Inspect the list with the smaller pointer, breaking ties with a randomly chosen starting ranker. Advance the pointer even for duplicates, but append only unseen documents. This balances inspected depths, not necessarily the number contributed by each ranker.

DBGD

Sample a candidate parameter direction, compare current and candidate rankers through interleaving, and move toward the winner.

Counterfactual OLTR

A stochastic logging policy records displayed actions and propensities. IPS then estimates the risk of current and candidate rankers from the same interaction log.

Main advantage over regular interleaving: one logged randomized policy can evaluate multiple candidate rankers off-policy instead of creating a fresh interleaved comparison for every pair. It depends on accurate propensities, exploration/support, and manageable variance.
MethodDataOutputMain trade-off
Offline qrelsqueries + runs + qrelsMAP/nDCGcleaner but expensive and static
Interleavinglive clicks on a mixed listpairwise preferencesensitive, but requires live exposure
DBGDrepeated interleavingparameter update directiononline adaptation versus exploration risk
Counterfactual IPSlogged clicks + propensitiesoff-policy value/risklog reuse versus variance and support assumptions
Week 8

Transformer-based reranking: BERT and LLM rankers

Encoder rerankers jointly encode query-document pairs. Decoder-based Large Language Models (LLMs) judge, compare, or order passages through prompts. Stage one retrieves candidates; stage two makes more expensive, fine-grained relevance judgements.

Retrieval → interaction → final ranking

First-stage retrieval

BM25 searches the full collection and returns top-k candidates.

Neural reranking

BERT jointly encodes pairs, or an LLM evaluates candidates through a prompt.

New order

Sort by scores, pairwise preferences, or an output permutation.

A reranker cannot recover a relevant document omitted by Stage 1. Increasing candidate depth can protect recall but increases latency. Candidate depth connects effectiveness with efficiency.

monoBERT: pointwise cross-encoder

Bidirectional Encoder Representations from Transformers (BERT) reads [CLS] query [SEP] document [SEP]. A classifier converts the contextual [CLS] vector into a relevance score.

s(q,d) = P(relevant = 1 | q,d)

Each document is judged independently. Training commonly uses human positives and BM25 hard negatives.

Training objective

L = -Σpos log(s) - Σneg log(1-s)

Binary cross-entropy rewards high positive scores and low negative scores. The output is a ranking signal, not necessarily a calibrated real-world probability.

Long-document evidence

MethodAggregationInterpretation
BERT-FirstPfirst passage scorecheap but ignores later evidence
BERT-MaxPmaximum passage scoreone strong passage represents the document
BERT-SumPsum of passage scoresaccumulate evidence
Birchfirst-stage score + weighted sentence scoressentence-level evidence
PARADEaverage, max, attention, or Transformer over passage vectorsrepresentation aggregation
Key distinction: MaxP/FirstP/SumP combine scalar scores; Passage Representation Aggregation for Document Reranking (PARADE) combines learned passage representations before the final score.

duoBERT: pairwise reranking

duoBERT reads a query and two candidates to estimate p(dᵢ > dⱼ | q). Pairwise wins are then aggregated.

s(dᵢ) = Σj≠i p(dᵢ > dⱼ | q)

This can refine a monoBERT list, but pair comparisons add substantial encoder cost.

Multi-stage trade-off

BM25 → monoBERT → duoBERT allows separate candidate depths and model choices. More tuning knobs create a wider effectiveness-efficiency trade-off space, but also more system complexity.

Four LLM reranking families

FamilyInputSignalMain trade-off
Pointwisequery + one passageYes/No logit, label, or gradesimple; absolute judgement may be unstable
Pairwisequery + passages A and BA > B preferencerobust; many comparisons
Listwisequery + passage listgenerated permutationlist context; generation/context cost
Setwisequery + small passage setbest-item logitsfewer calls than pairwise; avoids full-list generation

“Zero-shot” here means no new contrastive retriever training after obtaining an instruction-tuned LLM; it does not mean the underlying LLM was never trained.

Prompt variation

Role text, formatting, output restrictions, and query/passage order affect results. The slides report greater sensitivity for pointwise and listwise prompts, while pairwise and setwise are generally more robust. Model size, architecture, and training still matter.

Why setwise can cost less

One call compares several passages using logits. This needs fewer comparisons than pairwise ranking and less generation than listwise permutation output.

Week 8 practical data flow

BM25 top-k

Retrieve 10 or 20 candidates and read raw passage text.

monoBERT

Tokenise each pair, obtain relevant-class probability, and sort descending.

Evaluate

Write the reordered run and compare it with qrels.

The second exercise uses TinyLlama for pointwise Yes/No scores, then asks for a pairwise LLM prompt comparing two passages. Retrieval depth and evaluation cutoff are separate parameters.

LLM4IR versus IR4LLM
Large Language Models for Information Retrieval (LLM4IR) applies LLMs to tasks such as reranking. Information Retrieval for Large Language Models (IR4LLM) retrieves external evidence for an LLM. The Week 8 ranking exercise is LLM4IR.
Why automatic prompt engineering is harder for ranking
A ranking demonstration includes a query, several passage meanings, relative relevance, and an ordering. Multiple passages may share a valid relevance level, so the desired output is more complex and less unique than one classification label.
Week 9

Information Retrieval in the Age of LLMs

LLM4IR uses Large Language Models for retrieval and ranking; IR4LLM supplies external evidence to an LLM. This week connects retrieval models to RAG, long context and attribution.

The end-to-end evidence pipeline

Retrieve

BM25, DPR, TILDEv2, SPLADE, CiC, or a specialist model selects evidence.

Refine

Rewrite, rerank, filter, fuse, summarise, or compress.

Generate and attribute

Answer from evidence and link claims to real sources.

Retrieval effectiveness and answer quality are related but different. Better nDCG can make good evidence available, yet prompt order, truncation, conflicting model knowledge, and evidence use still determine the answer.

Prompting recap

Zero-shot gives instructions only; one/few-shot adds demonstrations; Chain-of-Thought (CoT) elicits intermediate reasoning tokens. Those tokens are generated text, not a guaranteed faithful trace of internal reasoning.

LLMs for retrieval and ranking

RepLLaMA and LLM2Vec generate dense representations. PromptReps and DiffRetriever explore multiple generated representations. Pointwise, pairwise, listwise, and setwise prompts produce ranking judgements.

Long-context search versus RAG

DimensionLC-LLM / Corpus-in-ContextRAG
Inputvery large corpus inside the promptsmall retrieved top-k
Benefitconsolidates a multi-stage pipelinescales to large and changing collections
Costlong-context attention and latencyretriever/reranker maintenance
Failureposition bias; lost-in-the-middlemissing, distracting, or conflicting evidence

Corpus-in-Context (CiC, “seek”) uses consistent document IDs, corpus-grounded examples and a fixed list output. Prefix caching reduces repeated corpus-prefix work, but does not remove position bias.

Specialised interfaces

Screenshot retrievers use a Vision-Language Model to preserve layout and visual evidence. DiffRetriever uses a diffusion language model to produce representative tokens in parallel and matches multiple representations.

Why RAG?

External evidence can be newer, private, domain-specific, updateable and inspectable. Unlike further pretraining, the collection remains separate from the generator's parameters.

Modular RAG

StageExamplesMain risk
Pre-retrievalrouting, rewriting, expansion, HyDEquery drift
Retrievallexical, dense, learned sparse, hybridgold evidence absent from top-k
Post-retrievalrerank, filter, fuse, summariselatency or useful evidence removed
Promptlexical/embedding compressionlost qualifiers or provenance
Generationread, cite, revise, retrieve againmodel prior overrides evidence

Rewrite-Retrieve-Read

A rewriter makes an underspecified query search-friendly, a retriever selects evidence, and a reader answers. The rewriter can be warmed up with pseudo-data and later optimised from downstream reward.

BlendFilter

Combine retrieval with model-generated query/answer signals, then use an LLM to filter irrelevant knowledge before generation. Retrieved results still require evidence selection.

Prompt compression

Lexical methods delete low-information tokens; embedding methods map long text to compact memory tokens. Both save tokens but may lose evidence detail and provenance.

Evidence conflict

A model may ignore corrective evidence or change a correct answer after contrary evidence. Relevance, answer correctness and groundedness must be evaluated separately.

Noise, position, and evidence amount

High-scoring distractors can sharply hurt answers; more distractors often worsen results; gold evidence in the middle can be underused; random context sometimes helps particular models. These are empirical model-dependent behaviours, not universal recipes.

Project 2 link: keep the same LLM, prompt, decoding and token budget across no-retrieval, BM25, neural and oracle evidence conditions.

Attribution

Attribution links answer claims to supporting references. Directly generated citations may be fabricated; retrieval-based attribution restricts candidates to real documents.

RARR

Retrofit Attribution using Research and Revision researches support for an existing answer, then revises unsupported content while preserving as much of the draft as possible.

Why does better retrieval not guarantee a better answer?
nDCG measures ranked evidence. Generation additionally depends on truncation, ordering, prompt design, model priors, and whether the generator follows the passages. Measure the relationship per query rather than assuming causality.
Formula sheet

Formula reference

Identify the variables, then ask what each factor rewards or penalises.

NameFormulaInterpretation
P@krelevant in top k / kprecision within cutoff k
Recallretrieved relevant / all relevantcoverage of the relevant set
F12PR/(P+R)harmonic mean of P and R
AP(1/|Rel|) Σ P@k × rel(k)record precision whenever a relevant result appears
MAPmean(AP over queries)each query has equal weight
RR1/rank(first relevant)only the first relevant result matters
nDCG@KDCG@K / IDCG@Kgraded relevance plus position discount
RBP(1-p)Σ r_i p^(i-1)p models continuation probability
Model matrix

Representation, scoring, loss, and negatives

For model questions, classify each claim by these components instead of memorising one sentence.

ModelRepresentation / poolingSimilarity / interactionTrainingRole
BM25sparse term statisticsweighted sum over termsusually untrained; tune k1,bstrong lexical baseline
TILDEv2query token IDs; contextual document-token weightsexact match + per-term max weightdocument-side neural learning and expansionfast learned sparse reranker
SPLADE(v2)mostly-zero vocabulary vectorssparse dot productMLM head, distillation, sparsity regularisationlearned sparse retrieval
PromptRepsLLM dense state + sparse logitsnormalised hybrid scorezero-shothybrid representation
DPRCLS bi-encoderdot productInfoNCE/NLL; in-batch and hard negativesfirst-stage dense retrieval
RepBERTmean token embeddingsinner productMultiLabelMarginLossBERT bi-encoder
ANCECLS / first tokendot productNLL/InfoNCE-style; ANN self-mined negativesdynamic hard-negative mining
Contrievermean poolingcosineunsupervised contrastive; same-document spansunsupervised dense retriever
ColBERTall token embeddingslate-interaction MaxSimcontrastive / pairwise CEefficient fine-grained matching
E5-MistralMistral decoder; EOS/last tokentemperature-scaled cosineInfoNCE; synthetic and supervised dataLLM embedding model
LLM2Vecdecoder with bidirectional attention; poolingoften cosineMNTP + unsupervised SimCSE + optional supervisiondecoder converted to encoder
RepLLaMALlama2; EOS last hidden statedot productInfoNCE; supervision + LoRALLM retriever
Cross-encoderjoint query-document encodingclassification/regression relevance headpointwise, pairwise, or listwisehigh-accuracy reranker
monoBERT[CLS] q [SEP] d [SEP]relevant-class softmax scorebinary cross-entropy; BM25 negativespointwise BERT reranker
BERT-MaxP / FirstP / SumPdocument passagesmax / first / sum passage scoretransferred document labelslong-document score aggregation
PARADEpassage vectorsaverage / max / attention / Transformer aggregationdocument-level rankingrepresentation aggregation
duoBERTquery + two documentspairwise preference aggregationpairwise cross-entropylate-stage BERT reranker
LLM pointwise / pairwiseone document / document pair in a promptlabel logits / preferencezero-shot promptingindividual judgement / comparison
LLM listwise / setwisecandidate list / small setpermutation / best-item logitszero-shot promptinglist context / efficient selection
Corpus-in-Contextwhole corpus in an LC-LLM promptgenerated document IDsfew-shot prompting; no retriever trainingsmall-corpus model-based retrieval
Screenshot retrieverpage pixels and layoutVLM similarityvision-language contrastive learninglayout-rich documents
DiffRetrieverparallel representative tokensmulti-representation matchingdiffusion language modelgenerative multi-vector retrieval
Basic RAGquery + top-k evidenceautoregressive answerretriever and generator may be frozenevidence-based IR4LLM
Rewrite-Retrieve-Readrewritten query + evidencedownstream answer rewardpseudo-data and optional policy optimisationunderspecified questions
BlendFilterretrieved and model-generated knowledgefilter then generateprompted LLM modulesremove distractors
RARRdraft + researched evidencesupport check and revisionpost-hoc research/revisionretrofit attribution
Example multiple-choice logic: the ColBERT and DPR pairings are correct, as is RepBERT with mean pooling, inner product, and Multi-Label Margin Loss. ANCE normally uses dot product, not cosine. E5-Mistral's EOS pooling and InfoNCE are plausible, but “mean-pooling similarity” confuses pooling with the similarity function.
Acronym and definition glossary

Full names and key definitions

Short name → full English name → definition. Model names that are not acronyms are identified separately.

Short nameFull nameDefinition
IRInformation RetrievalFinding and ranking documents that satisfy an information need.
TF / DF / CFTerm Frequency / Document Frequency / Collection FrequencyCounts within one document, across documents containing the term, and across all term occurrences.
IDFInverse Document FrequencyA term's discriminative weight based on how few documents contain it.
TF-IDFTerm Frequency-Inverse Document FrequencyCombines local frequency with collection rarity.
VSM / BIMVector Space Model / Binary Independence ModelVector similarity and probabilistic term-independence approaches to ranking.
BM25Best Matching 25A lexical model combining IDF, tf saturation, and length normalisation.
RSJ / F1Robertson-Spärck Jones / F-score with β = 1A probabilistic IDF weighting foundation for BM25, and the harmonic mean of precision and recall.
AP / MAPAverage Precision / Mean Average PrecisionAverage precision at relevant ranks for one query, then averaged across queries.
RR / MRRReciprocal Rank / Mean Reciprocal RankMeasures where the first relevant result appears.
DCG / IDCG / nDCGDiscounted Cumulative Gain / Ideal DCG / Normalized DCGCombines graded relevance and rank discount, then normalises by the ideal order.
RBPRank-Biased PrecisionModels a user's probability of continuing down the ranking.
BERTBidirectional Encoder Representations from TransformersAn encoder model that can jointly contextualise query and document tokens.
CLS / SEP / EOSClassification / Separator / End of Sequence tokenSpecial tokens for classification summaries, segment boundaries, and sequence endings.
MLM / FFNMasked Language Modeling / Feed-Forward NetworkA masked-token pretraining objective and the per-token nonlinear sublayer in a Transformer block.
GPT / LLMGenerative Pre-trained Transformer / Large Language ModelDecoder-style generation family and the broader class of large pretrained language models.
DPRDense Passage RetrievalA bi-encoder that retrieves by dense query-passage vector similarity.
ColBERTContextualized Late Interaction over BERTRetains token vectors and applies MaxSim for fine-grained late interaction.
ANN / ANCEApproximate Nearest Neighbour / Approximate Nearest Neighbor Negative Contrastive EstimationFast approximate vector search and a retriever that mines its ANN mistakes as hard negatives.
NLL / InfoNCENegative Log-Likelihood / Information Noise-Contrastive EstimationObjectives that penalise low target probability and contrast positives against negatives.
CECross-EntropyA classification loss comparing target and predicted distributions.
TILDETerm Independent Likelihood moDElLearns document-side vocabulary term likelihoods for efficient matching.
SPLADESparse Lexical and Expansion ModelLearns sparse vocabulary weights and semantic expansion terms.
ReLU / FLOPSRectified Linear Unit / Floating-Point OperationsProduces non-negative activations, while the FLOPS-inspired regulariser discourages overly dense SPLADE vectors.
T5Text-to-Text Transfer TransformerA sequence-to-sequence model that can generate offline doc2query expansions.
LTR / OLTRLearning to Rank / Online Learning to RankLearns an ordering from labelled data or continuously from user interactions.
IPSInverse Propensity ScoringReweights observations by inverse exposure probability to correct bias in expectation.
DBGDDueling Bandit Gradient DescentUses interleaving outcomes to move toward a winning exploratory ranker.
COLTRCounterfactual Online Learning to RankEvaluates candidate rankers off-policy using logged clicks and propensities.
RM3 / TRECRelevance Model 3 / Text REtrieval ConferenceA pseudo-relevance feedback model and a major standard IR evaluation programme.
QrelsQuery Relevance JudgementsGround-truth query-document relevance labels used to evaluate a run.
MS MARCO / BEIRMicrosoft Machine Reading Comprehension / Benchmarking Information RetrievalWidely used neural-ranking training data and a cross-domain retrieval benchmark suite.
JSONLJSON LinesStores one independent JSON object per line for streaming datasets.
LoRA / MNTP / SimCSELow-Rank Adaptation / Masked Next Token Prediction / Simple Contrastive Learning of Sentence EmbeddingsEfficient fine-tuning and representation-learning methods used by later embedding models.
PARADEPassage Representation Aggregation for Document RerankingAggregates encoded passage vectors for long-document ranking.
LLM4IR / IR4LLMLarge Language Models for Information Retrieval / Information Retrieval for Large Language ModelsUsing LLMs to improve IR versus retrieving evidence to support an LLM.
monoBERT / duoBERTModel names, not acronymsPointwise relevance scoring versus pairwise document preference.
RAG / LC-LLMRetrieval-Augmented Generation / Long-Context Large Language ModelRetrieve a small evidence set for generation versus place much more source text directly in context.
CiC / CoTCorpus-in-Context / Chain-of-ThoughtDirect corpus prompting for retrieval and generated intermediate reasoning steps.
VLM / HyDEVision-Language Model / Hypothetical Document EmbeddingsModels pixels and language; or retrieves by embedding a generated hypothetical answer document.
RARRRetrofit Attribution using Research and RevisionResearches evidence for a draft and revises unsupported claims.
PPOProximal Policy OptimizationA reinforcement-learning method that can optimise a trainable query rewriter while limiting update size.
Assignment 1

End-to-end A1 workflow

A1 is not just a BM25 function. It is a reproducible IR experiment with validation, tuning, comparison, and analysis.

Open the experiment study workflow. No personal submission or experiment outputs are included in this public guide.

Why separate train and test?

Train qrels select k1 and b. Test qrels are used once for unbiased final evaluation. Repeatedly changing parameters after inspecting test results leaks test information into training.

How to discuss tuned BM25

Do not write only “the score improved.” Explain how k1 changes tf saturation and b changes length normalisation, then use gain/loss queries to diagnose the effect.

# Clear scorer skeleton; adapt names to the supplied notebook
def bm25(tf_vector, df_vector, doc_len, k1=1.2, b=0.75):
    score = 0.0
    for tf, df in zip(tf_vector, df_vector):
        idf = math.log(N / (1 + df))
        norm = 1 - b + b * (doc_len / average_doc_length)
        tf_weight = ((k1 + 1) * tf) / (tf + k1 * norm)
        score += idf * tf_weight
    return score
Recall practice

Self-test

Answer first, then expand. Being able to explain why is the real test.

1. What are tf, df, and cf?
tf is the term count in the current document; df is the number of documents containing the term; cf is the term's total count across the collection.
2. Why does BM25 saturate tf?
The jump from zero to one occurrence is more informative than 100 to 101. Saturation prevents repetition from increasing the score without limit.
3. Why divide DCG by IDCG?
Queries differ in the number and grades of relevant documents. Normalisation provides a comparable scale, usually between zero and one.
4. What does p-value < .05 mean?
If H₀ were true, the probability of the observed or a more extreme difference is below 5%. It is not the probability that system B is better.
5. Why scale attention by √d_k?
Dot-product variance grows with dimension. Scaling prevents an excessively sharp softmax and helps stable gradients.
6. Encoder versus decoder?
An encoder typically sees both left and right context for understanding. A decoder uses a causal mask and sees only the left prefix for generation.
7. Why can dense retrieval match synonyms?
Training maps semantically related expressions to nearby vectors rather than requiring identical surface terms.
8. How does ColBERT calculate its score?
For every query token, find the highest similarity to any document token, then sum those maxima.
9. Why are hard negatives useful and risky?
They look relevant and provide strong gradients, but incomplete qrels can make truly relevant documents appear as false negatives.
10. Why not tune BM25 on the test set?
It adapts parameters to test judgements and makes the estimate of generalisation optimistically biased.
11. Why is SPLADE sparse although it uses BERT?
It outputs a vocabulary-sized vector with mostly zero dimensions. BERT learns which dimensions should be active.
12. TILDEv2 versus SPLADE?
TILDEv2 uses lightweight query token IDs and learned document-token weights; SPLADE encodes both sides into sparse vocabulary vectors.
13. Why put BM25 before TILDEv2?
BM25 cheaply narrows the full collection, then TILDEv2 reranks only plausible candidates.
14. Pointwise, pairwise, and listwise?
They learn from one document, a document preference pair, or an entire ranked list respectively.
15. Why are clicks biased?
Clicks depend on examination, position, selection and presentation as well as relevance.
16. What is the main purpose of IPS?
To correct exposure bias by weighting observations with inverse examination probability.
17. How does balanced interleaving work?
Mix two rankers' unseen results into one list and attribute clicks to infer pairwise preference.
18. Why use counterfactual OLTR?
It reuses one propensity-logged interaction stream to estimate several candidate rankers off-policy.
19. Why must monoBERT follow a retriever?
Joint encoding is too expensive for the whole collection. BM25 first creates a manageable candidate set that monoBERT can reorder.
20. Score aggregation versus representation aggregation?
MaxP/FirstP/SumP combine scalar passage scores; PARADE combines passage vectors before making a document-level decision.
21. monoBERT versus duoBERT?
monoBERT scores one document independently; duoBERT directly compares two documents.
22. Four LLM reranking families?
Pointwise judges one item, pairwise compares two, listwise generates an order, and setwise selects the best from a small set.
23. Why may setwise ranking cost less?
It compares several passages per inference using logits, reducing pairwise calls and avoiding full list generation.
24. Why does prompt wording matter?
Roles, output constraints, formatting, and component order alter the model context; sensitivity also varies by model.
25. LLM4IR versus IR4LLM?
LLM4IR applies LLMs to retrieval/ranking; IR4LLM retrieves external evidence for a generator.
26. Why can long context still miss evidence?
Position bias and lost-in-the-middle mean that fitting text into a context window does not guarantee that the model uses it.
27. Relevance versus groundedness?
Relevance asks whether a passage helps the query; groundedness asks whether answer claims are supported by the supplied evidence.
28. Why can one distractor harm RAG?
Semantic alignment without answer support introduces a competing signal that can mislead the generator.
29. RAG versus fine-tuning?
RAG changes inspectable external evidence at inference; fine-tuning changes model parameters.
30. What does RARR do?
It researches evidence for a draft, adds attribution, and revises unsupported content after generation.
Source map

Scope of this guide

The guide synthesises the supplied INFS7410 folder. Large corpora, indexes, and virtual environments are experimental resources rather than revision content.

  • Week 1 lecture notes, slides, and practical
  • Week 2 lecture notes, slides, and practical
  • Week 3 lecture notes, slides, and practical
  • Week 4 notes, Transformer worksheets, and solution
  • Week 5 lecture notes and practical solutions
  • Week 6 TILDEv2 and SPLADEv2 practical
  • Week 6 learned sparse notes
  • Week 7 full slide deck: LTR, IPS, interleaving and COLTR
  • Week 8 full slide deck and practical: neural/LLM reranking
  • Week 9 full slide deck: long-context search, modular RAG, evidence conflict, noise and attribution
  • Project 2 notebook, sampled BRIGHT Biology collection and marking sheet
Coverage: this edition integrates Weeks 1–9 and connects retrieval representations, candidate ranking, click feedback, neural reranking, RAG and evidence attribution.

Revision questions

Review 44 topics through independent explanations and worked examples. Original course PDFs, slide screenshots and full slide transcripts are not distributed here.

Open revision Q/A · Original course materials (login required)

No matching content. Try a shorter term.