← All projects

Information Retrieval · Financial Search

Financial Information Retrieval

A retrieval system for financial question answering that compares lexical BM25, tuned BM25 and dense semantic search with Sentence-BERT and exact FAISS indexing.

  • StatusComplete
  • Project typeUniversity group project
  • Team size4
  • BenchmarkBEIR FiQA-2018

The project tests whether dense semantic retrieval can improve financial question answering when queries and relevant passages use different vocabulary.

This project was completed as part of a four-person university group. My primary contribution focused on evaluation design, experimental methodology, BM25 parameter tuning analysis, results interpretation, and project coordination.

The team built the complete system documented here. The technical sections describe that shared work; the project information above distinguishes my individual contribution.

Three systems are evaluated on the same FiQA-2018 test queries and relevance judgements: a BM25 baseline, an optimised BM25 configuration and an SBERT dense retriever backed by exact FAISS search. Both retrieval branches return the top 100 documents per query and are evaluated independently rather than fused.

The notebook preserves the complete implementation, tuning outputs, model comparisons and an interactive search interface.

  • Python
  • BM25
  • Sentence Transformers
  • FAISS
  • BEIR
  • Gradio
0.4443

SBERT NDCG@10

The strongest ranking-quality result across all evaluated models.

0.7936

SBERT Recall@100

Nearly four-fifths of relevant passages recovered within the top 100.

+0.0056

BM25 tuning gain

Absolute NDCG@10 improvement from the baseline to the tuned model.

BEIR FiQA-2018 provides conversational financial questions, answer passages and test relevance judgements.

The notebook downloads the public BEIR archive at runtime and loads its test split through GenericDataLoader. Titles and passage text are concatenated before indexing. The dataset is not duplicated in either repository.

57,638

Corpus documents

Financial passages available to both retrieval branches.

648

Test queries

Natural-language questions used for final evaluation.

648

Qrel entries

Query-level relevance mappings used by BEIR metrics.

A shared corpus feeds two independent retrieval paths: lexical matching with BM25 and semantic matching with SBERT.

Each branch produces query-to-document scores in BEIR format, retrieves its top 100 candidates and passes them into the same evaluation workflow. Keeping the branches independent makes their differences easier to interpret.

Overview of the shared FiQA corpus branching into BM25 and SBERT retrieval systems before evaluation and interactive search
End-to-end system overview, including both retrieval paths and their shared outputs.

A nine-configuration grid search examined term-frequency saturation and document-length normalisation.

The baseline uses k1=0.9 and b=0.4. Tuning evaluates k1 ∈ {0.9, 1.2, 1.5} and b ∈ {0.5, 0.75, 0.9}. The best stored setting is k1=0.9, b=0.75, selected by NDCG@10. It retains the baseline term-frequency setting while applying stronger document-length normalisation.

BM25 pipeline from corpus preparation and tokenisation through indexing, top-100 retrieval and BEIR evaluation
BM25 indexing, retrieval and evaluation pipeline.
Heatmap of BM25 NDCG at 10 across nine k1 and b combinations
NDCG@10 across the BM25 tuning grid.
Heatmap of BM25 MAP at 10 across nine k1 and b combinations
MAP@10 across the same parameter combinations.
Bar chart comparing baseline and tuned BM25 across four retrieval metrics
Tuning produced small but consistent gains across all four final metrics.

Sentence embeddings allow the retriever to match semantic meaning even when queries and passages do not share exact terms.

The pretrained multi-qa-mpnet-base-dot-v1 model encodes documents and queries into 768-dimensional, L2-normalised vectors. Document vectors are stored in faiss.IndexFlatIP; with normalised embeddings, inner-product ranking is equivalent to cosine similarity. The index performs exact rather than approximate search.

Dense retrieval pipeline using Sentence-BERT encoding, normalised vectors and exact FAISS inner-product search
SBERT encoding and exact FAISS search for top-100 semantic retrieval.

Every run is converted to BEIR's query-to-document score format and evaluated against the FiQA test qrels with four complementary metrics.

NDCG@10

Measures ranking quality in the first ten results and rewards relevant documents placed higher.

MAP@100

Summarises precision at relevant ranks through the first 100 results.

Recall@100

Measures the share of known relevant documents recovered in the top 100.

P@10

Measures the proportion of relevant documents within the first ten results.

Evaluation workflow converting retrieval outputs to BEIR format and comparing rankings with FiQA relevance judgements
Shared evaluation workflow applied consistently to all three retrieval runs.

SBERT Dense achieved the strongest stored result on every reported metric.

Model NDCG@10 MAP@100 Recall@100 P@10
BM25 Baseline 0.2345 0.1874 0.4952 0.0648
BM25 Tuned 0.2401 0.1918 0.5084 0.0674
SBERT Dense 0.4443 0.3792 0.7936 0.1249

Final stored comparison on the BEIR FiQA-2018 test split. Higher is better for every metric.

BM25 tuning improves all four metrics, though the gains are modest. Dense retrieval substantially outperforms both lexical variants, consistent with its ability to bridge vocabulary differences between conversational questions and more specialised financial passages.

Grouped bar chart comparing BM25 Baseline, BM25 Tuned and SBERT Dense across NDCG, MAP, Recall and precision
Final model comparison across the four reported retrieval metrics.

A Gradio interface turns the evaluated retrievers into an explorable financial search tool.

Users can enter a free-text query, choose between tuned BM25 and SBERT Dense, select a Top-K value from 1 to 20 and inspect ranked document IDs, scores, titles and text snippets. Example financial questions support both retrieval modes.

Free-text query
Model selection
Top-K retrieval
Ranked results

The temporary gradio.live URL preserved in the notebook is not presented as a permanent deployment; running the interface cell creates a new session.

Vocabulary mismatch

Financial questions and relevant passages can express the same concept using very different terminology.

Fair comparison

Both branches needed identical test queries, cut-offs, qrels and metric definitions.

Model selection

BM25 tuning and final evaluation use the same split, which may overestimate generalisation.

Compute and indexing

Dense document encoding is more resource-intensive, and latency was not systematically benchmarked.

  • How lexical and dense retrieval solve different aspects of the relevance problem.
  • Why a single metric cannot fully describe ranking quality, precision and coverage.
  • How document normalisation parameters change BM25 behaviour across a real corpus.
  • How embedding normalisation connects cosine similarity with FAISS inner-product search.
  • Why validation splits, latency benchmarks and significance testing are important next steps.
  • How to turn an evaluated notebook workflow into an interface without overstating deployment maturity.

The repository contains the complete notebook, stored tuning grid, model comparison, diagrams, figures, requirements and presentation.