Multimedia RAG with Big-Data Analytics

Заказчик: AI | Опубликовано: 27.02.2026

I am building a production grade, enterprise ready retrieval augmented generation platform designed to ingest, index, retrieve, reason over, and continuously optimize large scale document corpora, initially focused on PDFs but architected for expansion, using a layout aware hierarchical processing pipeline that analyzes document structure via statistical font mode detection to prevent table of contents poisoning and preserve true section boundaries, then generates cost efficient heuristic summaries combined with extracted TF IDF concepts to create abstract first representations that reduce embedding cost while maintaining semantic fidelity. These enriched section level chunks are embedded using Sentence Transformers MiniLM and stored in a Pinecone first vector infrastructure with automatic FAISS fallback to ensure cloud redundancy and local resilience, enabling dense similarity search as the first retrieval stage, followed by cross encoder reranking using MS MARCO MiniLM over full text content to dramatically improve precision, after which adjacent section packing reconstructs narrative continuity before passing curated context into a citation aware LLM routing layer that prioritizes Gemini, OpenAI, then Anthropic, then Ollama local models, enforcing context bound generation and preventing hallucination outside retrieved evidence. Indexing is parallelized using ProcessPoolExecutor for efficient multi core utilization and automatically scales to distributed ingestion via PySpark when corpus size exceeds a configured threshold, enabling safe handling of 20k plus documents or 50GB class corpora, while the system is wrapped in a full MLOps backbone that integrates MLflow for experiment tracking of retrieval metrics, PPO reinforcement learning rewards, and parameter tuning, exposes Prometheus metrics for latency and retrieval monitoring compatible with Grafana dashboards, and supports Airflow DAG orchestration for scheduled indexing and policy training workflows. Reinforcement learning is implemented using a PyTorch based PPO policy network that treats retrieval selection as an action space, assigns rewards based on relevance heuristics, updates via policy gradients, and logs training metrics for continuous optimization, positioning the system not merely as a static RAG but as an adaptive retrieval intelligence engine. All components are configuration driven, CLI operable, fail safe with retry logic and thread safe writes, and designed to spin up reproducibly in a clean environment, resulting in a scalable, observable, cloud resilient, and extensible knowledge reasoning platform that balances cost control, structural awareness, retrieval precision, distributed scalability, and continuous learning within a single cohesive architecture. I want someone to have a look at the code, make necessary changes , fix any issues and send the updated code back to me.