Hybrid Architecture for Enterprise Knowledge Base Q&A: A Practical Guide
This article explains how to build enterprise knowledge base Q&A systems with a hybrid architecture that separates concerns into interaction and orchestration, retrieval and parsing, and model and governance layers. It compares the strengths of orchestration frameworks and document parsing services, outlines the overall design with asynchronous ingestion, contract-based interfaces, and stateless parsing, and covers port and network planning for co-located containers. It also details retrieval quality practices such as layered chunking, hybrid recall, metadata filtering, reranking, and traceable citations, plus evaluation, operations, and governance. The conclusion recommends an orchestration-first, parsing-as-backend approach for most enterprise scenarios.
1. The Core Issue: Layered Capabilities, Not an Either-Or Choice
In consulting work on enterprise knowledge base Q&A, the most common question is which type of platform to choose. Many discussions treat it as a single-choice question, but a more practical engineering view is to split the system into capability layers first:
- Interaction and orchestration layer: handles multi-turn dialogue, task flow orchestration, tool invocation, permissions, and front-end experience;
- Retrieval and parsing layer: handles document ingestion, layout reconstruction, chunking, indexing, and recall;
- Model and governance layer: handles model routing, prompt versioning, evaluation, logging, and monitoring.
Once you layer the system this way, it becomes clear that the two technical approaches are strong in different layers. One is good at quickly assembling workflows and connecting multiple models and external tools; the other is good at “understanding” documents with complex layouts. This article therefore discusses a hybrid architecture: a general-purpose workflow orchestration framework as the backbone, with deep document parsing capability as a callable backend service, decoupled through standard interfaces.
2. Abstracting the Strengths of the Two Capability Types
Typical strengths of orchestration frameworks
- Low onboarding cost; prototypes can be built through visual configuration;
- High modularity, making secondary development and plugin-based extension easy;
- Support for multi-model collaboration, conditional branching, loops, and tool invocation;
- Cross-knowledge-base routing that automatically selects the retrieval scope based on the question.
Typical strengths of parsing services
- High reconstruction fidelity for complex-layout documents (multi-column layouts, cross-page tables, scanned files);
- Built-in layout analysis, table structure recognition, and optical character recognition;
- Multiple chunking templates that adapt to different document styles;
- Engineering optimizations for high-load, low-latency scenarios.
3. Overall Design of the Hybrid Architecture
The backbone handles “flow and experience,” while the backend handles “understanding documents.” The two exchange data through HTTP interfaces and object storage. The illustrative call logic is as follows (pseudocode, only expressing the integration approach):
# 1) Document ingestion: hand the file to the parsing service and get structured results asynchronouslyresp = client.post("/api/v1/datasets/{dataset_id}/documents",files={"file": open(path, "rb")})doc_id = resp.json()["id"]# 2) Poll parsing status to avoid long tasks blocking the main flowwhile client.get(f"/api/v1/documents/{doc_id}").json()["status"] in ("RUNNING", "QUEUED"):sleep(3)# 3) Retrieval: the orchestration layer decides whether to do cross-base routinghits = client.post("/api/v1/retrieval",json={"question": q, "top_k": 8, "similarity": 0.2}).json()chunks = [h["content"] for h in hits["chunks"]]
There are three key design points: asynchronization (parsing and indexing are long tasks and must go through a task queue plus status polling or callbacks), contractualization (request and response fields are fixed as internal data contracts so the backend can be replaced), and statelessness (session and flow state live in the orchestration layer, while the parsing layer only performs stateless computation).
4. Port and Network Planning Before Deployment
Both types of components are usually deployed as containers and by default occupy host ports 80 and 443, so co-locating them on the same machine will inevitably cause conflicts. The port mapping format in container orchestration files is host_port:container_port, so you only need to change the left side and keep the right side. For example, changing 80:80 to 8080:80 and 443:443 to 8443:443 allows both sets of services to coexist.
Recommended implementation checklist:
- Plan a dedicated port range for the parsing service (such as 8080/8443) and forward by path prefix in the reverse proxy;
- Use a unified entry domain and certificate, route internal service-to-service traffic over internal addresses, and do not expose it to the public internet;
- Fix persistent directories for data volumes and indexes to avoid knowledge loss when containers are rebuilt;
- Define resource quotas explicitly, since both parsing and vector retrieval are memory-sensitive workloads.
5. Key Engineering Details for Retrieval Quality
- Layered chunking strategy: split policy-type documents by heading hierarchy, keep tables intact without breaking them, and use overlapping windows for long text;
- Hybrid recall: run keyword recall and semantic recall in parallel, then fuse and rerank, balancing proper nouns and semantic generalization;
- Metadata filtering: apply pre-filtering by department, classification level, and time range, improving precision while meeting permission requirements;
- Reranking: perform secondary sorting on candidate chunks to control the number and order of chunks entering the model context;
- Traceable citations: return the source and position of chunks so answers include provenance for manual verification.
6. Evaluation, Operations, and Governance
Evaluation must be independent of demo performance: build an evaluation set containing factual, multi-hop, and refusal-type questions, and separately measure recall hit rate, answer accuracy, and unsupported-answer rate. For operations, bring parsing time, retrieval latency, and model invocation failure rate into monitoring and alerting, and retain request trace identifiers in logs. For governance, both prompts and chunking templates must be versioned, and any change goes through canary release and regression testing.
7. Selection Conclusion
If documents are highly complex with messy layouts, prioritize strengthening the parsing layer; if business flows are complex and require multi-model and tool collaboration, prioritize strengthening the orchestration layer. Most enterprise scenarios need both, so adopt a hybrid architecture of “orchestration first, parsing as backend, decoupled interfaces,” and run it on general capabilities of cloud platforms such as Baidu AI Cloud—container platforms, object storage, message queues, and log monitoring—to obtain a knowledge base Q&A system that balances experience and depth at controllable cost.
