A customs import and export commodity tax rate detection method based on adversarial learning
By using contrastive learning and adversarial training of the CLAT-NEZHA model, the semantic inconsistency and imbalance of customs commodity data were resolved, improving the accuracy of tax rate prediction and the robustness of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- DALIAN UNIV OF TECH
- Filing Date
- 2023-11-16
- Publication Date
- 2026-07-14
AI Technical Summary
The complexity and imbalance of customs commodity data lead to insufficient accuracy of existing models in detecting import and export commodity tariffs. In particular, the influence of high-frequency words ignores the semantic information of low-frequency words, resulting in a decline in classification performance.
The CLAT-NEZHA model, which employs contrastive learning and adversarial training, introduces perturbation variables to simulate model errors through word embedding layers, adversarial training layers, NEZHA contrastive learning layers, and Softmax output layers. This allows for contrastive learning to improve the acquisition of semantic information and address the data imbalance problem.
It improved the accuracy of customs duty rate prediction, enhanced the model's generalization ability, mitigated the impact of data imbalance, and improved detection performance.
Smart Images

Figure CN117454904B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing technology, and specifically to a method for detecting customs import and export commodity tariffs based on adversarial learning. Background Technology
[0002] Customs duty rate detection refers to the classification of import and export commodities and the imposition of taxes based on these categories. Due to the complexity and specificity of customs commodity data, classification models often perform poorly in this task. By using contrastive learning and adversarial training, the model's generalization ability can be enhanced, mitigating the impact of data imbalance and improving the accuracy of customs duty rate predictions.
[0003] Natural Language Processing (NLP) technology enables computers to understand, analyze, process, and generate textual information. Therefore, applying NLP technology to customs tariff rate detection tasks can effectively improve the accuracy and efficiency of customs tariff rate detection, providing intelligent technical support for customs operations. However, in customs import and export commodity declaration texts, due to the varying quantities of different categories of goods, some words appear frequently. The model tends to focus too much on high-frequency words, neglecting the expressive content of low-frequency words, thus failing to fully express the semantic information of the declaration text and reducing the model's classification performance. Summary of the Invention
[0004] The purpose of this application is to provide a method for predicting customs import and export tariff rates. It innovatively uses contrastive learning and adversarial training to enable the model to learn more semantic information from the data text, alleviate the data imbalance problem, and improve the accuracy of customs tariff rate prediction.
[0005] To achieve the above objectives, the technical solution of this application is as follows:
[0006] A method for detecting customs import and export tariff rates based on adversarial learning, comprising the following steps:
[0007] Step 1: Preprocess the input text;
[0008] Step 2: Feed the preprocessed text line by line into the CLAT-NEZHA (Contrastive Learning and Adversarial Training with NEZHA) deep learning model in sequence. The CLAT-NEZHA model includes: a word embedding layer, an adversarial training layer, a NEZHA (NEural contextualized representation for Chinese Angesia understanding) contrastive learning layer, and a softmax output layer. The preprocessed text is first fed into the word embedding layer to complete the transformation from text to word vectors;
[0009] Step 3: The customs text word vectors obtained in Step 2 are fed into the adversarial training layer. Perturbations are added to the word vectors to simulate possible errors in the model, enabling the model to learn more semantic information in the data text, and finally forming a customs text word vector that incorporates perturbations.
[0010] Step 4: After concatenating the customs text word vectors with perturbation obtained in Step 3 with the original word vectors, the concatenation is fed into the NEZHA contrastive learning layer for contrastive learning.
[0011] Step 5: Feed the vector output by the NEZHA contrastive layer into the Softmax layer for tax rate detection.
[0012] By adopting the above technical solution, the present invention can achieve the following technical effects:
[0013] By using deep learning methods based on contrastive learning and adversarial training, the problems of polysemy caused by semantic differences in customs commodity data and the uneven distribution of customs commodity data categories were solved, thereby improving the accuracy of customs commodity tax rate prediction. Attached Figure Description
[0014] Figure 1 This is a flowchart illustrating a customs classification method for import and export commodities. Detailed Implementation
[0015] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments: the present application will be further described and illustrated using these examples.
[0016] Example 1
[0017] In the process of predicting customs import and export tariff rates, the presence of numerous identical terms representing different meanings in product descriptions often leads to inaccurate predictions. To address this issue, this invention proposes a method for predicting customs import and export tariff rates, with the following specific steps:
[0018] First, a [CLS] marker is added before the input text, making the vector in the last layer of the model a semantic representation of the entire sentence. Then, a perturbation variable 'a' is introduced into the text vector obtained after NEZHA processing to predict possible model errors, minimize the risk of perturbation, and thus improve the robustness of the model.
[0019] The entire process begins with preprocessing the input text, adding a [CLS] marker before the text and a [SEP] marker at the end as a separator. The preprocessed text is then sequentially fed into the CLAT-NEZHA deep learning model, converting it into word vectors. The resulting customs text word vectors are then processed through an adversarial training layer, where perturbations are added to simulate potential model errors, resulting in perturbed text word vectors. Next, the perturbed customs text word vectors are concatenated with the original word vectors and fed into the NEZHA contrastive learning layer for comparative learning, ultimately leading to tax rate prediction.
[0020] This approach addresses the issue of inconsistent text representations by introducing perturbations to enhance model robustness, while employing contrastive learning to improve the accuracy of tax rate predictions.
[0021] The present invention will be described in detail below with reference to the embodiments and accompanying drawings, so that those skilled in the art can implement it after referring to this specification.
[0022] This embodiment uses PyCharm as the development platform and Python as the development language. Experiments are conducted using real customs data. The specific process is as follows:
[0023] Step 1: Preprocess the input text;
[0024] Step 11. Delete irrelevant characters, spaces, and other abnormal information, and standardize the half-width character format;
[0025] Step 12. Add the [CLS] mark before the text and the [SEP] mark at the end of the text as a separator;
[0026] Step 2: Feed the preprocessed text line by line into the CLAT-NEZHA (Contrastive Learning and Adversarial Training with NEZHA) deep learning model in sequence. The CLAT-NEZHA model includes: a word embedding layer, an adversarial training layer, a NEZHA (NEural contextualized representation for Chinese language understanding) contrastive learning layer, and a softmax output layer. The preprocessed text is first fed into the word embedding layer to complete the transformation from text to word vectors;
[0027] Step 21. Feed the processed data into the word embedding layer one by one;
[0028] Step 22. By consulting a dictionary, the text characters are converted into numbers, and then mapped to a higher-dimensional space through a linear layer;
[0029] Step 23. Concatenate the word vectors of each character to form the sentence vector;
[0030] Step 3: The customs text word vectors obtained in Step 2 are fed into the adversarial training layer. Perturbations are added to the word vectors to simulate possible errors in the model, enabling the model to learn more semantic information in the data text, and finally forming a customs text word vector that incorporates perturbations.
[0031] Step 31. Generate random disturbance variable a;
[0032] Step 32. Add a perturbation variable 'a' to the word vectors to form perturbed word vectors;
[0033] Step 33. Feed the text with perturbation variables into the NEZHA model for retraining.
[0034] Step 4: After concatenating the customs text word vectors with perturbation obtained in Step 3 with the original word vectors, the concatenation is fed into the NEZHA contrastive learning layer for contrastive learning.
[0035] Step 41. Use R-drop on NEZHA to transform the NEZHA model into two sub-models with identical structures but different parameters;
[0036] Step 42. Feed the concatenated word vectors into the two sub-models for training;
[0037] Step 43. By optimizing the negative log-likelihood function, correct the output results of the two sub-models and output a final vector;
[0038] Step 5: Feed the vector output from the NEZHA contrastive layer into the Softmax layer for tax rate detection;
[0039] Step 51. Feed the vector into the Softmax layer to obtain the probability of each tax rate;
[0040] Step 52. Select the tax rate with the highest probability as the customs text tax rate detection result.
[0041] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A method for detecting customs import and export commodity tariff rates based on adversarial learning, characterized in that, The steps are as follows: Step 1: Preprocess the input text; Step 2: Feed the preprocessed text into the CLAT-NEZHA deep learning model one by one in sequence; the CLAT-NEZHA model includes: word embedding layer, adversarial training layer, NEZHA contrastive learning layer and Softmax output layer; the preprocessed text is first fed into the word embedding layer to complete the transformation from text to word vectors; Step 3: The customs text word vectors obtained in Step 2 are fed into the adversarial training layer. Perturbations are added to the word vectors to simulate possible errors in the model, enabling the model to learn more semantic information in the data text, and finally forming a customs text word vector that incorporates perturbations. Step 4: After concatenating the customs text word vectors with perturbation obtained in Step 3 with the original word vectors, the concatenation is fed into the NEZHA contrastive learning layer for contrastive learning. Step 5: Feed the vector output by the NEZHA contrastive layer into the Softmax layer for tax rate detection.
2. The customs import and export commodity tariff rate detection method based on adversarial learning as described in claim 1, characterized in that, Step 3 is specifically performed as follows: Step 31. Generate random disturbance variable a; Step 32. Add a perturbation variable 'a' to the word vectors to form perturbed word vectors; Step 33. Feed the text with perturbation variables into the NEZHA model for retraining.
3. A method for detecting customs import and export commodity tariff rates based on adversarial learning as described in claim 1 or 2, characterized in that, Step 4 is specifically operated as follows: Step 41. Use R-drop on NEZHA to transform the NEZHA model into two sub-models with identical structures but different parameters; Step 42. Feed the concatenated word vectors into the two sub-models for training; Step 43. By optimizing the negative log-likelihood function, correct the output results of the two sub-models and output a final vector.
4. A method for detecting customs import and export commodity tariff rates based on adversarial learning as described in claim 1 or 2, characterized in that, In step 1, the specific operations are as follows: The entire process begins by preprocessing the input text, adding a [CLS] marker before the text and a [SEP] marker at the end as a separator; then, the preprocessed text is fed sequentially into the CLAT-NEZHA deep learning model to convert the text into word vectors.
5. The customs import and export commodity tariff rate detection method based on adversarial learning as described in claim 3, characterized in that, In step 1, the specific operations are as follows: The entire process begins by preprocessing the input text, adding a [CLS] marker before the text and a [SEP] marker at the end as a separator; then, the preprocessed text is fed sequentially into the CLAT-NEZHA deep learning model to convert the text into word vectors.