Overview

MQNotebook is a production-ready, local-first Retrieval-Augmented Generation (RAG) system built to handle the messy reality of enterprise documents.

Unlike typical “chat with PDF” demos, MQNotebook is engineered to ingest:

  • scanned PDFs,
  • complex Excel spreadsheets,
  • PowerPoint decks with speaker notes,
  • and mixed-format document collections,

while running securely on a local machine or cloud environment.

🔗 Live Demo: https://mqnotebook.streamlit.app/


Design Philosophy

Most RAG demos assume clean text input.
MQNotebook assumes documents will fail — and designs for that failure.

The system prioritizes:

  • deterministic ingestion,
  • retrieval precision,
  • and controlled LLM exposure.

System Architecture

MQNotebook follows a multi-stage retrieval pipeline that separates document ingestion, retrieval, and reasoning.

Document Ingestion Layer

  • Scanned PDFs & Images
    OCR fallback using Tesseract + Poppler when text extraction fails.

  • PowerPoint (.pptx)
    Extracts text from slides, shapes, SmartArt, and speaker notes.

  • Excel (.xlsx)
    Parses spreadsheets row-by-row while preserving column structure.

All extracted content is normalized before embedding.


Retrieval & Ranking Layer

  • Vector Store: ChromaDB
  • Embeddings: BAAI/bge-small-en-v1.5 (runs locally on CPU)
  • Retriever: Top-K semantic search
  • Reranker: Cross-encoder to filter results before LLM inference

This reduces hallucinations by ensuring only conceptually relevant context reaches the model.


Generation Layer

  • LLM: Gemini 2.0 Flash (via OpenRouter)
  • Large context window
  • Fast reasoning
  • Controlled prompt scope

API keys are handled in-memory per session and cleared on reset.


Engineering Considerations

  • Windows File Locking Fix
    Dynamic, timestamped sessions prevent WinError 32 during vector store resets.

  • OS-Aware Execution
    Automatically switches OCR binary paths between Windows (local) and Linux (cloud).

  • Local-First Security Model
    Documents and embeddings remain local; only final prompts are sent to the LLM.


Relationship to DevShelf

MQNotebook complements DevShelf, which focuses on classic information retrieval and search engines.

  • DevShelf: First-principles search engine (TF-IDF, inverted index, ranking)
  • MQNotebook: Modern RAG system (embeddings, reranking, LLM integration)

Together, they demonstrate a full spectrum of search and knowledge retrieval systems — from traditional IR to AI-augmented reasoning.


Source & Documentation