AI-Powered Document Intelligence with Multi-LLM Orchestration — routing queries intelligently across Gemini, Groq & OpenRouter with a RAG backbone.
Working through large research PDFs and technical documents, I kept hitting the same wall: no single LLM was reliably best at everything. Gemini excelled at structured multi-step reasoning, Groq was blazing fast for quick factual lookups, and OpenRouter models offered the best creative synthesis. Manually switching between tools destroyed the flow.
The deeper problem: LLMs hallucinate badly on questions about specific documents they haven't seen. Every answer needed to be grounded in retrieved context — not fabricated from training weights. The solution required combining RAG for document grounding with intelligent query routing to dispatch each question to its optimal model.
NeuraFlow uses a two-stage pipeline: a RAG layer that grounds every response in retrieved document chunks, followed by a routing layer that dispatches queries to the optimal LLM based on query type, latency budget, and cost.
The Query Router classifies each query into factual lookup, analytical reasoning, or creative synthesis — then dispatches to the appropriate LLM. Simple lookups hit Groq at 120ms; complex reasoning flows to Gemini Flash; creative tasks go to OpenRouter. Cost and quality are both optimised automatically.
I shipped the router before defining a proper evaluation suite. Next time I'd write the benchmark questions and scoring criteria before writing a single line of pipeline code.
Large 1000-token chunks caused context overflow and retrieval noise. Smaller, semantically coherent chunks with 20% overlap improved precision more than any model swap.
Re-embedding on every restart added a 15-second penalty. Persisting ChromaDB to disk cut cold-start from 15s to under 2 seconds — a 7× improvement with one config flag.
Early beta users didn't trust answers without provenance. Adding chunk-level citations with page numbers dramatically increased engagement and reported confidence.
The full demo is deployed on Streamlit — upload any PDF and interrogate it across four LLMs simultaneously.