STAYCHARTED BLOG · Machine learning · Rules and automation
Rule-based system vs machine learning: when your rules stop scaling
Keep rules for policy and exact matches. Learn when to test a trained model for judgment calls, compare both on your history, and switch only where it helps.
The short answer
| Use rules when | Use a trained model when |
|---|---|
| The decision is policy: a law, a limit, a contract term | The decision is a judgment your team makes by reading |
| The condition is exact: an amount, a date, a code, a list of names | The input is free text, or worded a hundred different ways |
| A mistake would be unacceptable and must be explainable line by line | A small, measured error rate is fine, with unsure cases checked by a person |
| The rule rarely changes | New products, vendors and phrasings keep arriving |
Rules answer "what must happen". A model answers "what is this, most likely?". Most real workflows need both.
Why rules stop scaling
They only match what someone thought of. A rule for "password reset" misses "can't sign in", "locked out" and "2FA code never arrives". Each miss becomes another rule.
They grow without anyone pruning them. Every exception adds a rule. Few teams remove one, because nobody can be sure what would break.
They collide. Two rules match the same ticket or transaction, and the order they run in decides the answer. That order is rarely written down.
A simple match has no measured confidence. A keyword rule either fires or it doesn't. You can build exceptions, scores and review steps around it, but a basic match alone does not tell you how likely the category is to be right.
Accuracy can go unmeasured. If the only feedback is a complaint about the wrong queue, you need a test set to learn which rules work and which need attention.
What a trained model does differently
A classification model learns from examples your team already decided: past tickets with the team that handled them, past invoices with the GL account they were coded to, past products with their category.
- It can learn different wording for the same category. StayCharted’s AI Classifier Model uses meaning-based representations and tests which supported approach works best on your examples. Test whether phrases such as "locked out" and "can’t sign in" reach the right category.
- It gives every answer a confidence. You choose a cutoff: answers above it go straight through, and answers below it go to a person.
- It's measured before you use it. You see its accuracy on examples it never trained on, overall and for each category.
- It learns from corrections. When a person fixes an answer, that fix teaches the next version.
What it doesn't do: follow a policy that isn't in the examples, or guarantee a specific outcome for a specific input. That's what rules are for.
The pattern that works: rules for policy, a model for judgment
You rarely need to choose. The setup most teams settle on:
- Keep the rules that are policy. "Anything over $10,000 goes to the controller." "Anything mentioning a data breach goes to Security, always." These run first, or last, and the model never overrides them.
- Replace the rules that are guesses. Keyword lists, "contains" conditions, vendor-to-account tables, mapping spreadsheets. These are candidates for a model; replace them only where it tests better on your history.
- Let the model feed your existing rules engine. The model fills in a category; your workflow tool's rules decide what happens next. ServiceNow, Zendesk, Salesforce, Jira or your ERP keep doing the routing they already do.
- Send unsure answers to a person. The confidence cutoff is a rule too, and an easy one to explain.
Your rules' history is your training data
This is the part most teams miss. If rules have been sorting your tickets or transactions for a year, you already have a labeled dataset:
- every item the rules sorted, with where it went;
- every time a person moved it somewhere else, which is the most valuable label of all.
Export that, train on the final answers (after people's corrections), and the model learns both what your rules did right and where people had to step in. How to convert a rule-based system into a trained model →
How to compare them fairly
Before replacing anything, run both on the same recent items:
- Train on items decided before a cutoff date.
- Fill last month's items with the model.
- Compare the model's answers and the rules' answers with what your team finally decided.
- Switch over only the categories where the model does better, and keep rules for the rest.
Testing on later items, not a random sample, matters: it's how the model will be used. Train on the past, test on the future →
Where enterprises use rules a model could take over
| Rules teams maintain today | What a trained model learns instead | More |
|---|---|---|
| ServiceNow assignment and data lookup rules | which assignment group gets the incident | ServiceNow assignment rules vs a trained model → |
| GL coding rules in AP, vendor-to-account tables | GL account and cost center | GL coding rules vs machine learning → |
| QuickBooks bank rules | the category for each bank transaction | QuickBooks bank rules vs AI categorization → |
| Outlook and Exchange rules on shared mailboxes | which person or team handles the email | Outlook rules vs a trained model → |
| Keyword tables for UNSPSC or HS codes | the classification code | Keyword tables vs machine learning for codes → |
| Zendesk triggers, Jira automation, Salesforce case assignment rules | the queue, team or case type | Support ticket classification → |
Rules engines such as Drools, IBM ODM or Pega keep their place: the model supplies a category, and the rules decide what happens next.
Try it
The box below is a model that learned 77 banking support categories from 10,000 examples. Type a question in your own words. A keyword rule needs a matching term or pattern; the model can generalize from its training examples. Try the live demo →
Try it: type a customer question.
Explore the rules vs machine learning series
- Convert a Rule-Based System to Machine Learning, Safely
- ServiceNow Assignment Rules vs Machine Learning: When to Switch
- GL Coding Rules vs Machine Learning: Where Vendor Rules Fail
- QuickBooks Bank Rules vs AI Categorization: When to Switch
- Outlook Rules vs AI for Shared Inbox Routing: When to Switch
- Keyword Tables vs Machine Learning for UNSPSC and HS Codes
Common questions
Is a rule-based system AI?
Rule-based systems are often called symbolic or classical AI, because they encode a person's knowledge as if-then logic. Today "AI" usually means a model that learns from examples. The practical difference: rules do what they're told; a model does what the examples show.
Should we replace our business rules with machine learning?
Only the ones that are really judgment calls written as keyword conditions. Keep rules for policy, thresholds and anything that must be explained line by line.
Can a model and rules run together?
Yes, and that's the usual setup. The model suggests a category with a confidence; rules enforce policy and decide the routing.
How much history do we need to replace rules with a model?
A few hundred decided examples per category is a good start. How many examples do I need? →
How do we know the model is better than our rules?
Test both on the same recent items against what your team finally decided. Switch only where the model wins.