From c72ca5f0b561d6cef57358ab548151571348c782 Mon Sep 17 00:00:00 2001 From: Tek Raj Chhetri <52251022+tekrajchhetri@users.noreply.github.com> Date: Tue, 24 Feb 2026 11:56:58 -0500 Subject: [PATCH 1/7] Create search_design_doc.md --- docs/design_docs/search_design_doc.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/design_docs/search_design_doc.md diff --git a/docs/design_docs/search_design_doc.md b/docs/design_docs/search_design_doc.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/docs/design_docs/search_design_doc.md @@ -0,0 +1 @@ + From f2760bd5d53741c20d5e5b7dcaeb6f0c7bad5f5d Mon Sep 17 00:00:00 2001 From: Tek Raj Chhetri <52251022+tekrajchhetri@users.noreply.github.com> Date: Thu, 26 Feb 2026 12:17:06 -0500 Subject: [PATCH 2/7] Add task description to search design document Added a section outlining the task for the search system. --- docs/design_docs/search_design_doc.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/design_docs/search_design_doc.md b/docs/design_docs/search_design_doc.md index 8b13789..f0d49ae 100644 --- a/docs/design_docs/search_design_doc.md +++ b/docs/design_docs/search_design_doc.md @@ -1 +1,5 @@ +# Search Design Document + +## Task +Given a query $q$, the system aims to retrieve the most relevant concept or document $d$ from a candidate set $\mathcal{D}$. In our context, this task necessitates identifying the relevant ontological concepts to a given entity (e.g., in Named Entity Recognition scenarios) or to a broader text input, enabling semantic grounding and structured representation of the extracted information. From e6ef103f6baed8189f476b9d6d0b442111ba6f8e Mon Sep 17 00:00:00 2001 From: Tek Raj Chhetri <52251022+tekrajchhetri@users.noreply.github.com> Date: Thu, 26 Feb 2026 14:29:06 -0500 Subject: [PATCH 3/7] Document current situation with BioPortal usage Added a section detailing the current situation with BioPortal as the ontology database, including its benefits and trade-offs. --- docs/design_docs/search_design_doc.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/design_docs/search_design_doc.md b/docs/design_docs/search_design_doc.md index f0d49ae..5738a23 100644 --- a/docs/design_docs/search_design_doc.md +++ b/docs/design_docs/search_design_doc.md @@ -3,3 +3,10 @@ ## Task Given a query $q$, the system aims to retrieve the most relevant concept or document $d$ from a candidate set $\mathcal{D}$. In our context, this task necessitates identifying the relevant ontological concepts to a given entity (e.g., in Named Entity Recognition scenarios) or to a broader text input, enabling semantic grounding and structured representation of the extracted information. +## Current Situation + +Currently, we use **BioPortal** as our ontology database. BioPortal is a well-established, community-trusted platform that hosts and manages a large number of ontologies. However, these benefits come with several trade-offs: + +1. **Dependency on BioPortal** — If BioPortal is unavailable (for example, during upgrades), our use case is directly impacted. +2. **API rate limits** — Rate limiting can slow down API calls. While this is understandable given BioPortal’s design and shared usage model, it affects performance. +3. **Implementation dependency** — We rely on BioPortal’s implementations (e.g., search), which may not always be optimal or fully aligned with our specific use case. From 21776be69e8bb045b3c755f4cde9913ada226d7a Mon Sep 17 00:00:00 2001 From: Tek Raj Chhetri <52251022+tekrajchhetri@users.noreply.github.com> Date: Thu, 26 Feb 2026 15:59:53 -0500 Subject: [PATCH 4/7] Enhance search design document with detailed strategies Expanded the search design document with detailed requirements, proposed approach, implementation strategy, and design principles for the retrieval and reranking system. --- docs/design_docs/search_design_doc.md | 92 +++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/docs/design_docs/search_design_doc.md b/docs/design_docs/search_design_doc.md index 5738a23..0aff493 100644 --- a/docs/design_docs/search_design_doc.md +++ b/docs/design_docs/search_design_doc.md @@ -10,3 +10,95 @@ Currently, we use **BioPortal** as our ontology database. BioPortal is a well-es 1. **Dependency on BioPortal** — If BioPortal is unavailable (for example, during upgrades), our use case is directly impacted. 2. **API rate limits** — Rate limiting can slow down API calls. While this is understandable given BioPortal’s design and shared usage model, it affects performance. 3. **Implementation dependency** — We rely on BioPortal’s implementations (e.g., search), which may not always be optimal or fully aligned with our specific use case. + +## Overview & Requirements + +Before further detail, let’s first understand the steps involved. This task typically consists of two main stages:**retrieval** and **reranking**. + +In the first stage, **retrieval**, the objective is to identify a subset of potentially relevant candidates from $\mathcal{D}$. This is achieved by maximizing a scoring function $f(q, d)$, which estimates the relevance between the query and each candidate document: + +$$ +d^* = \arg\max_{d \in \mathcal{D}} f(q, d) +$$ + +Note at this stage we want to prioritizes high recall and computational efficiency. + +In the second stage, **reranking**, the retrieved candidates $\mathcal{D}_K$ are re-evaluated using a more expressive (and often computationally expensive) relevance model $g(q, d)$. The goal is to refine the initial ordering by more precisely estimating relevance: + +$$ +d^{**} = \arg\max_{d \in \mathcal{D}_K} g(q, d) +$$ + +With this in mind, we define the following search requirements: + +1. **Contextualized retrieval** — The implementation must overcome the limitations of sparse retrieval methods such as BM25 and basic similarity scoring, which lack contextual understanding. This includes support for contextualized approaches such as cross-encoders, dual-encoders and late interaction models (e.g., ColBERT). +2. **Keyword-based retrieval** — The system must also support fast and efficient keyword-based search. +3. **Generalizability** — The implementation should be easily adaptable to other use cases with minimal or no additional effort. + +## Proposed approach +The figure below presents a high-level overview of the proposed approach. Note that not all techniques shown will be used simultaneously; the final selection depends on trade-offs such as accuracy versus computational cost. For example, cross-encoding techniques offer high accuracy but are computationally expensive. Dual-encoder (or bi-encoder) techniques, on the other hand, provide a better balance between accuracy and computational efficiency. + +```mermaid +flowchart TB + subgraph R1["Retrieval"] + B{"Candidate Retrieval"} + C1["BM25 / Inverted Index"] + C2["Vector Search / ANN Index"] + D["Candidate Set (d*)"] + end + subgraph R2["Re-ranking"] + G{"Scoring / Re-rank"} + N3["Dual Encoder"] + H1["Late-Interaction Encoder"] + H2["Cross-Encoder / LLM Reranker"] + end + B -- Keyword (BM25) --> C1 + B -- Dense Embeddings --> C2 + C1 --> D + C2 --> D + G --
--> N3 + G --> H1 + G --
--> H2 + A["Input Text"] --> B + D --> G + N3 --> I["Final Results (d**)"] + H1 --> I + H2 --> I +``` + + +## Implementation + +The system will be implemented as an API-first service. Agents and external clients will consume the same API endpoints, ensuring a unified interface, consistent behavior, and eliminating duplicate implementations across tool and service layers. + +The API will encapsulate the full retrieval and ranking pipeline, including candidate retrieval, and reranking. The architecture will remain modular to allow interchangeable ranking components while preserving a stable external interface. + +### Ranking and Retrieval Strategy + +The implementation will prioritize a hybrid retrieval and reranking approach, combining fast lexical retrieval with dense and late-interaction models for improved accuracy. The following models and methods will be evaluated and integrated where appropriate: + +- **Li et al. (2026)** — *Query-focused and Memory-aware Reranker for Long Context Processing* + Used for long-context reranking scenarios requiring structured reasoning over extended passages. + +- **Lù (2024)** — *BM25s: Orders of Magnitude Faster Lexical Search via Eager Sparse Scoring* + Used as a high-performance sparse retrieval baseline for efficient first-stage candidate generation. + +- **Jha et al. (2024)** — *Jina-ColBERT-v2: A General-Purpose Multilingual Late Interaction Retriever* + Used for token-level late interaction retrieval to improve precision while maintaining scalability. + +- **Zhang et al. (2025)** — *Qwen3 Embedding: Advancing Text Embedding and Reranking through Foundation Models* + Used for dense embedding-based retrieval and semantic reranking. + +- **BiomedBERT Reranker** — NeuML BiomedBERT-based reranking model + Applied in domain-specific (biomedical) contexts requiring specialized semantic understanding. + +### Design Principles + +- API-first architecture with a single service interface +- Modular retrieval and ranking components +- Support for sparse, dense, and late-interaction methods +- Configurable reranking layer (neural or LLM-based) +- Scalability for large candidate concept sets +- Extensibility for domain-specific models + +This design enables flexible experimentation with retrieval and reranking strategies while maintaining a stable and production-ready service interface. From 1d33f0f6017200f09b1cd0931321b9b9d3b36856 Mon Sep 17 00:00:00 2001 From: Tek Raj Chhetri <52251022+tekrajchhetri@users.noreply.github.com> Date: Thu, 26 Feb 2026 16:03:25 -0500 Subject: [PATCH 5/7] Update search design document with clarifications and references Clarified search requirements and added references for models used in ranking and retrieval strategy. --- docs/design_docs/search_design_doc.md | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/docs/design_docs/search_design_doc.md b/docs/design_docs/search_design_doc.md index 0aff493..65c85e3 100644 --- a/docs/design_docs/search_design_doc.md +++ b/docs/design_docs/search_design_doc.md @@ -29,7 +29,7 @@ $$ d^{**} = \arg\max_{d \in \mathcal{D}_K} g(q, d) $$ -With this in mind, we define the following search requirements: +With this in mind, we define the following search requirements (focused on algorithms not system design): 1. **Contextualized retrieval** — The implementation must overcome the limitations of sparse retrieval methods such as BM25 and basic similarity scoring, which lack contextual understanding. This includes support for contextualized approaches such as cross-encoders, dual-encoders and late interaction models (e.g., ColBERT). 2. **Keyword-based retrieval** — The system must also support fast and efficient keyword-based search. @@ -77,20 +77,15 @@ The API will encapsulate the full retrieval and ranking pipeline, including cand The implementation will prioritize a hybrid retrieval and reranking approach, combining fast lexical retrieval with dense and late-interaction models for improved accuracy. The following models and methods will be evaluated and integrated where appropriate: -- **Li et al. (2026)** — *Query-focused and Memory-aware Reranker for Long Context Processing* - Used for long-context reranking scenarios requiring structured reasoning over extended passages. +- Li, Y., Li, J., Yu, M., Ding, G., Lin, Z., Wang, W. and Zhou, J., 2026. Query-focused and Memory-aware Reranker for Long Context Processing. arXiv preprint arXiv:2602.12192. -- **Lù (2024)** — *BM25s: Orders of Magnitude Faster Lexical Search via Eager Sparse Scoring* - Used as a high-performance sparse retrieval baseline for efficient first-stage candidate generation. +- Lù, X.H., 2024. Bm25s: Orders of magnitude faster lexical search via eager sparse scoring. arXiv preprint arXiv:2407.03618. -- **Jha et al. (2024)** — *Jina-ColBERT-v2: A General-Purpose Multilingual Late Interaction Retriever* - Used for token-level late interaction retrieval to improve precision while maintaining scalability. +- ha, R., Wang, B., Günther, M., Mastrapas, G., Sturua, S., Mohr, I., Koukounas, A., Wang, M.K., Wang, N. and Xiao, H., 2024, November. Jina-colbert-v2: A general-purpose multilingual late interaction retriever. In Proceedings of the Fourth Workshop on Multilingual Representation Learning (MRL 2024) (pp. 159-166). -- **Zhang et al. (2025)** — *Qwen3 Embedding: Advancing Text Embedding and Reranking through Foundation Models* - Used for dense embedding-based retrieval and semantic reranking. +- Zhang, Y., Li, M., Long, D., Zhang, X., Lin, H., Yang, B., Xie, P., Yang, A., Liu, D., Lin, J. and Huang, F., 2025. Qwen3 embedding: Advancing text embedding and reranking through foundation models. arXiv preprint arXiv:2506.05176. -- **BiomedBERT Reranker** — NeuML BiomedBERT-based reranking model - Applied in domain-specific (biomedical) contexts requiring specialized semantic understanding. +- BiomedBERT Reranker - [https://huggingface.co/NeuML/biomedbert-base-reranker](https://huggingface.co/NeuML/biomedbert-base-reranker) ### Design Principles @@ -100,5 +95,6 @@ The implementation will prioritize a hybrid retrieval and reranking approach, co - Configurable reranking layer (neural or LLM-based) - Scalability for large candidate concept sets - Extensibility for domain-specific models +- **Provenance by design**, ensuring that model versions, configurations, scoring methods, and retrieval metadata are tracked and reproducible This design enables flexible experimentation with retrieval and reranking strategies while maintaining a stable and production-ready service interface. From a88551f1b832ebfcad46a5381cee5b75298aadca Mon Sep 17 00:00:00 2001 From: Tek Raj Chhetri <52251022+tekrajchhetri@users.noreply.github.com> Date: Thu, 26 Feb 2026 16:42:58 -0500 Subject: [PATCH 6/7] Update docs/design_docs/search_design_doc.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- docs/design_docs/search_design_doc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/design_docs/search_design_doc.md b/docs/design_docs/search_design_doc.md index 65c85e3..96c0372 100644 --- a/docs/design_docs/search_design_doc.md +++ b/docs/design_docs/search_design_doc.md @@ -21,7 +21,7 @@ $$ d^* = \arg\max_{d \in \mathcal{D}} f(q, d) $$ -Note at this stage we want to prioritizes high recall and computational efficiency. +Note at this stage we want to prioritize high recall and computational efficiency. In the second stage, **reranking**, the retrieved candidates $\mathcal{D}_K$ are re-evaluated using a more expressive (and often computationally expensive) relevance model $g(q, d)$. The goal is to refine the initial ordering by more precisely estimating relevance: From 6a26f964e4df623e4da30a285f108aae6ae11de3 Mon Sep 17 00:00:00 2001 From: Tek Raj Chhetri <52251022+tekrajchhetri@users.noreply.github.com> Date: Thu, 26 Feb 2026 16:43:37 -0500 Subject: [PATCH 7/7] Update docs/design_docs/search_design_doc.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- docs/design_docs/search_design_doc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/design_docs/search_design_doc.md b/docs/design_docs/search_design_doc.md index 96c0372..3d9c78b 100644 --- a/docs/design_docs/search_design_doc.md +++ b/docs/design_docs/search_design_doc.md @@ -81,7 +81,7 @@ The implementation will prioritize a hybrid retrieval and reranking approach, co - Lù, X.H., 2024. Bm25s: Orders of magnitude faster lexical search via eager sparse scoring. arXiv preprint arXiv:2407.03618. -- ha, R., Wang, B., Günther, M., Mastrapas, G., Sturua, S., Mohr, I., Koukounas, A., Wang, M.K., Wang, N. and Xiao, H., 2024, November. Jina-colbert-v2: A general-purpose multilingual late interaction retriever. In Proceedings of the Fourth Workshop on Multilingual Representation Learning (MRL 2024) (pp. 159-166). +- Jha, R., Wang, B., Günther, M., Mastrapas, G., Sturua, S., Mohr, I., Koukounas, A., Wang, M.K., Wang, N. and Xiao, H., 2024, November. Jina-colbert-v2: A general-purpose multilingual late interaction retriever. In Proceedings of the Fourth Workshop on Multilingual Representation Learning (MRL 2024) (pp. 159-166). - Zhang, Y., Li, M., Long, D., Zhang, X., Lin, H., Yang, B., Xie, P., Yang, A., Liu, D., Lin, J. and Huang, F., 2025. Qwen3 embedding: Advancing text embedding and reranking through foundation models. arXiv preprint arXiv:2506.05176.