STAYCHARTED BLOG · MACHINE LEARNING · HS CODES
Machine learning for HS code classification: what 6,788 CBP rulings show
Machine learning for HS code classification, tested on 6,788 CBP rulings: accuracy at 2, 4, 6 and 10 digits, and how confidence sends the rest to your broker.
What HS code classification machine learning actually does
A supervised model learns from pairs: a product description and the code your team (or CBP) assigned to it. After training, it reads a new description and returns three things:
- a suggested code
- a confidence from 0 to 1
- a needs-review flag when the confidence is below the cutoff you set
In StayCharted AI Model Trainer (AMT), answers below the cutoff go to the Review Queue, or to the list you send your broker. Each confirmed or corrected code becomes training data for the next version, so the model keeps up with your own product mix and your own decisions.
The model does not apply the General Rules of Interpretation, and it does not read section or chapter notes. It learns patterns from past classifications. That is why it suits the work a licensed broker or classification specialist already reviews, and why it never replaces that review.
How accurate is machine learning for HS code classification?
The benchmark used CBP CROSS rulings from New York. Each model saw only the one-line ruling subject (for example, "notebooks from Vietnam") and had to return the 10-digit HTS code. We trained on 5,621 rulings from 29 March 2021 to 18 December 2025 and tested on 1,167 later rulings, from 18 December 2025 to 14 August 2026, across 69 chapters. The split was by date, so the test looks like real use: new rulings the model never saw.
Share of the 1,167 test rulings where the model matched CBP's code:
| Model | 10 digits | 8 digits | 6 digits | 4 digits | 2 digits |
|---|---|---|---|---|---|
| Always guess the most common training code | 1.3% | n/a | 3.4% | 4.4% | 10.4% |
| AI Classifier Model | 22.2% | 28.6% | 29.9% | 38.8% | 53.1% |
| Dedicated AI Model | 25.1% | 34.5% | 39.2% | 54.0% | 74.0% |
The Dedicated AI Model, a language model fine-tuned on the rulings, gets the chapter right on 74.0% of test rulings and the heading right on 54.0%. Both models are far above the baseline of always guessing the most common code. Neither gets most exact 10-digit codes right from a one-line subject, and we say so plainly.
Why exact HTS codes are hard to learn
The test was harder by design than most companies' own data. A few facts from the benchmark explain the 10-digit numbers:
- Many codes, few examples. The 5,621 training rulings cover 2,014 distinct 10-digit codes, and 1,129 of those codes appear only once.
- New codes. 27% of test rulings have a code that never appears in training, so no trained model could get those exactly right. On the 849 test rulings whose code does appear in training, 10-digit accuracy rises to 30.5% for the AI Classifier Model and 34.5% for the Dedicated AI Model.
- Same words, different code. In 147 test rulings the subject matched a training subject word for word, and in 39 of those (27%) CBP assigned a different code. The deciding facts (material, use, construction) sit in the full ruling, not in the subject line.
An HTS code classification model trained on your own filed entries, with fuller descriptions, may score differently. The benchmark page notes that results on your own history may differ, and that a second round using full ruling text is planned.
Confidence is where customs classification automation saves time
Accuracy on every row is only half the picture. The useful question for a broker is: when the model is sure, how often is it right? The AI Classifier Model's confidence held up well:
| StayCharted AI Classifier Model cutoff | Share of rulings at or above it | Right to 10 digits | Right to 6 digits |
|---|---|---|---|
| 0.9 | 6.7% | 96.2% | 96.2% |
| 0.8 | 8.2% | 88.5% | 88.5% |
| 0.7 | 11.1% | 82.2% | 86.0% |
| 0.5 | 17.1% | 71.0% | 78.0% |
| 0.3 | 28.9% | 54.6% | 65.9% |
At a 0.9 cutoff, the model answered 78 of the 1,167 rulings on its own and three of those were wrong. The other 93.3% went to review. That is a modest share, but it is the share a reviewer would otherwise spend time on, and the cutoff is yours to set. A team that prefers more coverage can choose 0.5 and accept that 71.0% of those answers match the exact code.
The Dedicated AI Model is more accurate overall, but its confidence is less useful for letting answers through. At 0.9 it covered only 1.3% of rulings (15 rulings) with 46.7% right, and at 0.8 it covered 6.7% with 65.4% right to 10 digits. Its best use is as a suggestion a person confirms, especially at chapter and heading level.
These are single-run results, and percentages on small high-confidence subsets move with each individual error.
Which HS code classification model to choose
The two models are good at different things:
- AI Classifier Model. A ready-made AI language model reads the meaning of each description and a private classifier learns your codes. It trains on a CPU, is on every plan (Free includes one), and gives the more trustworthy confidence. Choose it when you want sure answers to go straight through and the rest to go to review.
- Dedicated AI Model. An AI language model fine-tuned on your examples, trained on a GPU, on the Business plan. It is more often right at 6, 4 and 2 digits. Choose it when you want the best starting suggestion for a reviewer.
Combining them adds little. Using the AI Classifier Model's code when its confidence is 0.8 or higher, and the Dedicated AI Model's code otherwise, gave 25.4% at 10 digits and 39.4% at 6 digits, barely above the Dedicated AI Model alone. Head to head at 10 digits, the Dedicated AI Model was right where the AI Classifier Model was wrong 106 times, and the reverse happened 72 times.
Machine learning compared with rules and with prompting a general AI
Keyword rules break down quickly with thousands of codes. Writing and maintaining a rule for each of 2,014 codes is impractical, and the 39 identical subjects with different codes show that the same words do not always lead to the same classification.
Prompting a general AI assistant with code descriptions is the other common approach to tariff classification AI. The benchmark page cites the ATLAS study (2025), which tested 200 CROSS rulings with richer, AI-written product descriptions: a fine-tuned Llama 3.3 70B scored 40.0% at 10 digits and 57.5% at 6 digits, and GPT-5 Thinking scored 25.0% and 55.5%. Those figures are not directly comparable to ours, because the inputs and test set differ. What a trained model adds in your workflow:
- Your own decisions. It learns the codes your team actually files, including the unwritten habits behind them.
- A confidence you can check. The held-out test shows how often answers above each cutoff are right, before you rely on it.
- Consistency. The same description gets the same answer.
- Volume. Filling thousands of rows from a file, a Google Sheet, the API or a Snowflake or Databricks table does not require a person to prompt each one.
When you do not need machine learning
A trained model is not worth the setup for every team. Skip it if you import a handful of products that rarely change, if your codes fall into a few broad chapters a person can assign in seconds, or if you have very little classification history to learn from. In those cases a broker's review alone is simpler. For guidance on how much history is enough, see how many examples you need to train a classifier.
What it does not do
- Suggested codes are not legally binding. The importer remains responsible for the declared code, and only CBP issues binding rulings.
- The model does not replace a licensed customs broker or a classification specialist. It gives them a suggestion and a confidence so they can confirm or correct it faster.
- It does not read the General Rules of Interpretation, section notes or chapter notes.
How to start with an HTS code classification model
- Export product descriptions with the codes you filed or that your broker confirmed. Six-digit HS or full national codes both work; train on the level you file.
- Upload the file to StayCharted AI Model Trainer. AMT checks the data, including personal-information checks and masking, before training.
- Train an AI Classifier Model. AMT tests it on held-out rows and reports accuracy, confusions and the share of answers above each confidence cutoff with how many are right.
- Pick a cutoff from that table. Answers above it go straight through; the rest go to the Review Queue or your broker's list.
- Fill new rows from CSV or Excel files, the Google Sheets add-on, the API, or your Snowflake or Databricks tables.
- Retrain with the reviewed codes so the next version learns from your broker's corrections.
For how the HS fits with other standards such as UNSPSC and GS1 GPC, see product classification standards. For setting cutoffs, see AI confidence scores and human review. Plans are on the pricing page, and the full feature list is on the product page.
The Review Queue requires Essentials or Business. Retrain and publish a new version to use reviewer corrections in future answers.
Common questions
How accurate is machine learning for HS code classification?
On 1,167 CBP rulings, using only the one-line subject, the Dedicated AI Model matched the exact 10-digit code 25.1% of the time, the 6-digit subheading 39.2%, the heading 54.0% and the chapter 74.0%. The AI Classifier Model scored 22.2%, 29.9%, 38.8% and 53.1%. Full figures are on the benchmark page.
Can AI assign HTS codes without a customs broker?
For a small, high-confidence share it can make the first pass: at a 0.9 cutoff the AI Classifier Model covered 6.7% of test rulings and was right on 96.2%. The importer is still responsible for every declared code, and only CBP issues binding rulings, so a licensed broker or specialist should review the rest and own the result.
Why is 10-digit HTS classification so hard for a model?
In the benchmark, 2,014 codes appeared in 5,621 training rulings, 1,129 of them only once, and 27% of test rulings used a code never seen in training. In 39 of 147 cases, an identical subject line received a different code, because the deciding details are in the full ruling.
What is the best HS code classification model for a trade compliance team?
Use the AI Classifier Model when you want trustworthy confidence so sure answers go straight through. Use the Dedicated AI Model when you want the most accurate starting suggestion for a reviewer, especially at chapter and heading level.
How does customs classification automation handle uncertain products?
You set a confidence cutoff. Answers below it are flagged and go to the Review Queue or your broker's list, and the reviewed codes train the next version of the model.
Is tariff classification AI the same as a binding ruling?
No. A model's suggested code is guidance for your team. Only CBP issues binding rulings, and the model does not apply the General Rules of Interpretation or read section and chapter notes.