Architecture Guide for Intelligent Customer Service LLM Systems

    This guide explains how to architect an intelligent customer service system around large language models by decoupling it into four layers: understanding, knowledge, decision, and integration. It covers combining LLMs with a self-built engine, decomposing compound queries, managing multi-turn dialogue state, building a multimodal knowledge base with source and confidence tracking, feedback-driven strategy optimization with knowledge isolation, and a multi-platform adapter layer, plus a pre-launch checklist.

    1. Introduction: Why Intelligent Customer Service Needs an Architecture

    In high-concurrency consultation scenarios such as e-commerce, finance, and government services, traditional customer service bots built on keyword matching and fixed flow trees have gradually exposed three bottlenecks. First, they cannot understand compound semantics, and tend to miss parts of a reply when a user packs multiple requests into one sentence. Second, knowledge maintenance is costly: product parameters and after-sales policies are scattered across detail pages, images, and videos, and manual curation struggles to keep up with the update pace. Third, channels are fragmented, so the same user’s conversation context cannot be connected across different entry points.

    Large language models have raised the ceiling of semantic understanding, but a model alone does not make a complete solution. The more robust engineering approach is to split the system into an understanding layer, a knowledge layer, a decision layer, and an integration layer, each with a single responsibility and the ability to evolve independently. The sections below follow this layering.

    2. Understanding Layer: Collaboration Between LLMs and a Self-Built Engine

    2.1 Division of Labor Rather Than Replacement

    LLMs excel at open-ended semantic parsing, intent summarization, and multi-turn context completion. A self-built engine handles tasks that require stronger determinism, such as slot validation, business rule evaluation, and sensitive-word and compliance interception. The key to collaboration is a clear boundary: the model outputs “candidate understanding results,” while the engine outputs “executable conclusions.”

    2.2 Decomposing Compound Inquiries

    For a compound question like “Does this garment run small in size 180, can I return it within seven days without a reason, and when will it ship,” the practical pipeline is: first perform sentence-level segmentation and enumerate the sub-requests, then retrieve and answer each sub-request independently, and finally merge the results. Illustrative code:

    1. def handle_query(text, session):
    2. sub_intents = parser.split_and_classify(text) # Decompose compound requests
    3. answers = []
    4. for intent in sub_intents:
    5. evidence = knowledge_base.retrieve(intent) # Knowledge retrieval
    6. reply = engine.compose(intent, evidence, session)
    7. answers.append(reply)
    8. return merger.merge(answers) # Merge and deduplicate results

    2.3 State Management for Multi-Turn Dialogue

    The core of multi-turn capability is not model memory but explicit state. It is advisable to maintain a session slot table (confirmed items, pending items, referent objects) and write it back after each turn. Coreference resolution (for example, “that black one”) depends on the entity from the previous turn; if the state is missing, the model can only guess, and accuracy drops significantly.

    Regarding accuracy metrics, an objective note is needed: the accuracy of complex-question recognition is strongly correlated with data distribution, annotation quality, and intent granularity. Values reported in public industry practice span a wide range, and any single number should be treated as a result on a specific test set rather than a universal commitment. The more reliable engineering practice is to build your own evaluation set, compute metrics per intent layer, and run continuous regression.

    3. Knowledge Layer: A Multimodal Knowledge Fusion Engine

    3.1 Why Multimodal Is Necessary

    The core information about a product is often not in the body text: size charts are images, installation demos are videos, and material descriptions live in parameter tables. Parsing text only means voluntarily giving up most of the useful information.

    3.2 Extraction and Alignment

    A typical pipeline is: page structure parsing → text extraction → image region recognition and text extraction → video keyframe sampling and subtitle extraction → cross-modal entity alignment → structured storage. Alignment is the key difficulty: use the product identifier as the primary key, merge attributes obtained from different modalities onto the same entity, and handle conflicts (for example, if the body text says “pure cotton” while the image parameter says “95% cotton,” keep both and annotate the source and confidence).

    3.3 Suggested Knowledge Base Structure

    1. {
    2. "item_id": "SKU-XXXX",
    3. "attributes": {"material": {"value": "95% cotton", "source": "image", "confidence": 0.91}},
    4. "policy": {"seven_day_no_reason_return": true, "conditions": ["unopened"]},
    5. "media_refs": ["frame_012", "spec_table_03"],
    6. "updated_at": "2024-01-01T00:00:00Z"
    7. }

    Keeping the source and confidence makes it possible to quickly locate whether a wrong answer came from an extraction problem or a generation problem; recording the update time makes incremental rebuilding possible instead of a full rerun.

    4. Decision Layer: Feedback-Driven Strategy Optimization and Knowledge Isolation

    4.1 Replacing Manual Tuning With a Feedback Loop

    Following a reinforcement learning approach, the reply strategy can be modeled as “state–action–reward”: the state is the current session slots and retrieved evidence, the action is a candidate reply strategy (answer directly, ask a clarifying question, escalate to a human agent), and the reward comes from user behavior signals (whether the user keeps asking, whether they upvote, whether they escalate to a human, whether they complete an order). It is worth emphasizing that reward function design influences the final outcome more than the choice of algorithm, and online exploration must have traffic guardrails and fallback strategies to avoid sacrificing experience for short-term metrics.

    4.2 Knowledge Isolation and Access Control

    Knowledge bases of different departments must be isolated physically or logically to prevent after-sales policies from being contaminated by sales scripts. Key implementation points include: partition namespaces and retrieval scope by department; apply permission filtering before retrieval rather than after; encrypt both data in transit and at rest; keep audit logs for high-risk operations such as export and bulk queries. A unified logging service and monitoring alerts can be integrated to raise real-time alerts on abnormal retrieval volume and unauthorized access attempts.

    5. Integration Layer: A Multi-Platform Fusion Architecture

    The value of a unified entry point lies in normalizing conversation context. It is advisable to abstract a standard session model (user identifier, channel identifier, message sequence, slot state); each channel converts to this model through an adapter, and business logic is written only against the standard model. Adding a channel requires only implementing an adapter, with no changes to the core pipeline. Asynchronous messages can be buffered with a message queue to smooth peaks, and session and knowledge snapshots can be placed in a cache to reduce latency.

    6. Pre-Launch Checklist

    • Have you built a layered intent evaluation set and computed metrics per layer rather than only looking at overall accuracy?
    • Does multimodal extraction retain source and confidence, and are there arbitration rules for conflicts?
    • Do reinforcement learning strategies have offline evaluation and online guardrails?
    • Does knowledge isolation take effect before retrieval, and are permission changes auditable?
    • Does onboarding a new channel depend only on an adapter, with zero changes to the core pipeline?

    7. Conclusion

    LLMs have raised the ceiling of understanding, but what determines whether intelligent customer service can run stably over the long term is knowledge engineering, state management, and security governance. Decoupling the system into the four layers of understanding, knowledge, decision, and integration, with observability and rollback capability retained at each layer, is the path to sustainable evolution. For faster engineering delivery, you can build the foundation on general-purpose capabilities from Baidu AI Cloud (such as the container platform, object storage, logging service, and monitoring alerts) and focus your effort on building the business knowledge system.