This repository contains the design, implementation, and optimization of an Information Retrieval (IR) pipeline for patent prior-art search (prior-art patent retrieval). The project was developed as part of the MSc in Web Intelligence program for the course Information Retrieval on the Web at the International Hellenic University.
The objective is to retrieve and rank relevant patents from a corpus of 63,923 patent documents given search topics, maximizing Recall@100 and Mean Average Precision (MAP).
The retrieval system is built on PyTerrier and optimized through a multi-stage pipeline:
[Query Patent] ─► [Alphanumeric Normalization] ─► [BM25 Retrieval + Claims Query]
│
▼
[Hybrid Reranked Run 5] ◄── [Explicit IPC & Semantic ML Reranker] ◄── [Bo1 PRF Expansion]
- Fielded Indexing: We construct Terrier indexes over multiple fields (Title, Abstract, Claims).
-
BM25 & BM25F: Baseline retrieval uses the BM25 probabilistic model (
$c = 1.2$ ). We also evaluate BM25F with custom field weights tuned to favor title matches ($w_{title}=3.0$ ,$w_{abstract}=1.5$ ,$w_{claims}=1.0$ ). -
Query Normalization: To resolve tokenization mismatches (where corpus tokens like
TL1awere pre-tokenized into separate parts, but topic XML queries kept them as single tokens), we apply alphanumeric word boundary splitting to the queries.
- We apply the Bose-Einstein 1 (Bo1) Divergence from Randomness model to expand queries, using the top 3 retrieved documents and extracting 10 expansion terms.
For the optimized configuration, we implement a custom PyTerrier re-ranking transformer (IPCReranker) combining two signals:
- Explicit IPC Code Matching: Patent classification codes (International Patent Classification) are matched hierarchically:
- Exact Code Match: Boost score weight of
30.0 - Group Match (pre-slash, e.g.
H04W 12): Boost weight of15.0 - Subclass Match (first 4 characters, e.g.
H04W): Boost weight of3.0
- Exact Code Match: Boost score weight of
- Semantic Category Similarity: We train an offline text classifier (TF-IDF + SGDClassifier / Logistic Regression) on patent titles and abstracts to predict 607 unique IPC subclasses. At query time, we compute the dot product similarity between the predicted category probability vector of the query and the candidate patent document to provide a soft semantic boost (boost weight of
100.0).
wi-information-retrieval/
├── src/ # Source code (Python scripts)
│ ├── build_indexes.py # Script to construct Terrier indexes
│ ├── query_analysis.py # Script for query performance analysis
│ ├── ipc_reranker.py # Custom PyTerrier IPC Reranker transformer
│ ├── classifier.py # Text classification script (previously build_classifier_cache.py)
│ ├── generate_runs.py # Main pipeline script to produce submission runs
│ ├── download_topics.py # Utilities to download topics
│ ├── download_all_topics.py
│ ├── compare_results.py # Results comparison utilities
│ └── ir_utils.py # Helper utilities (parsing, queries)
├── deliverables/ # Final submission files
│ ├── Report_Moratis_Konstantinos.odt
│ ├── Konstantinos_Moratis_Information_Retrieval_1.pdf
│ ├── moratis_RUN1.res
│ ├── ...
│ └── moratis_RUN5.res
├── docs/ # Project description, assignments, and drafts
│ ├── 1η Εργασία στο πλαίσιο του μαθήματος «Ανάκτηση Πληροφοριών στο Διαδίκτυο».pdf
│ ├── SummariesForRetrieval_PatentSemTech2025_1.0.docx
│ ├── topics_overview.txt
│ └── underperforming_analysis.txt
├── README.md # Professional public README
├── LICENSE # Project LICENSE
└── .gitignore # Git ignore rules
The following table compares the different configurations evaluated on the training queries:
| Run ID / Pipeline | Recall@100 | Mean Average Precision (MAP) | Precision@10 | Description |
|---|---|---|---|---|
| Phase 1 Baseline | 0.5185 |
0.1983 |
0.0630 |
Flat BM25 on Title & Abstract |
| RUN 1 | 0.7593 |
0.4395 |
0.1037 |
BM25 + Claims query |
| RUN 2 | 0.6852 |
0.3013 |
0.0815 |
Fielded BM25F (Title-biased) |
| RUN 3 | 0.8333 |
0.4497 |
0.1111 |
BM25 + PRF (Raw queries) |
| RUN 4 | 0.8519 |
0.4578 |
0.1185 |
BM25 + PRF + Query Normalization |
| RUN 5 (Best) | 0.8889 |
0.5410 |
0.1333 |
Tuned BM25 + PRF + Hybrid IPC Reranker |
The Hybrid IPC Reranker (RUN 5) achieves a 23.1% relative MAP improvement and a 3.7% absolute Recall@100 improvement compared to the best flat model.
- Prerequisites: Ensure you have Python 3.8+ and Java JDK 11+ installed (required by Terrier).
- Install Dependencies:
pip install python-terrier scikit-learn joblib pandas pypdf
- Data Requirements: Place your patent corpus zip (
WPI_64K_SGML.zip) in the root directory.
Important
All scripts should be executed from the repository root directory to keep relative path resolution correct.
To build the required index structures:
python src/build_indexes.pyTo extract patent text representations, precompute category probability distributions, and cache them locally:
python src/classifier.pyTo execute the pipeline configurations on the test topics and output the 5 run files (moratis_RUN1.res to moratis_RUN5.res) to the deliverables/ folder:
python src/generate_runs.py