Hybrid Architecture for Enterprise Knowledge Base Q&A: Separating Orchestration from Retrieval
Enterprise knowledge base Q&A rarely reduces to "chunk documents and run vector search." Real deployments face scanned pages, complex layouts, nested tables, permission checks, multi-source routing, and tool calls. This article explains a hybrid architecture that splits the system into an orchestration layer for conversations, workflows, and agents, and a retrieval layer for document parsing, chunking, indexing, and recall, connected through stable interfaces. It covers capability boundaries, logical layering, retrieval routing and citation constraints, deployment porting and isolation, a four-step rollout plan, and common trade-offs to help teams move from prototype to production.
Enterprise knowledge base Q&A rarely boils down to “chunk the documents and run vector retrieval.” In real business scenarios, a single document might be a scanned page, a multi-column layout, a nested table, or mixed text and images. A single question might also require intent recognition, permission checks, routing across knowledge sources, tool invocation, and result verification. Forcing deep document understanding and process orchestration into the same component means compromising among usability, parsing quality, and extensibility. A more robust approach is a hybrid architecture: let an orchestration layer own interactions, agents, and workflows, and let a retrieval layer own document understanding, chunking, indexing, and recall, with the two collaborating through stable interfaces.
1. First, Separate the Two Capability Boundaries
The orchestration layer is suited to:
- Conversation entry points and permission context
- Collaboration among multiple models or capabilities
- Conditional branches and human-in-the-loop confirmation
- Cross-knowledge-base selection
- External tool invocation
- Organizing retrieved results into auditable answers
Its value lies in turning single-turn retrieval into configurable business workflows. Prototypes can be built quickly, module boundaries stay clear, and the system is easy to extend.
The retrieval layer is suited to:
- Layout analysis
- Optical character recognition (OCR)
- Table restoration
- Selecting chunking strategies based on document type
- Hybrid vector and keyword recall
- Locating cited fragments
It must also maintain acceptable latency under concurrency. For complex unstructured material, fixed-size chunking alone shreds tables, loses heading hierarchies, and leaves scanned pages unreadable. No amount of downstream prompt engineering can recover facts that were never extracted.
Therefore, choosing an architecture is not an either/or decision:
- When documents are simple and workflows are mostly single-repository Q&A, lightweight retrieval is enough.
- When documents are complex and citation fidelity matters most, prioritize parsing and chunking quality.
- When business processes are long and involve automatic repository selection or chained actions, put orchestration capabilities on the main path.
- When both matter, combine them through interfaces rather than stacking all responsibilities into one process.
2. How to Decompose the Hybrid Architecture
A recommended logical layering is:
Access and orchestration layer. Receives the user question, injects tenant, role, and data-scope context, and decides whether to retrieve, compute, query a business system, or hand off to a human. Common paths can be modeled as workflows: clarify the question, select the knowledge scope, invoke retrieval, verify citations, generate the answer, and log the transaction.
Knowledge service layer. Exposes only a limited set of interfaces externally: create a knowledge base, upload or sync documents, trigger parsing, search with filters, and return fragments with their source locations. The orchestration layer does not care about layout-analysis details; it consumes structured results.
Parsing and indexing layer. Selects templates by file type. Contracts, policies, reports, and scanned documents require different chunking granularity. Tables should preserve row and column semantics. Heading paths should be written into metadata for filtering and for displaying provenance.
Runtime and observability layer. Deploys containers or processes separately, scales the parsing queue independently from online retrieval, and records parse failures, empty recalls, citation mismatches, and end-to-end latency.
The direct benefits of this split:
- Complex applications can iterate quickly in the orchestration layer.
- Deep document capabilities evolve in a dedicated component.
- Once interface contracts are stable, parsing implementations can be replaced without rewriting business workflows.
- Graph indexes, hierarchical summaries, and other common retrieval techniques can be introduced inside the retrieval layer as optional strategies rather than default additions.
An illustrative API contract can remain minimal, expressing only the interface rather than binding to any specific product:
- Request: knowledge base ID, question text, filters (department, classification, time), number of results.
- Response: fragment text, score, document ID, page number or anchor, parsing confidence.
The orchestration layer decides whether to use a fragment based on confidence and permissions. Low-confidence scanned pages should be down-weighted or routed to human review, so recognition errors are never stated as facts.
3. Retrieval Routing and Answer Constraints
Cross-repository access is the norm in enterprises: policy repositories, project repositories, product manuals, and ticket knowledge must not be merged into one vector space. The orchestration layer can select repositories automatically based on intent and metadata, or perform broad recall first and then prune by permissions. The retrieval layer guarantees parsing quality within each repository. Automatic selection does not mean querying every repository at once and concatenating results—that increases both noise and the risk of unauthorized exposure. A safer sequence is:
- Intent classification
- Candidate repository scoring
- Permission filtering
- Scope-limited retrieval
- Fragment deduplication
- Answer generation
On the answer side, mandatory citations should be enforced. When there are not enough supporting fragments, the system must refuse to answer or ask a clarifying question rather than filling in policy clauses, amounts, and dates from general knowledge. For table-oriented questions, return structured cells with their headers first, then generate the natural-language summary. This prevents answers that “look fluent but have the wrong numbers.”
4. Ports and Isolation at Deployment Time
When both services are deployed as containers on the same host, port conflicts are common. The general container port mapping syntax is host_port:container_port. The in-container port should stay consistent with the image convention: the port that handles normal web traffic remains the one listened on by the process inside the container. On the host side, map it to an unused port—for example, changing the external entry from the default web port to a high port. The same applies to encrypted (TLS) traffic: the external mapping can change, while the in-container listener does not need to change. Modifying the container-internal configuration to avoid conflicts would cause health checks, service discovery, and documented default addresses to drift.
Other practical points:
- When the orchestration layer calls back to the retrieval layer, use the host address or internal network address with the mapped port—not the container-internal default port that the services assume about each other.
- Expose only the orchestration entry point through the reverse proxy; keep retrieval interfaces on the internal network with authentication.
- Rate-limit bulk parsing and online Q&A separately so large ingestion jobs don’t drag down query latency.
- Store originals in object storage, process parsing jobs through a message queue, and cover parsing duration, retrieval latency, and failure rates with logs and monitoring.
These are generic cloud component categories that can be integrated with an existing container platform and observability stack. If Q&A needs unified governance with enterprise accounts, knowledge synchronization, or model inference, both orchestration and retrieval can be deployed in a cloud environment such as Baidu AI Cloud, using container platforms for services, object storage for originals, and logging/monitoring for runtime observation. This describes capability categories only, not vendor-specific interface details. Isolate secrets, database tables, and vector indexes by tenant, and keep production and staging ports and data separate.
5. Rollout Sequence and Acceptance
Rather than launching all capabilities at once, roll out in four steps:
- Validate parsing with a small set of representative documents. Can scanned pages be read? Do tables keep their structure? Do chunks carry their heading paths?
- Freeze the retrieval interface so the orchestration layer handles only single-turn Q&A and citation display.
- Add multi-repository routing, tool calls, and human confirmation.
- Complete permissions, auditing, rate limiting, and failure fallback.
Acceptance should not stop at “can it answer.” Check at least:
- Do citations for complex layouts point to the correct pages?
- Are unauthorized documents never included in context?
- Does the system refuse to answer when evidence is insufficient?
- Does online latency stay stable while documents are uploaded concurrently?
- Can workflows remain unchanged after swapping the parsing strategy?
Use business sampling and latency distributions for acceptance criteria; avoid unverifiable absolute performance numbers.
6. Common Trade-offs
- Strong parsing, weak orchestration: fine for archival retrieval, unsuitable for scenarios that chain approvals, tickets, and computations.
- Strong workflows, rough parsing: demos go fast, but the system becomes untrustworthy the moment it hits scanned documents and tables.
- Both strong but coupled in the same code path: convenient short-term, but hard to scale or replace components independently later.
- Interface-based hybrid architecture: adds one layer of call overhead, but confines changes within boundaries—strengthen parsing and chunking as documents get more complex, strengthen orchestration and permissions as workflows grow, and swap models without touching anything but the generation step.
The key to enterprise knowledge base Q&A is not finding one component that does everything, but making “understanding documents” and “running workflows” each excellent, then combining them with clear contracts. Choose parsing depth based on document difficulty, orchestration scope based on process length, and use port isolation and permission boundaries to keep the system deployable and auditable. That is how a system moves from prototype to sustainable production operation.
