Enterprise Knowledge Base QA: Architectural Separation and Implementation

    This article explores the architectural design and implementation of enterprise knowledge base question-answering (QA) systems. It clarifies the distinction between conversational orchestration platforms and document understanding engines, advocating for a hybrid four-layer architecture connected by stable APIs. Key topics include capability boundaries, integration contracts, deep parsing triggers, orchestration layer enhancements, and best practices for evaluation, permissions, and system evolution to build a maintainable production system.

    When building a knowledge base QA system, a common misconception is treating the “conversational product” and the “document understanding engine” as the same thing during selection. The former addresses who orchestrates the workflow, how models and tools are invoked, and how multi-turn dialogues are managed as operable applications. The latter addresses how unstructured materials—such as scanned documents, tables, and messy layouts—are transformed into retrievable and citable knowledge chunks. Their overlapping capabilities are limited; forcing a single component to cover all scenarios often results in significant compromises in either usability or parsing quality. A more robust approach is to separate responsibilities by layers and connect them via interfaces to form a replaceable pipeline.

    Clarifying the Boundaries of Two Capabilities

    A knowledge base QA system typically includes four pipeline segments: access and authorization, document parsing and splitting, indexing and retrieval, and generation and orchestration. The first two determine “whether the correct evidence can be found,” while the latter two determine “whether the evidence can be utilized correctly within business workflows.”

    Platforms focused on application orchestration generally share these characteristics: low UI and configuration barriers, enabling rapid prototyping; modular replaceability for secondary development; support for stringing retrieval, tool invocation, conditional branching, and human-in-the-loop confirmation into task flows; and the ability to route across multiple knowledge collections rather than dumping all materials into a single database. Their weaknesses typically emerge with documents that have complex layouts: multi-column formatting, nested tables, scanned images, headers/footers, and tables spanning multiple pages. Relying solely on generic splitting often leads to unstable recall.

    Components focused on document understanding are the opposite. They excel at layout analysis, OCR, table structure restoration, and selecting splitting strategies based on document type. Retrieval services sensitive to latency and throughput are also better suited for dedicated parsing and indexing pipelines, preventing them from being slowed down by conversational orchestration. Their weaknesses usually lie in the application layer: cross-database routing, multi-role processes, tool coordination, and operational configurations are not necessarily their design focus.

    Therefore, selection is not an either-or decision. When document formats are simple but workflows are complex, prioritize deepening orchestration capabilities; when document formats are complex but QA paths are relatively fixed, prioritize deepening parsing and indexing. Most enterprises have both simultaneously, making a hybrid architecture more aligned with real-world materials.

    Layering the Hybrid Architecture

    It is recommended to divide the system into four layers, where layers communicate only through stable contracts.

    Access Layer: Responsible for identity, tenants, knowledge base authorization, and auditing. QA requests pass through permission filtering before entering orchestration, preventing the model from “seeing” snippets the user is unauthorized to access.

    Orchestration Layer: Responsible for task flows and agent strategies: intent recognition, clarifying questions, selecting knowledge collections, deciding whether to invoke calculators or ticketing systems, and formatting the final answer. The orchestration layer does not parse raw files directly; it only consumes retrieval results.

    Knowledge Service Layer: Provides a unified retrieval interface externally. Internally, it can connect to one or more parsing and indexing implementations: general text goes through a lightweight pipeline, while contracts, drawing descriptions, and scanned reports go through a deep parsing pipeline. For the caller, the difference is reflected only in collection identifiers, filter conditions, and return fields, rather than two entirely different calling methods.

    Data and Observation Layer: Responsible for raw files in object storage, intermediate parsing results, vector and keyword indexes, citation snippets, latency, hit rates, and human feedback. Without this layer, a hybrid architecture quickly becomes an un-debuggable black box.

    By splitting it this way, the orchestration platform can remain friendly to business users, the knowledge service can scale independently based on document difficulty, and replacing an implementation on either side does not require rewriting the entire business flow.

    Defining Clear Contracts for Integration

    Whether a hybrid approach succeeds depends on whether the interfaces are “narrow and stable.” It is recommended that the knowledge service expose at least three categories of capabilities, defined using versioned request and response contracts.

    First is ingestion. The caller submits a file identifier, document type, associated knowledge collection, and access scope. The knowledge service then asynchronously completes parsing, splitting, vectorization, and keyword indexing. Synchronously waiting for a large file to parse often disrupts orchestration timeouts and retries. Status queries should distinguish between queued, parsing failed, partial page failure, and ready for retrieval.

    Second is retrieval. The request includes query text, a list of knowledge collections, permission context, number of returns (top_k), and whether original text positioning is needed. In the response, each hit should contain the snippet text, document identifier, page number or block ID, relevance score, and sufficient positioning info for citation display. Do not return an untraceable string, otherwise, the “where did the evidence come from” audit required in enterprise scenarios cannot be fulfilled.

    Third is operations. Support rebuilding indexes by collection, deleting by document, and viewing parsing quality samples. Deletions must propagate to both vector and keyword sides; otherwise, revoked permissions might still result in content being recalled.

    As an illustration, a single call within an orchestration node can maintain this shape. Field names can be customized according to team standards; the focus is on semantics rather than a specific implementation:

    1. POST /kb/retrieve
    2. {
    3. "query": "Approval deadline for quarterly travel reimbursement",
    4. "collections": ["policy_hr", "policy_finance"],
    5. "principal": {"tenant": "t1", "groups": ["finance"]},
    6. "top_k": 6,
    7. "need_citation": true
    8. }

    The response should only include authorized snippets. The orchestration layer then decides whether to answer directly, ask a follow-up question, or hand off to a human based on relevance and conflicts.

    When to Apply Deep Parsing

    Not all files warrant deep parsing. A simple rule applies: if incorrect splitting would alter the facts, use deep parsing. Typical examples include scanned documents, dual-column policies, expense tables with merged cells, and operating instructions with image captions. For plain text notifications or structured exported Q&A pairs, rule-based splitting with metadata filtering is often cheaper and easier to control for latency.

    Deep parsing requires separate quality checks, not just verifying “whether it can be ingested.” It is recommended to sample and inspect: whether tables are read as disordered flat text, whether cross-page titles are treated as body text, whether headers/page numbers pollute snippets, and whether the same clause is chopped too finely, leading to incomplete semantic retrieval. Splitting templates should be maintained by document type, rather than applying a single global length parameter. Chunks that are too short lose context; chunks that are too long drag irrelevant sentences into the prompt. Both cause answers to drift.

    For latency-sensitive online QA, parsing should be completed offline or near-line; the online path should only handle retrieval and generation. Under heavy load, prioritize scaling retrieval replicas for the knowledge service, and separate rate limits between model calls in the orchestration layer and vector computations in the knowledge layer, preventing a single slow request from crippling the entire conversation.

    Essential Capabilities for the Orchestration Layer

    No matter how strong the knowledge service is, it cannot replace process orchestration. Common gaps in enterprise QA include: failing to ask follow-up questions when the user’s query is ambiguous; failing to indicate the applicable scope when multiple policies conflict; failing to execute step-by-step calls when needing to check the org chart before checking policies; and being unable to verify answers when citations are missing.

    In orchestration, it is recommended to make “retrieval” a reusable node rather than hardcoding it into a specific bot. The node’s input is a rewritten query and candidate collections, and the output is an evidence list with citations. Strategies can then be layered on top: automatically select collections by department or question type; stop fabricating and provide an entry for supplementary materials when evidence is insufficient; cite conflicting evidence side-by-side and explain the differences rather than synthesizing a seemingly definitive conclusion. Cross-collection routing is particularly crucial. Mixing HR policies, financial policies, and project documents into a single unfiltered retrieval means relevance scores cannot replace permissions and topic boundaries.

    Multi-model collaboration is also better placed at this layer: cheaper models for query rewriting and routing, more capable models for final synthesis, and specialized small models or rules for sensitive information detection. Models remain replaceable while knowledge contracts stay unchanged, preventing business flows from being locked to a specific model version.

    Evaluation, Permissions, and Evolution

    Before going live, prepare at least three types of evaluation sets. Document-type questions check whether citations point to the correct page or table; process-type questions check whether the correct branch was taken and whether unauthorized retrieval occurred; adversarial-type questions check whether the system refuses to answer when materials are insufficient. Metrics should not just look at “whether it sounds human,” but at citation hits, a zero unauthorized access rate, and human-sampled factual consistency. After changes to parsing or splitting strategies, the same batch of questions should be re-run to prevent silent regressions.

    Permissions must take effect before retrieval, not by keyword masking post-generation. Tenants, user groups, and document confidentiality levels should all become filter conditions. Logs should retain the query, hit document identifiers, and model versions, but by default should not store complete sensitive raw text long-term, satisfying auditing and data minimization principles.

    For evolution, keeping interfaces stable allows capabilities to be added incrementally: hybrid keyword and vector search, metadata filtering by time or document number, and structured queries for tables. If a certain type of material remains unstable, just replace the parsing implementation behind that specific collection without overhauling the orchestration. You can also mount more specialized indexes behind the same knowledge service—for example, supplementary retrieval for entity relationships—but externally it remains the same evidence structure, preventing application-level divergence.

    The benefits of a hybrid architecture can be summarized in three sentences: use orchestration capabilities to turn complex business processes into configurable applications; use specialized document understanding to turn difficult documents into citable evidence; and use narrow interfaces to preserve the right to replace and room to expand. When implementing in an enterprise, first map out document difficulty and process complexity to decide which layer requires deeper investment. This approach yields a far more maintainable production system than choosing sides between two “all-in-one solutions.”