Corpus Drives Codebook — Why Your Intent Taxonomy Is Stuck at 60% and How It Evolves from 36 to 48

A monthly review meeting. Ops drops a dashboard screenshot in the channel: 1,102 user messages, intent-classification accuracy 59.44%, unknown rate 40%. The business side reacts reflexively: "Can we just add an LLM fallback for that 40%?"
The vendor proposes the same thing: lower the large-language-model (LLM) fallback threshold from 0.85 to 0.7, and push more unknowns into LLM classification. A week later, in the follow-up, accuracy has risen from 59% to 67%, but the unknown rate has barely budged. The business side walks the remaining misses one by one: "The LLM still got these 200 wrong. Why?"
After auditing a few dozen samples, the engineer admits the thing nobody wants to hear. The real problem with these 200 is not that the classifier missed them. It is that the codebook has no slot for them in the first place.
"When will my return request go through?" The classifier labeled it refund_status (the money), when it was return_status (the return-review). The two definition cards never drew a clear boundary, so every call is a coin flip.
"Don't apply the refund, just ship it." The classifier labeled it order_cancel. It is actually a request to withdraw an after-sales request already filed. The taxonomy has no such intent, so every forced fit is wrong.
"If you don't take the return, I'll wait for the market supervision bureau." The classifier labeled it complaint_service. Business policy is that any mention of an external regulator goes straight to a human, which should be human_transfer. The rule was never written into the codebook, so the classifier had no way to know.
Every customer-service Agent project I've led this year, when unknown rates run high, starts by inspecting the classifier. About 80% of the time, the taxonomy itself was never designed well. The codebook is the taxonomy; the classifier is only its implementation. If the codebook is missing an intent, no amount of classifier cleverness will invent it. If the boundaries are vague, even a precise classifier is flipping a coin. If the names are inconsistent, what labelers mark and what the rules match cannot line up, and accuracy has a ceiling built in.
Whether a plan can ship, how to keep it from rotting after launch, the north-star metric, the split between brain and hands, and how to test, I wrote in 28 projects called themselves Agents. Only 4 needed to be built as one., In week two of the pilot, "I want a refund" sent the money out., Why a 70% Critic Beats a 95% Critic, The less you are Apple, the less you can skip this., Contained is not resolved: how "98% CSAT" gets faked, Agent Skills vs Knowledge Base: Why Stuffing SOPs Into RAG Doesn't Make an Agent Capable, and Pytest-green doesn't mean ship-ready.. How to tune the thresholds is in Just add an LLM as a fallback? The bill went up 12x.. How to layer the interfaces is in Don't Let AI Agents Call APIs Directly. This piece turns to the taxonomy itself. Without that, a tuned classifier still tops out at 60%.
This piece does three things. First, how to work backwards from a real user-utterance corpus to find the holes in the taxonomy: four systematic confusion patterns, each with concrete samples. Second, a four-quadrant test to run before anyone says to add an intent. Most so-called missing intents are not intents at all; they are parameter slots, dialogue states, or multimodal signals. Third, a three-round diff process, the actual path from 36 to 45 to 46 to 48, with who approved each round, what got added, what got rejected, and how many downstream files a single rename touches.
Next time someone in a review says the unknown rate is high, and that an LLM fallback will fix it, put the rules from this post on the table. A high unknown rate is almost never a classifier problem. It is a systemic gap in the codebook.
The 1,102 anonymized samples, clustered by expert-corrected labels, surface four confusion patterns. The codebook sits in the middle as the single source of truth. Downstream, labels, rules, knowledge, and eval have to move in dependency order. That judgment lives in the prose; the figure should not have to define it.
Four patterns showed up in 1,102 samples
Codebook gaps cannot be found by brainstorming at a desk. You have to label a real corpus, have business experts apply expert corrections, and then count which labels keep getting corrected to the same wrong thing. After three months of accumulation, the 1,102-sample batch made four patterns obvious.
Users do not distinguish goods from money. The taxonomy does.
return_status is return-review progress. refund_status is money-arrival progress. They are two distinct intents, with different backend APIs and different SLA calculations.
Users do not think that way. In the expert-correction pass over 1,102 samples, there were six places where "asking about review progress" had been mislabeled refund_status.
"When will my return request go through?" The first business reflex is that this is about money. Go through, here, means the review was approved.
"This after-sales review is way too slow." Review speed is clearly about the goods.
"I already sent it back, you signed for it, now refund me." This one really is refund_status, because the user's focus has already moved from whether they can return the item to when the money arrives.
The root cause is not the classifier. The codebook hid the boundary. In the original definition cards, return_status and refund_status each had a one-line definition: no easily confused counterexamples, and no rule for what to do when the user does not distinguish the two.
The fix belongs in the codebook, not the classifier. Definition card v2 writes the rule down. return_status is the user asking about the review progress of a return ticket; typical phrasing is "how far has the review gotten," "when will it go through," "return speed." Counterexamples that should be refund_status are "when does the money arrive," "you under-refunded me," "the refund hasn't landed." When both goods and money are mentioned, watch the landing point: "I sent it back, now refund me" has already moved to the money, so refund_status; "the return request went through, where's my money," under the rule as it was written, still has its focus on the review, so return_status.
Once that section was added to the v2 card, inter-annotator agreement went from 78% to 91%, not because labelers got smarter, but because the codebook wrote the rule down.
A missing intent, and eight samples forced into a neighbor
Take order_cancel and cancel_order_exec together. In expert review, the business side added eight samples. Not one of them was a true order cancellation. All eight were "withdraw a return or refund already requested": how do I retract the refund; I don't want to return it, how do I cancel; I clicked by mistake and applied for a refund; I strongly request that the return be cancelled; can I cancel the return request; I'll cancel after-sales first; don't apply the refund, just ship it; the item hasn't shipped yet, I accidentally requested a return, how do I cancel.
The taxonomy had no "withdraw an after-sales request" intent. Experts forced the samples into order_cancel, labelers marked them that way, and the classifier learned "order cancel, plus after-sales wording, goes to order_cancel." After launch, a genuine "I want to cancel this order" started to be misclassified.
This is the typical shape of a corpus-driven codebook gap. One sample does not look like a problem. The same missing intent appearing eight times is a system signal. The fix was to add cancel_after_sales, wired downstream to the ticket system's "withdraw after-sales request" action. The taxonomy moved from 45 to 46 because of this one intent.
Catching the signal requires a specific column on the recovered samples: expert_correct_intent. It is not enough for labelers to mark mapped_intent. A business expert has to review, for each sample, "if this does not belong to any of the mapped intents, which one is it closest to," and then you count the high-frequency adjacent intents inside those expert corrections. The same error, repeated enough times, is a codebook hole.
Three intents with no written boundary, so labelers flip a coin
complaint_service, escalation, and human_transfer sound close on the business side, and labeling them is almost a coin flip.
"Your after-sales is terrible, someone needs to deal with this." Complaint, or escalation?
"I'll email your Shanghai headquarters executives." Does executives make this escalation, or still a complaint?
"If you don't take the return, I'll wait for the market supervision bureau." This must be human_transfer, but labelers marked it complaint_service.
"Transfer me to after-sales." Escalation, or a human handoff?
The business side later aligned on three sentences. complaint_service: the user is unhappy with the current service, but has not asked to speak to someone else. escalation: an explicit request for a manager, supervisor, superior, or person in charge. human_transfer: an explicit request to go to a human, or a mention of 12315, a consumer association, a government hotline, a lawyer, or a court. The key rule: any mention of an external regulator, such as 12315, government, court, or the press, is human_transfer, transferred immediately, not sent down the slow complaint_service path.
Once that definition landed in codebook v2.1, labeler agreement finally stabilized. The point was not how many new intents were added. It was that the key rule got pinned down in the codebook, instead of living in 30 labelers' heads. If it lives only in their heads, the next cohort of labelers loses it.
One intent mixed three data sources, so routing could not be tuned
product_inquiry, under expert review, turned out to mix three fundamentally different query types. "What material is this shoe?" is a static spec, answered from the knowledge base, usually in under 10ms. "What's on the size chart?" is a static attribute, same path, also under 10ms. "Do you still have size 42?" is live inventory, an API call in real time, 500ms or more, and time-sensitive.
The three queries do not share a data source: knowledge base versus a live API. They do not share a latency cost: 10ms versus 500ms. They do not share a cost of being wrong: a wrong spec annoys the customer; a wrong stock answer sends them to the store for nothing. They do not share a freshness window either. Specs are effectively permanent; inventory goes stale in minutes.
The cost of mixing them is more than a messy data source. When the LLM, in a RAG pipeline, sees an inventory-style query and the retrieval comes from the knowledge base instead of the stock API, it invents "in stock." Business caught this after launch. Tracing it back to the codebook showed the original definition of product_inquiry had been mixed from the start.
The fix split three independent intents out of the set of 45: product_inquiry stays, but is limited to static specs and attributes; stock_availability is new, and hits the live inventory API; restock_notify is new, and handles stock-subscription. Business experts asked for the split; engineering did not invent it. The evidence was already in the 1,102 samples: "does this style exist" and "what's the material" were, to the experts, two completely different talk tracks. Combining them in the codebook was a design error.
What the four patterns share: none of them is "the classifier missed." The classifier was facing a taxonomy that was already wrong, and the label, rule, and knowledge artifacts were misaligned from the source. By the time you are tuning classifier thresholds, you are already too late.
An intent is not whatever the user said
Before the business side proposes adding an intent, run four lines. In the same recovery round, business suggested 15 "missing intents." After the four-quadrant test, only eight should actually be added; three were businesses the company does not even have; four were not intents at all.
The four lines are: if the backend action is different, it must be a separate intent; if only a parameter differs, do not add an intent, add a slot; if only the phrasing differs, it is the same intent said another way, and it belongs in the training data; if only the dialogue state differs, it belongs in the state machine, not the taxonomy.
Each line catches a common fake "missing intent."
Business asked for a "send Alipay account" intent. The backend action is the same as the refund flow: read the account the user provided, write it into the ticket, trigger reconciliation. Only a parameter differs: the refund flow collects one more field, alipay_account. The right move is to add a slot to the refund flow, not a new intent.
They also asked for a "I'll take a photo later" intent, for when a user says "give me a minute, I'll find the shoes and take a picture." The Agent does not need a new backend action. It needs to park the conversation, wait for the next message, usually an image, and continue the complaint_quality flow. The right move is an awaiting_photo state in the dialogue state machine, not a new intent. If you add it to the taxonomy, the classifier has to learn to return delayed_photo when the user says they will photograph later. What can the Agent do with that intent? Nothing. It is an empty run.
Or: "please support a 'user sent an image' intent." Sending an image is an attachment event. The frontend can see it directly from message.attachments. Once recognized, route automatically into the complaint_quality flow, which is where most photo sends belong. The right move is frontend detection and auto-routing, not a new intent. Asking an LLM classifier "is this message a photo" is a cannon aimed at a mosquito. About five lines of JavaScript in the frontend will do it.
And sometimes the business does not exist. Business asked for three intents: real-name verification, a cleaning and maintenance service, and customer-service hours. Does the company have a cross-border or customs business? No, so there is no real-name scenario, and the request should be rejected. Does it offer cleaning as a value-added service? No, reject that too. Customer-service hours belong in the FAQ knowledge base; they do not need their own intent. The business side will not always ask this first. They see a related question in the historical logs and want to add it. Engineering's job is to confirm that the business exists, then decide whether an intent is warranted.
One sentence to bring it back: an intent is the smallest classification unit for which the system has to take a different action. It is not "whatever phrase the user said," not "every topic that ever appeared in the agent logs," and not "every user expression the business side would like recognized." Run that sentence over the 15 suggested "missing intents," and the eight that remain are the ones that should actually be added.
From 36 to 45 to 46 to 48: the three-round diff path
A taxonomy is not designed once. It is a loop: recover corpus, revise, sync downstream, run regression, recover again. Three rounds in three months, each diff approved jointly by business and engineering, produced the path below.
Round 1, 36 to 45: nine new intents from the corpus, plus two renames
Round 1 was based on expert-correction counts over the 1,102 samples. Business proposed 15 new-intent suggestions and three merge-or-split questions. After the four-quadrant test, nine were added: wrong_item, missing_item, return_address, shipping_address_change, price_inquiry, stock_availability, third_party_auth, edit_return_number, restock_notify. Two were renamed: invoice became invoice_request, and invoice_register became invoice_auto_issue. Three were rejected: real_name_auth (no such business), cleaning_service (no such business), service_hours (belongs in the FAQ). Four were deferred: sending a photo is a multimodal signal, "I'll photograph later" is a dialogue state, the Alipay account is a slot, and a shipping-reminder check overlaps an existing intent.
| Action | Count | Detail |
|---|---|---|
| Add | 9 | wrong_item / missing_item / return_address / shipping_address_change / price_inquiry / stock_availability / third_party_auth / edit_return_number / restock_notify |
| Rename | 2 | invoice → invoice_request; invoice_register → invoice_auto_issue |
| Reject | 3 | real_name_auth (no business) / cleaning_service (no business) / service_hours (FAQ) |
| Defer | 4 | photo send (multimodal) / photograph later (dialogue state) / Alipay account (slot) / shipping-reminder check (overlaps an existing intent) |
Every rejection and deferral needs a written why for the business side. That document is alignment material for them, not an internal engineering memo.
This is the highest-information round in a codebook's life. Teams that have never recovered a corpus designed the taxonomy from imagination, so of course it does not match the real distribution. Only after a real corpus has been walked once do you know which intents are missing, which boundaries are messy, and which should never have existed.
Round 2, 45 to 46: a hole the expert addendum caught
After round 1 shipped, business experts reviewed another 33 intents, about 180 samples, in the addendum of definition card v2. Counting high-frequency adjacent-intent errors, the same hole appeared eight times, the cancel_after_sales gap from the previous section.
This round added only one intent, and finding it was expensive. Without the second expert addendum, the hole would have waited until three months after launch, when a user said they could not cancel an after-sales request. By then, downstream labels, rules, knowledge, and eval would already have been deployed against 45 intents.
The lesson: corpus recovery is not a one-shot exercise. Round 1 catches the obvious gaps. The less obvious ones need multiple expert passes, plus high-frequency counts from expert correction. A workable cadence: before launch, at least 1,000 samples and one expert pass, for round 1; one month after launch, another 1,000 and a second pass, for round 2; three months after launch, another 1,000 and a third pass, for round 3. After three rounds the taxonomy is largely stable; later changes are low-frequency local edits, one or two intent adds or removals per quarter.
Round 3, 46 to 48: merge needs that only showed up after launch
Round 3 did not start as more new intents. It started from the other direction. Once too many intents had been added, some of them needed to collapse into the same sub_topic inside the LLM Router, the v2 architecture I described in Just add an LLM as a fallback? The bill went up 12x..
product_inquiry, product_compare, product_recommend, brand_specific, and price_inquiry, five legacy intents, collapse into one product sub_topic. complaint_quality and complaint_service collapse into complaint. Three dedicated sub_topics were also added for boundary cases the original codebook missed: payment, order_cancel, and defect (clearance or sale items with flaws).
The point of this round is not relabeling the codebook. It is aligning the codebook with the downstream LLM Router's sub_topic system. Intent labels are for labelers and the classifier. Sub_topics are for the routing layer and the ticket system. Both must exist, with an explicit mapping. The end state, v2.3, is 48 legacy intents plus 23 sub_topics, bridged by a LEGACY_INTENT_TO_ROUTE table.
Three rounds of diff, and the taxonomy is finally stable.
The renaming avalanche: one rename touches 10 files
The expensive part of taxonomy evolution is not adding an intent. It is renaming one. A single rename touches 10 files. Skip one of them, and production starts to degrade in a quiet way: classification is right, but the answer falls back; or the classifier cannot find the intent, while logs still run under the old name.
In round 1, invoice became invoice_request, a simple-looking rename. Downstream, these files all have to move with it: the business-readable definition card v2 (a docx) for labelers and review; the code-readable source of truth, intent/codebook.json; the old-to-new compatibility layer, intent/aliases.py; rule-engine keywords in intent/rules.py; embedding anchors in intent/semantic.py and anchors.json; the LLM few-shot prompt in intent/classifier.py; the matching knowledge file knowledge-base/<intent>_v1.0.md, both the name and the contents; expected labels in tests/test_eval_intent.py; internal plans and strategy docs; and the team's MEMORY and onboarding docs, which may still describe the path from 36 to 48 in the old language.
Ten files. Miss one, and the failure mode changes. Skip rules.py, and the rules keep hitting the old invoice, so classifier output no longer matches the codebook. Skip anchors.json, and the embedding layer's anchor sentences still carry the old name: similarity is right, the label is shifted. Skip the knowledge-base filename, and the KB parser cannot find invoice_request_v1.0.md, retrieval fails, and the answer falls back. Skip the eval expectations, and the new classifier emits invoice_request while the tests still wait for the old label, which looks like "classifier accuracy dropped."
Miss any one of them, and the live taxonomy is quietly degrading. In a codebook evolution process, this step has to be a hard PR gate: all 10 files updated, or the PR does not merge.
Legacy data is a separate problem. Production already has tens of thousands of historical labels under the old name invoice. The labeler guide has just switched to invoice_request, and new labels use the new name. How do the two sets meet? aliases.py has to catch them.
The snippet below is for implementers. The judgment is already above: old names must resolve to new ones. You cannot cut over with a one-shot database migration.
INTENT_ALIASES = {
# old_name → new_name
"invoice": "invoice_request",
"invoice_register": "invoice_auto_issue",
"nvoice_request": "invoice_request", # typo from manual label entry
"shipping_wrong": "wrong_item", # leftover misname from old rules
"清洁保养服务": "product_inquiry", # compatibility when business typed Chinese
}
def resolve_intent(raw_name: str) -> str:
return INTENT_ALIASES.get(raw_name, raw_name)
Downstream code should always read through resolve_intent(raw_name), so old data migrates smoothly. It is about ten lines of code, and it saves weeks of reconciliation. Without aliases.py, every rename means a database migration that rewrites historical labels; during the migration, downstream queries miss; and on Monday, business sees that "the intent mix in the daily report all changed," and escalates it three layers up.
The codebook is the single source of truth. Sync the four downstream artifacts in dependency order.
The codebook is the single source of truth. Downstream labels, rules, knowledge, and eval have to change in dependency order. Get the order wrong, and you redo the work: the front moved, the back did not follow, and regression can no longer tell a real regression from a sync that is only half done.
The dependency is this, each step a prerequisite for the next. First the labeling system: update the label schema and the labeler guide; already-labeled samples migrate through aliases; each new intent gets at least 30 additional samples. Then the rule engine, intent/rules.py. First match wins, so action intents must sit before policy intents, and execution cues like "help me," "handle," or "do it" have to be there to prevent false hits. Then the knowledge base, knowledge-base/<intent>_v1.0.md: every new intent needs a matching knowledge file, or answers can only fall back; filenames use underscores, not hyphens, because the KB parser depends on that. Only then the eval baseline, tests/test_eval_intent.py and the eval sheet: at least five eval samples for each new intent, at least ten for each legacy one.
The order is not arbitrary. Labels before rules, because the rule engine extracts high-frequency keywords from labeled samples; no labels, no keywords. Rules before knowledge, because knowledge-base retrieval is intent-gated; if the rules miss, the knowledge is never retrieved. Knowledge before eval, because eval measures the whole chain (intent, retrieval, answer), and if the knowledge is not there yet, you can only measure intent accuracy, which wastes most of the test's return.
Reverse the order, and you pay for it. Change the rules without adding labels, and rule coverage will not rise. Change eval expectations without changing knowledge, and the regressions fill with false negatives, while the team spends its energy deciding whether a failure is real or just an unfinished sync.
The pass bar belongs in continuous integration (CI), as a hard gate: average F1-score drop on legacy intents no more than 2%; recall on new intents at least 60%; unknown rate does not rise; unit tests all green, except for known expected failures. Miss the bar, roll the codebook revision back, and review again. This gate has to hold. The historical failure was shipping anyway after legacy-intent F1 dropped 5%, to hit a release date; a month later, user follow-ups showed that the historically frequent questions were being answered worse than before, and by the time the team clawed it back they had three weeks of dirty data.
Three things to do this week, and five questions to ask a vendor
You can start this week. Collect at least 1,000 real samples from the past month, and have business experts run one expert-correction pass: keep the original label, and write "if it does not belong to that label, which is it closest to." Count high-frequency adjacent intents in those corrections. The same misplacement, appearing at least five times, is a codebook-gap signal.
Then run every "missing intent" suggestion from the business side through the four-quadrant test. A different backend action is an intent; only a parameter differs, add a slot; only the phrasing differs, it goes into training data; only the state differs, it goes into the state machine. Those lines usually filter out more than half of the fake missing intents.
If you do not already have an aliases.py, build one this week, and put into it every rename, typo, and leftover rule name from the past six months. The next rename will not require a hunt through the historical labels.
At the next review, put these five questions at the front of the table.
How did your intent taxonomy evolve? What you want is documentation of three rounds of diff: what was added, what was rejected, and why. If all they can produce is a "final" intent list, the taxonomy was probably designed from imagination.
What is the unknown rate after launch? If it is still 20% or higher one month in, you have to ask why. "Add an LLM fallback" means they have not looked at the codebook layer.
Where does your codebook live? A Word document, or JSON? What is the sync mechanism? If the codebook exists only in Word, and downstream files hard-code intent labels, the next rename will desynchronize everything. You want codebook.json, plus an aliases.py compatibility layer, before the system is mature.
Is there an expert_correction column in your labeling sheet? Without it, the corpus cannot surface codebook gaps, and the taxonomy will only get messier as it grows.
What is the regression gate for a drop in legacy-intent F1? Is it hard-blocked in continuous integration? "5% is fine," or "no hard block, we'll review and decide," are failing answers. A drop of 2% or less, hard-blocked in CI, is the floor.
If a vendor cannot answer three of these five, the taxonomy-evolution process is basically empty. The rest of the engineering can look polished, and three months later the live unknown rate will be back at 40%.
How to tune the classifier is in Just add an LLM as a fallback? The bill went up 12x.. This piece is meant to be used with it. The classifier decides whether the codebook's already-designed ceiling can be reached. The codebook decides what the ceiling is. Get both right, and intent-classification accuracy can move from 60% to 90% and stay there.
If you want the tools from this piece for the next recovery round or review, I put together a pack. Send me the keyword "INTENT-CARD" and I'll send it: the v2 intent definition card template, with easily confused negatives and boundary-rule fields; the four-quadrant test, sized for a 30-minute review; a codebook.json schema plus a minimal aliases.py compatibility layer; and a meeting template for a three-round diff review.
Channels are in the footer. X or email both work.
Building an agent right now?
Send me your worst conversation. Free failure teardown.
Subscribe
Get the next essay in your inbox.


Comments