Hybrid Architecture for Enterprise Knowledge Base Q&A: A Practical Guide

    This article explains why enterprise knowledge base Q&A is hard to standardize on a single framework, and how to combine an application orchestration platform with a deep retrieval service. It covers a five-layer architecture, the retrieval contract between layers, port and network planning for containerized deployment, key retrieval engineering details such as layered parsing and hybrid search, plus evaluation, operations, cost governance, and common pitfalls.

    1. Why Enterprise Knowledge Base Q&A Can’t Be “One Choice for Life”

    In enterprise knowledge management, knowledge base Q&A (Retrieval-Augmented Generation, RAG) has become the standard pattern: documents are chunked, vectorized, and stored; when a user asks a question, relevant fragments are retrieved first and then passed to a large language model as context to generate the answer. The pipeline looks simple, but in real deployments teams usually hit bottlenecks in two places.

    The first is the document side. Real enterprise documents are far from clean plain text. They are PDFs containing scanned pages, complex tables, headers and footers, multi-level headings, formulas, and images, along with large amounts of unstructured data. Parsing quality directly sets the ceiling for retrieval: misparse a single table, and no downstream model, however strong, will answer correctly.

    The second is the workflow side. Real business scenarios are rarely “one question, one answer.” They require multi-turn clarification, permission checks, routing across multiple knowledge bases, calls to business system APIs, human review, and writing results back. These belong to the domain of orchestration and AI Agent capabilities.

    The common mistake is trying to solve both problems with a single framework, which forces compromises in either parsing depth or workflow flexibility. A more sound approach is capability decoupling: let the platform that excels at workflow orchestration and user interaction carry the main trunk, and let the service that excels at deep document parsing and retrieval act as a callable capability node, with the two composed through standard interfaces.

    2. Comparing the Two Capability Types

    To avoid tying the discussion to specific products, we abstract the candidates into two roles.

    Type A: application orchestration platform. Typical traits include a low barrier to entry, visual workflows, a modular plugin system, out-of-the-box multi-model access and prompt management, and often cross-knowledge-base routing that automatically decides which library to query based on question semantics. Its weakness is limited parsing depth for difficult documents.

    Type B: deep retrieval service. Typical traits include fine-grained layout parsing, optical character recognition (OCR), built-in chunking templates, a deep document processing pipeline for unstructured content, and stable performance under high concurrency and latency-sensitive conditions. Its weakness is weaker workflow orchestration and front-end interaction, and it usually offers no automatic cross-library routing.

    The conclusion is clear: this is not an either/or choice but a combination problem — use A for interaction and orchestration, use B for parsing and retrieval. In addition, if the business involves multi-hop reasoning or graph relationships, general-purpose graph retrieval and hierarchical indexing open-source approaches can be added as supplementary nodes, again plugged in through interfaces.

    3. Layered Design of the Hybrid Architecture

    A five-layer split is recommended, with layers communicating only through contracts:

    1. Access layer: web chat interface, enterprise IM bot, embedded pages in business systems.
    2. Orchestration layer: workflow engine and agents, responsible for intent recognition, clarifying follow-ups, permission filtering, tool calls, result assembly, and human fallback.
    3. Capability layer: deep retrieval service, business query APIs, message queues, object storage, logging, monitoring and alerting, and other general cloud capability categories.
    4. Data layer: raw document storage, intermediate parsing artifacts, vector indexes, metadata and permission label stores.
    5. Governance layer: evaluation sets, canary releases, audit, and cost tracking.

    The key design principle: the orchestration layer is unaware of retrieval implementation details. The retrieval service exposes only three clearly defined interfaces to the layer above — document ingestion, retrieval, and health check.

    1. # Example: retrieval capability contract called by the orchestration layer (pseudocode)
    2. retrieval:
    3. ingest: POST /api/v1/documents # upload document + return parsing task ID
    4. status: GET /api/v1/tasks/{id} # query parsing progress
    5. search: POST /api/v1/retrieval # input: query, top_k, permission labels, library ID
    6. health: GET /healthz

    4. Deployment: Port and Network Planning

    Both types of systems officially recommend containerized deployment, and the most common failure in co-located deployment is a port conflict. In container orchestration files, the port mapping format is A:B, where A is the host port and B is the container port; inside the container, 80 typically handles HTTP and 443 handles HTTPS. The rule is: change only the host-side port and keep the container port unchanged, so that no internal application configuration needs to be modified.

    1. # Example: change host port 80 to 8080 while keeping container port 80
    2. services:
    3. retrieval-service:
    4. ports:
    5. - "8080:80"
    6. - "8443:443"

    Additional recommendations: assign separate custom networks to the two systems to avoid unintended connectivity from the default bridge network; route by path prefix through a single reverse proxy (for example /chat to the orchestration layer and /kb to the retrieval layer), exposing only one domain and certificate externally; keep all internal calls on internal addresses without public exposure.

    5. Key Engineering Details of the Retrieval Pipeline

    • Layered parsing and chunking strategy: scanned pages go through OCR, tables go through structured templates, plain text goes through semantic chunking, and heading hierarchy is preserved as metadata so answers can be traced back and cited.
    • Hybrid retrieval: vector semantic recall plus keyword exact recall, then fused with a reranking model, which significantly improves hit rates for proper nouns, IDs, and clause numbers.
    • Permissions up front: department and classification level are written into the index as metadata, and the retrieval API requires the caller’s permission labels, implementing “filter first, then recall” so unauthorized content never enters the context.
    • Cross-library routing: the orchestration layer decides based on question classification whether to query a single library, run multiple libraries in parallel, or fall back to all libraries, then deduplicates and ranks multi-library results by confidence.
    • Context budget: retrieved fragments are trimmed by length and prioritized to control prompt cost while preserving citation sources.

    6. Evaluation, Operations, and Cost Governance

    Evaluation must come first. Build an evaluation set of 100–300 real questions covering four categories — factual, clause-based, table-based, and refusal — with metrics including at least recall hit rate, answer accuracy, citation traceability, and refusal accuracy. Run a full regression every time chunking parameters or prompts change.

    For operations, design parsing tasks as an asynchronous queue with status polling so long-running requests don’t block conversations; introduce semantic caching for high-frequency questions; and use logging services plus monitoring and alerting to observe time to first token, retrieval latency, and failure rate. For cost, track the four segments separately — parsing, indexing, retrieval, and generation — to locate the real bottleneck.

    7. Common Pitfalls

    First, misdiagnosing a parsing problem as a model problem, repeatedly swapping models without changing chunking. Second, letting the orchestration layer connect directly to the vector store, which creates coupling and makes the implementation impossible to replace. Third, ignoring permission metadata and being forced to rebuild the index after launch. Fourth, running only offline evaluation with no online canary and no user feedback loop.

    In summary, the robust path for enterprise knowledge base Q&A is to build interaction and workflows on an orchestration platform as the main trunk, use a replaceable deep retrieval service as a capability node for difficult documents, guarantee extensibility through standard interfaces and clear layering, and drive continuous iteration with evaluation and observability.