
The machine narrows the search space. It cannot carry responsibility for the declaration.
An automatic classification engine does one thing well: it goes from 5,000 possible headings to three plausible candidates, in seconds, across tens of thousands of references. That is a real gain and it is not in dispute.
What it does not do, and will not do: read a chapter note for this particular case, notice that a technical document is missing, or answer to the administration for the code that was declared. The boundary between the two is decided before deployment, not after the first audit.
What the machine decides, what a person signs
What the engine produces
What the decision requires
Nature of the result
A ranking of hypotheses by statistical likelihood.
A single heading, justified by a named rule.
Basis of the reasoning
Regularities observed in past data.
The heading term, the section and chapter notes, the GIRs.
Handling of missing information
Produces an answer anyway, with a lower score.
Blocks and opens a collection task.
Traceability
Weights, possibly salient terms.
A quotable sentence: "note 2 to chapter X excludes…".
Responsibility
None.
The declarant's and the importer's, undivided.
A high score signals strong resemblance to past cases. It never signals compliance with a rule applicable today.
The minimum data before any prediction
Without these fields, the suggestion is well-presented guesswork
| Control point | Status | What you must be able to show |
|---|---|---|
| Technical description, not commercial description | Required | Material, function, process, presentation. A range name lowers result quality more than it improves it. |
| Attributes quantified where the tariff quantifies them | Required | Fibre percentages, capacity, power, contents. |
| Form of presentation | Required | Assembled, unassembled, in a set. This is what engines miss most often. |
| Description field empty or generic | Blocking | Route to collection, not to the engine. |
| Description copied from a supplier website | Blocking | It describes a sales argument, not goods. |
Routing: three lanes, not two
A binary "accepted / rejected" system always ends up accepting too much. You need an explicit third lane, for the cases you know do not belong in automatic handling.
Fast lane
Known family, complete attributes, a single candidate above threshold, no sensitive measure on the line. Sample-based check after the fact.
Human review
Two close candidates, a missing attribute, or a material rate gap between candidates. A classifier works the file normally.
Permanent exclusion
Sets, composite articles, products under trade-defence measures, lines with sanitary control or licensing. Never automated, whatever the score.
Why a confidence score is not a legal rule
Proposed heading
A 5-point gap: to be settled, not ignored
Discarded without review
The score measures resemblance to training examples. If those examples contain a repeated error — a code of convenience used for three years — the engine will reproduce it with a high score, and its confidence will be all the greater because the error was systematic. That is the most dangerous failure mode, because it is silent.
The silent failures to test before going live
- T1
Test set with known answers
Fifty references classified manually, complete file, never seen by the model. It is the only honest measure of the error rate.
- T2
Description sensitivity test
Reword the same goods three ways. If the code changes, the engine classifies words, not goods.
- T3
Missing attribute test
Remove a decisive field and check that the system blocks instead of producing a degraded answer.
- T4
Tariff edition test
Check behaviour on a heading deleted or split at the last revision. An engine trained on old data proposes lines that no longer exist.
- T5
Production drift test
Replay the test set quarterly. A drop in performance with no model change signals that the catalogue, not the model, has changed.
Costing the effect of a propagated error
Automation does not create new kinds of error. It changes their propagation speed: what used to touch ten lines now touches a thousand.
| Input | Formula | Result |
|---|---|---|
| References classified automatically | Deployment scope | 1,200 |
| Error rate measured on the test set | Known-answer test | 3% |
| Expected erroneous references | 1,200 × 3% | 36 |
| Annual declarations per reference | History | 1.5 |
| Average duty gap per declaration | Teaching assumption | MAD 12,500 |
| Gross annual exposure | 36 × 1.5 × 12,500 | MAD 675,000 |
This calculation makes the decision arbitrable: it compares the cost of human control against the exposure it avoids. A 3% error rate is excellent for a model and unacceptable on a line with a large rate gap — both statements are true at once, and it is the amount that settles it.
Compare the candidates in the tree
When two candidates remain, the decision is taken in the tariff, not in the engine's interface. Open both lines, go back up to the notes, and write down what separates them.
8517130000Open the tariff record 8471300000Open the tariff recordVersion the model, the decision and the approval
Three distinct objects must be dated and retained: the model version and its training set, the classification decision with its decisive rule, and the human approval with its author. Conflating the three makes it impossible to answer the only question that matters after an incident — how many references were classified by the faulty version, and which ones.
The applicable regulatory framework and its entry-into-force dates are tracked on the Official Gazette portal; nomenclature changes through the WCO correlation tables.
Related articles

Calculating Moroccan customs duties by product
Import duty, the parafiscal levy and VAT do not share a base. The full cascade, the order of operations, and the documents that make the figure reproducible.

Classify a product catalogue with HS codes that stay maintainable
Classifying 4,000 references is not classifying 4,000 times. How to build families on stable attributes and handle the exceptions first.

How to choose a customs broker and freight forwarder in Morocco
Comparing fees says nothing about the quality of a declarant. The mandate, the hard-file test, and the evidence they owe you back.

Wrong HS code in Morocco: correction, reassessment, and penalty file
The first 72 hours decide what a classification error costs. Freeze reuse, scope the affected population, choose the regularisation route.