AegisRAG is a Query-Adaptive Dynamic Retrieval-Augmented Generation (RAG) framework designed to improve contextual relevance and retrieval efficiency for PDF-based question answering.
Unlike traditional RAG systems that use a fixed retrieval strategy for every query, AegisRAG first classifies the user's intent and dynamically adapts retrieval depth and context selection to generate more accurate and context-aware answers.
The system leverages:
- Semantic Search
- Query Classification
- Dynamic Retrieval Strategies
- FAISS Vector Database
- Large Language Models (LLMs)
- Streamlit-Based Interactive Interface
🔗 Deployment: AegisRAG Live Demo
Upload a PDF and ask questions in natural language to receive context-aware responses.
- Upload PDF documents
- Automatic text extraction
- Intelligent document chunking
- Embedding generation
- Semantic indexing
Automatically classifies queries into:
- 📌 Factual Questions
- 📖 Summarization Requests
- ⚖️ Comparison Queries
Instead of using a fixed retrieval depth:
Factual Query
↓
Retrieve Few Highly Relevant Chunks
Summarization Query
↓
Retrieve Larger Context Window
Comparison Query
↓
Retrieve Context From Multiple Sections
This improves retrieval efficiency while reducing retrieval noise.
- Embedding-based retrieval
- Context-aware search
- Meaning-based matching
- Vector similarity search using FAISS
- Context-grounded responses
- Reduced hallucinations
- Improved factual accuracy
- Better contextual relevance
- Stores previous conversations
- Tracks query classifications
- Displays retrieval statistics
flowchart TD
A[PDF Upload] --> B[Text Extraction]
B --> C[Text Chunking]
C --> D[Embedding Generation]
D --> E[FAISS Vector Store]
F[User Query] --> G[Query Classification]
G --> H[Factual]
G --> I[Summarization]
G --> J[Comparison]
H --> K[Adaptive Retrieval]
I --> K
J --> K
E --> K
K --> L[Retrieved Context]
L --> M[LLM Response Generation]
M --> N[Final Answer]
Upload research papers, reports, manuals, or any PDF document for semantic analysis.
Ask questions directly from uploaded documents using natural language.
The system automatically determines the query category and selects the appropriate retrieval strategy.
Displays the most relevant chunks retrieved from the document along with similarity scores.
Generates grounded answers using retrieved contextual information.
Track previous queries, retrieval details, and generated responses.
User Query
↓
Fixed Retrieval
↓
LLM
↓
Answer
- Retrieval Noise
- Static Context Window
- Irrelevant Chunks
- Poor Adaptability
- Fixed Retrieval Depth
User Query
↓
Query Classification
↓
Adaptive Retrieval Strategy
↓
Semantic Retrieval
↓
LLM Generation
↓
Context-Aware Answer
✅ Better Context Relevance
✅ Reduced Hallucinations
✅ Adaptive Retrieval Depth
✅ Improved Retrieval Efficiency
✅ Query-Aware Context Selection
✅ Higher Answer Quality
- Dynamic retrieval selection based on query intent
- Reduction of retrieval noise
- Adaptive Top-K retrieval
- Efficient semantic PDF search
- Context-aware answer generation
- Lightweight Dynamic RAG implementation
- Streamlit
- Python
- FAISS
- Sentence Transformers
- LangChain
- Hugging Face Embeddings
- Large Language Models (LLMs)
- PyPDF
- Recursive Character Text Splitter
- FAISS Similarity Search
AegisRAG/
│
├── src/
├── tests/
├── web/
│
├── app.py
├── web_app.py
├── requirements.txt
├── pyproject.toml
├── Dockerfile
├── README.md
│
├── assets/
│ ├── architecture.png
│ ├── AegisRAG_1_Home_Upload_PDF.png
│ ├── AegisRAG_2_Ask_Question.png
│ ├── AegisRAG_3_Query_Classification.png
│ ├── AegisRAG_4_Retrieved_Context.png
│ ├── AegisRAG_5_Generated_Answer.png
│ └── AegisRAG_6_Chat_History.png
│
└── README.mdgit clone https://github.com/YOUR_USERNAME/AegisRAG.git
cd AegisRAGpip install -r requirements.txtstreamlit run app.py| Metric | Traditional RAG | AegisRAG |
|---|---|---|
| Query Awareness | ❌ | ✅ |
| Retrieval Depth | Fixed | Dynamic |
| Context Selection | Static | Adaptive |
| Retrieval Noise | High | Reduced |
| PDF QA Performance | Moderate | Improved |
| Context Relevance | Medium | High |
- Retrieval-Augmented Generation (RAG)
- Dynamic RAG
- Semantic Search
- Vector Databases
- FAISS
- LangChain
- Large Language Models
- NLP
- Information Retrieval
- Prompt Engineering
- Streamlit
- Python
- AI Application Development
- Multi-PDF Retrieval
- Hybrid Search (BM25 + Vector Search)
- Agentic RAG Workflow
- Web Search Integration
- Citation Generation
- Reranking Models
- Multimodal RAG
- Knowledge Graph Integration
- Real-Time Information Retrieval
- Joshita Bhattacharyya
- Rohan Roy
- Arunabho Garai
Developed as part of the Bachelor of Technology Degree Program.
AegisRAG introduces a query-adaptive Dynamic RAG framework that improves contextual relevance and retrieval efficiency for PDF-based question answering systems through adaptive retrieval strategies and query-aware retrieval mechanisms.
If you found this project useful:
⭐ Star the repository
🍴 Fork the project
🛠️ Contribute improvements
📢 Share it with others






