RAGzilla
Advanced Bilingual Medical RAG System
Secure, accurate, and verified medical information extraction eliminating the risk of LLM hallucinations.
The Challenge
Extracting reliable and verified information from complex medical documents is highly difficult. Utilizing general LLMs poses a severe risk of "Hallucinations" in critical healthcare contexts.
The Solution
We built a robust, bilingual (Arabic & English) Retrieval-Augmented Generation (RAG) system engineered from the ground up to ensure high accuracy, clinical relevance, and maximum security.
Mechanism & Safety
The system ingests and indexes medical PDFs, retrieving highly relevant text alongside exact citations. A strict internal "Refusal Logic" mechanism prevents the model from answering out-of-scope questions.
Business Problem & Solution
Verified Data Sources
Relied exclusively on highly trusted reference documents, including 3 medical PDFs issued by the World Health Organization (WHO) and official blood pressure treatment guidelines. Total processed corpus: 404 pages.
Smart Chunking
Texts were meticulously prepared for accurate semantic search. We utilized a chunk size of 1,500 characters with a 200-character overlap, employing custom text separators specifically designed to support Arabic punctuation.
Vector Embedding
Text chunks were converted into dense semantic vectors consisting of 384 dimensions. We applied an L2-normalized strategy to the vectors to guarantee the absolute accuracy of cosine similarity measurements during retrieval.
Data Pipeline: Sources, Chunking & Embedding
Hybrid Search Strategy Combines the power of Semantic Search (utilizing ChromaDB and FAISS vector databases) with exact Keyword Search (using the BM25 algorithm) to achieve the highest possible retrieval accuracy.
High-Speed LLM Inference Powered by an advanced language model accessed via the ultra-fast Groq API, allowing the system to process complex medical queries in both Arabic and English with unmatched agility and flexibility.
Strict Generation Parameters Operating at a low Temperature (0.1) to ensure realistic, factual, and direct answers. Supported by a 3-layer refusal mechanism to verify contextual relevance before any text generation occurs.
Retrieval Engine & LLM Architecture
The goal of this evaluation is to test search and retrieval quality across four experiments (using ChromaDB & FAISS with K values of 3 and 5), to determine optimal accuracy in fetching correct information.
* The table demonstrates the superiority of the ChromaDB configuration at K=5 across most key metrics, particularly in Recall and NDCG.
Configuration | Vector DB | K-Value | Precision@K | Recall@K | MRR | NDCG@K |
Chroma K=3 | ChromaDB | 3 | 0.167 | 0.167 | 0.200 | 0.200 |
Chroma K=5 ⭐ | ChromaDB | 5 | 0.190 | 0.303 | 0.238 | 0.275 |
FAISS K=3 | FAISS | 3 | 0.150 | 0.150 | 0.233 | 0.250 |
FAISS K=5 | FAISS | 5 | 0.140 | 0.227 | 0.246 | 0.270 |
System Evaluation & Key Indicators
Test case