Commodity tax number recommendation method and device based on large language model
Through the product tax number recommendation method and device based on the large language model, the inefficiency and abnormal detection problems that customs have in tax number review are solved, fast and accurate tax number recommendation and abnormal detection are achieved, and the stability of tax collection is improved.
Patent Information
- Application Number
- CN202411943189.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-12-26
AI Technical Summary
The customs have problems in the review of commodity tax number inefficient manual review and the traditional rule engine cannot cover complicated abnormal situations, which makes it difficult to effectively correct the abnormal declaration of tax number.
The product tax number recommendation method and device based on the large language model is adopted. By receiving the product information input by the user, the tax number recommendation large language model, query and rewrite large language model and mixed search module are used to generate the final product tax number recommendation, and abnormal detection is performed on the declaration information.
It realizes the rapid and effective acquisition of correct commodity tax numbers and detects abnormal situations in declaration information, improves the efficiency and accuracy of customs tax number review, and maintains the stability of fair trade and tax collection.
Smart Images

Figure CN119887415A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of large language models, and more specifically, to a method and device for recommending tax numbers of commodities based on large language models. Background Art
[0002] In international trade, customs commodity tax numbers cover a variety of categories and sub-categories. Import and export companies often make mistakes, omissions or deliberate false declarations when declaring commodity tax numbers. Abnormal declaration of tax numbers can lead to loss of tariff revenue, disrupt market order, and even involve illegal activities such as smuggling and tax evasion.
[0003] At present, customs mainly relies on manual review and rule engines to review commodity tax numbers, which are of various types and complex characteristics. Manual review is time-consuming, labor-intensive, inefficient and inefficient. At the same time, traditional rule engines use predefined rule sets to detect abnormal tax number declaration behaviors. These rules are based on empirical knowledge and manual definitions, which cannot cover complex abnormal situations and need to be constantly updated and maintained to adapt to new trade forms.
[0004] In order to ensure fair trade and effective taxation, the customs department needs an effective and fast way to obtain the correct commodity tax number and correct the abnormal declaration of commodity tax number. Therefore, a new method and device for recommending commodity tax number is needed. Summary of the invention
[0005] The embodiments of the present application provide a method and device for recommending commodity tax numbers based on a large language model, which can recommend the correct commodity tax number based on the user's question, or determine whether the declared commodity tax number is abnormal based on the user's declared information.
[0006] According to the first aspect of the present application, a method for recommending a tax number of a commodity based on a large language model is provided, comprising: receiving commodity information input by a user; inputting the commodity information into the tax number recommendation large language model to obtain an initial recommended tax number for the commodity; inputting query rewriting information based on the commodity information into the query rewriting large language model to obtain a commodity name and commodity specifications; inputting the commodity name and the commodity specifications into a hybrid retrieval module to obtain a tax number hybrid retrieval result; and inputting the initial recommended tax number and the tax number hybrid retrieval result into a decision fusion module to obtain a final recommended tax number for the commodity.
[0007] According to an embodiment of the first aspect of the present application, the product information is a user question text about the product.
[0008] According to an embodiment of the first aspect of the present application, inputting the product information into a tax number recommendation large language model to obtain an initial recommended tax number for the product includes: the tax number recommendation large language model determining whether the product description in the user's question text is complete; and when the product description is complete, the tax number recommendation large language model outputs the initial recommended tax number for the product based on the product description.
[0009] According to an embodiment of the first aspect of the present application, inputting the product information into the tax number recommendation large language model to obtain the initial recommended tax number of the product also includes: when the product description is incomplete, the tax number recommendation large language model conducts one or more rounds of dialogue with the user to supplement the product description until the tax number recommendation large language model determines that the product description is complete; and the tax number recommendation large language model outputs the initial recommended tax number of the product based on the product description; wherein, in each round of dialogue, the tax number recommendation large language model outputs a prompt question, and the user inputs additional user question text regarding the prompt question.
[0010] According to an embodiment of the first aspect of the present application, inputting query rewriting information based on the product information into a query rewriting large language model to obtain the product name and product specifications includes: inputting the user question text into the query rewriting large language model to obtain the product name and the product specifications.
[0011] According to an embodiment of the first aspect of the present application, inputting query rewriting information based on the product information into a query rewriting large language model to obtain the product name and product specifications includes: inputting the user question text and one or more prompt questions in the one or more rounds of dialogue and one or more additional user question texts into the query rewriting large language model to obtain the product name and the product specifications.
[0012] According to an embodiment of the first aspect of the present application, the commodity information is the declared commodity name, declared commodity specifications and declared commodity tax number filled in by the enterprise when declaring the commodity.
[0013] According to an embodiment of the first aspect of the present application, inputting the commodity information into a tax number recommendation large language model to obtain an initial recommended tax number for the commodity includes: inputting the declared commodity name and the declared commodity specifications into the tax number recommendation large language model to obtain the initial recommended tax number for the commodity.
[0014] According to an embodiment of the first aspect of the present application, inputting query rewriting information based on the product information into a query rewriting large language model to obtain the product name and product specification includes: inputting the declared product name and the declared product specification into the query rewriting large language model to obtain the product name and the product specification.
[0015] According to an embodiment of the first aspect of the present application, the method also includes: comparing the declared commodity tax number with the final recommended tax number; when the declared commodity tax number is consistent with the final recommended tax number, returning no abnormality to the user; and when the declared commodity tax number is inconsistent with the final recommended tax number, returning an abnormality to the user.
[0016] According to an embodiment of the first aspect of the present application, inputting the product name and the product specification into a hybrid retrieval module to obtain a tax number hybrid retrieval result includes: the hybrid retrieval module vectorizes the product name and the product specification to obtain a vectorized product name and a vectorized product specification; the hybrid retrieval module performs similarity calculation on the vectorized product name based on a tax number vector database to obtain the top K entries in the tax number vector database that are most similar to the vectorized product name; and the hybrid retrieval module performs similarity calculation on the vectorized product specifications based on the top K entries to obtain the top 1 entry in the top K entries that is most similar to the vectorized product specification; wherein the tax number hybrid retrieval result includes the product name, product specification and product tax number in the top 1 entry and the calculated similarity value.
[0017] According to an embodiment of the first aspect of the present application, when the product name is empty, the hybrid retrieval module returns empty, and the tax number hybrid retrieval result is empty, wherein, when the product name is not empty and the product specification is empty, K=1.
[0018] According to an embodiment of the first aspect of the present application, the initial recommended tax number and the tax number mixed retrieval result are input into a decision fusion module to obtain the final recommended tax number of the commodity, including: when the tax number mixed retrieval result is not empty and the similarity value is greater than a first threshold, the decision fusion module outputs the commodity tax number as the final recommended tax number of the commodity; and when the tax number mixed retrieval result is empty or the similarity value is less than or equal to the first threshold, the decision fusion module outputs the initial recommended tax number as the final recommended tax number of the commodity.
[0019] According to an embodiment of the first aspect of the present application, the tax number recommendation large language model is constructed in the following manner: select a general large language model as a base model; use a tax number pre-training data set to perform a first training on the general large language model, wherein the training method is full parameter fine-tuning; monitor the difference curve of the loss function during the first training, and stop the first training when the difference curve converges; use a tax number fine-tuning data set to perform a second training on the general large language model, wherein the training method is partial parameter fine-tuning; monitor the difference curve of the loss function during the second training, and stop the second training when the difference curve converges; use a tax number preference optimization data set to perform a third training on the general large language model to obtain the tax number recommendation large language model.
[0020] According to an embodiment of the first aspect of the present application, the tax number pre-training dataset includes the Customs Import and Export Tariff of the People's Republic of China, commodity tax number historical declaration data and Internet data, wherein the tax number fine-tuning dataset includes a predefined tax number multi-round question and answer dataset, wherein the tax number preference optimization dataset includes a predefined tax number preference question and answer dataset.
[0021] According to an embodiment of the first aspect of the present application, the query rewriting large language model is constructed in the following manner: dividing the query rewriting data set into a training set and a test set; selecting multiple general large language models as base models; using the training set to train the multiple general large language models separately, wherein the training method is partial parameter fine-tuning; for each general large language model, monitoring the difference curve of the loss function during training, and stopping the training when the difference curve converges; using the test set to test each trained general large language model, and selecting the trained general large language model with the highest test score as the query rewriting large language model.
[0022] According to an embodiment of the first aspect of the present application, the query rewriting dataset includes a predefined tax number query rewriting multi-round question and answer dataset.
[0023] According to an embodiment of the first aspect of the present application, the tax number vector database is constructed in the following manner: the historical declaration data of commodity tax numbers are cleaned to obtain a database including commodity names, cleaned commodity specifications, and commodity tax numbers; the commodity names and cleaned commodity specifications are vectorized respectively to obtain the tax number vector database including commodity names, cleaned commodity specifications, vectorized cleaned commodity names, vectorized cleaned commodity specifications, and commodity tax numbers.
[0024] According to the second aspect of the present application, a device for recommending tax numbers of commodities based on a large language model is provided, comprising: a processor, and a memory storing instructions, wherein when the instructions are executed by the processor, the processor executes the method of the first aspect of the present application.
[0025] According to a third aspect of the present application, a computer-readable storage medium is provided, on which instructions are stored. When the instructions are executed by a computer, the computer executes the method of the first aspect of the present application.
[0026] According to the tax number recommendation method and device for commodities based on a large language model of an embodiment of the present application, a tax number recommendation large language model can be obtained by training a general large language model using a tax number pre-training data set, a tax number fine-tuning data set, and a tax number preference optimization data set; a query rewriting large language model can be obtained by training multiple general large language models using a query rewriting data set; and a tax number vector database can be obtained by cleaning and vectorizing the commodity tax number historical declaration data. Further, the initial recommended tax number of the commodity can be obtained by receiving commodity information input by a user and inputting the commodity information into the tax number recommendation large language model. The commodity name and commodity specifications can be obtained by inputting the query rewriting information based on the commodity information into the query rewriting large language model, and the tax number mixed retrieval result can be obtained by inputting the commodity name and commodity specifications into the hybrid retrieval module. Finally, the final recommended tax number of the commodity can be obtained by inputting the initial recommended tax number and the tax number mixed retrieval result into the decision fusion module. In addition, when the commodity information is the declared commodity name, declared commodity specifications and declared commodity tax number filled in by the enterprise when declaring the commodity, the declared commodity tax number can be compared with the final recommended tax number to determine whether the declared commodity tax number is abnormal. Therefore, it is possible to recommend the correct commodity tax number based on the user's question, or to determine whether the declared commodity tax number is abnormal based on the user's declared information, thereby providing the customs department with more effective tax number recommendation tools and anomaly detection tools, thereby maintaining the stability of fair trade and tax collection. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the drawings without paying creative work.
[0028] Figure 1 is a flow chart of a method for recommending a commodity tax number based on a large language model according to an embodiment of the present application;
[0029] Figure 2It is a recommended architecture diagram of commodity tax number according to the embodiment of the present application;
[0030] Figure 3 is a flow chart of a hybrid retrieval module according to an embodiment of the present application;
[0031] Figure 4 is a flow chart of a decision fusion module according to an embodiment of the present application;
[0032] Figure 5 is a flowchart of a method for constructing a tax number recommendation large language model according to an embodiment of the present application;
[0033] Figure 6 is a flowchart of a method for constructing a query rewriting large language model according to an embodiment of the present application;
[0034] Figure 7 is a flowchart of a method for constructing a tax number vector database according to an embodiment of the present application; and
[0035] Figure 8 It is a schematic diagram of the hardware structure of a device for recommending tax numbers of commodities based on a large language model according to an embodiment of the present application. DETAILED DESCRIPTION
[0036] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only configured to explain the present application and are not configured to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0037] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0038] The features and exemplary embodiments of various aspects of the present application will be described in detail below.In addition, the features, structures, or characteristics described below may be combined in any suitable manner in one or more embodiments.
[0039] The large language model has been the focus of scholars' research in recent years. It is an artificial intelligence model based on deep learning technology, which solves a variety of natural language processing tasks through dialogue, such as text generation, summary extraction, question-answering system, etc.
[0040] The embodiments of the present application provide a method and device for recommending commodity tax numbers based on a large language model, which can recommend the correct commodity tax number based on the user's question, or determine whether the declared commodity tax number is abnormal based on the user's declared information.
[0041] Figure 1 is a flow chart of a method for recommending a commodity tax number based on a large language model according to an embodiment of the present application; Figure 2 It is a recommended architecture diagram of commodity tax number according to the embodiment of the present application; Figure 3 is a flow chart of a hybrid retrieval module according to an embodiment of the present application; and Figure 4 is a flowchart of a decision fusion module according to an embodiment of the present application.
[0042] like Figure 1 As shown, the method for recommending tax numbers of commodities based on a large language model according to an embodiment of the present application includes the following steps S110 to S150.
[0043] S110: receiving product information input by the user.
[0044] In one embodiment, the commodity information may be a user question text about the commodity. For example, the user question text may be "What is the tax number of walnuts?", "What is the tax number of shelled walnuts?", "What is the tax number of durian?", "What is the tax number of frozen durian?", etc.
[0045] Alternatively, in one embodiment, the commodity information may be the declared commodity name, declared commodity specifications, and declared commodity tax number filled in by the enterprise when declaring the commodity. For example, the commodity information may be "walnut" (declared commodity name), "shelled" (declared commodity specifications), and "0802320000" (declared commodity tax number) filled in by the enterprise when declaring the commodity.
[0046] S120: Input the product information into the tax number recommendation language model to obtain an initial recommended tax number for the product.
[0047] In one embodiment, when the product information is a user question text about the product, step S120 may include: the tax number recommendation large language model determines whether the product description in the user question text is complete; and when the product description is complete, the tax number recommendation large language model outputs the initial recommended tax number of the product based on the product description.
[0048] For example, when the user's question text is "What is the tax number of shelled walnuts?", the tax number recommendation large language model determines that the product description in the user's question text is complete. Specifically, because the user's question text records the product name "walnut" and the product specification "shelled", the tax number recommendation large language model can output the initial recommended tax number of the product "walnut" according to the product name "walnut" and the product specification "shelled", such as "0802320000". In one embodiment, the initial recommended tax number is a ten-digit tax number.
[0049] In one embodiment, when the product information is a user question text about the product, step S120 may also include: when the product description is incomplete, the tax number recommendation large language model conducts one or more rounds of dialogue with the user to supplement the product description until the tax number recommendation large language model determines that the product description is complete; and the tax number recommendation large language model outputs an initial recommended tax number for the product based on the product description; wherein, in each round of dialogue, the tax number recommendation large language model outputs a prompt question, and the user inputs additional user question text about the prompt question.
[0050] For example, when the user's question text is "What is the tax number of walnuts?", the tax number recommendation large language model determines that the product description in the user's question text is incomplete. Specifically, because the user's question text only records the product name "walnuts" but does not record the product specifications, the tax number recommendation large language model cannot output the initial recommended tax number of the product "walnuts" based only on the product name "walnuts". For example, the tax number of shelled walnuts is inconsistent with the tax number of unshelled walnuts.
[0051] In this case, the tax number recommendation language model needs to have one or more rounds of dialogue with the user to supplement the product description until the tax number recommendation language model determines that the product description is complete. Specifically, in each round of dialogue, the tax number recommendation language model outputs a prompt question, and the user enters additional user question text about the prompt question.
[0052] For example, based on the user question text "What is the tax number of walnuts?", the tax number recommendation large language model can output the prompt question "Please add the processing method of walnuts" in the first round of dialogue, and the user can enter an additional user question text about the prompt question in the first round of dialogue "The processing method of walnuts is to shell them." At this time, the tax number recommendation large language model can determine that the product description is complete, because the tax number recommendation large language model can output the initial recommended tax number of the product "walnuts" based on the product name "walnuts" and the product specification "shelled", such as "0802320000." Further, if after the above-mentioned first round of dialogue ends, the tax number recommendation large language model still determines that the product description is incomplete, the tax number recommendation large language model can have a second round of dialogue, a third round of dialogue, and so on with the user until the tax number recommendation large language model determines that the product description is complete.
[0053] In one embodiment, when the commodity information is the declared commodity name, declared commodity specifications and declared commodity tax number filled in by the enterprise when declaring the commodity, step S120 may include: inputting the declared commodity name and declared commodity specifications into the tax number recommendation large language model to obtain the initial recommended tax number of the commodity.
[0054] For example, the declared commodity name may be "walnut", and the declared commodity specification may be "shelled". Specifically, the tax number recommendation large language model can output the initial recommended tax number of the commodity "walnut" according to the commodity name "walnut" and the commodity specification "shelled", such as "0802320000".
[0055] S130: Inputting query rewriting information based on the product information into the query rewriting large language model to obtain the product name and product specification.
[0056] In one embodiment, when the product information is a user question text about the product, and when the product description in the user question text is complete, step S130 may include: inputting the user question text into a query rewriting language model to obtain the product name and product specifications.
[0057] For example, the user question text "What is the tax number of shelled walnuts?" can be input into the query rewriting language model to obtain the product name "walnuts" and the product specification "shelled".
[0058] Alternatively, in one embodiment, when the product information is a user question text about the product, and when the product description in the user question text is incomplete, step S130 may include: inputting the user question text together with one or more prompt questions in one or more rounds of dialogue and one or more additional user question texts into the query rewriting large language model to obtain the product name and product specifications.
[0059] For example, the user question text "What is the tax number of walnuts?", the prompt question in the first round of dialogue "Please add the processing method of walnuts", and the additional user question text in the first round of dialogue "The processing method of walnuts is to shell them" can be input into the query rewriting large language model together to obtain the product name "walnuts" and the product specification "shelled".
[0060] Alternatively, in one embodiment, when the commodity information is the declared commodity name, declared commodity specifications and declared commodity tax number filled in by the enterprise when declaring the commodity, step S130 may include: inputting the declared commodity name and the declared commodity specifications into the query rewriting large language model to obtain the commodity name and the commodity specifications.
[0061] For example, the declared product name "walnut" and the declared product specification "shelled" may be input into the query rewriting large language model to obtain the product name "walnut" and the product specification "shelled".
[0062] S140: Input the product name and product specification into the mixed search module to obtain the tax number mixed search result.
[0063] In one embodiment, step S140 may include: a hybrid retrieval module vectorizes the product name and product specification to obtain a vectorized product name and a vectorized product specification; the hybrid retrieval module performs similarity calculation on the vectorized product name based on the tax number vector database to obtain the top K entries in the tax number vector database that are most similar to the vectorized product name; and the hybrid retrieval module performs similarity calculation on the vectorized product specifications based on the top K entries to obtain the top 1 entry in the top K entries that is most similar to the vectorized product specification; wherein the tax number hybrid retrieval result includes the product name, product specification and product tax number in the top 1 entry and the calculated similarity value.
[0064] For example, the hybrid retrieval module can use the text vector representation model to vectorize the product name and product specifications respectively, so as to obtain the vectorized product name and the vectorized product specifications. For example, the text vector representation model can be a BGE-small model, a BGE-large model, a TFIDF model, a word-to-vector model, etc. This application does not impose any restrictions on this.
[0065] Furthermore, the hybrid retrieval module may compare the vectorized product name with the entries in the tax number vector database (e.g., perform similarity calculation), thereby obtaining the top K entries in the tax number vector database that are most similar to the vectorized product name. Here, K may be an integer greater than or equal to 1, such as 3, 5, 7, etc. In addition, similarity calculation may include, for example, calculating cosine similarity, calculating Euclidean similarity, calculating Euclidean distance, calculating Manhattan distance, etc.
[0066] After obtaining the first K entries in the tax number vector database that are most similar to the vectorized product name, the hybrid retrieval module can compare the vectorized product specifications with the first K entries (e.g., perform similarity calculation), thereby obtaining the first entry in the first K entries that is most similar to the vectorized product specifications. In this way, the hybrid retrieval module can return the tax number hybrid retrieval result, that is, the product name (e.g., "walnut"), product specifications (e.g., "shelled"), and product tax number (e.g., "0802320000") in the first entry, as well as the calculated similarity value (e.g., 1).
[0067] In addition, in one embodiment, when the product name is empty, the hybrid search module returns empty, and the tax number hybrid search result is empty. For example, when the product name input to the hybrid search module is empty, the hybrid search module cannot perform similarity calculation for the vectorized product name, that is, it cannot compare and search in the tax number vector database. At this time, the hybrid search module returns empty by default, and the tax number hybrid search result is set to empty.
[0068] Further, in one embodiment, when the product name is not empty and the product specification is empty, the above K=1. For example, after the hybrid retrieval module obtains the first K entries in the tax number vector database that are most similar to the vectorized product name, when the product specification input to the hybrid retrieval module is empty, the hybrid retrieval module cannot perform similarity calculation for the vectorized product specification, that is, it cannot compare and search for the first K entries. Therefore, K can be set to 1. That is, when performing similarity calculation for the vectorized product name, only the first entry in the tax number vector database that is most similar to the vectorized product name is obtained, and the product name (e.g., "walnut"), product specification (e.g., "shelled") and product tax number (e.g., "0802320000") in the first entry and the calculated similarity value (e.g., 1) are used as the tax number hybrid retrieval result.
[0069] S150: Input the initial recommended tax number and the tax number mixed search result into the decision fusion module to obtain the final recommended tax number of the product.
[0070] In one embodiment, step S140 may include: when the tax number mixed retrieval result is not empty and the similarity value is greater than a first threshold, the decision fusion module outputs the product tax number as the final recommended tax number of the product; and when the tax number mixed retrieval result is empty or the similarity value is less than or equal to the first threshold, the decision fusion module outputs the initial recommended tax number as the final recommended tax number of the product.
[0071] For example, when the tax number mixed retrieval result is not empty and the similarity value (e.g., 0.96) is greater than the first threshold (e.g., 0.95), the decision fusion module can output the product tax number (e.g., "0802320000") in the first entry in the tax number mixed retrieval result as the final recommended tax number of the product.
[0072] For another example, when the tax number mixed search result is empty or the similarity value (for example, 0.94) is less than or equal to the first threshold (for example, 0.95), the decision fusion module can output the initial recommended tax number (for example, "0802320000") output by the tax number recommendation language model as the final recommended tax number for the product.
[0073] In one embodiment, when the commodity information is the declared commodity name, declared commodity specifications and declared commodity tax number filled in by the enterprise when declaring the commodity, the tax number recommendation method for commodities based on a large language model according to the embodiment of the present application also includes: comparing the declared commodity tax number with the final recommended tax number; when the declared commodity tax number is consistent with the final recommended tax number, returning no abnormality to the user; and when the declared commodity tax number is inconsistent with the final recommended tax number, returning an abnormality to the user.
[0074] For example, when the tax number of the declared goods filled in by the enterprise when declaring the goods is consistent with the above-mentioned final recommended tax number, it can be indicated that the tax number of the declared goods of the enterprise is correct. At this time, the user can be notified that there is no abnormality in the tax number of the declared goods of the enterprise. In addition, when the tax number of the declared goods filled in by the enterprise when declaring the goods is inconsistent with the above-mentioned final recommended tax number, it can be indicated that the tax number of the declared goods of the enterprise is incorrect. At this time, the user can be notified that there is an abnormality in the tax number of the declared goods of the enterprise. This can provide users with a more accurate tax number anomaly detection tool.
[0075] According to the tax number recommendation method for commodities based on a large language model of an embodiment of the present application, the initial recommended tax number of the commodity can be obtained by receiving commodity information input by a user and inputting the commodity information into the tax number recommendation large language model. The query rewriting information based on the commodity information is input into the query rewriting large language model to obtain the commodity name and commodity specification, and the commodity name and commodity specification are input into the hybrid retrieval module to obtain the tax number hybrid retrieval result. Finally, the initial recommended tax number and the tax number hybrid retrieval result are input into the decision fusion module to obtain the final recommended tax number of the commodity. In addition, in the case where the commodity information is the declared commodity name, declared commodity specification and declared commodity tax number filled in by the enterprise when declaring the commodity, the declared commodity tax number can be compared with the final recommended tax number to determine whether the declared commodity tax number is abnormal. Therefore, it is possible to recommend the correct commodity tax number according to the user's question, or to determine whether the declared commodity tax number is abnormal according to the user's declaration information, so as to provide the customs department with a more effective tax number recommendation tool and anomaly detection tool, thereby maintaining the stability of fair trade and tax collection.
[0076] Figure 5 1 is a flow chart of a method for constructing a tax number recommendation language model according to an embodiment of the present application. Figure 5 As shown, the method for constructing a large language model for tax number recommendation according to an embodiment of the present application includes the following steps S510 to S560.
[0077] S510: Select a general large language model as a base model.
[0078] In one embodiment, the general large language model may include, for example, GLM1, GLM2, GLM3, GLM4, QWEN, etc. This application does not impose any limitation on this.
[0079] S520: Use the tax number pre-training dataset to perform the first training on the general large language model, where the training method is full parameter fine-tuning.
[0080] In one embodiment, the tax number pre-training data set may include the import and export tariff of the Customs of the People's Republic of China, commodity tax number historical declaration data, and Internet data, etc. For example, Internet data may include books related to tax numbers, tax number exercises, general knowledge, etc.
[0081] In addition, the tax number pre-training dataset is a cleaned dataset, which can remove noise and irrelevant content and ensure data quality. For example, the tax number exercises obtained from the Internet contain many HTML tags, non-text content, etc., which need to be cleaned. After the cleaning is completed, the cleaned text can be segmented and serialized, and the text can be segmented by selecting an appropriate word segmenter (for example, GLM word segmentation tool, etc.), and the segmented text can be converted into vocabulary units (tokens) that can be understood by a general large language model. For example, the format of the tax number pre-training dataset can be: {"text":"context1"}.
[0082] Furthermore, during the first training of the general large language model using the tax number pre-training dataset, the training method may be full parameter fine-tuning, that is, all parameters of the general large language model are fine-tuned.
[0083] S530: Monitor the difference curve of the loss function during the first training, and stop the first training when the difference curve converges.
[0084] In one embodiment, when the difference curve of the loss function of the first training converges (for example, when the difference no longer decreases significantly), it can indicate that the first training for the universal large language model has been completed.
[0085] S540: Use the tax number fine-tuning dataset to perform a second training on the general large language model, wherein the training method is partial parameter fine-tuning.
[0086] In one embodiment, the tax number fine-tuning dataset includes a predefined tax number multi-round question-and-answer dataset. For example, the format of the predefined tax number multi-round question-and-answer dataset can be: {"user":"query1","gpt":"response1",...,"user":"queryn","gpt":"responsen"}, where query1, query2,...,queryn are user question texts, and response1, response2,...,responsen are the answer results of the general large language model. For example, query1 can be "What is the tax number of walnuts?", response1 can be "Please add the processing method of walnuts", query2 can be "The processing method of walnuts is shelled", and response2 can be "The tax number of shelled walnuts is 0802320000".
[0087] Furthermore, during the second training of the general large language model using the tax number fine-tuning dataset, the training method may be partial parameter fine-tuning, that is, fine-tuning a part of the parameters of the general large language model.
[0088] S550: Monitor the difference curve of the loss function during the second training, and stop the second training when the difference curve converges.
[0089] In one embodiment, when the difference curve of the loss function of the second training converges (for example, when the difference no longer decreases significantly), it can indicate that the second training for the universal large language model has been completed.
[0090] S560: Use the tax number preference optimization dataset to train the general large language model for the third time to obtain the tax number recommendation large language model.
[0091] In one embodiment, the tax number preference optimization data set includes a predefined tax number preference question and answer data set. For example, the format of the predefined tax number preference question and answer data set can be: {"user":"query1","chosen":"response1","rejected":"response2"}, query1 is the user's question text, response1 is the general large language model accepting this type of answer result, and response2 is the general large language model rejecting this type of answer result. For example, query1 can be "What is the tax number of shelled walnuts?", response1 can be "Check the category and chapter name in the tariff, because walnuts are processed by shelling, so the tax number is 0802320000", and response2 can be "The tax number of shelled walnuts is 0802320000". Combined with the actual application scenario, response1 is better than response2.
[0092] Figure 6 is a flow chart of a method for constructing a query rewriting large language model according to an embodiment of the present application. Figure 6 As shown, the method for constructing a query rewriting large language model according to an embodiment of the present application includes the following steps S610 to S650.
[0093] S610: Divide the query rewriting data set into a training set and a test set.
[0094] In one embodiment, the query rewriting dataset may include a predefined tax number query rewriting multi-round question and answer dataset. For example, the format of the predefined tax number query rewriting multi-round question and answer dataset may be: {"inputs": "q1r1, q2r2, ..., qn", "outputs": "query_new"}, where q1r1, q2r2, ..., qn is the concatenation of each round of user input and each round of large language model output (excluding the last round of large language model output) in one or more rounds of dialogue between the user and the tax number recommendation large language model, and query_new is a new query. Here, the new query can improve the retrieval accuracy and efficiency of the tax number vector database.
[0095] For example, an entry of the predefined tax number query rewriting multi-round question-answering dataset can be {"inputs":"What is the ten-digit tax number of walnuts? / Please provide additional information on the processing method of walnuts / The processing method is shelling","outputs":"{"product name":"walnuts","declaration elements":"shelling"}.
[0096] In one embodiment, the ratio of the training set to the test set of the query rewriting data set may be 9: 1. In addition, the ratio of the training set to the test set of the query rewriting data set may be any appropriate ratio, which is not limited in the present application.
[0097] S620: Select multiple universal large language models as base models.
[0098] In one embodiment, multiple universal large language models may be selected as base models. For example, the universal large language model may include GLM1, GLM2, GLM3, GLM4, QWEN, etc. This application does not impose any restrictions on this.
[0099] S630: Use the training set to train multiple general large language models respectively, wherein the training method is fine-tuning of some parameters.
[0100] In one embodiment, the training set is used to train multiple general large language models respectively at the same time. Further, during the training of multiple general large language models using the training set, the training method can be fine-tuning of some parameters. That is, fine-tuning of some parameters of the general large language model.
[0101] S640: For each general large language model, monitor the difference curve of the loss function during training, and stop training when the difference curve converges.
[0102] In one embodiment, when the difference curve of the loss function for the training of each universal large language model converges (for example, when the difference no longer decreases significantly), it can indicate that the training for the universal large language model has been completed.
[0103] S650: Use the test set to test each trained general large language model, and select the trained general large language model with the highest test score as the query rewriting large language model.
[0104] In one embodiment, a trained general large language model with the highest test score may be selected as the query rewriting large language model, so that more accurate output can be obtained when the query rewriting large language model is subsequently used.
[0105] Figure 7 FIG. 1 is a flow chart of a method for constructing a tax number vector database according to an embodiment of the present application. Figure 7 As shown, the method for constructing a tax number vector database according to an embodiment of the present application includes the following steps S710 to S720.
[0106] S710: Clean the commodity tax number historical declaration data to obtain a database including commodity names, cleaned commodity specifications, and commodity tax numbers.
[0107] In one embodiment, in the commodity tax number historical declaration data, since there are rules and standards for commodity tax numbers, if the same commodity has different commodity specifications (e.g., appearance, processing method, use, or storage method, etc.), it corresponds to different commodity tax numbers. In addition, in the commodity tax number historical declaration data, there are other commodity specifications (e.g., brand, packaging, contract date, etc.) for the commodity, and these commodity specifications have no effect on the commodity tax number. Therefore, it is necessary to clean the commodity tax number historical declaration data to obtain a database including the commodity name, the cleaned commodity specifications (these commodity specifications have an effect on the commodity tax number), and the commodity tax number.
[0108] S720: vectorize the product name and the cleaned product specification respectively to obtain a tax number vector database including the product name, the cleaned product specification, the vectorized product name, the vectorized cleaned product specification, and the product tax number.
[0109] In one embodiment, the text vector representation model can be used to vectorize the product name and the cleaned product specifications respectively, so as to obtain the vectorized product name and the vectorized cleaned product specifications. For example, the text vector representation model can be a BGE-small model, a BGE-large model, a TFIDF model, a word-to-vector model, etc. This application does not impose any restrictions on this. Here, the tax number vector database includes the vectorized product name and the vectorized cleaned product specifications, so that the above-mentioned similarity calculation of the hybrid retrieval module can be realized.
[0110] The present application also provides a device for recommending tax numbers of commodities based on a large language model, comprising: a processor, and a memory storing instructions, which, when executed by the processor, enable the processor to execute the above-mentioned method for recommending tax numbers of commodities based on a large language model.
[0111] Figure 8 1 is a schematic diagram of the hardware structure of a commodity tax number recommendation device based on a large language model according to an embodiment of the present application. Figure 8 The device for recommending tax number of commodities based on a large language model may include a processor 81 and a memory 82 storing computer program instructions.
[0112] Specifically, the processor 81 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0113] The memory 82 may include a large capacity memory for data or instructions. Where appropriate, the memory 82 may include removable or non-removable (or fixed) media. In a particular embodiment, the memory 82 is a non-volatile solid-state memory. The memory 82 may include a read-only memory (ROM), a random access memory (RAM), a disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Therefore, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the above-mentioned tax number recommendation method for commodities based on a large language model.
[0114] The processor 81 implements the tax number recommendation method for commodities based on the large language model in the above-mentioned embodiment by reading and executing the computer program instructions stored in the memory 82 .
[0115] In one example, the commodity tax number recommendation device based on the large language model may further include a communication interface 83 and a bus 84. Figure 8 As shown, the processor 81, the memory 82, and the communication interface 83 are connected via a bus 84 and communicate with each other.
[0116] Bus 84 includes hardware, software or both, and the parts of the tax number recommendation device of the commodity based on the large language model are coupled to each other.For example, but not limitation, bus can include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In suitable cases, bus 84 can include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.
[0117] The present application also provides a computer-readable storage medium on which instructions are stored. When the instructions are executed by a computer, the computer executes the above-mentioned method for recommending tax numbers for commodities based on a large language model.
[0118] Examples of computer-readable storage media include non-transitory computer-readable storage media, such as portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk-read-only memory (CD-ROM), optical storage devices, magnetic storage devices, etc.
[0119] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0120] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A method for recommending a commodity tax number based on a large language model, comprising: Receive product information; Inputting the commodity information into a tax number recommendation language model to obtain an initial recommended tax number for the commodity; Inputting the query rewriting information based on the product information into the query rewriting language model to obtain the product name and product specification; Input the commodity name and the commodity specification into a mixed search module to obtain a tax number mixed search result; as well as The initial recommended tax number and the tax number mixed search result are input into a decision fusion module to obtain the final recommended tax number of the commodity.
2. The method according to claim 1, wherein: The product information is a user's question text regarding the product.
3. The method according to claim 2, wherein: Inputting the product information into the tax number recommendation language model to obtain the initial recommended tax number of the product includes: The tax number recommendation large language model determines whether the product description in the user's question text is complete; and When the product description is complete, the tax number recommendation language model outputs an initial recommended tax number for the product based on the product description.
4. The method according to claim 3, wherein: Inputting the product information into the tax number recommendation language model to obtain an initial recommended tax number for the product further includes: In the case where the product description is incomplete, the tax number recommendation large language model conducts one or more rounds of dialogue with the user to supplement the product description until the tax number recommendation large language model determines that the product description is complete; and The tax number recommendation language model outputs an initial recommended tax number for the commodity according to the commodity description; In each round of dialogue, the tax number recommendation language model outputs a prompt question, and the user inputs additional user question text regarding the prompt question.
5. The method according to claim 3, wherein: Inputting the query rewriting information based on the product information into the query rewriting language model to obtain the product name and product specifications includes: The user question text is input into the query rewriting language model to obtain the product name and the product specification.
6. The method according to claim 4, wherein: Inputting the query rewriting information based on the product information into the query rewriting language model to obtain the product name and product specifications includes: The user question text, one or more prompt questions in the one or more rounds of dialogue, and one or more additional user question texts are input into the query rewriting large language model to obtain the product name and the product specification.
7. The method according to claim 1, wherein: The commodity information refers to the declared commodity name, declared commodity specifications and declared commodity tax number filled in by the enterprise when declaring the commodity.
8. The method according to claim 7, wherein: Inputting the product information into the tax number recommendation language model to obtain the initial recommended tax number of the product includes: The declared commodity name and the declared commodity specification are input into the tax number recommendation large language model to obtain an initial recommended tax number for the commodity.
9. The method according to claim 7, wherein: Inputting the query rewriting information based on the product information into the query rewriting language model to obtain the product name and product specifications includes: The declared product name and the declared product specification are input into the query rewriting large language model to obtain the product name and the product specification.
10. The method according to claim 7, further comprising: Compare the declared commodity tax number with the final recommended tax number; If the tax number of the declared commodity is consistent with the final recommended tax number, a message indicating that there is no abnormality is returned to the user; as well as In the case where the declared commodity tax number is inconsistent with the final recommended tax number, an abnormality is returned to the user.
11. The method according to claim 1, wherein: Inputting the product name and the product specification into the mixed search module to obtain the tax number mixed search result includes: The hybrid search module vectorizes the product name and the product specification to obtain a vectorized product name and a vectorized product specification; The hybrid search module performs similarity calculation on the vectorized product name based on the tax number vector database to obtain top K entries in the tax number vector database that are most similar to the vectorized product name; and The hybrid retrieval module performs similarity calculation on the vectorized product specifications based on the first K entries to obtain a first entry among the first K entries that is most similar to the vectorized product specifications; The tax number mixed search result includes the product name, product specification and product tax number in the first entry and the calculated similarity value.
12. The method according to claim 11, wherein: When the product name is empty, the mixed search module returns empty, and the tax number mixed search result is empty. Wherein, when the product name is not empty and the product specification is empty, K=1.
13. The method according to claim 12, wherein: Inputting the initial recommended tax number and the tax number mixed search result into the decision fusion module to obtain the final recommended tax number of the commodity includes: When the tax number mixed search result is not empty and the similarity value is greater than a first threshold, the decision fusion module outputs the commodity tax number as the final recommended tax number of the commodity; and When the tax number mixed search result is empty or the similarity value is less than or equal to the first threshold, the decision fusion module outputs the initial recommended tax number as the final recommended tax number of the commodity.
14. The method according to claim 1, wherein: The tax number recommendation language model is constructed in the following way: Select the general large language model as the base model; The tax number pre-training dataset is used to perform a first training on the general large language model, wherein the training method is full parameter fine-tuning; Monitoring a difference curve of the loss function during the first training, and stopping the first training when the difference curve converges; The tax number fine-tuning dataset is used to perform a second training on the general large language model, wherein the training method is partial parameter fine-tuning; Monitoring a difference curve of the loss function during the second training, and stopping the second training when the difference curve converges; The general large language model is trained for a third time using the tax number preference optimization dataset to obtain the tax number recommendation large language model.
15. The method according to claim 14, wherein: The tax number pre-training data set includes the import and export tariff of the Customs of the People's Republic of China, commodity tax number historical declaration data and Internet data. The tax number fine-tuning dataset includes a predefined tax number multi-round question-answering dataset. The tax number preference optimization data set includes a predefined tax number preference question and answer data set.
16. The method according to claim 1, wherein: The query rewriting language model is constructed in the following way: Divide the query rewriting dataset into a training set and a test set; Select multiple general large language models as base models; Using the training set to train the multiple general large language models respectively, wherein the training method is fine-tuning of some parameters; For each universal large language model, monitoring a difference curve of the loss function during training, and stopping the training when the difference curve converges; Each trained general large language model is tested using the test set, and the trained general large language model with the highest test score is selected as the query rewriting large language model.
17. The method according to claim 16, wherein: The query rewriting data set includes a predefined tax number query rewriting multi-round question and answer data set.
18. The method according to claim 11, wherein: The tax number vector database is constructed in the following manner: Clean the commodity tax number historical declaration data to obtain a database including commodity names, cleaned commodity specifications, and commodity tax numbers; The commodity names and the cleaned commodity specifications are vectorized respectively to obtain the tax number vector database including the commodity names, the cleaned commodity specifications, the vectorized commodity names, the vectorized cleaned commodity specifications, and the commodity tax numbers.
19. A commodity tax number recommendation device based on a large language model, comprising: processor, and A memory storing instructions, wherein when the instructions are executed by the processor, the processor is caused to perform the method according to any one of claims 1 to 18.
20. A computer-readable storage medium having instructions stored thereon, which, when executed by a computer, cause the computer to perform the method according to any one of claims 1 to 18.
Citation Information
Patent Citations
Tax number classification and associated element identification method based on deep learning
CN116975707A
Method and device for determining commodity tax number based on deep learning
CN117710124A
Method and device for checking customs declaration information of import and export goods
CN117829158A
Text information extraction method and device, equipment and storage medium
CN118193681A
Commodity tax number determination method, device and equipment
CN119127936A
Cited By
Method and apparatus for recommending harmonized system code for goods on basis of large language model
WO2026137769A1