______ ___ __ ____ __
/ ____/________ _____/ (_)__ ____ / /_/ __ \__ _______/ /_
/ / __/ ___/ __ `/ __ / / _ \/ __ \/ __/ /_/ / / / / ___/ __ \
/ /_/ / / / /_/ / /_/ / / __/ / / / /_/ _, _/ /_/ (__ ) / / /
\____/_/ \__,_/\__,_/_/\___/_/ /_/\__/_/ |_|\__,_/____/_/ /_/
Next-Generation Cross-Modal Graph RAG for Technical Architecture & Distributed Systems
Bridging Video Frames, Speech Transcripts, System Architecture Diagrams, and Technical PDFs into an Interconnected Knowledge Graph.
- π Executive Summary
- π― The Problem: Modality Blindness in Traditional RAG
- π System Architecture & Workflow
- π¬ Core Concepts & Technical Deep Dive
- π Benchmark Engine & Baseline Comparison
- π» Tech Stack
- π Quickstart & Installation
- π§ͺ Automated Test Suite
- β¨ Key Specialities & Innovations
- π Closing Message
GradientRush is an enterprise-grade Multimodal Knowledge Engine engineered to ingest, cross-link, index, and retrieve insights from complex, heterogeneous technical media:
- Recorded Video Presentations & System Architecture Walkthroughs
- Spoken Audio & Engineer Discussions (Whisper ASR with word-level timestamps)
- Architecture Diagrams, Flowcharts & Slide Visuals (Vision OCR & Visual Semantics)
- Technical Whitepapers, Documentation & System Specifications (PyMuPDF layout extraction)
Rather than treating documents and videos as isolated silos, GradientRush maps every piece of evidence into an interconnected cross-modal graph. When an engineer queries the engine, it performs balanced vector retrieval, traverses temporal and semantic relationships, and synthesizes an authoritative answer with exact provenance (second-level timestamps, page numbers, and high-resolution visual evidence previews).
Standard Retrieval-Augmented Generation (RAG) systems suffer from critical failure modes when dealing with technical content:
- Modality Blindness: Text-only RAG completely ignores visual diagrams (e.g. multi-leader network splits, write-ahead log flows, failover state machines).
- Temporal Disconnect: Audio transcripts often say "as shown in this diagram here" without preserving the exact visual frame shown at that exact second.
- Context Dilution / Token Flooding: Naive relationship expansion can balloon 5 retrieval results into 100+ candidates, diluting LLM prompts and exploding API costs.
- Misleading Confidence: Systems displaying arbitrary "100% Confidence" labels without rigorous vector geometric backing.
GradientRush solves all four challenges from first principles.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β INGESTION LAYER β
β Video (FFmpeg) β Speech (Whisper) β Vision (OCR) β PDFs (PyMuPDF) β
ββββββββββ¬ββββββββββββββββββ¬ββββββββββββββββββββ¬ββββββββββββββββββββ¬βββββββββ
β β β β
βΌ βΌ βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CROSS-MODAL GRAPH CONSTRUCTION β
β β’ Dense 384-d Embeddings (SentenceTransformers all-MiniLM-L6-v2) β
β β’ Temporal Alignment (15s frame <-> speech co-occurrence window) β
β β’ Semantic Entity Linking (shared architectural concepts) β
ββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β POSTGRESQL + PGVECTOR DATABASE β
β β’ Evidence Table (Vector HNSW Index, Timestamp, Modality, Page) β
β β’ EvidenceRelationship Table (TEMPORALLY_ALIGNED, SAME_TOPIC) β
ββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β TARGETED RETRIEVAL PIPELINE β
β 1. Balanced Multi-Source Vector Search (Top 5 Candidates) β
β 2. 1-Hop Graph Traversal (Expands ~61 Candidates) β
β 3. Strict Evidence ID Deduplication β
β 4. Modality Diversity Reranking (Frame + Speech + PDF Quotas) β
β 5. Top 12-15 Candidate Pruning & Hop-Penalty Scoring β
ββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MULTIMODAL SYNTHESIS & UI β
β β’ Multi-Tier Gemini 2.5 Flash / Flash Lite LLM Fallback Pool β
β β’ Grounded Answer with Second-by-Second Video Timestamps β
β β’ High-Resolution Frame Image Previews & Exact Page Deep-Links β
β β’ Calibrated 7-Tier Confidence Badges (Full -> Zero) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Video Ingestion (
video.py): Uses FFmpeg to perform scene-change and periodic keyframe sampling (every 10 seconds), generating high-resolution JPG frames stored in/data/frames/. - Audio Ingestion (
audio.py): Extracts audio tracks and processes them through OpenAI Whisper to produce word-level timestamps and time-stamped speech segments. - Image OCR & Vision Ingestion (
image.py): Performs vision-language visual semantic parsing and layout OCR to convert visual diagrams into rich semantic text descriptions. - Document Ingestion (
pdf.py): Employs PyMuPDF to extract structured, page-tagged text blocks while preserving section hierarchy.
All ingested chunks are projected into a normalized 384-dimensional dense semantic vector space using sentence-transformers/all-MiniLM-L6-v2. Vectors are stored in PostgreSQL using the pgvector extension with an HNSW cosine distance index for millisecond search latency.
GradientRush constructs two fundamental cross-modal edge types:
-
TEMPORALLY_ALIGNED: Bi-directional link between speech utterances and video frames captured within the same 15-second time window ($|t_{\text{frame}} - t_{\text{speech}}| \le 15s$ ). -
SAME_TOPIC: Cross-modal semantic link established when entities extracted from a document section overlap with entities visually present in a frame or discussed in a transcript.
To prevent prompt flooding and evidence dilution, GradientRush implements an optimized retrieval pipeline:
-
Hop Penalties: Direct Retrieval (
$+0.0$ ),TEMPORALLY_ALIGNED($+0.06$ ),SAME_TOPIC($+0.10$ ). - Modality Quotas: Guarantees balanced representation across Video Frames, Transcripts, and PDF Documentation.
- Token Savings: Reduces LLM prompt tokens by over 75% while boosting synthesis quality.
Unlike systems that display misleading static "100% confidence" numbers, GradientRush maps true vector cosine distance (
| Confidence Tier | Cosine Distance ( |
Cosine Similarity ( |
Grounding Semantic |
|---|---|---|---|
| Full | Verbatim quote or identical semantic match | ||
| Very High | Core architectural topic match & direct answer | ||
| High | Highly relevant visual frame, diagram, or speech chunk | ||
| Moderate | Supporting context / 1-hop graph relationship expansion | ||
| Low | Broad contextual or peripheral mention | ||
| Very Low | Distant semantic association | ||
| Zero | Unrelated background noise |
GradientRush includes a dedicated Benchmark Engine accessible at /compare that executes real-time side-by-side queries against a conventional Text-Only RAG Baseline:
ββββββββββββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββ
β Multimodal Graph RAG (Ours) β Text-Only RAG Baseline β
ββββββββββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββ€
β β
Retrieves visual diagrams (split-brain β β Fails on visual-specific questions β
β slashed-globe leader failure icon) β (contains no diagram understanding) β
β β
Preserves second-level video timestamps β β Lacks temporal cross-modal alignment β
β β
Full 1-hop graph relationship context β β Missing graph-expanded context β
β β
High accuracy cross-modal synthesis β β Hallucinates or reports "insufficient" β
ββββββββββββββββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββ
| Layer | Technologies |
|---|---|
| Frontend | React 19, Vite 8.2, React Router v7, Lucide Icons, Pure Vanilla CSS |
| Backend API | FastAPI, Uvicorn, SQLAlchemy 2.0 (Async), Pydantic v2 |
| Database | PostgreSQL 16, pgvector (Dense Vector HNSW Indexing), SQLite fallback |
| AI & Embeddings | SentenceTransformers (all-MiniLM-L6-v2), PyTorch, Google Gemini 2.5 Flash |
| Media Processing | FFmpeg, OpenAI Whisper (ASR), PyMuPDF (PDF Parser), PIL |
| Authentication | Google Firebase Authentication, Scoped Multi-Tenant Workspace Contexts |
| Testing | Pytest, Pytest-Asyncio, HTTPX AsyncClient (18/18 Unit & Integration Tests) |
- Python 3.10+
- Node.js 18+ and npm
- PostgreSQL with
pgvectorextension enabled (or Docker) - FFmpeg installed (
brew install ffmpegon macOS orapt install ffmpegon Linux)
git clone https://github.com/soelnvc/GradientRush.git
cd GradientRush# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r backend/requirements.txt
# Configure environment variables
cp .env.example .env
# Fill in GEMINI_API_KEY and DATABASE_URL in .env
# Start FastAPI backend server
python -m uvicorn backend.app.main:app --host 0.0.0.0 --port 8000 --reload# In a new terminal window
cd frontend
# Install frontend dependencies
npm install
# Start Vite development server
npm run devOpen your browser and navigate to:
- Dashboard & Ingestion: http://localhost:5174/
- Media Library & Source Detail: http://localhost:5174/sources
- Query Engine: http://localhost:5174/query
- Benchmark & Comparison: http://localhost:5174/compare
- FastAPI Interactive Docs (Swagger): http://localhost:8000/docs
GradientRush includes an end-to-end automated test suite covering embedding generation, vector search precision, API contracts, negative grounding, and error handling.
Run all tests via pytest:
source venv/bin/activate
PYTHONPATH=. pytest backend/tests/ -v============================= test session starts ==============================
backend/tests/test_embeddings.py::test_embedding_generation PASSED [ 5%]
backend/tests/test_embeddings.py::test_multiple_embeddings_distinct PASSED [ 11%]
backend/tests/test_embeddings.py::test_evidence_integrity_in_database PASSED [ 16%]
backend/tests/test_error_handling.py::test_empty_query_rejected PASSED [ 22%]
backend/tests/test_error_handling.py::test_invalid_limit_rejected PASSED [ 27%]
backend/tests/test_error_handling.py::test_malformed_request_body PASSED [ 33%]
backend/tests/test_error_handling.py::test_very_long_query_handled_gracefully PASSED [ 38%]
backend/tests/test_health.py::test_health_endpoint PASSED [ 44%]
backend/tests/test_health.py::test_database_connection PASSED [ 50%]
backend/tests/test_health.py::test_pgvector_extension PASSED [ 55%]
backend/tests/test_health.py::test_embedding_column_dimension PASSED [ 61%]
backend/tests/test_query_api.py::test_query_api_contract_success PASSED [ 66%]
backend/tests/test_query_api.py::test_query_api_speech_multimodal_evidence PASSED [ 72%]
backend/tests/test_query_api.py::test_unknown_questions_grounding PASSED [ 77%]
backend/tests/test_vector_search.py::test_vector_search_execution PASSED [ 83%]
backend/tests/test_vector_search.py::test_vector_search_top_k_respected PASSED [ 88%]
backend/tests/test_vector_search.py::test_vector_search_no_duplicates PASSED [ 94%]
backend/tests/test_vector_search.py::test_vector_search_empty_query PASSED [100%]
======================= 18 passed, 6 warnings in 38.27s ========================
- True Cross-Modal Alignment: Unlike standard chunking, video frames are indexed with their exact visual geometry and synchronized to speech timestamps within a 15-second multi-modal window.
- Auto-Growing Query Box & Responsive Pinning: Seamless Apple-grade user interface with auto-resizing textareas and top-aligned submission controls.
- Click-to-Expand Provenance Cards: Click any evidence card to reveal un-clamped text, cosine distance, vector similarity, confidence tier, and high-resolution frame screenshots.
- Multi-Tenant Workspace Contexts: Create isolated project workspaces (or query globally) with scoped data privacy and Google OAuth integration.
- Multi-Tier LLM Fallback Pool: Automatic 5-tier failover across Gemini 2.5 Flash, Flash-Lite, and 1.5 Pro to ensure uninterrupted query synthesis.
- Desaturated Apple Aesthetics: Monochromatic, minimalist typography with clean translucent cards designed for maximum readability during long technical review sessions.
"True understanding of complex distributed systems cannot happen in text alone. When an engineer draws a architecture diagram on a whiteboard or presents a slide showing replica failover, that visual evidence is the ground truth. GradientRush was built to ensure that no diagram is forgotten, no timestamp is lost, and every synthesis is backed by incontrovertible cross-modal proof."
Built with β€οΈ for the Hackathon by Team The House of Scaler
β Star us on GitHub β