Back to Systems Showcase
AI & Data Engineering

Synapse: Semantic Vector RAG & Governance Engine

Enterprise LLM retrieval-augmented generation gateway with streaming latency optimization, PII sanitization, and vector cache.

Synapse: Semantic Vector RAG & Governance Engine
The Engineering Challenge

Problem & Root Cause

Internal teams faced high LLM inference costs and unverified hallucinations due to poor context chunking and duplicate semantic queries.

Architectural Solution

System Architecture Strategy

Architected a unified RAG proxy with hybrid dense-sparse vector search, semantic caching, and streaming token delivery with real-time prompt security filtering.

Core System Implementation

Detailed Architecture Overview

Client requests enter a Next.js App Router edge middleware that checks a cosine-similarity semantic vector cache in Redis before dispatching hybrid retrieval to Qdrant.

Critical Technical Highlights:

Semantic caching layer reducing duplicate embedding queries by 64%
Hybrid dense (vector) and sparse (BM25) re-ranking with cross-encoders
Real-time PII regex and prompt injection sanitization before model dispatch
Streaming SSE output with deterministic citation tracking

Personal Engineering Contribution:

Implemented the semantic cache algorithm, vector indexing pipeline, and Next.js frontend playground.

Verified Production Metrics

  • Reduced OpenAI monthly API spend by 58%
  • Achieved average retrieval response time under 180ms
  • Zero leakage of sensitive internal customer data across 800k queries

Edge Cases & Lessons Learned

Semantic cache invalidation when underlying documentation changed was solved via document version hashing and inverted vector indexes.

Applied Technologies & Tooling

Python / FastAPI(Backend)
Next.js 15(Frontend)
Qdrant Vector DB(Database)
Redis(Cache)
OpenAI API(AI)
Docker(DevOps)