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

    This article explains why choosing between an application orchestration platform and a document parsing service is often a false dilemma in enterprise knowledge base Q&A. It shows how to split the system into an upper orchestration layer and a lower parsing and retrieval layer, defines the responsibilities of each, and covers port conflict handling during deployment, retrieval pipeline design, evaluation, security, cost control, and a phased rollout plan.

    1. The Problem: Why “Either/Or” Is a False Choice

    When teams build knowledge base Q&A systems in enterprises, they often get stuck debating one question: should we pick an out-of-the-box, orchestration-friendly application platform, or a retrieval service with stronger document parsing? In real projects, these are rarely mutually exclusive. A more pragmatic approach is to split the system into two layers: an upper layer for interaction, orchestration, and agent scheduling, and a lower layer for document parsing, chunking, and retrieval, with the two layers communicating through standard interfaces.

    The immediate benefit is that business users can quickly assemble flows such as Q&A, review, and multi-turn follow-up in a visual interface, while difficult cases like complex PDFs, scanned documents, and nested tables are handed to a dedicated parsing layer. Once the layers are decoupled, either one can be replaced or scaled independently.

    2. Defining the Boundaries of the Two Capability Sets

    2.1 What the Orchestration Layer Should Handle

    • Low-barrier building: visual node orchestration that lets non-ML engineers participate in flow design;
    • Fast validation: getting a usable prototype running in tens of minutes, proving value before optimizing;
    • Modular extension: pluggable tool calls, external APIs, and code nodes;
    • Multi-knowledge-base routing: automatically selecting the target base based on the question and metadata, which a dedicated parsing service typically does not provide;
    • Agent capabilities: task decomposition, tool selection, and result aggregation.

    2.2 What the Parsing and Retrieval Layer Should Handle

    • Layout reconstruction: recognizing heading hierarchy, paragraphs, and headers and footers to avoid content being flattened;
    • Scanned document processing: optical character recognition that turns image-based content into searchable text;
    • Table and structured extraction: preserving row and column relationships so tables are not compressed into a string of characters;
    • Chunking templates: multiple strategies such as by Q&A pair, by section, and by semantic window;
    • High throughput and low latency: stable operation under both batch ingestion and online query workloads.

    2.3 The Combined Payoff

    The orchestration layer handles “how to ask, how to schedule, and how to present,” while the parsing layer handles “reading accurately, chunking precisely, and finding results.” Integrating them through interfaces keeps the system elastic: upgrading the parsing layer does not affect upper-layer applications, and adding a business line above does not require rebuilding the data pipeline.

    3. Ports and Conflict Management During Deployment

    Both types of components are usually delivered as containers and by default occupy ports 80 and 443 on the host. When deploying on the same machine, changing the mappings before startup is the simplest way to avoid trouble. The mapping format is host_port:container_port; change only the left side and keep the container port unchanged.

    1. services:
    2. doc-parser:
    3. ports:
    4. - "8080:80" # map original 80 to host port 8080
    5. - "8443:443"
    6. orchestrator:
    7. ports:
    8. - "80:80"

    Three additional practices:

    1. Use a reverse proxy as the single entry point, route by path prefix, and expose only one domain externally;
    2. Let containers communicate through internal service names rather than going through host ports, reducing an extra network hop;
    3. Explicitly mount data volumes and model cache directories to avoid losing indexes and caches when containers are rebuilt.

    4. Engineering the Retrieval Pipeline

    The key to a hybrid architecture is not “connecting” the layers but “connecting them correctly.” Split the pipeline into four stages and define metrics for each:

    • Parsing and ingestion: track per-document processing time, retry rate on failures, and table reconstruction accuracy;
    • Chunking and vectorization: track chunk granularity and the relevance of recall, keeping multi-granularity indexes for the same document when necessary;
    • Hybrid retrieval: vector recall handles semantic similarity, keyword recall handles proper nouns and identifiers, and the two result sets are combined with weighted fusion and then reranked;
    • Generation and citation: answers must include the source passages so business users can verify them.

    Illustrative call logic (pseudocode):

    1. def answer(query, tenant_id):
    2. routes = router.pick(query, tenant_id) # multi-base routing
    3. hits = []
    4. for kb in routes:
    5. hits += parser_api.search(kb, query, top_k=8)
    6. ctx = rerank(query, hits)[:5] # fusion + rerank
    7. return llm.answer(query, ctx, cite=True) # generate with citations

    Engineering also needs three things that are easy to overlook: documents that fail parsing go into a dead-letter queue and trigger alerts; tenant-level isolation is enforced in retrieval filter conditions; and every request records a trace identifier, making it easy to tell whether the problem is “no recall” or “poor generation.”

    5. Evaluation, Security, and Cost

    The evaluation set should come from real business questions and cover four categories: single-hop facts, multi-hop reasoning, table queries, and refusing to answer when no answer exists. Look at both recall hit rate and citation accuracy; judging only answer fluency hides retrieval defects.

    Security recommendations: identify and redact sensitive information before documents are ingested; control knowledge base visibility by role; filter inputs and validate outputs against prompt injection.

    Costs can be tiered: use online retrieval for hot data and batch offline ingestion for cold data; deploy the vector store separately from object storage and scale each independently as it grows; cache results for high-frequency questions.

    6. Rollout Roadmap

    Phase one: get single-base Q&A working with citation display. Phase two: add complex document parsing and hybrid retrieval. Phase three: add multi-base routing, agent orchestration, and an evaluation dashboard. If the scenario involves massive heterogeneous documents or graph relationship reasoning, a general-purpose graph indexing approach can be added alongside the parsing layer as a supplement, but the interface contract stays unchanged to keep the architecture evolving sustainably.