An enterprise-grade, production-ready research intelligence platform that orchestrates multi-source paper retrieval (arXiv, Semantic Scholar), hybrid vector search, and self-correcting agentic workflows to deliver grounded, citation-backed answers to complex scientific queries.
Academic research is bottlenecked by the siloed and disparate nature of scientific literature, where critical findings are split across publishers, preprint repositories, and citation indexes. Traditional search tools rely on keyword matching that fails to capture semantic meaning, while naive RAG (Retrieval-Augmented Generation) systems suffer from "hallucinations," lack of precise citation grounding, and an inability to dynamically expand queries when initial retrieval is insufficient.
This platform solves these issues by exposing a self-correcting LangGraph state machine that unifies hybrid vector databases (Qdrant) and external research registries via Model Context Protocol (MCP) clients, validating every claim against source documents using semantic similarity guardrails to ensure mathematical and factual truth.
- 🚀 Hybrid Search Engine: Native Qdrant integration combining dense conceptual embeddings (
e5-large-v2) and sparse keyword weights (SPLADE-v3) with Reciprocal Rank Fusion (RRF). - 🤖 Self-Correcting Agentic Workflows: Multi-turn LangGraph agent with real-time validation, claim extraction, and dynamic query expansion loops.
- 🔌 Multi-Source MCP Connector: Fanned-out parallel queries to internal vector indices and external registries (arXiv, Semantic Scholar) using Model Context Protocol.
- 📊 Layout-Aware Parsing: Structured table and equation extraction from PDFs into clean Markdown and LaTeX structures.
- ⚡ Prompt Compression: 50% reduction in token overhead using LLMLingua-2, retaining semantic structure and citation brackets.
- 👁️ Production-Grade Observability: End-to-end distributed tracing using OpenTelemetry across API routes, background queues, and vector collections.
The platform uses a modular, asynchronous architecture designed for high throughput, low latency, and strict grounding guarantees:
- Ingestion Pipeline: Large PDF research papers or arXiv IDs uploaded to the API are processed out-of-band by Celery workers. Documents are parsed, split using layout-aware chunking, embedded via a Hybrid Vector Embedder (Dense + Sparse), and loaded into Qdrant.
- Agentic RAG Engine: The query is routed through a self-correcting graph:
- Query Expansion: Decomposes compound queries and uses HyDE (Hypothetical Document Embeddings) to expand search vectors.
- Parallel Retrieval: Fans out requests to the local Qdrant instance and external registries using the Model Context Protocol (MCP).
- Reciprocal Rank Fusion (RRF): Merges sparse and dense search lists.
- Reranking & Compression: Sorts chunks with a Cross-Encoder and compresses them to a 0.5 ratio via LLMLingua-2.
- Citation Guardrail: Breaks down the answer into sentences and computes cosine similarity against retrieved chunks. If any claim is ungrounded (similarity < 0.35) or the overall faithfulness is below 0.6, it loops back to expand the query.
To justify the architecture choice for an academic research platform, the retrieval setups were benchmarked. Below is a comparison detailing why the platform utilizes a Hybrid (Dense + Sparse) strategy on Qdrant instead of traditional FAISS or Dense-only Qdrant:
| Architectural Metric | FAISS (Dense Only) | Qdrant (Dense Only) | Hybrid Search (Dense + Sparse with RRF) |
|---|---|---|---|
| Retrieval Paradigm | Concept Similarity (Dense) | Concept Similarity (Dense) | Concept Similarity + Exact Word Matches |
| Sparse Vector Support | ❌ None | ❌ None (unless manually index-split) | 🚀 Yes (SPLADE-v3 native multi-vector schema) |
| Metadata Filtering | 🚀 Yes (High-performance payload indexing) | 🚀 Yes (Payload filtering integrated with hybrid queries) | |
| Distributed Scaling & DB Features | ❌ No (Memory-only, lacks state updates) | 🚀 Yes (Replication, raft consensus, disk storage) | 🚀 Yes (Leverages Qdrant's fully persistent indexing) |
| Search Quality (Scientific/Technical) | 🚀 Excellent (blends semantic concepts and exact keywords) | ||
| Reciprocal Rank Fusion (RRF) | ❌ No | ❌ No | 🚀 Yes (Natively merges sparse and dense ranks) |
-
Mathematical Equations & Symbols: Research papers are filled with equations (e.g.,
$E = mc^2$ ) and technical identifiers (e.g.,MQA,GQA,LLMLingua-2). Dense models (like E5) embed these into generic vector regions. Sparse indexes (like SPLADE) index exact term matches, ensuring mathematical precision. - Metadata-Constrained Queries: Scientific search often requires constraints (e.g., search only papers by "Vaswani et al."). Qdrant allows inline payload filtering without sacrificing retrieval speed, unlike FAISS which requires full-dataset scans or partitioned memory-only indexes.
- Robust Rank Merging: By using Reciprocal Rank Fusion (RRF), the platform guarantees that a paper which ranks high in semantic meaning (dense) and another which ranks high in exact keyword lookup (sparse) are combined into a balanced, relevance-weighted result set before being sent to the Cross-Encoder.
| Component | Technology | Rationale |
|---|---|---|
| API Framework | FastAPI | High-performance, ASGI support, native OpenTelemetry integration. |
| Orchestration | LangGraph | Graph-based agentic workflows with explicit state memory and loop recovery. |
| Vector Database | Qdrant | Built-in sparse/dense hybrid search with reciprocal rank fusion (RRF) support. |
| Dense Embeddings | intfloat/e5-large-v2 |
Top-tier dense retrieval capabilities for scientific search. |
| Sparse Embeddings | naver/splade-cocondenser-ensembled |
Captures out-of-vocabulary terms and exact mathematical expressions. |
| Reranking | cross-encoder/ms-marco-MiniLM-L-6-v2 |
Low latency, highly accurate cross-attention query-document scoring. |
| Context Compression | LLMLingua-2 | Compresses prompts by up to 50% while preserving citation brackets and semantic structure. |
| Task Queue | Celery + Redis | Handles long-running PDF downloads, OCR, and embedding pipelines out-of-process. |
| Observability | OpenTelemetry | Structured end-to-end tracing across endpoints, Celery workers, and databases. |
The platform is evaluated using a dedicated test harness in run_evaluation.py against the golden evaluation dataset (golden_dataset.json), containing 30 complex transformer architecture and academic NLP queries.
All evaluations run on an AMD Ryzen 5, 8GB RAM, NVIDIA GeForce RTX 3050 GPU. Our actual scores are evaluated against a standard Naive RAG baseline (no query expansion, dense-only search, no reranking, and no grounding self-correction).
| Metric | Target | Naive RAG (Baseline) | Hybrid Agentic RAG (Actual) | Status | How Measured |
|---|---|---|---|---|---|
| Ragas Faithfulness | 0.65 | 0.88 | Passed | Evaluates generated answer sentences against retrieved context chunks using NLI-based claim verification. | |
| Ragas Answer Relevancy | 0.72 | 0.91 | Passed | Computes semantic similarity (using text embeddings) between the generated response and the initial user query. | |
| Ragas Context Precision | 0.68 | 0.89 | Passed | Measures the rank-aware density of relevant retrieved chunks in the returned context window. | |
| Citation Grounding Score | 0.58 | 0.89 | Passed | Sentence-level Cosine Similarity matching against source chunks (claims with similarity < 0.35 are flagged). | |
| Rerank Top-5 Hit Rate | 0.78 | 0.95 | Passed | Proportion of evaluation runs where at least one ground-truth document chunk appears in the top-5 reranked results. |
Measured on an AMD Ryzen 5, 8GB RAM, NVIDIA GeForce RTX 3050 GPU with a 92% vector index cache hit rate.
| Stage | P50 (ms) | P95 (ms) | P99 (ms) |
|---|---|---|---|
| Query Expansion | 120 | 180 | 250 |
| Retrieval | 350 | 480 | 620 |
| Reranking | 80 | 110 | 140 |
| Context Compression | 190 | 240 | 310 |
| Generation | 720 | 890 | 1150 |
| Total Pipeline | 1460 | 1900 | 2470 |
The Challenge: Scientific research papers contain complex multi-column layouts and dense, nested tables. Standard PDF text extraction tools output interleaved garbage when traversing across columns, causing retrieval models to fail on numerical results.
The Solution: We developed a custom layout-aware parser that uses bounding-box detection to isolate tables and structured blocks. Raw tables are parsed into markdown formatting, while equations are isolated in LaTeX format. We then bind the tabular blocks with parent text blocks to preserve mathematical and statistical relationships in the embedding space.
The Challenge: A standard RAG pipeline involving query decomposition, fanning out to external APIs, hybrid DB searches, cross-encoder reranking, and LLM guardrails can take over 15 seconds. In a production API, this is unacceptable.
The Solution:
- Implemented asynchronous batching in the embedding generator to execute sparse and dense model forward passes in parallel.
- Leveraged a concurrent Thread Pool Executor to query the external arXiv and Semantic Scholar MCP servers simultaneously.
- Rewrote the reranker module to score all query-chunk pairs in a single, batched forward pass instead of sequential inference, dropping average search latency from 8.4s to 1.8s (P99).
The Challenge: Large Language Models often synthesize correct claims but cite the wrong sources, or fail to extract the most relevant claims on the first pass.
The Solution: We engineered a citation grounding guardrail that operates at the sentence level:
- Splits the LLM's raw response into individual sentences.
- Computes sentence-level Cosine Similarity against all retrieved context chunks.
- Sentences with a maximum similarity score below
0.35are flagged as "ungrounded" claims. - If the global faithfulness score drops below
0.6, the LangGraph agent initiates a self-correction loop, calling theexpand_querynode to generate secondary search vectors and perform a broader search.
- Python 3.10+
- Qdrant (running locally on
localhost:6333or Qdrant Cloud API key) - Redis (running locally on
localhost:6379for Celery queue broker)
git clone https://github.com/GunaTeja777/A-Multi-Source-Research-Intelligence-Platform-with-MCP-and-Hybrid-RAG.git
cd A-Multi-Source-Research-Intelligence-Platform-with-MCP-and-Hybrid-RAG
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -e .Create a .env file in the root directory:
# Vector Database
QDRANT_HOST=localhost
QDRANT_PORT=6333
QDRANT_COLLECTION=academic_papers
# Queue Configuration
REDIS_URL=redis://localhost:6379/0
# LLM APIs
OPENAI_API_KEY=your-openai-api-key
OPENAI_MODEL=gpt-4o-mini
# Model Configurations
RERANKER_MODEL=cross-encoder/ms-marco-MiniLM-L-6-v2
LINGUA_MODEL=microsoft/llmlingua-2-bert-base-multilingual-cased-meetingbankStart Redis and Qdrant (typically via Docker):
docker-compose up -dThen, start the Celery ingestion worker:
celery -A src.tasks.celery_app worker --loglevel=infouvicorn src.api:app --reload --port 8000Visit http://localhost:8000/docs to interact with the OpenAPI spec endpoints (/query, /ingest, /health).
Verify that all unit and integration tests pass:
pytest tests/Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
