Architecture Selection and Integration Practices for Enterprise Knowledge Base Q&A
This article explores architectural choices and integration strategies for building enterprise knowledge base Q&A systems. It highlights the need to evaluate application orchestration and knowledge processing capabilities, choose between integrated and modular architectures, design reliable retrieval service contracts, and manage deployment and network boundaries. Additionally, it covers evidence-based answering, end-to-end security and permissions, and the establishment of comprehensive evaluation and monitoring to ensure accurate, traceable, and secure responses.
1. Clarifying the Problem: Enterprises Need More Than Just a “Chatting Knowledge Base”
When building an enterprise knowledge base Q&A system, companies typically expect employees to ask questions directly and receive accurate, traceable answers. However, from ingesting documents into the system to returning the answer to the user, the process involves at least document parsing, content chunking, index construction, retrieval ranking, context organization, and model generation.
A failure in any of these stages can distort the final answer. For instance, a monetary amount in a scanned document might be misrecognized, fields and values in a table might lose their correspondence, retrieval results might omit the applicable scope of a policy, or the model might reference an obsolete version. These issues cannot be solved merely by switching models.
Therefore, architectural selection should revolve around two core capabilities:
One is application orchestration capability, responsible for connecting users, models, tools, and business processes; the other is knowledge processing capability, responsible for transforming enterprise documents into accurately retrievable and effectively citable evidence.
These two capabilities can be provided by the same system or built separately and connected via service interfaces. The real question to answer is not “which solution is more advanced,” but “whether current requirements justify introducing an additional system boundary.”
2. Evaluating Application Orchestration and Knowledge Processing Separately
2.1 Application Orchestration Layer: Focusing on Task Completion
The application orchestration layer solves process problems outside of Q&A. It can be responsible for identifying question types, selecting models, invoking retrieval services, executing conditional branches, maintaining session state, and handing results over to subsequent business steps.
For example, if a user asks whether a certain expense can be reimbursed, the system might need to sequentially:
- Determine that the question is a fee policy consultation;
- Obtain the user’s organization and applicable policy scope;
- Retrieve relevant policy clauses;
- Generate an explanation based on the evidence;
- If the user wants to proceed, enter the application process.
This type of requirement is well-suited for explicit workflows. The input, output, and failure handling for each step in a workflow are clearly defined, making it easy to test and audit.
For exploratory tasks where steps cannot be determined in advance, agents with tool-calling capabilities can be introduced. However, agents should not be considered the default solution for all scenarios. For operations involving payments, approvals, or data modifications, tool permissions should be restricted, and necessary manual confirmation steps should be established.
Application orchestration capability also does not mean the system inherently possesses cross-knowledge base routing. Knowledge base selection needs to be designed based on business tags, permission scopes, question categories, or retrieval feedback. Routing accuracy cannot be assumed reliable based solely on a prompt.
2.2 Knowledge Processing Layer: Focusing on Evidence Reliability
The focus of the knowledge processing layer is to preserve the content and structural relationships of documents as much as possible.
Enterprise documents may contain multi-column layouts, scanned pages, complex tables, heading hierarchies, footnotes, and attachments. Directly converting documents into continuous text often breaks the relationships between information. For instance, if “applicable region” and “subsidy standard” in a table are separated, retrieval might hit the relevant numbers, but the answer might cite incorrect conditions.
Therefore, document processing needs to focus on:
- Whether text extraction is complete;
- Whether scanned content is recognized accurately;
- Whether heading and section hierarchies are preserved;
- Whether the row and column relationships of tables are clear;
- Whether page numbers, source locations, and version information are traceable;
- Whether old content is invalidated promptly after document updates.
Having stronger document parsing capabilities does not mean all documents will be processed correctly automatically. Low-resolution scans, cross-page tables, handwritten content, and complex diagrams may still require manual sampling or specialized processing.
Similarly, parsing capability does not directly imply low latency or high throughput. Document ingestion is an offline processing pipeline, while online Q&A is a retrieval and generation pipeline. Both need to be tested separately.
3. Choosing Between Integrated and Modular Architectures
3.1 When to Prefer an Integrated Architecture
If the knowledge sources are primarily clearly structured text, the Q&A process is relatively simple, and the team wants to quickly validate business value, an integrated solution is usually more appropriate.
Its advantages include fewer deployed components, centralized configuration entry points, and shorter troubleshooting paths. Enterprises can first verify whether employees are willing to use it, whether questions can be effectively covered, and how much manual effort is required to maintain the knowledge base.
However, “integrated” does not mean “zero governance cost.” Permission management, data updates, evaluation, and monitoring must still be implemented. A quick demo does not prove production readiness.
3.2 When a Modular Architecture is Appropriate
When both complex document processing and business process orchestration become core requirements, and a single system cannot satisfy both, the two capabilities can be split.
A typical structure is as follows:
User request
→ Identity authentication and permission context
→ Application orchestration service
→ Knowledge retrieval service
→ Candidate evidence filtering and ranking
→ Model generation
→ Citation verification and result return
Document ingestion uses a separate pipeline:
Document reception
→ Security check and type identification
→ Content parsing
→ Quality check
→ Content chunking
→ Index construction
→ Release of searchable version
This design allows document processing and application development to iterate independently and facilitates different applications sharing the same knowledge service.
The trade-offs are equally clear: the system must handle interface compatibility, network failures, permission passing, version synchronization, and cross-service monitoring. A modular architecture is not simply adding an extra call; it adds a set of service contracts that require long-term maintenance.
3.3 Use Real Samples to Decide Whether to Split
It is recommended to extract representative samples from actual enterprise materials, covering body text, scans, tables, and multi-version policies, and to build a corresponding set of questions.
Record parsing errors, retrieval omissions, citation errors, and process execution issues separately. If the main bottleneck is concentrated in document processing, prioritize improving the knowledge processing pipeline; if the main issue is the difficulty of expressing business steps, enhance the orchestration capability.
Do not assume better results just because there are more components. Every added component should explain what measurable problem it solves.
4. Designing Clear Retrieval Service Contracts
The application orchestration layer should not directly depend on the internal data structures of the knowledge service; it should exchange information through stable interfaces.
Requests typically need to express the query content, retrieval scope, and trusted permission context; responses need to include the evidence text, source information, location markers, and document version.
Below shows a general logical structure only and does not represent any actual product interface:
Request structure:
{"query": "How is the travel accommodation standard determined?","scope": ["current travel policy"],"limit": 5,"request_id": "tracking identifier for this request"}
Response structure:
{"evidence": [{"text": "Policy clauses related to the question","source_id": "internal document identifier","location": "Chapter 3, Section 2","version": "currently valid version"}]}
Identity and permissions should be generated by a trusted server side based on authentication results, and should not directly trust the organization, role, or document scope submitted by the user.
In addition, interface design should clearly define timeouts, error types, maximum response body size, and version compatibility rules. Retries should primarily target temporary faults suitable for retrying; for operations that produce business side effects, idempotency mechanisms need to be considered separately.
The score returned by the retrieval service should also not be directly displayed as “answer confidence.” The meaning of scores from different retrieval methods, models, and index configurations may vary and cannot be compared across systems without calibration.
5. Solving Port and Network Boundaries First During Deployment
A common first problem in modular deployments is multiple services competing for the same host port.
Port mappings are usually represented as:
Host Port:Container Port
For example:
8080:80
This means that when accessing port 8080 on the host, the request is forwarded to port 80 inside the container. If another service has already occupied host port 80, you can adjust the host port of the new service without modifying its internal listening port.
However, port adjustments only resolve listening conflicts and do not automatically solve network access issues. You should also note the following:
- The local loopback address inside a container usually points to the current container, not the host or other containers;
- Services should use actual reachable network addresses between each other;
- The browser access address may differ from the inter-service call address;
- If a gateway is used as a unified entry point, check path forwarding, timeouts, and streaming response configurations;
- Internal retrieval services should not be permanently exposed to the public internet just for easy debugging.
Enterprise deployments should divide user entry points, application services, and knowledge services into different access boundaries, opening only necessary ports. Whether a port number is commonly used for encrypted communication does not determine if the connection is secure; secure transmission still depends on protocol configuration, certificates, and access control.
6. Building Answers on Evidence
6.1 Chunking Strategies Must Respect Document Structure
Content chunking should not be based solely on fixed character counts. Policy documents are suitable for chunking by chapters and clauses, tables should preserve headers and related rows, and operation manuals should maintain the continuity between steps.
Chunks that are too small will lose context, while chunks that are too large will introduce irrelevant content. A reasonable approach is to test different chunking strategies on representative samples and check whether the retrieval results can completely support the answer, rather than just looking at whether keywords appear.
6.2 Retrieval Needs to Balance Keywords and Semantics
Enterprise questions often contain both semantic descriptions and exact identifiers. Natural language is suitable for semantic matching, while policy numbers, clause numbers, and professional abbreviations require exact matching capabilities.
Therefore, keyword retrieval and vector retrieval can be combined based on business needs, followed by deduplication and re-ranking of candidate content. Whether to add a ranking step should be judged based on quality gains, response latency, and resource costs.
For version-sensitive knowledge, the valid time and applicable scope should be restricted during the retrieval phase to prevent mixing old and new policies.
6.3 Stop Inferring When Evidence is Insufficient
The generation phase should explicitly require: answer only based on the retrieved evidence, and do not write speculation as enterprise regulations.
If evidence is missing, conflicting, or the applicable conditions cannot be determined, the system should state the limitations and ask the user for supplementary information or escalate to manual confirmation.
Citations should come from real source identifiers in the retrieval results, and the model should not fabricate document titles, page numbers, or clause numbers. For key conclusions, citation verification can be added to check whether they are supported by corresponding evidence.
7. Permissions and Security Must Run Through the Entire Chain
Enterprise knowledge bases may contain sensitive information such as HR, contracts, and finance. Permission isolation should be enforced during the retrieval process, not by hiding parts of the text after the answer is generated.
The reason is that once unauthorized content enters the model context, even if it is not output verbatim, it has already crossed the security boundary.
It is recommended to implement the following simultaneously:
- Documents and chunks inherit consistent access permissions;
- Retrieval scope is determined by a trusted identity context;
- Caches are isolated by permission scope to avoid cross-user reuse of sensitive answers;
- Logs and tracing data avoid storing unnecessary full original text;
- Knowledge deletion synchronously processes indexes, caches, and related derived data;
- Tool calls follow the principle of least privilege.
It is also necessary to guard against malicious instructions in documents. Retrieved content should be treated as data to be analyzed, not executed as system instructions. When business operations are involved, explicit server-side rules and authorization results should prevail.
8. Ensuring Continuous Availability with Evaluation and Monitoring
8.1 Build Evaluation Sets Covering Normal and Abnormal Cases
The evaluation set should not only include common questions but also cover complex tables, cross-section questions, no-answer questions, version conflict questions, and unauthorized access tests.
It is recommended to evaluate separately:
- Parsing quality: Are key fields and structures correct?
- Retrieval quality: Does the required evidence enter the candidate results?
- Answer quality: Are the conclusions correct, complete, and well-founded?
- Citation quality: Are the sources real and do they support the corresponding conclusions?
- Permission correctness: Is unauthorized content isolated?
- Operational performance: End-to-end latency, failure rate, and resource consumption.
Do not judge system quality solely on whether the “answer looks fluent.” A fluent wrong answer is often more dangerous than explicitly stating an inability to answer.
8.2 Observe Performance Bottlenecks in Stages
The online pipeline should separately record the time consumed by identity checks, question processing, retrieval, ranking, model first-token output, and complete generation.
If retrieval is fast but generation is slow, continuing to optimize document parsing usually will not significantly reduce online latency. If failures come from the permission service or network timeouts, the dependency pipeline needs to be fixed first, rather than adjusting prompts.
Caching can improve response speed, but the cache key must account for knowledge versions, permission scopes, and retrieval configurations. Otherwise, the cache might return expired content or another user’s visible information to the current user.
8.3 Define Acceptable Behavior for Failure Scenarios
When the knowledge service is unavailable, the system should state that it cannot obtain enterprise basis, rather than falling back to the model’s common sense and continuing to output deterministic answers.
When partial retrieval results are available, it can answer provided the scope is clearly annotated; when evidence is incomplete, it should lower the conclusion strength or request supplementary information. For enterprise Q&A, the goal of reliable degradation is to control error risk, not to maintain a superficial answer rate.
9. Recommended Implementation Order
Phase 1: Sort out document types, business questions, permission rules, and answer acceptance criteria to clarify system boundaries.
Phase 2: Establish a baseline using real samples, connect the shortest Q&A pipeline first, and record parsing, retrieval, and citation issues.
Phase 3: Based on the evaluation results, decide whether to split knowledge processing and application orchestration, avoiding prematurely introducing complex architectures.
Phase 4: Refine interface contracts, network isolation, version updates, and permission passing, and conduct small-scale business pilots.
Phase 5: Complete monitoring, fault degradation, regression evaluation, and knowledge operation processes, and then gradually expand the scope of use.
The core of enterprise knowledge base Q&A is not connecting more components together, but ensuring that documents can be correctly understood, evidence can be accurately retrieved, processes can be stably executed, and the entire process is traceable, verifiable, and governable. Only by making architectural selection and integration around these goals can architecture investments translate into continuous business value.
