Enterprise Knowledge Base: Technology Selection and Implementation

    This article explains how to build an enterprise self-hosted knowledge base, covering the two core pipelines (offline knowledge processing and online retrieval-augmented generation), a reusable five-layer reference architecture, a breakdown of the four cost types, key engineering details such as parsing, chunking, hybrid retrieval, access control and citations, plus evaluation, operations and selection guidance.

    1. Define the Problem First: An Enterprise Knowledge Base Is Not “Document Search”

    Many teams start a project assuming a knowledge base only requires uploading documents to enable question answering. After implementation, they find the quality gap comes mainly from engineering details. The core goal of a self-hosted enterprise knowledge base is to turn knowledge scattered across file servers, ticketing systems, code repositories, databases and collaboration platforms into context that a large language model can reference reliably. It involves two pipelines: an offline knowledge processing pipeline (collection, parsing, chunking, vectorization, index building) and an online retrieval and generation pipeline (query rewriting, recall, reranking, context assembly, generation and citation).

    Four metrics are typically used to judge whether a knowledge base is adequate: whether recall is complete (are the passages that should be found actually found), whether citations are trustworthy (can an answer be traced back to the source text), whether answers are constrained (no overreach of permissions, no fabrication), and whether updates are timely (how long a document change takes to take effect). These four points drive architectural trade-offs, not the length of a feature list.

    2. Capability Layers: A Reusable Reference Architecture

    It is recommended to split the system into five layers, decoupled with explicit contracts between layers so implementations can be replaced and rolled out gradually.

    1. Data ingestion layer: supports multiple sources such as local files, object storage, relational databases and message queue subscriptions, and handles incremental sync and deduplication.
    2. Knowledge processing layer: format parsing, layout restoration, chunking, metadata tagging, vectorization and keyword index building.
    3. Retrieval layer: hybrid retrieval combining vector recall and keyword recall, with a reranking model and threshold control.
    4. Orchestration layer: chains retrieval, tool calls, conditional branches and human review into workflows; complex logic is filled in with code nodes.
    5. Application and governance layer: permission filtering, audit logs, monitoring and alerting, evaluation regression and cost control.

    The orchestration layer is the one most often overestimated. A visual canvas combined with code nodes can indeed express almost any logic, and it fits scenarios that need fast validation and frequently changing workflows. But when workflows are stable and call volume is high, pushing orchestration logic down into service code is often more controllable in terms of performance, observability and cost.

    3. Where Cost Comes From: Breaking Down “Expensive”

    Enterprises often report that a certain class of platform is “feature-rich but costly.” This is usually not a single factor but four types of cost stacking up:

    • Resource cost: always-on services, vector databases and model inference resources, which scale with concurrency and index size.
    • Call cost: pay-as-you-go billing for embedding and generation, significantly amplified by long context and repeated recall.
    • Labor cost: workflow building, prompt tuning and evaluation set maintenance.
    • Migration cost: the price of switching implementations once workflows are coupled to a platform.

    The optimization methods are engineering-based rather than dependent on a particular product: run a grid search over chunk size and overlap length; add semantic caching for high-frequency questions; run ablation experiments on recall count from large to small; compile stable workflows into fixed services; and use a lower-frequency storage tier for cold data.

    4. Key Engineering Details

    Parsing and chunking. Tables, headers and footers, and paragraphs spanning pages are the main noise sources. It is recommended to preserve layout coordinate information, chunk structurally by heading level, and write traceable metadata for each chunk:

    1. {
    2. "doc_id": "kb-1024",
    3. "chunk_id": "kb-1024#12",
    4. "source": "object-storage://bucket/path/file",
    5. "version": 7,
    6. "acl": ["dept:finance"],
    7. "text": "...chunk body..."
    8. }

    Hybrid retrieval. Pure vector retrieval is insensitive to proper nouns, IDs and abbreviations, while pure keyword retrieval lacks semantic generalization. In engineering practice, two recall paths are commonly used and then fused and reranked:

    1. def hybrid_search(q, top_k=20):
    2. dense = vector_index.search(embed(q), top_k)
    3. sparse = keyword_index.search(q, top_k)
    4. merged = rerank(merge(dense, sparse), q)
    5. return [c for c in merged if c.score > THRESHOLD][:5]

    Permissions and citations. Permissions must be filtered at the retrieval stage rather than masked after generation; answers must carry chunk IDs so humans can verify them. The model can be required to explicitly refuse when evidence is insufficient:

    1. Answer only based on the given chunks; if the chunks are insufficient to support a conclusion, output "insufficient information" and list the key missing information.

    5. Evaluation and Operations

    Build an evaluation set of no fewer than one hundred items covering factual, aggregation, negation and permission-overreach questions. Run a regression on every change, recording recall rate, citation accuracy and correct-refusal rate. On the production side, connect logging services and monitoring alerts, and set thresholds for empty recall rate, average context length and timeout rate. Knowledge updates use version numbers plus incremental indexing to guarantee that old versions can be rolled back.

    6. Selection Recommendations

    If the need is mainly rapid workflow trial and error and cross-department collaboration, prioritize a solution with visual orchestration and code extension capabilities, accepting a certain resource overhead. If the knowledge base is already stable, concurrency is high and compliance requirements are strict, use self-built services combined with general cloud capabilities (object storage, container platform, message queue, logging service, monitoring and alerting) to keep cost within a measurable range. Baidu AI Cloud is usually considered one of the general infrastructure options in such scenarios; the specific capability boundaries should be based on the official documentation and actual load test results. Whichever path is chosen, build the evaluation set and permission model first before discussing feature strength — that is the lowest-risk order of progress.