RSI Architecture for Customer Service Agents: From Offline Training to a Closed-Loop Self-Correction System
Replacing a strong closed-source model with a mid-size in-house customer service agent is not a one-time distillation task. This article explains an RSI production loop—serving live traffic, inspection, root-cause attribution, repair data, online self-distillation, and gated rollout—and how it cut inspected bad cases, lifted satisfaction, and lowered cost per service in after-sales support.
In the current wave of AI applications, intelligent customer service agents are gradually replacing rule-based bots as the main link between a business and its users. Making a support model “smarter with use” is less about learning in the abstract and more about judgment and correction. Did a conversation actually fail? Did the error come from the model’s own reasoning, or from a mismatch in an external component such as a tool call or a Skill rule? And which version of the rules should be used to decide?
To address that gap, a technical team deployed an architecture based on recursive self-improvement (RSI) in local-services and e-commerce after-sales support. The design turns model iteration into a standard production loop so a mid-size in-house model can keep improving on real business traffic. After several closed-loop iterations, the inspected bad-case rate fell from 6.42% to 1.97%. Online satisfaction surpassed the previous closed-source strong model, and after full replacement the cost per service dropped by 70.5%.
This article breaks down that RSI architecture and how a customer service agent with self-correction is built and evolved.
1. Why one-shot distillation cannot keep up with a changing business
When replacing a strong online model, such as a closed-source large model, the common mistake is to treat the work as a simple post-training project: pull historical conversation traces, run one round of imitation learning on the in-house model, and assume traffic can be switched once offline scores are close enough. The fatal flaw is ignoring how dynamic the environment is.
The real difficulty is that, once the model takes real traffic, it faces a business environment that it helps shape and that keeps changing. If the model is weak on a class of intents, users change how they follow up. That shift accumulates, and the offline training set drifts away from the live distribution.
1.1 A clear system boundary
In after-sales support—for example, missing items, wrong deliveries, or late orders—the agent does not answer once and stop. It advances across multiple turns. A typical boundary looks like this:
- Model layer: understands context and intent, reasons, and produces decisions.
- Skill/SOP layer: holds business rules (refund limits, compensation standards, handoff-to-human conditions) and chooses the execution path.
- Tool layer: reads system state (order details, delivery trace, fulfillment status) and performs actions (start a refund, create a ticket).
The simplified decision pseudocode below shows that split:
def customer_service_agent(user_query, context):# 1. Model layer: intent recognition and slot extractionintent, slots = model.predict(user_query, context)# 2. Tool layer: state lookupif intent == "COMPLAINT_MISSING_ITEM":order_status = tool_api.query_order(slots['order_id'])delivery_status = tool_api.query_delivery(slots['order_id'])# 3. Skill/SOP layer: rule-based decisionaction = skill_router.evaluate_sop(intent, order_status, delivery_status)# 4. Model layer: natural-language reply from the actionresponse = model.generate(action, context)return response
1.2 Two hard constraints of a closed-source strong model
A closed-source strong model is fast to connect and often strong out of the box, but at scale it hits two constraints:
- Call cost grows linearly. Multi-turn sessions plus usage-based pricing make cost pressure rise with traffic.
- No control of the model itself. When behavior fails, the only levers are prompts or external rules. A vendor upgrade or shutdown can suddenly mismatch rules that were already tuned, and data privacy and boundaries are harder to fully control.
The point of an in-house mid-size model (on the order of 30B parameters) is therefore not only that it is cheaper. It brings the control plane in-house: inference can be deployed independently to cut cost, weights can be trained to fix defects directly, and release cadence is fully owned. Acceptance must also move from “the offline leaderboard passed” to “satisfaction does not drop after the model takes real traffic.”
2. The core of RSI: a production loop that corrects itself
The essence of a recursive self-improvement (RSI) architecture is to make “find the problem, then fix it” automatic and procedural. The loop has six stages that form a repeating flywheel.
2.1 Go live
The in-house model first takes part or all of real traffic. The system logs every session: user input, model reasoning, tool-call results, and the final reply. Those logs are the raw material of the loop.
2.2 Inspect and find errors
An automated inspection scans the logs. That includes rule-based keyword matching, but it also relies on a judge model that is independent of the online service and performs deeper semantic checks. It flags blocked flows, useless extra turns, policy-violating replies, and other bad cases.
2.3 Attribute and assign responsibility
This is the hardest stage. When inspection finds a bad case, the root cause must be located precisely:
- Model misunderstanding: wrong intent, or failure to use context correctly.
- Component failure: a tool API returns an error, or a Skill/SOP rule has a logic hole.
The attribution engine breaks a failed session into single steps and checks them one by one, so the team knows whether to change the model, the rules, or the tools.
2.4 Build the repair
From the attribution result, the system builds repair data automatically or semi-automatically. If the fault is in the model, the wrong reasoning trace is rewritten into high-quality preference pairs (DPO data) or instruction-tuning data (SFT data).
2.5 Online self-distillation (OPSD)
The repaired data enters online parameter self-distillation (OPSD). Unlike traditional offline full training, OPSD lets the model take small, incremental parameter updates without stopping service, so it can adapt quickly to the latest business changes.
2.6 Evaluate and release
The fine-tuned version must pass a strict sandbox evaluation. It has to hold its level on the standard test set and also replay the latest hard-case set. Only after every gate is passed does the new version roll out gradually in grayscale, and the next cycle begins.
3. Engineering practices and challenges inside the loop
A few engineering details decide whether an RSI deployment actually works.
First, attribution has to be robust. A support agent often fails for more than one reason. A wrong tool call may come from forgetting a long context, or from an earlier SOP step that steered the dialogue the wrong way. A state-machine session reconstructor turns unstructured dialogue into a structured state-transition graph, so attribution becomes a node-check problem.
Second, data quality must not degrade. Automatically built repair data can inject noise and pull the model off course. In OPSD, strict cleaning and confidence filtering are required. Repair data enters the distillation queue only when its confidence is above a set threshold and a human sample check confirms it is correct.
4. Business results and where the architecture can go
Combining RSI with a mid-size in-house model produced clear results in after-sales support. After five iterations, the bad-case rate in automatic inspection fell sharply from 6.42% to 1.97%, less than half the rate of the previous online closed-source strong model. More importantly, on real traffic, user satisfaction did not fall because the model was smaller. It moved from 4.57 percentage points behind to a small lead. After full replacement, cost per service fell by 70.5%, which is both lower cost and better results.
Putting a customer service agent into production is not a one-time delivery. It is long-running system operation. RSI builds a closed data flywheel so the model can diagnose and improve itself. Keeping that control in-house is not limited to support. It is a useful engineering pattern for other agents that need strong reasoning and tool use. Combined with high-performance compute and containerized inference from platforms such as Baidu AI Cloud, this kind of self-evolving architecture can further unlock the practical value of large models in industry.
