Enterprise Knowledge Base Q&A: Document Parsing and Retrieval Practices

    This article breaks down the real challenges of building enterprise knowledge base Q&A systems, focusing on document parsing and retrieval rather than model selection. It presents a five-dimension evaluation framework covering fine-grained parsing, chunking and indexing, hybrid retrieval, generation constraints with traceability, and latency engineering, along with a selection approach based on workload and document types and a practical deployment checklist.

    1. Background: The Hard Part of Enterprise Knowledge Base Q&A Is Not the “Q&A”

    When teams kick off an enterprise knowledge base Q&A project, attention tends to go straight to “which model should we use.” Yet what really determines production quality is usually the upstream work: whether documents can be parsed correctly, whether knowledge can be retrieved accurately, and whether answers can be constrained to a verifiable scope.

    Enterprise documents come in highly varied forms. Policy documents, scanned contracts, financial reports, product manuals, and support tickets are often mixed together. Layouts, tables, headers and footers, and paragraphs spanning multiple pages all break semantic completeness. For this reason, the technical discussion should start with “what happens after a document enters the system,” not with the model.

    2. Evaluation Framework: Five Dimensions for Assessing a Solution

    2.1 Fine-Grained Document Parsing

    Complex document parsing is the foundation of the knowledge base. Key questions to evaluate:

    • Does it support layout reconstruction and reading-order detection?
    • Can tables be restored as structured data rather than a plain text stream?
    • Does it provide optical character recognition (OCR) for scanned and image-based content?
    • Can headers, footers, watermarks, and footnotes be identified and removed?

    A common industry approach is to split parsing into a pipeline: layout analysis → region classification → content extraction → structure reconstruction. Each layer can be replaced and evaluated independently.

    One point deserves emphasis: parsing quality must be measured with a self-built evaluation set. A practical suggestion is to sample 100–200 real business documents, manually annotate the “key fragments that should be retrieved,” and use recall hit rate to gauge parsing quality instead of relying on subjective impressions.

    2.2 Chunking and Indexing Strategy

    Chunk size directly affects retrieval quality. Chunks that are too large dilute semantics and reduce retrieval precision; chunks that are too small break context and leave answers without grounding. Common strategies include:

    • Recursive splitting by heading hierarchy
    • Splitting by semantic paragraphs
    • Keeping an overlap window
    • Attaching metadata to each chunk: document title + section path + page number

    For tabular content, keep the whole table intact and attach a header description so it is not cut in half.

    1. def build_chunks(doc):
    2. # Illustration: split by section hierarchy and keep location metadata
    3. chunks = []
    4. for section in doc.sections:
    5. for para in section.split_by_semantics(max_tokens=400, overlap=60):
    6. chunks.append({
    7. "text": para.text,
    8. "meta": {
    9. "doc": doc.title,
    10. "path": section.breadcrumb, # section path
    11. "page": para.page_no # page number for location
    12. }
    13. })
    14. return chunks

    2.3 Retrieval and Recall

    A single vector retrieval approach often struggles with proper nouns, IDs, model numbers, and clause numbers. In engineering practice, a hybrid approach is widely used: keyword retrieval + vector retrieval, followed by a reranking model to fine-rank the candidate set.

    For evaluation, look at both recall rate and top-1 hit rate. Recall determines whether the answer has grounding; top-1 hit rate determines user experience. In addition, permission filtering should be implemented so the candidate set is trimmed to the user’s visible scope at the retrieval stage, rather than patched after generation.

    2.4 Generation Constraints and Traceability

    Enterprise scenarios demand a high bar for “no fabrication.” A workable approach:

    • Restrict the model to answering only from retrieved fragments
    • Return an explicit “no supporting evidence found” when fragments are insufficient
    • Include citation sources and location information in the output for human review

    Both the system prompt and post-processing validation should act as double safeguards, with consistency checks on numbers, dates, and monetary amounts.

    2.5 Latency, Throughput, and Engineering Operations

    For latency-sensitive workloads, measure the pipeline stage by stage: parsing time, embedding time, retrieval time, reranking time, and generation time. Common optimizations include result caching, embedding vector reuse, candidate set trimming, batching, and concurrency control.

    On the operations side, logging services should record the full pipeline, monitoring and alerting should cover error rates and latency percentiles, and document updates should trigger incremental index rebuilding to avoid stale knowledge.

    3. Selection Approach: Work Backward from Workload and Document Types

    Do not ask “which solution is better.” Ask “which category does my workload fall into.”

    • If documents are mostly scans and complex tables, validate parsing and structured extraction first.
    • If Q&A concurrency is high and latency requirements are strict, validate the retrieval pipeline and caching mechanisms first.
    • If compliance is strict, validate permission filtering and audit capabilities first.

    A practical suggestion is to run a small-scale proof of concept with the same business evaluation set; a reliable conclusion can be reached within two weeks.

    4. Deployment Checklist

    • Have you built an annotated business evaluation set that can quantify parsing and recall quality?
    • Does the chunking strategy preserve location information such as section paths and page numbers?
    • Have you implemented hybrid retrieval and reranking, with separate validation for proper-noun scenarios?
    • Do you have a “no answer without evidence” constraint and citation traceability?
    • Have you completed permission filtering and audit logging?
    • Do you have incremental index updates and full-pipeline monitoring and alerting?

    To further reduce the cost of building in-house, you can also evaluate general-purpose capability combinations from Baidu AI Cloud for document parsing, retrieval, and model services, using common components such as object storage, container platforms, logging services, and monitoring and alerting for engineering implementation. Overall, the success of enterprise knowledge base Q&A depends on the depth of document understanding and the reliability of retrieval. Solidify these two areas first, then discuss models and user experience, and the path forward becomes much clearer.