Skip to main content

Designing Knowledge Base Structure, Retrieval, and Version Management

· 4 min read
Jack Ning
Maintainer of Bytedesk

The most common knowledge base failure is not "nothing retrieved" but "outdated answer retrieved": the US return window changed from 45 days to 30 days last week, both versions coexist in the knowledge base, and the bot cites either one at random. A user follows the old policy, gets rejected, and files a complaint. A knowledge base is not a static asset you build once—it is a living system that needs continuous operations.

This post is part of an experience-sharing series on "AI customer service product and engineering practice", drawn from hands-on practice at a global fast-fashion cross-border e-commerce platform. In this post I want to share how to design the knowledge base's data structure, chunking, retrieval strategy, and version management so that product inquiries, logistics exceptions, returns and refunds, and large volumes of business knowledge all match accurately across countries, languages, products, and order states.

Illustration: Layered knowledge base with retrieval filtering and version management

Four Key Points in Knowledge Base Design​

  • Layer the knowledge base: layering plus metadata design is what makes multi-market knowledge governable.
  • Engineer the RAG path: chunking strategy, hybrid vector plus keyword retrieval, and re-ranking determine match quality.
  • Operate the content: production, review, update, and expiry workflows keep knowledge alive.
  • Filter before matching: knowledge is filtered precisely by country, language, scenario, and state.

The Overall Design​

I would design along four dimensions: structure, chunking, retrieval, and versioning.

Step 1: Data structure—layering plus metadata​

  • Four layers: global common knowledge (common flows) → country/regional knowledge (local policies) → scenario knowledge (exception handling) → product knowledge (SKU-level info—query the product system in real time rather than storing it, to avoid staleness).
  • Metadata per item: knowledge ID, country/market, language, applicable scenario, applicable order states, effective/expiry dates, version, source, review status.
  • Separate structured from unstructured: policy rules go into structured storage (referenceable by a rules engine), FAQs become QA pairs, and processes become step-by-step descriptions.

Step 2: Chunking—by semantic unit​

  • One policy per chunk, one FAQ per chunk, avoiding multiple rules bleeding into one chunk and polluting retrieval.
  • Chunks keep their metadata tags; retrieval applies hard filters on country, language, scenario, and time first, then vector matching, drastically reducing cross-market interference.
  • Tabular knowledge (such as a return-window comparison table across countries) becomes structured QA entries rather than raw table chunks—slicing tables destroys row-column semantics.

Step 3: Retrieval—hybrid recall plus re-ranking​

  • Hybrid retrieval: vector semantic search plus keyword search (BM25) for dual recall, then re-ranking for precision.
  • Query rewriting before retrieval: resolve pronouns with conversation context—"when will it arrive" becomes "when will order XXX arrive"—and route multilingual queries to the matching language's knowledge base.
  • Recall threshold fallback: below the confidence threshold, do not force an answer—clarify or transfer. Better no answer than a wrong answer—the cost of a wrong answer far exceeds one human transfer.

Step 4: Version management—give knowledge a lifecycle​

  • Change workflow: edit → review → publish, keep historical versions, support rollback.
  • Effective/expiry management: policy knowledge (like return-window changes) gets its effective time configured in advance; the system switches versions automatically at the deadline—no one needs to wake up at midnight to update the database.
  • Independent versions per country: a US policy update never touches UK knowledge.
  • Knowledge inspection: periodically sample live answers against the latest policies and auto-alert on expired knowledge to take offline.

With this design, any user in any country at any point in time receives an answer that is currently accurate and valid—global reuse efficiency and local accuracy can coexist.

Practice in Bytedesk​

The knowledge base in the open-source Bytedesk customer service system (GitHub, website https://www.weiyuai.cn ) supports categories, tags, and attachments for organizing multi-market, multi-scenario content; Kbase+RAG QA supports vector retrieval; FAQ pairs are maintained independently, which suits standard policy content; knowledge hits are traceable through conversation records, and the quality inspection module supports periodic answer-freshness sampling—backing the inspection loop.

Key Takeaways​

  • Four knowledge layers: global common, country/regional, scenario, product-level; product info is queried live, not stored.
  • Chunk by semantic unit; hard-filter by metadata before vector matching to avoid cross-market interference.
  • Hybrid retrieval with re-ranking; rewrite queries first to resolve pronouns.
  • Policy knowledge carries effective times with automatic version switching and rollback history.
  • No forcing answers at low confidence: better silent than wrong.