The symptom is not the cause
When a RAG chatbot gives a wrong answer, changing the prompt is tempting. But the failure may have happened earlier: the source document was never indexed, the correct chunk was not retrieved, or the evidence was lost before generation.
Debug the pipeline as distinct stages: ingestion, indexing, retrieval, reranking, context construction and answer generation.
Failure mode: missing or stale content
PDF parsing can drop tables, headings or footnotes. Background jobs can silently fail. Deleted or updated documents may remain in the index. Track document versions, extraction quality and ingestion errors, and test updates end to end.
A user should never receive a citation to a source that no longer exists or is no longer authorized.
Failure mode: poor chunking
Tiny chunks lose context; oversized chunks dilute relevance and consume tokens. Splitting tables, procedures or legal clauses in the wrong place changes meaning. Preserve structure and compare chunking strategies against real queries.
There is no universally optimal chunk size. The right choice depends on document type, retrieval method and expected questions.
Failure mode: retrieval misses
Embedding similarity alone may struggle with identifiers, product codes, rare names or exact quotations. Consider keyword or hybrid retrieval and metadata filters, then test whether reranking improves results.
Measure whether the correct source appears in the top retrieved results before judging the language model's answer.
Failure mode: weak evaluation
A few impressive demos do not establish quality. Build a dataset with answerable, unanswerable, ambiguous and permission-sensitive questions. Score retrieval and final responses separately. Inspect failures manually, especially high-impact cases.
Avoid relying on a single model-based judge. Use human review and deterministic checks where possible, and track regressions across releases.
Recovery plan
Start with a representative failure set, trace each query through the pipeline and fix the highest-frequency root cause. Establish a baseline, change one component at a time and retest. Resist adding agent orchestration before basic retrieval works.
If your existing RAG system produces unreliable answers, I can audit its ingestion, retrieval traces and evaluation process, then prioritize fixes without a complete rewrite.
Need a developer for the long run?
I can start now and work with you for months or years, not hand off after two weeks. Send me a message and we will talk through your project, requirements and next steps.