Enterprise Knowledge Base Q&A: Architecture Selection and a Layered Integration Approach

    This article breaks down why enterprise knowledge base Q&A projects succeed or fail, focusing on three underlying challenges: document understanding, trustworthy retrieval, and stable workflow orchestration. It compares deep document parsing solutions with workflow orchestration solutions, then proposes a layered architecture that decouples parsing and indexing, retrieval services, and orchestration through stable API contracts. It also covers port and network planning for co-located container deployments, key retrieval engineering details such as chunking, hybrid search, reranking, and citation-constrained generation, plus evaluation, access control, and operations. A final decision checklist helps teams choose the right layer to strengthen.

    1. The Core Problem: Why Enterprise Knowledge Base Q&A Is Hard

    When teams deploy knowledge base Q&A inside an enterprise, they often focus on “which framework to choose.” In practice, success is usually determined by three deeper questions: whether documents can be understood correctly, whether retrieval results can be trusted, and whether business workflows can be orchestrated reliably. The two demands raised in the original discussion—“complex document processing” and “multi-model collaboration with complex workflows”—map to the retrieval quality layer and the orchestration layer respectively. These belong to different levels of abstraction and should not sit on the same selection scale.

    Enterprise corpora are typically heterogeneous: policy documents, bidding and tender documents, financial reports, scanned files, and image-based manuals are mixed together. Complex layouts, cross-page tables, header and footer noise, and double-column formatting all break simplistic character-based chunking. If layout semantics are lost during parsing, no stronger generation model can recover the missing information later.

    2. Strengths and Limitations of the Two Component Types

    2.1 Deep Document Parsing Solutions

    Their strength is document understanding: strong structural reconstruction for formatted documents, scans, and tables, usually with built-in optical character recognition and multiple chunking templates. They perform stably in heavy-load, latency-sensitive retrieval scenarios.

    The limitations are equally clear: they typically do not handle routing and selection across knowledge bases, and complex orchestration, multi-model collaboration, and human-in-the-loop nodes must be added at an upper layer. Their interfaces and configuration options also lean toward engineering, making self-service use harder for business users.

    2.2 Workflow Orchestration Solutions

    Their strength is ease of use and delivery speed: visual orchestration and modular design support secondary development, prototypes can run in a short time, tool invocation and task flows are extensible, and they can automatically select the appropriate knowledge base during cross-base retrieval.

    The limitation is parsing depth: with complex layouts and scans, a lack of dedicated structural reconstruction makes recall quality the ceiling.

    The conclusion is not either/or. A more reasonable approach is to split the system into three layers—parsing and indexing, retrieval services, and orchestration and interaction—using the implementation best suited to each layer and coupling them through standard interface contracts.

    3. Integration Architecture: Layered Decoupling and Interface Contracts

    The recommended layers are:

    • Parsing and indexing layer: document ingestion, layout reconstruction, chunking, vectorization, and index building.
    • Retrieval service layer: exposes knowledge base management, document upload, parsing triggers, retrieval, and reranking through interfaces.
    • Orchestration and interaction layer: intent recognition, multi-turn dialogue, tool invocation, cross-base routing, permission filtering, and answer generation.

    The layers depend only on stable interface contracts and do not share internal implementations. Illustrative call logic (pseudocode, with endpoint paths as placeholders):

    1. # The orchestration layer calls the retrieval service over a standard HTTP API
    2. def retrieve(query, tenant_id, kb_ids=None, top_k=8):
    3. payload = {
    4. "question": query,
    5. "tenant_id": tenant_id, # multi-tenant isolation
    6. "kb_ids": kb_ids, # when empty, the upper layer performs cross-base routing
    7. "top_k": top_k,
    8. "similarity_threshold": 0.35
    9. }
    10. resp = http.post(f"{RETRIEVAL_BASE}/api/v1/retrieval", json=payload,
    11. headers={"Authorization": f"Bearer {TOKEN}"})
    12. chunks = resp.json()["data"]["chunks"]
    13. return [c for c in chunks if c["score"] >= payload["similarity_threshold"]]

    The contract should define the semantics of four fields: tenant identifier, knowledge base scope, similarity threshold, and the structure of returned chunks (original text, source document, page number, score). Source and page number must be passed through; otherwise the frontend cannot show citations, and answer credibility drops sharply.

    4. Port and Network Planning Before Deployment

    Both component types are officially recommended for containerized deployment. The most common failure in co-located deployment is host port conflicts. In container orchestration files, port mappings are written as A:B, where A is the host port and B is the container port; containers usually serve plain HTTP on 80 and encrypted HTTPS on 443. If both systems declare 80:80, the first to start takes the port, and the second fails outright or behaves unpredictably.

    The rule is to change only the host-side port and keep the container port unchanged. For example, change 80:80 to 8080:80 and 443:443 to 8443:443, then expose a single entry point externally through a reverse proxy by domain or path. Example snippet:

    1. services:
    2. retrieval-service:
    3. ports:
    4. - "8080:80" # host 8080 -> container 80
    5. - "8443:443" # host 8443 -> container 443
    6. orchestration:
    7. ports:
    8. - "3000:3000" # orchestration console

    Additional recommendations: create separate container networks for the two systems, allow only one-way access from the orchestration layer to the retrieval layer, expose only one external entry point, and route all cross-component calls through internal network domain names rather than host IPs to avoid cascading changes when ports change.

    5. Key Engineering Details for Retrieval Quality

    • Layered chunking: split well-structured documents by heading hierarchy, keep tables as separate chunks with headers preserved, and run recognition and layout cleaning on scans before chunking.
    • Hybrid retrieval: vector recall handles semantic similarity, keyword recall handles proper nouns, IDs, and clause numbers; fuse the two result sets and then rerank.
    • Reranking and thresholds: first recall a larger candidate set, then narrow it with a reranking model, using a similarity threshold and a top_k cap to control noise.
    • Multi-turn rewriting: compress dialogue history into a standalone query before retrieval to avoid recall drift from missing references.
    • Citation-constrained generation: require the generation step to answer only from retrieved content and to provide document names and page numbers, explicitly refusing when no evidence exists.

    6. Evaluation, Access Control, and Operations

    Build the evaluation set by sampling real business questions and labeling answer sources. Measure recall hit rate, answer accuracy, citation accuracy, and refusal accuracy separately, forming a regression baseline; run the full regression after any chunking or model parameter change.

    Access control must run in the same path as retrieval: carry tenant and user labels in the retrieval request and trim results during filtering, rather than masking after generation. For auditing, retain the question, retrieved chunks, citations, and response latency; connect logs and metrics to a unified logging service and monitoring and alerting system; use object storage to archive original documents and parsing artifacts, and a message queue to smooth parsing task peaks.

    7. Selection Decision Checklist

    If the bottleneck is understanding documents with complex layouts, strengthen the parsing and indexing layer first. If the bottleneck is long workflows with many participants that require human collaboration and multi-model cooperation, strengthen the orchestration layer first. If both exist, adopt layered integration and decouple with interfaces, avoiding lock-in to a single framework’s capability boundaries.