Revolutionary RAG Technology: Store document locations directly in vector databases for unprecedented citation accuracy and retrieval precision.
Tired of RAG systems that can't tell you where their information comes from? i-RAG solves the fundamental problem of citation accuracy in RAG by embedding document locations alongside content.
- Lost Citations: Standard RAG chunks documents arbitrarily, making it impossible to provide precise source locations
- Hallucinated Sources: Systems claim information comes from "page 5" when they don't actually track page numbers
- Slow Reasoning-Based Alternatives: Solutions like VectifyAI/PageIndex sacrifice speed for accuracy
- Citation Gaps: Critical limitations exposed in recent research
i-RAG introduces paragraph-level indexing with multi-question-based embeddings - a fundamentally better approach that addresses all major RAG limitations while maintaining lightning-fast retrieval.
We store multiple embeddings per paragraph based on AI-generated questions and the original paragraph text. If each embedding is stored with its text, the storage space used increases. Storing text locations helps in precise citations including file name, page number, and line number without needing to store the entire text multiple times.
- Exact Location Tracking: Every retrieved result includes document URL, page number, and line number
- Source Transparency: No more guessing - know exactly where your AI's information comes from
- Academic-Grade Citations: Perfect for research, legal, and compliance applications
- Solves Citation Accuracy Issues
- Future-Proof Architecture: Built to handle the next generation of citation requirements
- Faster than Reasoning-Based RAG: I-RAG delivers speed while maintaining accuracy
- Multiple Retrieval Pathways: Question-based embeddings create numerous entry points per paragraph. Duplicate or consecutive chunks can be merged to optimize context for accurate question-answering.
- Lightweight Setup: No need for complex reasoning models or extensive infrastructure
- Scalable Architecture: Handles large document collections with ease
- Python 3.8+
- Pinecone account
- API keys for Cohere and OpenAI
git clone https://github.com/Pro-GenAI/Index-RAG
cd Index-RAG
pip install -e .
cp .env.example .env
# Configure your API keys in .env# Host the embedding models
python index_rag/host_models.py &
# Ingest documents with precise location tracking
python -c "from index_rag.utils.ingestion import ingest_document; ingest_document('your-document.pdf')"
# Start the RAG API server for an OpenAI-compatible API
python index_rag/utils/server.py &import openai
client = openai.OpenAI(
api_key="dummy",
base_url="http://localhost:8001/v1"
)
response = client.chat.completions.create(
model="RAG-app",
messages=[{"role": "user", "content": "What is compound interest?"}]
)
print(response.choices[0].message.content)
# Sample output: "According to Investopedia (investopedia.pdf, page 12, line 45),
# compound interest is the interest on a loan or deposit calculated based ..."| Feature | i-RAG | Traditional RAG | Reasoning-Based RAG |
|---|---|---|---|
| Citation Accuracy | β Exact (URL + Page + Line) | β Approximate | β Exact |
| Retrieval Speed | β Fast | β Fast | β Slow |
| Setup Complexity | β Simple | β Simple | β Complex |
| Scalability | β High | β High |
- Academic Research: Cite sources with surgical precision
- Legal Applications: Track document provenance exactly
- Financial Analysis: Provide investment advice with source verification
- Medical Documentation: Reference exact locations in medical literature
- Compliance Systems: Audit trails with document coordinates
- Educational Platforms: Teach with verifiable source material
- Paragraph-Level Processing: Natural document segmentation
- Question Generation: LLM-powered question creation per paragraph
- Multi-Vector Storage: Pinecone with text location metadata
- OpenAI-Compatible API: Drop-in replacement for existing applications
- FastAPI Backend: High-performance model serving
- PDF documents with page and line number tracking
- Extensible to other document types
- Metadata preservation for all document properties
- Rapid Deployment: Get citation-accurate RAG in minutes, not weeks
- Cost Effective: No expensive reasoning models required
- Scalable: Grows with your document collection
- Compliance Ready: Perfect for regulated industries requiring source verification
- Audit Trails: Complete provenance tracking for all AI responses
- Integration Friendly: OpenAI-compatible API works with existing tools
- Citation Precision: Academic-grade source attribution
- Reproducible Results: Exact location tracking enables verification
- Benchmark Ready: Superior performance on citation-aware evaluations
- β Star this repository
- π Read the documentation
- π Deploy your first citation-accurate RAG system
- π€ Share your success stories
i-RAG: Because AI should never have to say "I don't know where that came from."
Built with β€οΈ for the future of trustworthy AI systems

