Enterprise Knowledge Base Q&A: Architecture Selection and Integration Practices

    This article explains how to choose and integrate an architecture for enterprise knowledge base Q&A. It separates the system into application orchestration and knowledge processing, compares integrated versus decoupled designs, defines clear interface contracts, and covers document parsing quality, deployment and network isolation, reproducible evaluation, and the security and operations practices needed to move from a demo to a maintainable enterprise system.

    1. Start With the Problem: Enterprises Need Reliable Q&A, Not a Single Tool

    When enterprises build a knowledge base Q&A system, they usually want employees to query policies, contracts, operating manuals, project materials, and historical cases directly, and to receive accurate, traceable answers. But there is a long engineering path between “upload documents and start chatting” and “support real business operations.”

    First, enterprise data is not always clean text. Scanned documents may contain OCR errors, complex tables may depend on row and column relationships, multi-column layouts can scramble reading order, and a single policy may exist in several versions at once.

    Second, a question does not always require only a document lookup. For example, “does this expense meet the reimbursement requirements” may involve policy retrieval, amount calculation, personnel permissions, and approval status at the same time. Knowledge retrieval alone cannot complete the entire business process.

    Finally, enterprise scenarios require the system to explain its basis, respect access permissions, and clearly state when it cannot make a judgment due to insufficient evidence. A fluent answer does not equal a correct answer, and it certainly does not mean the answer can be used for business decisions.

    For these reasons, technology selection should begin with capability layering, rather than comparing the feature count of a particular system first.

    2. Split the System Into Application Orchestration and Knowledge Processing

    2.1 Application Orchestration Handles “How to Complete the Task”

    The application orchestration layer faces user interaction and business execution, and typically takes on these responsibilities:

    • Managing conversation context and user input.
    • Choosing a processing path based on the question type.
    • Organizing retrieval, computation, business API calls, and answer generation.
    • Controlling timeouts, exception branches, and necessary human confirmation.
    • Unifying answer format, call logs, and task status.

    This kind of capability suits business processes with many steps and relatively clear rules. For example, after an employee submits a contract risk query, the system first identifies the contract type, then retrieves relevant clauses, and then generates a risk list according to predefined rules.

    For stable business processes, an explicit workflow is usually easier to test and audit. For questions without a fixed path, you can introduce an agent to plan tasks, but you still need to limit the scope of tool calls, the number of executions, and the operations that are permitted.

    Just because an agent can plan autonomously does not mean you should let it directly execute high-risk operations such as making payments, deleting data, or changing permissions. These actions should go through deterministic validation and include a human confirmation step.

    2.2 Knowledge Processing Handles “How to Obtain Trustworthy Evidence”

    The knowledge processing layer faces the materials themselves and mainly includes:

    • Document parsing and OCR.
    • Reading order recovery and layout structure extraction.
    • Recognition of headings, paragraphs, tables, and attachment relationships.
    • Text chunking, vector representation, and index building.
    • Retrieval, reranking, and source information preservation.

    Its core goal is not to extract as much text as possible, but to preserve the original semantics and evidence location as much as possible.

    For example, an “approval limit” in a table only becomes valid evidence when it is kept together with the department, role, and applicable conditions. If chunking separates these elements, then even if a certain amount is retrieved, the generated answer may lack the necessary qualifiers.

    2.3 The Two Capabilities Have Different Selection Criteria

    When evaluating the application orchestration layer, focus on process expressiveness, ease of debugging, interface extensibility, and exception handling.

    When evaluating the knowledge processing layer, focus on parsing quality for representative documents, retrieval accuracy, source localization, version maintenance, and permission filtering.

    Strong complex-document parsing does not mean low online Q&A latency, and convenient workflow configuration does not mean knowledge retrieval is naturally accurate. The two capabilities must be validated separately, and a single metric cannot replace an overall evaluation.

    3. When to Use an Integrated Design and When to Use a Decoupled One

    3.1 An Integrated Solution Fits a Simple Starting Phase

    If the materials are mainly clearly structured text, the business process is short, and the team wants to validate requirements quickly, you can start with an integrated architecture.

    Its advantages are fewer deployment components, centralized configuration, and low integration cost. For a small internal pilot, this usually helps build a test set and collect user feedback quickly.

    Even during the pilot phase, you should retain original document identifiers, versions, and source information to avoid being unable to migrate the evidence chain during a later upgrade.

    3.2 A Decoupled Solution Fits Complex Documents or Expanding Business

    When documents contain many scanned files and complex tables, or when Q&A needs to connect to multiple business processes, you can deploy application orchestration and knowledge services independently and have them collaborate through interfaces:

    User request
    → Identity authentication and permission check
    → Question classification and process orchestration
    → Knowledge retrieval service
    → Evidence organization
    → Model generation
    → Citation validation and answer output

    Document ingestion follows a separate path:

    Original file
    → File check
    → Document parsing
    → Structured chunking
    → Metadata enrichment
    → Index building
    → Ingestion quality check

    Optimizing the two paths separately helps isolate the resource-intensive document parsing tasks and reduces their impact on online requests.

    However, decoupling is not free. It adds the cost of interface maintenance, identity propagation, troubleshooting, and version compatibility. It is only worth adopting when the business benefit is enough to cover this complexity.

    4. The Key to Interface Integration Is Clear Contracts, Not Just Connectivity

    When the application orchestration layer calls the knowledge service, it should avoid passing only the question and returning only a concatenated block of text. It is recommended to divide the interface contract into at least four parts.

    4.1 Define the Retrieval Scope

    The request needs to express the question text, the knowledge sets that are allowed to be queried, filter conditions, and a request tracking identifier.

    The permission scope should be generated by a trusted backend based on the current user identity, rather than accepting a client’s own declaration directly. A user must not be able to expand the range of materials they can retrieve by modifying request fields.

    Cross-knowledge-base queries should also not search all materials by default. You can first select candidate sets based on business category, the user’s organization, or explicit rules, and then retrieve within the authorized scope.

    4.2 Preserve the Evidence Structure

    The response should include the evidence text and its source information, such as document identifier, version, section, page number, or original position.

    The following is only an illustrative custom interface structure and does not represent the real interface of any existing system:

    1. Request:
    2. Question text
    3. Authorized retrieval scope
    4. Business filter conditions
    5. Request tracking identifier
    6. Response:
    7. Evidence list
    8. Evidence text
    9. Document identifier
    10. Document version
    11. Source location
    12. Ranking information
    13. Processing status
    14. Error information

    Keeping these fields is what allows the answer stage to generate citations and, when an error is found, to locate the specific stage among parsing, chunking, retrieval, or generation.

    Different retrieval strategies may use different score scales, so it is not advisable to directly mix and rank the raw scores from multiple sources, and it is even more wrong to interpret a retrieval score as the probability that an answer is correct.

    4.3 Define Failure Behavior

    The interface should distinguish between no results, insufficient permissions, processing timeouts, and service errors.

    “No evidence retrieved” is a normal business result and should not be confused with “the retrieval service is unavailable.” The former can prompt the user to add to the question or materials, while the latter should state that the query cannot be completed right now.

    For temporary failures, you can use retries with an upper limit; for identity authentication failures or malformed requests, repeated retries are usually pointless. Retries also need to consider whether the operation is idempotent, especially when business writes are involved.

    4.4 Limit the Size of Returned Content

    More retrieval results are not always better. Too many duplicate fragments consume the model’s context and increase latency and cost.

    Based on question complexity and the model’s input limits, control the number and total length of evidence, and deduplicate at the same time. For questions that need multiple pieces of support, organize evidence by topic rather than handing unordered fragments directly to the model.

    5. Document Processing Quality Sets the Upper Limit of System Effectiveness

    5.1 Use Different Parsing Strategies for Different Document Types

    Text documents should prioritize extracting the original text and structure; scanned files need OCR; complex tables need to preserve headers, row and column relationships, and necessary unit information.

    OCR results should be spot-checked, focusing on amounts, dates, IDs, negation words, and units of measurement. Even a single wrong character in these can change a business judgment.

    For merged cells, tables spanning pages, and chart captions, you should not assume that automatic processing is always reliable. High-risk materials can add manual review and retain the original page for users to verify.

    5.2 Chunking Should Serve Semantic Completeness

    Chunking simply by fixed length easily separates applicable conditions, exception clauses, and the main content. A more reasonable strategy is to chunk based on heading hierarchy, paragraph boundaries, table structure, and business semantics.

    When necessary, you can use a “retrieve with small fragments, supplement with larger context” approach: first locate the relevant fragment, then return adjacent paragraphs or the containing section. But supplementing context must also obey permission limits.

    5.3 Establish Version and Lifecycle Management

    Each document should record its effective date, version, owning department, and active status. When old and new policies coexist, the retrieval system needs to filter or flag version differences based on business rules.

    After a document is deleted or its permissions change, you must handle not only the original file record but also the index, cache, and any retained derived content. Otherwise, users may still obtain invalid or no-longer-authorized information through an old index.

    6. Deployment Integration: Ports, Network, and Resource Isolation

    6.1 Understand Port Mapping Correctly

    Container port mapping usually takes the form “host port:container port.” For example:

    1. 8080:80

    This means the host’s port 8080 is forwarded to port 80 inside the container. If two services both try to occupy port 80 on the same host address, a binding conflict usually occurs.

    Adjusting the host-side port can resolve this kind of conflict, but it does not automatically solve authentication, network connectivity, or application path configuration problems.

    80 and 443 are common web service port conventions, and the actual listening port is determined by the service configuration. Merely changing the port to 443 does not automatically enable an encrypted connection.

    6.2 Distinguish Internal Access From External Access

    If the application orchestration service and the knowledge service are on the same private container network, they can usually be accessed through internal service addresses, without exposing all interfaces to the host.

    Note in particular: the local address inside a container points to that container itself, not to another container, and not necessarily to the host.

    In production, it is best to set a unified entry point that provides encrypted access externally, and to restrict the index, storage, and internal management interfaces to the private network. Credentials should be injected through controlled configuration, avoiding being written into public code or appearing in logs.

    6.3 Separate Offline Processing From Online Requests

    Document recognition, batch indexing, and model inference may compete for compute and memory resources. It is recommended to place ingestion tasks in a separate queue or task execution unit, with resource limits and concurrency control.

    Deployment scale should be determined by testing with real materials and request volume, not estimated only from the number of components. In particular, check whether online Q&A latency and error rate rise noticeably during index building.

    7. Build a Reproducible Evaluation System Before Launch

    The evaluation set should cover real business, not just a few easy questions. At a minimum, it should include:

    • Single-document factual queries.
    • Multi-document synthesis.
    • Table data queries.
    • Old and new version conflicts.
    • Questions with no answer.
    • Unauthorized access attempts.
    • Questions that are ambiguous or have incomplete information.

    Evaluation can be divided into three levels.

    Parsing layer: Check whether text completeness, reading order, table relationships, and source localization are correct.

    Retrieval layer: Check whether the correct evidence enters the candidate results, and whether the wrong version or unauthorized content is mixed in.

    Answer layer: Check whether the conclusion is supported by evidence, whether citations correspond, whether condition limits are complete, and whether the system can refuse to infer when evidence is insufficient.

    Performance testing should break down the time spent on document processing, retrieval, reranking, model generation, and workflow execution, and observe tail latency under concurrency. Average response time may hide the problem of a few requests waiting for a long time.

    8. Enterprise Adoption Also Needs a Security and Operations Loop

    Permission control should be enforced at the retrieval stage, rather than retrieving all materials first and then letting the model decide what can be shown. Caches must also be bound to the authorization scope to prevent sensitive answers from being reused across different users.

    Text in knowledge documents may also contain misleading instructions. Therefore, treat retrieved content as data to be analyzed, not as commands that can override system rules, and limit the business tools the model can call.

    For operations, use request tracking to correlate user requests, retrieval results, model output, and error status, and desensitize sensitive information in logs. Key metrics include ingestion failure rate, proportion of no-result retrievals, number of permission denials, answer latency, and proportion of missing citations.

    When the knowledge service is unavailable, the system can degrade to prompting a later retry or returning a clear service status, but it should not generate a seemingly certain business conclusion in the absence of evidence.

    9. Summary: Select by Capability Boundaries, Validate With Real Data

    A sound enterprise knowledge base Q&A solution is not about finding a single component that handles every stage, but about clarifying the responsibility boundaries among application orchestration, document processing, knowledge retrieval, and business execution.

    For simple scenarios, you can start from an integrated prototype; for complex documents and multi-step business, you can adopt an architecture that decouples application orchestration from knowledge services. Either way, you should validate effectiveness through representative documents, real questions, permission tests, and performance tests.

    What truly determines whether a system can be used long term is whether the evidence is trustworthy, whether permissions are reliable, whether failures are controllable, and whether problems can be located and fixed after they occur. Once these foundational capabilities are solid, knowledge base Q&A can grow from a demo feature into a sustainable enterprise application.