Skip to main content
Back to projects

TextWave

RAG question-answering

AI / ML Interactive
Python phi3 Docker

Hit@5 0.932

Interactive demo runs a real embedding model in your browser

Ask a question about "Acme Cloud" — a small sample knowledge base. TextWave runs a real sentence-embedding model (all-MiniLM-L6-v2) locally and retrieves the most semantically similar passage. The full system adds a phi3 / qwen2.5 generator on top.

Or tap a sample question:

How it works

TextWave answers questions from a document set by first retrieving relevant passages and then letting a small language model answer from that evidence — retrieval-augmented generation.

Question user query Chunk and embed sentence chunks → vectors Vector search brute vs HNSW vs LSH Rerank sequential reranking Grounded answer local LLM (phi3 / qwen2.5)

Design decisions

Building it, step by step

1. Chunk and embed the corpus

Documents are split into sentence chunks and embedded into 384-dimension vectors.

2. Retrieve and rerank

Brute-force cosine search retrieves 20 candidates; sequential reranking reduces that to the final top chunks.

Example: “What is the refund policy?” retrieves the refund paragraph by vector similarity, not keyword luck.

3. Generate from the retrieved context

The top chunk is passed to phi3:mini, which writes an answer grounded in that passage.

What I evaluated

MetricResult
RetrievalHit@5 0.932
Indexbrute force beat HNSW / LSH
Generatorphi3:mini
RAG gainexact 0.372 → 0.504 vs standalone

What I learned

Retrieval quality is the true ceiling, and grounding helps or hurts depending on the question — medium and hard questions improved most, while some easy yes/no answers got slightly worse.