Case Study

Workspace RAG

A 100% local, air-gapped hybrid retrieval engine combining semantic vectors and lexical search with zero-leakage security.

Client: Gnomad Studio
  • Python
  • ChromaDB
  • SQLite
  • Ollama
  • Firestore
  • rag
  • semantic-search
  • local-ai
  • database

The Business Case

Organizations are eager to connect their internal documents to large language models, but sending proprietary codebases, financial sheets, or customer records to cloud APIs exposes them to data leaks. Workspace RAG provides a 100% private, serverless solution. Running entirely on local hardware, it guarantees that no intellectual property ever leaves the machine while matching the retrieval accuracy of cloud search.


Technical Architecture

To deliver precise search results, the engine uses Reciprocal Rank Fusion (RRF) to combine semantic and exact keyword search.

                     ┌──────────────┐
                     │  User Query  │
                     └──────┬───────┘
             ┌──────────────┴──────────────┐
             ▼                             ▼
  ┌────────────────────┐        ┌────────────────────┐
  │ Semantic Vector DB │        │ Keyword Lexical DB │
  │ (ChromaDB + Nomic) │        │ (Custom Pure-BM25) │
  └──────────┬─────────┘        └──────────┬─────────┘
             │ (Top M)                     │ (Top M)
             ▼                             ▼
  ┌──────────────────────────────────────────────────┐
  │           Reciprocal Rank Fusion (RRF)           │
  └────────────────────────┬─────────────────────────┘
                           │ (Top K Blended Chunks)

             ┌──────────────────────────┐
             │  Local Ollama Inference  │
             └──────────────────────────┘

Engineering Highlights

1. Hybrid Search Fusion

Standard vector databases struggle with exact matches like product codes or acronyms. This project combines semantic search (ChromaDB + nomic-embed-text) with a custom in-memory BM25 lexical index. By running RRF (constant $k=60$), technical acronyms and semantic topics rise to the top together.

2. Token-Aware Markdown Chunking

To prevent text from losing context when cut in half, the chunking utility recursively breaks documents on logical boundaries (paragraphs, sentences, and punctuation) while maintaining a strict 500-token limit and 50-token overlap.

3. Serverless Cloud Indexing

When local hosting is not required, the engine leverages Firebase Firestore’s native vector search. This allows high-dimensional cosine similarity searches without the hosting and cost overhead of a running PostgreSQL instance.