Knowledge Base Q&A: From Vector Retrieval to Evidence-Grounded Answers

    This article breaks knowledge base question answering into two separate problems, retrieval and generation, and walks through the full pipeline: document ingestion with structure-aware chunking and metadata, query-time retrieval that combines semantic and keyword search, reranking to select usable evidence, answer generation with citations and access control, and stage-by-stage evaluation before launch. It shows how to keep chunks readable out of context, handle follow-up questions and conflicting document versions, respond when evidence is missing, and trace failures back to the stage where they occur.

    1. Start by Splitting Knowledge Base Q&A into Two Problems

    When users ask an internal knowledge base a question, they usually do not know the document titles, and they rarely use the terminology found in the documentation. A user might ask “how do I sign in again after switching phones,” while the operations manual covers the same ground under a section called “Replacing an Authentication Device.” Vector retrieval narrows the gap between the two phrasings: the system encodes the question as a vector, then looks up semantically similar passages in the index. A large language model then organizes an answer from the retrieved material. This flow is commonly called retrieval-augmented generation (RAG).

    When designing the system, keep “did we find evidence” separate from “did we use the evidence correctly.” The first is a retrieval problem; the second is a generation problem. Even if the top few results are all on topic, that does not mean any of them contains the required steps, the applicable conditions, or the exceptions. Conversely, if the right material did make it into the context but the model cited the wrong version, increasing recall further usually will not help. Only by observing the two stages separately can you tell where the problem actually is.

    2. Ingestion: Make Chunks Readable Outside Their Original Context

    Raw documents should not be split by a fixed character count. In an operations manual, preconditions and procedural steps belong together; in a policy document, rules and their exceptions belong together; in a table, column headers and data rows belong together. Otherwise the system may retrieve “must be submitted within five business days” while losing the surrounding text that says who receives it and when the clock starts.

    A more reliable approach is to detect structure first, using headings, paragraphs, lists, and tables, and then split again inside sections that are still too long. Each chunk can retain its section path, so a step like “rebind the verification device” still carries the scenario information of “device lost” or “normal device replacement.” You can also keep a small amount of neighboring content during splitting to soften information breaks across paragraphs, but too much overlap fills the candidate set with near-duplicate chunks, so pair it with a deduplication strategy.

    Beyond the vector, store metadata such as document ID, section position, version, effective status, and access scope. These serve citation lookup, version filtering, and permission checks respectively. For documents that get updated, the system must be able to locate old chunks and replace or retire them, not just append new content. Otherwise, when the old and new versions are worded similarly, both may be retrieved at once, and the model becomes more likely to produce an answer that mixes versions.

    3. Query Retrieval: Cover Both Semantic Similarity and Exact Matching

    At query time, the system encodes the user’s question as a vector and searches for similar chunks within the authorized scope. Query and document vectors must live in compatible representation spaces. In general, follow the encoding conventions of the same embedding model; if the model explicitly distinguishes query encoding from document encoding, use each accordingly. When switching embedding models, do not assume that new query vectors can still be compared reliably against the old index; rebuild the corresponding index, validate it, and only then switch over.

    Semantic retrieval handles different phrasings well, but it is not necessarily good at distinguishing error codes, clause numbers, or configuration keys that differ by a single character. For Q&A scenarios that involve numbers and domain-specific terms, use keyword retrieval and vector retrieval together: the former matches explicit literal clues, the latter adds synonymous expressions and contextually related content. When merging candidates from both paths, do not simply add raw scores measured on different scales; fuse by rank within each path first, then use an evaluation set to decide whether finer score calibration is needed.

    Query rewriting also helps with follow-up questions. A user might first ask “how do employees replace a verification device” and then ask “is it the same for external collaborators?” At the retrieval stage, the system needs to fill in what “the same” refers to. But rewriting must not invent an identity or environment the user never provided. If different identities map to different procedures and the context is not enough to determine which one the user means, asking one targeted clarifying question is more reliable than guessing and then retrieving.

    4. Reranking: Select Usable Evidence from Relevant Content

    The job of initial recall is to avoid missing anything potentially useful; the job of reranking is to decide which chunks best answer the current question. Take “can I replace a verification device if the old device is unavailable?” The standard replacement procedure may be highly similar to the question, yet it requires confirmation on the old device. The genuinely useful evidence comes from the section on handling a device you cannot access. Reranking should not look only at topical similarity; it must also check whether the subject, conditions, and what the question asks for actually match.

    When assembling the context, select evidence according to the information the answer needs rather than mechanically taking a fixed number of chunks. If the question spans eligibility conditions, procedural steps, and exceptions, cover all three and drop duplicates. If a step depends on a precondition stated in the previous paragraph, pull in the necessary neighboring chunk. When multiple versions exist, filter by the known effective dates and applicable scope; if sources conflict and you cannot tell which one applies, state the difference explicitly instead of letting the model stitch the two into a process that only looks complete.

    5. Answer Generation: Make Conclusions Verifiable Against the Source

    The input handed to the large language model should separate task instructions, the user’s question, and the retrieved material. The retrieved material is data to be analyzed; even if it contains text that looks like an instruction, it should not change the answer requirements set by the application. For procedural questions, the answer should state the applicable conditions and the conclusion first, then list the necessary steps, with sources marked near the key conclusions. Citations should point to a specific section; listing only the document’s front page usually does not help readers verify details.

    Insufficient evidence does not mean the only option is a flat “cannot answer.” If the material confirms that the standard replacement procedure requires the old device but says nothing about a lost device, the system can state: “The current manual only covers the case where the old device is available, so the procedure after losing the device cannot be confirmed from it.” This reports what is known and avoids turning “no rule was retrieved” into “no such procedure exists.”

    Access control also cannot be delegated to the generation model. The system must verify that a chunk is accessible before passing it to the model, and must avoid exposing unauthorized material in the answer, the citations, or debug output. For caches that reuse retrieval results or answers, factor in access scope and document version so that stale results are not returned after permissions change or documents are updated.

    6. Evaluation and Launch: Improve by the Stage Where the Error Happens

    Before launch, build a set of test questions with reference evidence, covering common phrasings, abbreviations, identifiers, cross-paragraph questions, outdated documents, and cases with no answer. The test set should record not only the expected answer but also which chunks support the conclusion. That way, even when the model happens to answer correctly, you can still check whether the system can find evidence reliably.

    At the retrieval stage, observe whether the reference evidence appears among the top few candidates and whether it survives reranking. At the generation stage, check whether key conclusions are supported by evidence, whether citations point to the right location, and whether applicable conditions were dropped. For no-answer samples, distinguish two error types: refusing to answer when evidence exists, and giving a confident conclusion when it does not. Their costs vary by business, so a single similarity threshold is not appropriate for both.

    For troubleshooting, narrow the scope step by step along the chain. If the correct evidence is not in the index, check ingestion and updates. If it is in the index but not recalled, check how the question is phrased, the chunking, and the retrieval strategy. If it was recalled but never reached the context, check reranking and filtering. If it reached the model and the answer is still wrong, look at prompt design and citation constraints. At the same time, record retrieval, reranking, and generation latency separately, so you do not blindly enlarge the candidate set to compensate for one stage and inflate overall latency.

    Vector retrieval answers “where to start looking,” not “what is certainly correct.” Reliable knowledge base Q&A has to design in the freshness and permissions of the material, the coverage of the evidence, and the verifiability of the answer. Establishing an evaluable baseline with real questions and reference chunks first, then optimizing for the errors that actually occur in the chain, usually yields steadier gains than stacking complex components from the outset.