A RAG (Retrieval-Augmented Generation) system built without any vector database or embeddings — using Google Gemini + PageIndex instead.
Traditional RAG pipelines follow this pattern:
Chunk documents → Embed into vectors → Store in Vector DB → Query by similarity search
This project challenges that assumption. Instead of embedding-based retrieval, it uses PageIndex to index document pages directly. At query time, Gemini reasons over the indexed pages to find and synthesize relevant information — no embeddings, no ANN (approximate nearest neighbor) lookup.
vectorless_rag/
├── PageIndex_Vectorless_RAG.ipynb # Main notebook
├── attention_all_you_need.pdf # Sample document (Attention Is All You Need)
└── .gitignore
- Load a PDF document (e.g., Attention Is All You Need paper)
- Index pages using PageIndex — no embeddings generated
- Query using natural language
- Gemini reasons over the indexed pages and returns a synthesized answer
- No vector DB setup or maintenance overhead
- No embedding model needed — reduces infra cost and latency
- Simpler pipeline: fewer moving parts = easier to debug
- Works well for structured/paginated documents (PDFs, reports)
- Faster to prototype and deploy
- Google Gemini is free to use 😂
- Scales differently — retrieval is not O(log n) like ANN search
- Less effective for large unstructured corpora where semantic similarity shines
- Dependent on Gemini's reasoning quality for relevance judgment
- PageIndex is optimized for document-style inputs; less flexible for arbitrary text chunks
- Not a drop-in replacement for vector RAG in all use cases
- Python 3.12
- Google Gemini API key (free at Google AI Studio)
- Jupyter Notebook
git clone https://github.com/spylovec2/vectorless_rag.git
cd vectorless_rag
pip install -U pageindex google-generativeai python-dotenvGEMINI_API_KEY = os.getenv("GEMINI_API_KEY")| Tool | Purpose |
|---|---|
| Google Gemini | LLM for reasoning & answer generation |
| PageIndex | Document page indexing without vectors |
| Jupyter Notebook | Interactive development environment |
| Python | Core language |
The repo includes the "Attention Is All You Need" paper (attention_all_you_need.pdf) as a sample document to test the RAG pipeline against.
- Inspired by Krish Naik's video on RAG pipelines
- Sample document: Attention Is All You Need — Vaswani et al., 2017
If you find this interesting or have feedback, feel free to open an issue or reach out on LinkedIn.
⭐ Star this repo if you found it useful!