A method and system for automatic classification and grading of public data
Through large-scale model retrieval, enhanced generation technology and real-time update vector knowledge bases, the problem of insufficient timeliness and professional knowledge of large-scale models in multi-industry and multi-source data is solved, and efficient, accurate and economical automation of public data classification and grading is achieved.
Patent Information
- Application Number
- CN202411587567.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2044-11-08
AI Technical Summary
The existing data classification and grading methods rely on manual construction of rule bases and pre-training of large models, which are difficult to adapt to multi-industry, multi-source heterogeneous data and rapidly changing policy standards. The large models lack timeliness and expertise, resulting in classification and grading accuracy and High cost.
Using large-model retrieval enhancement generation technology, combined with real-time updated classification and hierarchical vector knowledge base, data vector processing is performed through weighted embedding models and closest search algorithms, and fine-tuning and automated classification and grading are used for large-models with Transformer architecture to reduce model training costs. and improve accuracy.
The timeliness and accuracy of large models in public data classification and grading have been achieved, the frequency and cost of manual fine-tuning has been reduced, the needs of multi-industry and multi-source data are adapted to the performance of classification and grading have been improved.
Smart Images

Figure CN119128607B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method and system for automatic classification and grading of public data, belonging to the technical field of automatic classification and grading of data. Background Art
[0002] With the rapid development of technologies such as big data and artificial intelligence, the data security situation has become increasingly severe, and traditional boundary protection has been broken. It is urgent to carry out data security work based on the data life cycle dimension, and data classification and grading are the basis and prerequisite for carrying out data life cycle security protection. Lay the foundation for the protection of public data and the release of its value. However, at present, most of the data classification and grading still use manual verification and manual labeling methods. Under the massive amount of data, on the one hand, the manual labeling workload is extremely large, and the data classification and grading processing cycle is very long; on the other hand, manual labeling also has a high risk of labeling errors, and it is difficult to adapt to the continuous data application needs. Therefore, it is urgent to study the automated grading method for public data classification and grading to effectively improve the classification and grading work and ensure timeliness, accuracy and economy.
[0003] The existing automated implementation method of data classification and grading is: mainly based on the constructed rule base, manually construct the corresponding rule template, and use actual business data to test the predictive reasoning of the rule template (where the classification and grading prediction models use models including NN, SVM, decision tree, K nearest neighbor or softmax), and then analyze the test results. This type of method still requires a lot of manpower to build the rule base in the early stage, and it needs to be rebuilt as the rules change. It is difficult to apply to public data fields that cover multiple industries, have massive and multi-source heterogeneous data, and have different classification and grading standards for different industries. The existing implementation method based on large models focuses on building large models based on public data information, lacks semantic enrichment of the input data to be classified and graded, and is difficult to overcome the problem of lack of knowledge timeliness and insufficient professional knowledge in specific fields. If you need to improve the timeliness of model knowledge and insufficient professional knowledge, you need to re-pre-train the large model, which causes a large cost. Therefore, the present invention innovatively proposes to realize automatic classification and grading of public data based on retrieval enhancement generation technology. Based on the external classification and grading vector knowledge base, on the one hand, the knowledge of the classification and grading vector knowledge base can be efficiently and jointly updated according to changes in policy standards; on the other hand, the pre-trained large model can be fine-tuned based on the classification and grading vector knowledge base, which can reduce the training cost and effectively improve the model effect. The input data can be enriched through the external classification and grading vector knowledge base to solve the problem of insufficient professional knowledge in specific fields of the large model, and further improve the performance of automatic classification and grading of the large model. Summary of the invention
[0004] In view of the problems existing in the prior art, the present invention provides a method and system for automatic classification and grading of public data. Based on the large model retrieval-augmented generation (RAG) technology, the present invention enables the large model to access a real-time updated classification and grading knowledge base. On the one hand, it effectively solves the problem of lack of timeliness of classification and grading knowledge in the large model, as well as the problem of insufficient professional knowledge in specific fields of public data. On the other hand, without the need for frequent fine-tuning and adaptation of the large model, it makes full use of external data to improve the accuracy of classification and grading of the large model. In addition, based on the interactive capabilities of the large model, the accuracy of classification and grading can be continuously optimized and improved.
[0005] The technical solution of the present invention is: In the first aspect, the present invention provides a method for automatic classification and grading of public data, comprising:
[0006] S1. Collect public data classification and grading standards and specifications, as well as other rule texts related to classification and grading, to form an original classification and grading vector knowledge base and a large model pre-training corpus;
[0007] S2. Based on the weighted embedding model, the classification rule text and grading rule text in the classification and grading standard specification, as well as other rule texts related to classification and grading are vectorized to form a classification and grading vector knowledge base;
[0008] S3. Vectorize the input data to be classified and graded based on the weighted embedding model, and then perform similarity matching with the classification and grading vector knowledge base content based on the nearest neighbor search algorithm to obtain matching information between the field to which the data belongs and the grading rules;
[0009] S4. Select a language model with a Transformer architecture, pre-train the model based on public data classification and grading standards and specifications, as well as corpora of other rule texts related to classification and grading, and then adapt and fine-tune the pre-trained model based on the public data classification and grading vector knowledge base; the classification and grading vector knowledge base is dynamically updated according to the revision of standards and specifications and changes in classification and grading rules;
[0010] S5. Input the data to be classified and graded, as well as the matching information with the classification and grading vector knowledge base, into the big model for automatic classification and grading.
[0011] Furthermore, the S2 specifically includes:
[0012] S21. Preprocess the collected text corpus and segment sentences using word segmentation, part-of-speech tagging, named entity recognition, and keyword extraction techniques; then perform word segmentation using the MaxMatch method based on the dictionary;
[0013] S22. For image data, use OCR recognition technology to identify data in the image, and then segment the identified data based on the method in S21;
[0014] S23. Select an embedding model to process text data. The embedding model selected is Word2Vec. Word vectors are generated by learning text data. The specific architecture of the continuous bag of words model is as follows:
[0015]
[0016] in, is the target word The word vector of represents the vocabulary, For vocabulary Any word in is the average value of the context word vectors, Words to express The word vector of For word vector The transpose of ; Another non-continuous jump model implementation architecture is:
[0017]
[0018] S24. The Word2Vec model is improved by introducing weights, and higher weights are given to the key words of classification and grading rules to reflect their importance. The specific calculation is as follows:
[0019]
[0020] in, Indicates the target word The weighted word embedding vector representation of Indicates the target word The term frequency-inverse document frequency weight, Represents the total number of words in the sentence, Indicates the target word The word vector of
[0021] S25. Based on the weighted embedding model, the classification rule text in the classification and grading standard specification is converted into a classification vector knowledge base that can be processed by computers. ;
[0022] S26. Based on the weighted embedding model, the classification rule text in the classification and grading standard specification is converted into a classification vector knowledge base that can be processed by computers .
[0023] Furthermore, the S3 specifically includes:
[0024] S31. vectorizing the input data to be classified and graded based on a weighted embedding model;
[0025] S32. According to the classification and grading data characteristics, select the existing nearest neighbor search algorithm, the selected nearest neighbor search algorithm is Annoy, ScaNN, Faiss or Hnswlib algorithm;
[0026] S33. Based on the existing nearest neighbor search algorithm, the input classification data is matched with the knowledge base content to obtain the field category matching information;
[0027] S34. Based on the existing nearest neighbor search algorithm, the input data to be classified and graded is matched with the knowledge base content to obtain matching information of the data sensitivity level.
[0028] Furthermore, the S4 specifically includes:
[0029] S41. Select the language model of Transformer architecture, and pre-train the model based on the public data classification and grading standards and corpus of other rule texts related to classification and grading. The calculation formula of the large language model is:
[0030]
[0031]
[0032]
[0033]
[0034]
[0035] in, is the ID sequence of the input data; For input text; is the word segmenter; is the embedding layer function of the large language model; is the word embedding sequence, Embedding layer for large language models; is the hidden vector of the next word; It is the output layer of the large language model; is the probability distribution of the next word; is the function for selecting the sequence number with the highest probability; The ID of the next word;
[0036] S42. Based on the public data classification and grading vector knowledge base, the pre-trained large model is adapted and fine-tuned. The re-parameterized parameter efficient fine-tuning method is used to re-parameterize some model parameters of the pre-trained large language model to the low-dimensional parameter space. The low-dimensional parameter space is optimized during fine-tuning, thereby significantly reducing the model's computational complexity and memory consumption. At the same time, dynamic adjustments and updates are made according to the revision of standard specifications and changes in classification and grading rules. The specific efficient fine-tuning adaptation method is to decompose the weight change of the self-attention module of the large language model into the multiplication of two low-rank matrices.
[0037] ;
[0038] in Represents the changing weight parameter of the self-attention module of the large model, represents the weight of the self-attention module in the last round of training, represents the weight change, , Indicated by Split low-rank matrix.
[0039] Furthermore, the S5 specifically includes:
[0040] S51. Integrate the data to be classified and graded with the matching information according to certain rules to enrich the input of the large model, increase the richness of the input information and the classification and grading discrimination information;
[0041] The integration of the data to be classified and graded and the matching information according to certain rules refers to vectorizing the data to be classified and graded as the first-dimensional input, using the classification matching information as the second-dimensional input of the input information, and using the classification matching information as the third-dimensional input of the input information, thereby forming a three-dimensional input vector, specifically:
[0042]
[0043] in, Represents the word embedding vector after the data to be classified and graded is vectorized. express Classification matching information with classification and grading knowledge base, express Matching information with the classification and grading knowledge base; By integrating the matching information of the classification and grading knowledge base with the input information, the input semantic information is enriched, the big model's understanding of specific domain knowledge is enhanced, and the accuracy of classification and grading is increased;
[0044] S52. Input the integrated information vector into the large model, and output the classification and grading results of the input data, as well as the relevant judgment basis;
[0045] S53. For the output public data classification and grading results, if the manual review is passed, the results are output;
[0046] S54. For the output public data classification and grading results, if they fail the manual review, a question-and-answer interaction is conducted with the big model to allow the big model to update the knowledge base and make a new prediction until the prediction results pass the manual review.
[0047] In a second aspect, the present invention further provides a system for automatic classification and grading of public data, the system comprising a module for executing the method of the first aspect.
[0048] In a third aspect, the present invention further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for automatic classification and grading of public data of the first aspect mentioned above is implemented.
[0049] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for automatic classification and grading of public data described in the first aspect above is implemented.
[0050] In a fifth aspect, the present invention further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the method for automatic classification and grading of public data of the first aspect.
[0051] The public data automatic classification and grading system and storage medium based on the large model retrieval enhancement generation technology provided by the present invention builds a vector knowledge base based on various policies, regulations and standard specifications for public data classification and grading, and uses relevant corpus to adapt and fine-tune the large model, then calculates the similarity matching between the data to be classified and graded and the knowledge in the vector knowledge base, integrates the matching information and the data to be classified and graded, and after integration, inputs the large model that has been adapted and fine-tuned for classification and grading reasoning;
[0052] The beneficial effects of the present invention are as follows: Based on the Retrieval-Augmented Generation (RAG) technology of a large model, the present invention enables the large model to access a real-time updated classification and grading knowledge base, which effectively solves the problem of the lack of timeliness of classification and grading knowledge in the large model and the problem of insufficient professional knowledge in specific fields of public data. On the other hand, without the need for frequent fine-tuning and adaptation of the large model, the external data is fully used to improve the accuracy of classification and grading of the large model. In addition, based on the interactive ability of the large model, the accuracy of classification and grading can be continuously optimized and improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0054] Figure 1 It is a flow chart of a method for automatic classification and grading of public data provided by the present invention;
[0055] Figure 2 It is a module connection diagram of a public data automatic classification and grading system provided by the present invention;
[0056] Figure 3 It is a flow chart of the architecture of a public data automatic classification and grading system provided by the present invention;
[0057] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention.
[0058] The numbers in the figure are:
[0059] 110-Classification and grading knowledge base construction module; 120-Knowledge retrieval and matching module; 130-Large model adaptation and fine-tuning module; 140-Automation classification and grading module;
[0060] 310 - processor; 320 - communication interface; 330 - memory; 340 - communication bus. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. It should be noted that the embodiments in this application and the features in the embodiments can be combined with each other arbitrarily without conflict.
[0062] It should be noted that the execution subject of the embodiments of the present invention can be various types of terminals, such as computers, smart phones, tablet computers, wearable devices, personal digital assistants (English: Personal Digital Assistant, abbreviated: PDA), mobile Internet devices (English: Mobile Internet Device, abbreviated: MID) and other terminals that can perform text processing, and the present invention does not impose any restrictions on this.
[0063] Example 1: Figure 1 As shown, an embodiment of the present invention provides a method for automatically classifying and grading public data, comprising:
[0064] S1. Collect public data classification and grading standards and specifications, as well as other rule texts related to classification and grading, to form an original classification and grading vector knowledge base and a large model pre-training corpus;
[0065] Among them, the classification and grading of public data must first meet the requirements of relevant laws, regulations and standards, and then focus on complying with the classification and grading system specifications or standards in various industries. If there are no relevant standards in the relevant industry, the relevant standards or guidelines for the classification and grading of public data issued by the local authorities shall be followed. Therefore, it is necessary to collect relevant standards for data classification and grading, such as GB / T43697-2024 "Data Security Technology Data Classification and Grading Rules", GB / T 35273-2020 "Information Security Technology Personal Information Security Specification", TC260-PG-20212A "Network Security Standard Practice Guide Network Data Classification and Grading Guidelines", etc., as well as classification and grading industry specifications or standards in the fields of finance, transportation, market supervision, medical insurance, natural resources, education, etc., as well as relevant standards and specifications for the classification and grading of public data.
[0066] The collection of relevant policies, regulations, standards and specifications in the government affairs field is used to train the large model. Although it is called the government affairs field here, the collected corpus is actually very rich, including policies, regulations and standards and specifications in various sub-fields such as transportation, health care, medical insurance, education, government services, development and reform, finance, and public security;
[0067] S2. Based on the weighted embedding model, the classification rule text and grading rule text in the classification and grading standard specification, as well as other rule texts related to classification and grading are vectorized to form a classification and grading vector knowledge base;
[0068] In the optional examples of the present invention, the rule information related to data classification and grading is vectorized, such as the rule "data is classified according to the idea of first industry field classification and then business attribute classification", "according to the industry field, data is divided into industrial data, telecommunications data, financial data, energy data, transportation data, natural resource data, health data, education data, scientific data, etc.", "the competent (regulatory) departments of various industries and fields shall refine the data in the industry field according to the business attributes of the industry and field" and so on, to form a classification vector knowledge base. The classification rule "data is divided into three levels from high to low: core data, important data, and general data according to the importance of data in economic and social development, and the degree of harm to national security, economic operation, social order, public interests, organizational rights and interests, and personal rights and interests once it is leaked, tampered with, damaged, or illegally obtained, illegally used, or illegally shared" is vectorized to form a hierarchical vector knowledge base.
[0069] In some feasible implementations, the S2 specifically includes:
[0070] S21. Preprocess the collected text corpus and segment sentences using word segmentation, part-of-speech tagging, named entity recognition, and keyword extraction techniques; then perform word segmentation using the MaxMatch method based on the dictionary;
[0071] S22. For image data, use OCR recognition technology to identify data in the image, and then segment the identified data based on the method in S21;
[0072] S23. Select an embedding model to process text data. The embedding model selected is Word2Vec. Word vectors are generated by learning text data. The specific architecture of the continuous bag of words model is as follows:
[0073]
[0074] in, is the target word The word vector of represents the vocabulary, For vocabulary Any word in is the average value of the context word vectors, Words to express The word vector of For word vector The transpose of ; Another non-continuous jump model implementation architecture is:
[0075]
[0076] S24. The Word2Vec model is improved by introducing weights, and higher weights are given to the key words of classification and grading rules to reflect their importance. The specific calculation is as follows:
[0077]
[0078] in, Indicates the target word The weighted word embedding vector representation of Indicates the target word The term frequency-inverse document frequency weight, Represents the total number of words in the sentence, Indicates the target word The word vector of
[0079] S25. Based on the weighted embedding model, the classification rule text in the classification and grading standard specification is converted into a classification vector knowledge base that can be processed by computers. ;
[0080] S26. Based on the weighted embedding model, the classification rule text in the classification and grading standard specification is converted into a classification vector knowledge base that can be processed by computers .
[0081] S3. Vectorize the input data to be classified and graded based on the weighted embedding model, and then perform similarity matching with the classification and grading vector knowledge base content based on the nearest neighbor search algorithm to obtain matching information between the field to which the data belongs and the grading rules;
[0082] In some feasible implementations, S3 specifically includes:
[0083] S31. vectorizing the input data to be classified and graded based on a weighted embedding model;
[0084] S32. According to the classification and grading data characteristics, select the existing nearest neighbor search algorithm, the selected nearest neighbor search algorithm is Annoy, ScaNN, Faiss or Hnswlib algorithm;
[0085] S33. Based on the existing nearest neighbor search algorithm, the input classification data is matched with the knowledge base content to obtain the field category matching information;
[0086] S34. Based on the existing nearest neighbor search algorithm, the input data to be classified and graded is matched with the knowledge base content to obtain matching information of the data sensitivity level.
[0087] In some feasible implementations, the relevant search algorithm may select Locality-Sensitive Hashing (LSH), KD tree (kd tree), ball tree (Ball Tree), random projection tree (RandomProjection Trees), graph structure method (Graph-Based Methods) or product quantization (ProductQuantization, PQ), etc., among which the locality-sensitive hashing method is further divided into the original locality-sensitive hashing method and the locality-sensitive hashing method based on p-stable distribution.
[0088] Based on the original local sensitive hashing implementation method, the data is first embedded from the Euclidean space under the L1 criterion to the Hamming space.
[0089] The embedding algorithm is: first find the maximum value of all coordinate values of all points ; For any point , , is the dimension of the data; each dimension Convert to a length of 0 / 1 sequence, where the first The values are 1 and the rest are 0; then The length is The sequences are connected to form a sequence of length sequence.
[0090] In the original locality sensitive hashing implementation, each hash function is defined as:
[0091]
[0092] The input is a sequence of 01, and the output is the value of a certain bit in the sequence. There is When mapping data into buckets, choose The above hash functions form a hash map:
[0093]
[0094] Therefore, the algorithm steps are:
[0095] from [0,M∙ t] Internal Number, forming a set , which constitutes a bucket hash function .
[0096] For a vector , get a dimensional hash value, i.e. | ,in Each dimension in the dimension corresponds to a hash function .
[0097] To facilitate bucket labeling, a second hashing step is performed to map a vector into a real number.
[0098]
[0099] in is from [0,M -1] The numbers randomly selected from the vector map are mapped through the above algorithm. Therefore, based on the above algorithm, the input data vector to be classified and graded is matched with the knowledge base content to obtain matching information.
[0100] S4. Select a language model with a Transformer architecture, pre-train the model based on public data classification and grading standards and specifications, as well as corpora of other rule texts related to classification and grading, and then adapt and fine-tune the pre-trained model based on the public data classification and grading vector knowledge base; the classification and grading vector knowledge base is dynamically updated according to the revision of standards and specifications and changes in classification and grading rules;
[0101] In some feasible implementations, the S4 specifically includes:
[0102] S41. Select the language model of Transformer architecture, and pre-train the model based on the public data classification and grading standards and corpus of other rule texts related to classification and grading. The calculation formula of the large language model is:
[0103]
[0104]
[0105]
[0106]
[0107]
[0108] in, is the ID sequence of the input data; For input text; is the word segmenter; is the embedding layer function of the large language model; is the word embedding sequence, Embedding layer for large language models; is the hidden vector of the next word; It is the output layer of the large language model; is the probability distribution of the next word; is the function for selecting the sequence number with the highest probability; The ID of the next word;
[0109] S42. Based on the public data classification and grading vector knowledge base, the pre-trained large model is adapted and fine-tuned. The re-parameterized parameter efficient fine-tuning method is used to re-parameterize some model parameters of the pre-trained large language model to the low-dimensional parameter space. The low-dimensional parameter space is optimized during fine-tuning, thereby significantly reducing the model's computational complexity and memory consumption. At the same time, dynamic adjustments and updates are made according to the revision of standard specifications and changes in classification and grading rules. The specific efficient fine-tuning adaptation method is to decompose the weight change of the self-attention module of the large language model into the multiplication of two low-rank matrices.
[0110] ;
[0111] in Represents the changing weight parameter of the self-attention module of the large model, represents the weight of the self-attention module in the last round of training, represents the weight change, , Indicated by Split low-rank matrix.
[0112] S5. Input the data to be classified and graded, as well as the matching information with the classification and grading vector knowledge base, into the big model for automatic classification and grading.
[0113] In some feasible implementations, the S5 specifically includes:
[0114] S51. Integrate the data to be classified and graded with the matching information according to certain rules to enrich the input of the large model, increase the richness of the input information and the classification and grading discrimination information;
[0115] The integration of the data to be classified and graded and the matching information according to certain rules refers to vectorizing the data to be classified and graded as the first-dimensional input, using the classification matching information as the second-dimensional input of the input information, and using the classification matching information as the third-dimensional input of the input information, thereby forming a three-dimensional input vector, specifically:
[0116]
[0117] in, Represents the word embedding vector after the data to be classified and graded is vectorized. express Classification matching information with classification and grading knowledge base, express Matching information with the classification and grading knowledge base; By integrating the matching information of the classification and grading knowledge base with the input information, the input semantic information is enriched, the big model's understanding of specific domain knowledge is enhanced, and the accuracy of classification and grading is increased;
[0118] S52. Input the integrated information vector into the large model, and output the classification and grading results of the input data, as well as the relevant judgment basis;
[0119] S53. For the output public data classification and grading results, if the manual review is passed, the results are output;
[0120] S54. For the output public data classification and grading results, if they fail the manual review, a question-and-answer interaction is conducted with the big model, allowing the big model to update the knowledge base and make new predictions until the prediction results pass the manual review, thereby improving the classification and grading accuracy of the big model.
[0121] In an optional embodiment of the present invention, the data to be classified and graded are preprocessed with the matching information, and the two parts of information are combined to ensure that the input large model information can distinguish the data to be classified and graded from the relevant classification categories and sensitive related knowledge. The preprocessed data is input into the large model, and the large model automatically classifies and grades, and outputs the basis for the relevant classification and grading.
[0122] In an optional example of the present invention, if the classification and grading results output by the large model are inaccurate, the accuracy of the large model's prediction and reasoning can be improved through continuous interactive dialogue based on the large model's self-learning and interactive dialogue advantages.
[0123] The following is a system embodiment of the present invention. The system embodiment of the present invention is used to execute the method implemented by the first embodiment of the method of the present invention. For ease of explanation, only the relevant parts of the embodiment of the present invention are shown. For the specific parts not disclosed, please refer to the first embodiment of the present invention.
[0124] In a feasible implementation manner, the embodiment of the present invention provides a public data automatic classification and grading system, which may include:
[0125] The first formation module is used to comprehensively collect relevant policies, regulations, standards and specifications in the field of government affairs, policies, regulations, standards and specifications related to the classification and grading of public data, and other rule texts related to classification and grading, to form an original classification and grading vector knowledge base and a large model pre-training corpus;
[0126] The second forming module is used to vectorize the classification rule text and the grading rule text in the classification and grading standard specification, as well as other rule texts related to the classification and grading, based on the weighted embedding model to form a classification and grading vector knowledge base;
[0127] The matching module is used to vectorize the input data to be classified and graded based on the weighted embedding model, and then perform similarity matching with the content of the classification and grading vector knowledge base based on the nearest search algorithm to obtain matching information between the field to which the data belongs and the grading rules;
[0128] The fine-tuning module is used to select a large language model of the Transformer architecture, pre-train the large model based on public data classification and grading standards and specifications, as well as the corpus of other rule texts related to classification and grading, and then adapt and fine-tune the pre-trained large model based on the public data classification and grading vector knowledge base; the classification and grading vector knowledge base is dynamically updated according to the revision of standards and specifications and changes in classification and grading rules;
[0129] The classification module is used to input the data to be classified and graded, as well as the matching information with the classification and grading vector knowledge base into the large model for automatic classification and grading.
[0130] In a feasible implementation manner, the second forming module is specifically used to implement the following functions:
[0131] Preprocess the collected text corpus and segment sentences using word segmentation, part-of-speech tagging, named entity recognition, and keyword extraction techniques; then perform word segmentation using the MaxMatch method based on the dictionary;
[0132] For image data, OCR recognition technology is used to identify the data in the image, and then the identified data is segmented based on the method in S21;
[0133] Select an embedding model to process text data. The embedding model selected is Word2Vec. Word vectors are generated by learning text data. The specific architecture of the continuous bag of words model is as follows:
[0134]
[0135] in, is the target word The word vector of represents the vocabulary, For vocabulary Any word in is the average value of the context word vectors, Words to express The word vector of For word vector The transpose of ; Another non-continuous jump model implementation architecture is:
[0136]
[0137] S24. The Word2Vec model is improved by introducing weights, and higher weights are given to the key words of classification and grading rules to reflect their importance. The specific calculation is as follows:
[0138]
[0139] in, Indicates the target word The weighted word embedding vector representation of Indicates the target word The term frequency-inverse document frequency weight, Represents the total number of words in the sentence, Indicates the target word The word vector of
[0140] Based on the weighted embedding model, the classification rule text in the classification and grading standard specification is converted into a classification vector knowledge base that can be processed by computers. ;
[0141] Based on the weighted embedding model, the classification rule text in the classification and grading standard specification is converted into a classification vector knowledge base that can be processed by computers. .
[0142] In a feasible implementation manner, the matching module is specifically used to implement the following functions:
[0143] Vectorize the input data to be classified and graded based on the weighted embedding model;
[0144] According to the characteristics of the classified and graded data, an existing nearest neighbor search algorithm is selected, and the selected existing nearest neighbor search algorithm is Annoy, ScaNN, Faiss or Hnswlib algorithm;
[0145] Based on the existing nearest neighbor search algorithm, the input data to be classified and graded is matched with the knowledge base content to obtain domain category matching information;
[0146] Based on the existing nearest neighbor search algorithm, the input data to be classified and graded is matched with the knowledge base content to obtain matching information of the data sensitivity level.
[0147] In a feasible implementation manner, the fine-tuning module is specifically used to implement the following functions:
[0148] A large language model with a Transformer architecture is selected, and the large model is pre-trained based on the public data classification and grading standards and specifications, as well as the corpus of other regular texts related to classification and grading. The calculation formula of the large language model is:
[0149]
[0150]
[0151]
[0152]
[0153]
[0154] in, is the ID sequence of the input data; For input text; is the word segmenter; is the embedding layer function of the large language model; is the word embedding sequence, Embedding layer for large language models; is the hidden vector of the next word; It is the output layer of the large language model; is the probability distribution of the next word; is the function for selecting the sequence number with the highest probability; The ID of the next word;
[0155] Based on the public data classification and grading vector knowledge base, the pre-trained large model is adapted and fine-tuned. The re-parameterized parameter efficient fine-tuning method is used to re-parameterize some model parameters of the pre-trained large language model to the low-dimensional parameter space. The low-dimensional parameter space is optimized during fine-tuning, thereby significantly reducing the model's computational complexity and memory consumption. At the same time, it is dynamically adjusted and updated according to the revision of standard specifications and changes in classification and grading rules. The specific efficient fine-tuning adaptation method is to decompose the weight change of the self-attention module of the large language model into the multiplication of two low-rank matrices.
[0156] ;
[0157] in Represents the changing weight parameter of the self-attention module of the large model, represents the weight of the self-attention module in the last round of training, represents the weight change, , Indicated by Split low-rank matrix.
[0158] In a feasible implementation manner, the grading module is specifically used to implement the following functions:
[0159] Integrate the data to be classified and graded with the matching information according to certain rules to enrich the input of the large model, increase the richness of the input information and the classification and grading discrimination information;
[0160] The integration of the data to be classified and graded and the matching information according to certain rules refers to vectorizing the data to be classified and graded as the first-dimensional input, using the classification matching information as the second-dimensional input of the input information, and using the classification matching information as the third-dimensional input of the input information, thereby forming a three-dimensional input vector, specifically:
[0161]
[0162] in, Represents the word embedding vector after the data to be classified and graded is vectorized. express Classification matching information with classification and grading knowledge base, express Matching information with the classification and grading knowledge base; By integrating the matching information of the classification and grading knowledge base with the input information, the input semantic information is enriched, the big model's understanding of specific domain knowledge is enhanced, and the accuracy of classification and grading is increased;
[0163] Input the integrated information vector into the large model, and output the classification and grading results of the input data, as well as the relevant judgment basis;
[0164] For the output public data classification and grading results, if they pass the manual review, the results will be output;
[0165] For the output public data classification and grading results, if they fail manual review, question-and-answer interaction will be conducted with the big model to allow the big model to update the knowledge base and make new predictions until the prediction results pass manual review, thereby improving the classification and grading accuracy of the big model.
[0166] In one possible implementation, see Figure 2 , is a schematic diagram of the structure of a public data automatic classification and grading system provided by an embodiment of the present invention. Figure 2 The system shown may include:
[0167] The classification and grading knowledge base construction module 110 is used to collect various policies, regulations and standards related to classification and grading, and construct them into a vector knowledge base that can be recognized by a computer;
[0168] The knowledge search and matching module 120 is used to match the input data with the knowledge in the classification and grading knowledge base to clarify the field and specific sensitivity level of the input data;
[0169] The large model adaptation and fine-tuning module 130 is used to select a suitable large model and perform adaptation and fine-tuning on the large model according to the public data classification and grading standard specifications and classification and grading rules as a corpus;
[0170] The automatic classification and grading module 140 is used to support the automatic classification and grading of public data by matching and identifying the data to be classified and graded with the classification and grading knowledge base information, and integrating the matching information with the data to be classified and graded as the input of the large model.
[0171] An embodiment of the present invention further provides an electronic device, Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4 As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the public data automatic classification and grading method.
[0172] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0173] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method for automatic classification and grading of public data is implemented.
[0174] An embodiment of the present invention further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the method for automatic classification and grading of public data of the first aspect described above.
[0175] The present invention innovatively proposes to realize the automatic classification and grading of public data based on the retrieval enhancement generation technology combined with the pre-trained large model technology. The present invention is based on the construction of an external classification and grading vector knowledge base. On the one hand, the classification and grading vector knowledge base knowledge can be efficiently and jointly updated according to the changes in policy standards; on the other hand, the pre-trained large model can be fine-tuned based on the classification and grading vector knowledge base, reducing the training cost and efficiently improving the effect of the model on the public data classification and grading task, and enriching the input data through the external classification and grading vector knowledge base to solve the problem of insufficient professional knowledge of the large model in specific fields, and further improve the performance of the automatic classification and grading of the large model. Compared with the existing method of pre-training the large model only through classification and grading related field knowledge, the present invention only needs to pre-train the large model once, and can rely on the classification and grading vector knowledge base to update and expand the classification and grading field knowledge in real time, with high adaptability and extensibility, and further enrich the information dimension of the input data to be classified and graded through the classification and grading vector knowledge base, providing more decision-making information to the large model, and further improving the accuracy of the automatic classification and grading of the model.
[0176] Traditional classification and grading methods, for structured data (such as tabular data), when automatically classified based on classification and grading templates, can achieve an accuracy rate of 70% if there are rule templates of the same type; through experimental data training, the classification and grading accuracy can be increased to 90% by manually tuning the existing rule templates. However, this type of method requires a lot of manual work to customize the domain classification and grading templates, and has poor transferability, and is not suitable for unstructured data classification and grading scenarios. In addition, the accuracy comparison of different methods is shown in Table 1:
[0177] Table 1: Comparison of automation levels and advantages and disadvantages of different methods
[0178]
[0179] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0180] The contents described above may be implemented individually or in combination in various ways, and these variations are all within the protection scope of the present invention.
[0181] It should be noted that, in the present invention, 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 term "comprises" or any other variant thereof is intended to cover non-exclusive inclusion, so that an 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 article or device. In the absence of further restrictions, the elements defined by the sentence "comprises..." do not exclude the existence of other identical elements in the article or device including the elements.
[0182] The above embodiments are only used to illustrate the technical solution of the present invention and are not intended to limit the present invention. The present invention is described in detail with reference to the preferred embodiments. It should be understood by those skilled in the art that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention, and should be included in the scope of the claims of the present invention.
Claims
1. A method for automatic classification and grading of public data, characterized by: include: S1. Collect public data classification and grading standards and specifications, as well as other rule texts related to classification and grading, to form an original classification and grading vector knowledge base and a large model pre-training corpus; S2. Based on the weighted embedding model, the classification rule text and grading rule text in the classification and grading standard specification, as well as other rule texts related to classification and grading are vectorized to form a classification and grading vector knowledge base; S3. Vectorize the input data to be classified and graded based on the weighted embedding model, and then perform similarity matching with the classification and grading vector knowledge base content based on the nearest neighbor search algorithm to obtain matching information between the field to which the data belongs and the grading rules; S4. Select a language model with a Transformer architecture, pre-train the model based on public data classification and grading standards and specifications, as well as corpora of other rule texts related to classification and grading, and then adapt and fine-tune the pre-trained model based on the public data classification and grading vector knowledge base; the classification and grading vector knowledge base is dynamically updated according to the revision of standards and specifications and changes in classification and grading rules; S5. The data to be classified and graded, as well as the matching information with the classification and grading vector knowledge base, are input into the large model for automatic classification and grading; The S2 specifically includes: S21. Preprocess the collected text corpus and segment sentences using word segmentation, part-of-speech tagging, named entity recognition, and keyword extraction techniques; then perform word segmentation using the MaxMatch method based on the dictionary; S22. For image data, use OCR recognition technology to identify data in the image, and then segment the identified data based on the method in S21; S23. Select an embedding model to process text data. The embedding model selected is Word2Vec. Word vectors are generated by learning text data. The specific architecture of the continuous bag of words model is as follows: ; in, is the target word The word vector of represents the vocabulary, For vocabulary Any word in is the average value of the context word vectors, Words to express The word vector of For word vector The transpose of ; Another non-continuous jump model implementation architecture is: ; S24. The Word2Vec model is improved by introducing weights, and higher weights are given to the key words of classification and grading rules to reflect their importance. The specific calculation is as follows: ; in, Indicates the target word The weighted word embedding vector representation of Indicates the target word The term frequency-inverse document frequency weight, Represents the total number of words in the sentence, Indicates the target word The word vector of S25. Based on the weighted embedding model, the classification rule text in the classification and grading standard specification is converted into a classification vector knowledge base that can be processed by computers. ; S26. Based on the weighted embedding model, the classification rule text in the classification and grading standard specification is converted into a classification vector knowledge base that can be processed by computers .
2. A method for automatic classification and grading of public data according to claim 1, characterized in that: The S3 specifically includes: S31. vectorizing the input data to be classified and graded based on a weighted embedding model; S32. According to the classification and grading data characteristics, select the existing nearest neighbor search algorithm, the selected nearest neighbor search algorithm is Annoy, ScaNN, Faiss or Hnswlib algorithm; S33. Based on the existing nearest neighbor search algorithm, the input classification data is matched with the knowledge base content to obtain the field category matching information; S34. Based on the existing nearest neighbor search algorithm, the input data to be classified and graded is matched with the knowledge base content to obtain matching information of the data sensitivity level.
3. The method for automatic classification and grading of public data according to claim 1, characterized in that: The S4 specifically includes: S41. Select the language model of Transformer architecture, and pre-train the model based on the public data classification and grading standards and corpus of other rule texts related to classification and grading. The calculation formula of the large language model is: ; ; ; ; ; in, is the ID sequence of the input data; For input text; is the word segmenter; is the embedding layer function of the large language model; is the word embedding sequence, Embedding layer for large language models; is the hidden vector of the next word; It is the output layer of the large language model; is the probability distribution of the next word; is the function for selecting the sequence number with the highest probability; The ID of the next word; S42. Adapt and fine-tune the pre-trained large model based on the public data classification and grading vector knowledge base, adopt the re-parameterized parameter efficient fine-tuning method, re-parameterize some model parameters of the pre-trained large language model to the low-dimensional parameter space, and optimize the low-dimensional parameter space during fine-tuning; at the same time, dynamically adjust and update according to the revision of standards and classification and grading rules; the specific efficient fine-tuning adaptation method is to decompose the weight change of the self-attention module of the large language model into the multiplication of two low-rank matrices; ; in Represents the change weight parameter of the self-attention module of the large model, represents the weight of the self-attention module in the last round of training, represents the weight change, , Indicated by Split low-rank matrix.
4. The method for automatic classification and grading of public data according to claim 1, characterized in that: The S5 specifically includes: S51. Integrate the data to be classified and graded with the matching information according to certain rules to enrich the input of the large model, increase the richness of the input information and the classification and grading discrimination information; The integration of the data to be classified and graded and the matching information according to certain rules refers to vectorizing the data to be classified and graded as the first-dimensional input, using the classification matching information as the second-dimensional input of the input information, and using the classification matching information as the third-dimensional input of the input information, thereby forming a three-dimensional input vector, specifically: ; in, Represents the word embedding vector after the data to be classified and graded is vectorized. express Classification matching information with classification and grading knowledge base, express Classification matching information with the classification and grading knowledge base; S52. Input the integrated information vector into the large model, and output the classification and grading results of the input data, as well as the relevant judgment basis; S53. For the output public data classification and grading results, if the manual review is passed, the results are output; S54. For the output public data classification and grading results, if they fail the manual review, a question-and-answer interaction is conducted with the big model to allow the big model to update the knowledge base and make a new prediction until the prediction results pass the manual review.
5. A public data automatic classification and grading system, characterized in that: The system comprises modules for executing the method according to any one of claims 1-4.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, it implements the method for automatic classification and grading of public data as described in any one of claims 1-4.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for automatic classification and grading of public data as described in any one of claims 1 to 4 is implemented.
8. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for automatic classification and grading of public data as described in any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Language model dynamic updating method and device, electronic equipment and storage medium
CN116992283A
Aircraft system knowledge graph construction method, device, equipment and medium
CN118886491A
Cited By
Feedback integrated retrieval augmented generation (RAG) framework
US12762310B1