Problem
AI assistants can hallucinate or answer unsupported questions when they respond without checking whether the available evidence actually supports the answer.
Prototype / Academic Project
A small explainable Retrieval-Augmented Generation prototype that demonstrates grounded answer behavior, retrieval thresholds, and refusal when local evidence is insufficient.
At a glance
Context
Prototype / Academic Project
Current state
Local RAG prototype
Role
Sole builder for ingestion, retrieval, thresholding, generation modes, and benchmark notes
AI assistants can hallucinate or answer unsupported questions when they respond without checking whether the available evidence actually supports the answer.
Evidence boundary: the system has to refuse unsupported questions when local retrieval does not clear the relevance threshold.
I built a local RAG prototype that ingests text files, chunks them, indexes the chunks with TF-IDF, retrieves evidence with cosine similarity, checks a minimum relevance threshold, and only answers when the retrieved context clears that threshold. When the local evidence is insufficient, the assistant refuses instead of guessing.
Indexed 7 local source documents into 15 searchable chunks and produced 7/7 useful retrieval/refusal decisions on a small sanity benchmark using TF-IDF + cosine similarity with a default 0.12 threshold.
Dataset sizes and recorded checks within this project’s stated scope.
7
local source documents
15
searchable chunks
15 × 772
TF-IDF matrix shape
TF-IDF + cosine similarity
retrieval method
0.12
default minimum relevance threshold
7/7
useful retrieval/refusal decisions on the small benchmark
The pipeline is shown as explicit stages so the system boundary is inspectable.
Seven local source documents provide the bounded knowledge corpus.
Text files are loaded into the prototype for local processing.
Documents are split into 15 searchable chunks.
The chunk corpus becomes a 15 × 772 TF-IDF matrix.
Queries retrieve top-k chunks by lexical similarity.
The assistant answers only when retrieved context clears the minimum relevance threshold.
In-domain questions are answered from local evidence; unsupported questions are refused.
Where the pattern matters
Implementation details and the artifacts available for review.
The prototype demonstrates both grounded answers and explicit refusal when the local corpus does not support a question.
The flow is intentionally small and inspectable: local files become chunks, chunks become TF-IDF features, retrieval is thresholded, and generation depends on retrieved evidence.
The main applied lesson is the refusal boundary, not broad RAG accuracy.
The evidence is intentionally modest and quantified as a sanity benchmark.
Interpreting this work
Possible next steps
How the implemented TF-IDF baseline differs from other retrieval options.
RAGeATM implements TF-IDF with cosine similarity and a refusal threshold. The other methods below are comparison options, not implemented features or a universal ranking. Their usefulness depends on the corpus, query types, evaluation set, and operating constraints.
| Method | Mechanism | Useful when | Limitation |
|---|---|---|---|
| Exact keyword search | Literal words or phrases in a query and document. | Finding an exact identifier, name, or known phrase. | Misses relevant passages that use different wording. |
| TF-IDF | Weighted term overlap using cosine similarity; implemented in this prototype. | A small, inspectable lexical baseline when queries and documents share vocabulary. | Word overlap can miss paraphrases or retrieve passages with the right terms but the wrong meaning. |
| BM25 | Improved keyword relevance with term-frequency saturation and document-length normalization. | A lexical baseline to compare against TF-IDF on the same documents and queries. | Lexical matching remains weak for synonyms and paraphrases without matching terms. |
| Static embeddings | Fixed word vectors combined into a representation of a query or passage. | Exploring similarity beyond literal word overlap with a simple vector representation. | A fixed vector for a word does not adapt to its meaning in each sentence. |
| Modern embedding models | Learned query and passage vectors compared by similarity. | Testing semantic retrieval for varied wording and paraphrases. | Similar passages can still be irrelevant; model choice, language coverage, and corpus fit matter. |
| Hybrid search | Lexical and embedding retrieval combined into one candidate set or ranking. | Corpora where both exact terminology and varied wording matter. | Fusion choices need evaluation and add indexing and operational complexity. |
| Reranked retrieval | A second model scores query–passage relevance within an initial candidate set. | Testing whether a smaller set of more relevant passages improves downstream answers. | Adds latency and cost, and cannot recover relevant passages missing from the candidate set. |
A useful next evaluation would compare TF-IDF, BM25, and an embedding retriever on the same documented queries, including paraphrases, ambiguous requests, and unsupported questions. Report retrieval relevance, refusal errors, latency, and run conditions before drawing broader conclusions.
Inspect the source, setup instructions, and project documentation.
More portfolio context.
A collaborative University of St. Thomas SEIS 745 project in which David Braun served as lead developer and primary implementer, turning large NOAA weather datasets into county-level risk views and decision-support reporting.
Workflow orchestration layer in active development for managing state, decision flow, and human review inside StormIQ.