← Selected work

LLM systems · Retrieval · Evaluation · Observability

Local Document Q&A

A local document-QA system with asynchronous ingestion, hybrid lexical/dense retrieval, source-aware context handoff, local generation, and end-to-end tracing. Retrieval stages are evaluated independently so changes can be accepted or rejected on corpus-level evidence rather than answer fluency.

Hybrid retrievalEvaluationLocal LLMSource metadataOpenTelemetry

Retrieval and generation are evaluated separately

A document can fail to enter the index, the correct candidate can rank too low, fusion can suppress an exact match, context packing can omit supporting evidence, or generation can ignore evidence that was retrieved correctly. The system keeps those stages independently inspectable instead of collapsing them into a single answer-quality judgment.

Document QA and RAG pipeline overview showing document ingestion, embeddings, hybrid OpenSearch and Qdrant indexing, retrieval orchestration, answer generation, evaluation, Streamlit, Celery, and Phoenix observability
System overview. Portfolio architecture summary of the current implementation. Open the image for the full-resolution view.

Architecture keeps retrieval stages separable

OpenSearch and Qdrant outputs can be inspected before and after fusion, MMR, sibling expansion, reranking, and context packing, allowing each retrieval change to be compared against the same fixture.

Reproducible mixed benchmark

The retrieval stack is measured with a six-stage artifact pipeline: source acquisition, parsing, chunking, embedding, native OpenSearch/Qdrant indexing, and retrieval evaluation. Each stage records immutable lineage fingerprints and persists reusable artifacts privately, so a corpus or configuration change rebuilds only the stages it invalidates rather than starting from raw PDFs every time.

410fixed full-tier queries
205,998indexed chunks per backend
1,000Open RAGBench PDFs in v2
0evaluation errors in the full run

The mixed regression set combines Open RAGBench, OfficeQA, NFCorpus, and German/Arabic MIRACL subsets. composite-v2 is a controlled corpus-scale experiment: it keeps the same 80 positive Open RAGBench PDFs and the same 160 questions as v1, then expands that track from 200 to 1,000 PDFs by adding 800 deterministic non-gold distractors. Those additions were not selected using this system's retrieval scores or embedding similarity, so they are not presented as mined hard negatives.

Full composite-v2 retrieval result

TrackRecall@1Recall@3Recall@5MRRnDCG@5p95 ms
MIRACL Arabic0.35560.59330.75720.69570.672611.2
MIRACL German0.17490.42510.54950.58570.495011.8
NFCorpus0.01430.03560.04050.26500.162112.8
OfficeQA0.08230.23470.25970.24730.209623.6
Open RAGBench0.68750.91250.94370.79780.835035.0
Macro average0.26290.44020.51010.51830.4749—

What changed when the PDF corpus grew 5×?

Open RAGBench metricv1 · 200 PDFsv2 · 1,000 PDFsDelta
Recall@10.76880.6875-0.0813
Recall@30.95630.9125-0.0438
Recall@50.95630.9437-0.0126
MRR0.85100.7978-0.0532
nDCG@50.87800.8350-0.0430
p95 latency26.3 ms35.0 ms+8.7 ms

The larger corpus primarily increased ranking pressure: Recall@1 fell materially, while Recall@5 remained high at 0.9437. In other words, the relevant Open RAGBench document was displaced from the first position more often but was still usually present in the top five. Because all five tracks share the combined index, the extra PDFs also act as distractors for OfficeQA, NFCorpus, and MIRACL queries.

These are project-regression results on deliberately subsetted and combined source benchmarks, not official upstream benchmark scores or a general claim about RAG accuracy.

Retrieval hit is not the same as usable context

The evaluation separates expected-document hits, supporting-document hits, and final-context support because a relevant candidate can be retrieved and still disappear during diversification, sibling expansion, ranking, or token-budget packing before generation.

Candidate retrieval

Lexical and dense candidates remain inspectable before later retrieval stages transform the ranked set.

Context handoff

Support labels test whether sufficient evidence survives into the final context rather than counting any retrieval hit as a grounded answer.

Generation

Source metadata remains attached so output can be checked against the evidence actually handed to the model.

Measured retrieval variants

Optional cross-encoder reranking was integrated and evaluated against the same checked-in retrieval fixture. It reduced retrieval quality on this corpus, so it remained disabled and subsequent experiments shifted to context-packing alternatives rather than tuning a stage that had not helped.

Current scope

The repository is an evolving local system rather than a production-hosted service. Production authorization, service exposure, and hosted multi-user security are outside the current scope.