Label calculation method based on hybrid expert LLM

Through hybrid expert LLM model integration and blockchain technology, it solves the low accuracy, weak semantic understanding and privacy security issues of unstructured long text tag extraction, achieves high-accuracy and reliable tag calculation, and improves the system. Privacy protection and tag library expansion capabilities.

CN118760736AActive Publication Date: 2024-10-11ZHEJIANG LAB

Patent Information

Application Number
CN202410956784.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2024-10-11
Estimated Expiration
2044-07-17

AI Technical Summary

Technical Problem

When extracting tags from unstructured long text, the existing technology has low accuracy and recall rates, weak semantic understanding capabilities, lack of tag generation and expansion capabilities, and insufficient privacy security and credibility.

Method used

A label calculation method based on hybrid expert LLM is adopted. Through the integration and combination of multiple LLM models, vector similarity is used for label semantic expansion, and small sample prior knowledge and knowledge distillation technology are introduced, combined with blockchain technology and data computing sand. The box provides privacy protection to ensure the security and credibility of the computing process.

Benefits of technology

It improves the accuracy and recall rate of label calculation, reduces the problem of model illusion, improves system reliability and privacy protection capabilities, and realizes automatic expansion and update of the label library.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118760736A_ABST
    Figure CN118760736A_ABST
Patent Text Reader

Abstract

The invention discloses a label calculation method based on a hybrid expert LLM, and the method comprises the steps: designing a label calculation method of a hybrid expert LLM system model architecture, and carrying out the parallel calculation and model integration of a plurality of LLMs. And designing technologies such as label semantic extension based on vector similarity, prior calculation based on LLM + small sample prior knowledge, posterior calculation based on LLM + RAG, label filtering based on multi-LLM combined soft decision, secondary label recall based on knowledge distillation and the like to realize accurate calculation of labels. The method is different from a traditional label calculation scheme, the accuracy and reliability of label calculation are greatly improved, the problem of model illusion is effectively solved, and meanwhile the accuracy of label calculation is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of artificial intelligence information technology, and in particular relates to a label calculation method based on hybrid expert LLM. Background Art

[0002] Labeling user information, also known as user portrait, is to collect data from various dimensions such as user basic data, social attributes, consumption habits, preference characteristics, and then characterize the characteristics of users or products, explore potential value information, and thus abstract the overall picture of user information. User portrait is the foundation of big data application, and plays an important role in many scenarios such as human resource management, job matching, precision marketing, personalized recommendations, personalized services, and refined operations. It is the basis of data-driven operations. The label calculation of user portrait is commonly known as "labeling" users. From the perspective of the calculation method of labeling, it is generally divided into three types: ① statistical labels; ② rule labels; ③ machine learning labels. The calculation of the first two types of labels is relatively simple, and the technical complexity is relatively low. For machine learning labels, they need to be generated by AI algorithms to predict or intelligently analyze certain attributes or behaviors of users. For example, judging whether the user is male or female based on the user's behavioral habits, judging the user's preference for a certain product based on the user's consumption habits, extracting the label of the user's work skills based on the user's resume text data, and extracting the label of the user's interests and hobbies based on the user's reading and Internet log data, etc.

[0003] The present invention is mainly aimed at the problem of extracting a large number of tags from unstructured long texts. In order to explain the background of the problem and illustrate the invention method, this article will take "extracting work skill tags from resume text data" as an example, and will not go into details below. The technical difficulties of this type of problem are:

[0004] 1) The accuracy / recall rate of the label calculation model is low. Due to the wide range of label values, such as the possible values ​​of the professional skill labels in a resume, there can be as many as tens of thousands of skill labels. Traditional machine learning algorithms generally model label extraction as multi-label classification or sequence labeling problems. For multi-classification problems with a large number of target categories (such as tens of thousands of categories), the classification target data is extremely scattered and sparse, and the accuracy / recall rate of the classification model is usually difficult to guarantee. At the same time, the extreme sparsity of data leads to high requirements for the quality of training data and sample size. For existing named entity recognition (NER) algorithms, which rely on the annotation of large-scale high-quality training corpora for domain knowledge, there are also problems such as low accuracy / recall rate and difficulty in handling complex semantics.

[0005] 2) Weak ability to understand semantics. Accurate understanding of label semantics is very complex, and there are a large number of synonyms and ambiguous words. For example, the two labels "database" and "data mining" have similar words but completely different semantics of the work skills they express. "A slight difference can lead to a huge mistake"; "federated learning" and "machine learning" are quite different in terms of words, but they are quite similar in semantics. The existing label calculation method is still not powerful enough for natural language processing and understanding, and has difficulties in accurate semantic understanding, ambiguity processing, synonym processing, fuzzy expression understanding, and text oral understanding. It also lacks comprehensive understanding and reasoning ability of text semantics, especially long texts, resulting in unsatisfactory core indicators of label extraction (both accuracy and recall are not high). Conventional models such as naive Bayes, SVM, logistic regression, random forest, XGBOOST, etc. for text classification can generally only capture shallow semantics in text. Even text classification algorithms that integrate deep learning pre-training models (ELMo, BERT, etc.) have limited actual effects and require a lot of secondary training based on local data.

[0006] 3) Poor label generation and expansion capabilities. Existing label calculation methods are mainly based on supervised learning to train models, mainly discriminative models, which discriminate (or predict) text or entities and lack the ability to directly generate labels; at the same time, existing label calculation methods cannot automatically expand "unknown" (untrained model) label information.

[0007] 4) Insufficient privacy, security and credibility of label calculation. In the label calculation process, the user's original data (such as resume text data, user behavior data, etc.) often involves user privacy, and the original data provider and the calculation party are usually people with different roles. The calculation party usually performs calculations based on the original plaintext provided by the data provider, which poses a risk of stealing user privacy sensitive information. At the same time, there is a lack of trust mechanism to ensure whether the calculation process and results of the calculation party are credible.

[0008] In response to the above problems, the present invention innovatively solves the four core problems of low accuracy and recall rate of label calculation in long texts, weak semantic understanding ability, poor label generation and expansion ability, and insufficient privacy, security and credibility of label calculation. Summary of the invention

[0009] The purpose of the present invention is to address the deficiencies of the prior art, such as low accuracy and recall rate of label calculation from unstructured long texts, weak semantic understanding ability, and poor label generation and expansion ability, and provide a label calculation method based on a hybrid expert LLM; in response to the problem of insufficient privacy, security and credibility of label calculation, the present invention provides a trusted intelligent label calculation device with a hybrid expert LLM and privacy protection. At the same time, it further solves the two major negative problems brought about by the application of LLM (large language model) in the label calculation process: the model hallucination problem (such as the possibility of partially forged, fabricated or unreliable labels) and the inherent lack of credibility of a single LLM (different LLMs have different "biases" for the deep semantic understanding of texts, and the slight errors of a single LLM may be amplified by the wrong transmission to trigger erroneous results. A single LLM also has the problem of model malice or unreliable credibility.).

[0010] The object of the present invention is achieved through the following technical solution: a label calculation method based on hybrid expert LLM, comprising:

[0011] Get user information and build the corresponding tag library;

[0012] Based on the user information and the tags in the tag library, prompt1 is formed to ask questions to M different LLMs in the first hybrid expert model system, the returned results are constrained to be a tag list, and all the results are merged to obtain a first tag set;

[0013] Calculate the similarity between each tag in the first tag set and the tags in the tag library, and return a set of similar tags for each tag in the first tag set to obtain a second tag set;

[0014] Converting tags in the second tag set into vectors of search query questions, and searching a vector database to obtain context information most relevant to each tag; the vector database stores user information;

[0015] Insert the context information and its corresponding label into prompt2, and ask questions to N different LLMs in the second hybrid expert model system respectively to determine whether the label is correct or not; if the LLM determines that it is correct, the weight is 1 / N, and if it is wrong, the weight is 0; if the sum of the weights is greater than or equal to the first preset threshold, the label is retained, and if it is less than or equal to the second preset threshold, the label is discarded; if it is between the first preset threshold and the second preset threshold, the label is marked as a label to be determined;

[0016] If there is a label to be determined, the label to be determined is input into the classification model to determine whether the label to be determined is correct or not. If it is determined to be correct, the label is retained, otherwise the label is discarded.

[0017] Furthermore, each label in prompt1 is randomly sampled independently from the label library.

[0018] Further, the return result is constrained to be a label list including: sorting the labels returned by each LLM from greatest to least important, and returning the first N labels;

[0019] The returning of a set of similar tags includes: sorting by similarity from large to small and taking at most the top K tags according to a third preset threshold.

[0020] Furthermore, the user in the user information is a pointer to a main object of the calculation tag, and the user information is information about a text description data type related to the main object.

[0021] Furthermore, the classification model is trained as follows:

[0022] At least one LLM in the second hybrid expert model system is used as a teacher model and the classification model is used as a student model, and distillation training is performed on the classification model.

[0023] Furthermore, it also includes expanding the tag library, specifically:

[0024] According to the tag list generated by LLM in the first hybrid expert model system, if the frequency of occurrence of the generated tag is greater than the fourth preset threshold and / or the similarity between the generated tag and the tag in the tag library is greater than the fifth threshold, the tag is added to the tag library.

[0025] Furthermore, it also includes expanding the vector database, specifically:

[0026] Semantic expansion is performed according to the acquired user information, and the semantic information obtained by the expansion is vectorized and stored in the vector database or a new vector database is established and stored in the newly established vector database.

[0027] Further, it also includes performing reputation scoring on the LLM in the second hybrid expert model system;

[0028] The reputation calculation method is: R-LLM(i)=sum(LLM(i)==nLLM Output) / accumulated number of judgments; where LLM(i)==nLLM Output means judging whether the single output of the i-th LLM is equal to the final output, if so, output 1, otherwise 0;

[0029] If the reputation is lower than the third preset threshold, the LLM exits the tag calculation.

[0030] The present invention also provides a hybrid expert LLM and privacy-protected trusted smart tag computing device, including a user side and a data computing sandbox;

[0031] The user side includes a local database and a vector database, both of which store encrypted user information;

[0032] The data computing sandbox is used to execute the above-mentioned label calculation method based on hybrid expert LLM, obtain the retained label, encrypt the label and output it to the user side for storage; the user information obtained is obtained by obtaining the specified user ciphertext information from the local database and decrypting it.

[0033] Furthermore, it also includes regulators to conduct independent and public audits of calculation data, processes and results.

[0034] Compared with the prior art, the beneficial effects of the embodiments in this specification are:

[0035] (1) Improve the accuracy and recall of label calculation. This method is different from the traditional calculation method of extracting labels based on machine learning / deep learning. The present invention comprehensively applies the design framework of combining LLM+local self-training fine-tuning model, generative label calculation and discriminative label calculation. Through the integration of multi-channel LLM hybrid expert models, label semantic expansion based on vector similarity, introduction of small sample prior knowledge in prompt engineering, multiple recalls based on knowledge distillation and other technologies, the recall rate of label calculation is improved through the above technologies. The present invention introduces LLM to exert its inherent powerful semantic understanding and comprehensive capabilities, ensures the accuracy of label calculation, and further designs a calculation architecture that combines prior calculation (preliminary recall first) with a posteriori calculation (later verification of reliability), and then combines the use of multiple LLM joint judgments. Compared with a single LLM, it can further improve the accuracy of label extraction. The above algorithm design greatly improves the accuracy of label calculation.

[0036] (2) Solve the hallucination problem of label calculation based on LLM. In the first stage prompt project (prompt1), the present invention uses independent random sampling of the original label library to prompt LLM with some label value samples as prior knowledge or examples, thereby guiding and constraining LLM to accurately and normatively calculate labels, suppressing the possibility of LLM fabricating or forging labels, and reducing the probability of LLM model hallucination problems. At the same time, a single LLM is usually limited by the number of token inputs, and the prior knowledge that can be input at one time (such as the initial label library has tens of thousands of labels) is limited. This method samples the prior knowledge (tens of thousands of labels) in parallel and inputs it to different LLMs as much as possible. From an overall perspective, it can improve the understanding of prior knowledge by multiple LLMs, thereby improving the overall label calculation effect. In the second stage prompt project (prompt2), the present invention introduces RAG technology and soft decision methods to verify and screen label reliability, further effectively solving the model hallucination problem while ensuring the accuracy of label calculation.

[0037] (3) Improved reliability of label calculation. The present invention innovatively adopts a multi-way parallel hybrid expert LLM computing architecture for label extraction, which is independent of a single LLM (whether due to service failure, model hallucination or other problems), and can greatly improve the system reliability, computing reliability, and result reliability of label calculation.

[0038] (4) Automatically expand and update the tag library. This method uses the inherent text generation capability of LLM technology. Different from the traditional computational methods based on classification or sequence labeling problems, this method can automatically calculate and expand some "unknown" and valuable new tags. After simple classification and verification, it can automatically update (Update) to the local tag library, thereby realizing automatic tag expansion.

[0039] (5) Trusted computing with privacy protection is realized. This method ensures the privacy security of the main algorithm calculation process and the credibility of the calculation process results through blockchain technology + data calculation sandbox. All plaintext information is only decrypted and calculated in the sandbox memory. The original calculation data and key process information in the sandbox are written to the blockchain through smart contracts and the credibility is verified. The blockchain network is used to realize the transparent and tamper-proof information. Through the above technologies, it is ensured that the label calculation algorithm logic, LLM prompt instructions, calculation input and output data, etc. inside the sandbox are not maliciously tampered with, which prevents the risk of leaking user privacy data and ensures the credibility of the results. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0041] Figure 1 A flow chart of a tag calculation method provided in Example 1 of the present invention;

[0042] Figure 2 An example of a prompt language prompt1 provided in Embodiment 1 of the present invention (llama3 model);

[0043] Figure 3 An example of another prompt language prompt1 provided in Embodiment 1 of the present invention (qwen2 model);

[0044] Figure 4 A reference template of prompt language prompt2 provided in Example 1 of the present invention;

[0045] Figure 5 An example (llama3 model) of a prompt language prompt2 provided in Embodiment 1 of the present invention;

[0046] Figure 6 An example of another prompt language prompt2 provided in Embodiment 1 of the present invention (qwen2 model);

[0047] Figure 7 An example (llama3 model) of another prompt language prompt2 provided in Embodiment 1 of the present invention;

[0048] Figure 8 An example (qwen2 model) of another prompt language prompt2 provided in Embodiment 1 of the present invention;

[0049] Fig. 9 A schematic diagram of a label secondary recall process based on knowledge distillation provided in Example 1 of the present invention;

[0050] Fig.10 An example of a prompt language prompt1 provided in Embodiment 2 of the present invention (llama3 model);

[0051] Fig.11 An example (qwen2 model) of another prompt language prompt1 provided in Embodiment 2 of the present invention;

[0052] Fig.12A reference template of prompt language prompt2 provided in Embodiment 2 of the present invention;

[0053] Fig.13 An example of a prompt language prompt2 provided in Embodiment 2 of the present invention (llama3 model);

[0054] Fig.14 An example (qwen2 model) of another prompt language prompt2 provided in Embodiment 2 of the present invention;

[0055] Fig.15 An example (llama3 model) of another prompt language prompt2 provided in Embodiment 2 of the present invention;

[0056] Fig.16 This is a sample (qwen2 model) of another prompt language prompt2 provided in Embodiment 2 of the present invention. DETAILED DESCRIPTION

[0057] The terms used in the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The singular forms "a", "the" and "the" used in the present invention and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0058] The present invention is described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the features of the following embodiments and implementations can be combined with each other.

[0059] A label calculation method based on hybrid expert LLM of the present invention comprises:

[0060] (1) Obtain user information and build a corresponding tag library;

[0061] User information definition: The user mentioned in the present invention refers to the main object of the calculation tag (including individuals, objects, cities, enterprises, groups, etc.), and the user information is the information of the text description data type related to the main object.

[0062] Specifically, user information includes: resume information of personal objects, city archive information of city objects, news and public opinion document information of enterprise objects, product review data of item objects, and so on. After the user information is processed by the algorithm, the user object can be associated with a specific label. For example, through the resume text information and the label library of professional skills, the professional skill label that matches a resume information can be obtained; through the label library of city archive text data and Chinese medicinal material plants, the Chinese medicinal material plant label that matches the city can be obtained; through the news and public opinion document information of the enterprise and the enterprise public opinion label library, the public opinion label that matches the enterprise can be obtained; through the product review data and the emotional evaluation label library, the emotional evaluation label that matches the product can be obtained. Those skilled in the art should understand that other types of user information can also be obtained and corresponding labels can be constructed to obtain labels that match the user, which will not be repeated here.

[0063] (2) Based on the user information and the tags in the tag library, prompt1 is formed to ask questions to M different LLMs in the first hybrid expert model system, the returned results are constrained to be a tag list, and all the results are merged to obtain a first tag set; the first hybrid expert model system includes M different LLMs;

[0064] In one embodiment, each tag in prompt1 is independently randomly sampled from a tag library.

[0065] In one embodiment, the returned result is constrained to be a tag list, including: sorting the tags returned by each LLM in descending order of importance, and returning the first N tags.

[0066] In one embodiment, the tag library is further expanded, specifically:

[0067] According to the tag list generated by LLM in the first hybrid expert model system, if the frequency of occurrence of the generated tag is greater than the fourth preset threshold and / or the similarity between the generated tag and the tag in the tag library is greater than the fifth threshold, the tag is added to the tag library.

[0068] (3) calculating the similarity between each tag in the first tag set and the tags in the tag library, and returning a set of similar tags for each tag in the first tag set to obtain a second tag set;

[0069] In one embodiment, returning a set of similar tags includes: taking at most the first K tags according to the similarity and a third preset threshold.

[0070] (4) converting the tags in the second tag set into vectors of the search query question, and searching a vector database to obtain the most relevant context information for each tag; the vector database stores user information;

[0071] In one embodiment, the vector database is further expanded, specifically:

[0072] Semantic expansion is performed according to the acquired user information, and the semantic information obtained by the expansion is vectorized and stored in the vector database; or a new vector database is established, and the semantic information obtained by the expansion is vectorized and stored in the newly established vector database.

[0073] (5) inserting the context information and its corresponding label into prompt2, and respectively asking questions to N different LLMs in the second hybrid expert model system to determine whether the label is correct or not; if the LLM determines that it is correct, the weight is 1 / N, and if it is wrong, the weight is 0; if the sum of the weights is greater than or equal to the first preset threshold, the label is retained; if it is less than or equal to the second preset threshold, the label is discarded; if it is between the first preset threshold and the second preset threshold, the label is marked as a label to be determined;

[0074] If there is a label to be determined, the label to be determined is input into the classification model to determine whether the label to be determined is correct or not. If it is determined to be correct, the label is retained, otherwise the label is discarded.

[0075] The second hybrid expert model system includes N different LLMs.

[0076] In one embodiment, the classification model is trained as follows:

[0077] At least one LLM in the second hybrid expert model system is used as a teacher model and the classification model is used as a student model, and distillation training is performed on the classification model.

[0078] In one embodiment, it further includes performing reputation scoring on the LLM in the second hybrid expert model system;

[0079] The reputation calculation method is: R-LLM(i)=sum(LLM(i)==nLLM Output) / accumulated number of judgments; wherein, LLM(i)==nLLM Output indicates whether the single output of the i-th LLM is equal to the final output, if so, output 1, otherwise 0; if the reputation is lower than the third preset threshold, the LLM exits the label calculation. In some embodiments, there are multiple LLMs (such as 8) in the second hybrid expert model system, and only one or two of the LLMs exit the label calculation, which does not affect the label calculation and does not require other processing. Of course, a new LLM can also be added to the second hybrid expert model system to replace the LLM that exits the label calculation.

[0080] In terms of label calculation methods, the present invention comprehensively and innovatively applies the design schemes of combining LLM+local self-training fine-tuning model, combining generative label calculation with discriminative label calculation, and combining prior calculation with a posteriori calculation. In terms of calculation methods, the architecture of the hybrid expert system model is designed, and multiple LLM parallel calculations and model integration are adopted. Specifically designed methods such as label semantic expansion based on vector similarity, prior calculation based on LLM+small sample prior knowledge, a posteriori calculation based on LLM+RAG, label filtering based on multi-LLM joint soft decision, and secondary label recall based on knowledge distillation improve the accuracy of label calculation.

[0081] The present invention also provides a hybrid expert LLM and privacy-protected trusted smart tag computing device, including a user side and a data computing sandbox;

[0082] The user side includes a local database and a vector database, both of which store encrypted user information;

[0083] The data computing sandbox is used to execute the above-mentioned label calculation method based on hybrid expert LLM, obtain the retained label, encrypt the label and output it to the user side for storage; the user information obtained is obtained by obtaining the specified user ciphertext information from the local database and decrypting it.

[0084] Specifically, the user side establishes a two-way TLS authentication connection channel with the data computing sandbox. The user side transmits the user information to be calculated in ciphertext to the data computing sandbox, and decrypts it in the memory of the sandbox environment to obtain the user's plaintext data.

[0085] In one embodiment, a regulator is also included to conduct independent public audits of the calculation data, processes, and results.

[0086] Specifically, the regulatory node generally chooses a trusted third party that is independent of the data owner and the computing party. On the one hand, it plays the role of third-party supervision from a mechanism perspective, and can conduct independent and public audits of computing data, processes and results, thereby enhancing mutual trust and collaboration among alliance chain members. On the other hand, from a technical perspective, building a three-party system is more decentralized for alliance chains than a two-party system, further enhancing the security of the blockchain system itself.

[0087] The present invention also designs a support architecture based on blockchain technology and a data computing sandbox to conduct all-round, zero-trust and continuous credibility verification of the data, process, results, model reputation, etc. of tag computing, thereby improving the effect and credibility of tag computing and realizing data privacy protection.

[0088] The overall calculation method is as follows Figure 1The roles of the participants involved include: data holders, computing parties, and regulators. The node layout is divided into user-side nodes (corresponding to user data holders), data computing sandbox nodes (corresponding to computing parties), and regulatory nodes, forming a blockchain network based on a consortium chain.

[0089] The data computing sandbox creates a secure trusted execution environment (TEE) to ensure the confidentiality, privacy and integrity of tag computing and data processing. All plaintext information is decrypted and calculated only in the sandbox's memory. The data computing sandbox has a built-in hybrid expert model consisting of multiple LLMs to integrate and combine the outputs of multiple LLM models.

[0090] The blockchain network supports the establishment of a decentralized trust mechanism between the data computing sandbox and the user-side data nodes. Four core smart contracts are deployed and executed in the blockchain: computing logic contract, computing process contract, credibility calculation, and LLM model reputation scoring contract to ensure the credibility of the sandbox computing logic, process, results and model.

[0091] Computation logic contract: Serialize the code of the tag calculation algorithm and the data template (such as the prompt template) into binary code B, calculate the hash value of B to obtain Hash(B), write it into the built-in ledger database of the blockchain in advance during the initialization phase of creating the blockchain, and provide query and verification interfaces. Before executing the tag calculation program each time, the data calculation sandbox first serializes the code to be executed B' and calculates the hash, and writes Hash(B') into the blockchain.

[0092] Computation process contract: The user side writes the hash value (recorded as Hash(R1)) of the plaintext original information (such as resume data) into the blockchain. The hash value Hash(R2) of the decrypted plaintext original information (resume data) in the data calculation sandbox memory is written into the blockchain. At the same time, the hash value of the input information of each LLM is stored in the array list L=list[hash(LLM-n-input-i)], where LLM-n-input-i represents the i-th input content of the n-th LLM. The hash array L is further written into the blockchain.

[0093] Credibility calculation contract: Based on the blockchain ledger data, the following verification logic is executed:

[0094] Verification 1: Hash(B) == Hash(B')

[0095] Verification 2: Hash(R1) == Hash(R2);

[0096] Verification 3: All element values ​​in the array list L = list[hash(LLM-n-input-i)] are equal.

[0097] If the above three verification rules are verified by the smart contract execution, it proves that the entire label calculation process is credible, otherwise the calculation result may be unreliable.

[0098] LLM model reputation scoring contract: Based on the "hybrid expert soft decision label filtering" calculation link of the aforementioned label calculation method, the calculation results of multiple LLMs are integrated, and the smart contract is run to score the reputation of each LLM. The reputation calculation method of each LLM is: R-LLM(i)=sum(LLM(i)==nLLM Output) / cumulative number of judgments. Among them, LLM(i)==nLLM Output means to judge whether the single output of the i-th LLM is equal to the final output (the output after multiple LLM voting soft judgments and the classification model output). If so, the output is 1, otherwise 0. Then the sum is accumulated and divided by the total number of judgments to obtain the reputation score of each LLM. For LLMs whose reputation is lower than a certain threshold, a certain proportion can be dynamically selected for elimination, and the control can be triggered by the smart contract. Figure 1 The multi-channel LLM fuse switch in the embodiment can realize the fusing of low-credibility LLMs, so that low-credibility LLMs withdraw from participating in label calculation.

[0099] Embodiment 1:

[0100] (1) Prepare the system computing environment.

[0101] like Figure 1 As shown, the computing environment and technical preparation work mainly involved in the present invention include:

[0102] Sandbox environment: Data sandbox builds a trusted execution environment TEE based on environmental isolation, providing a computing environment with CPU and memory isolation. Optional trusted execution environment technologies include Intel SGX and ARM TrustZone. For example, the capacity of the secure enclave of TEE based on Intel SGX / TDX1 can reach up to 512GB for a single CPU, and 1TB for two channels, which can meet the current execution space requirements of hundreds of billions of large models.

[0103] LLM model: You can choose openai, llama2, llama3, qwen2 and other large models without limitation; considering data privacy protection, the local deployment of large models is adopted. The integration framework of large model applications can choose open source frameworks such as LangChain.

[0104] Embedding Model: You can choose Word2Vec, FastText, BERT, M3E: MokaMassive Mixed Embedding, OpenAI text-embedding-3-small, OpenAI text-embedding-ada-002, etc. The specific implementation depends on the parameter scale, resource requirements and accuracy.

[0105] Vector database: You can choose Milvus, Annoy / Chroma / Faiss (lightweight), GaussDB Vector / Tencent Cloud VectorDB, etc., depending on the data scale and performance requirements.

[0106] Consortium chain: You can choose the more commonly used open source frameworks such as IBM Hyperledger Fabric.

[0107] (2) Data preparation

[0108] The data sources mainly include: resume text data (tens of thousands of resume documents), initial label library (mainly including skill data, with tens of thousands of job skill labels), some examples of labels are shown in Table 1:

[0109] Table 1: Examples of some job skill labels

[0110] tagname 0 Python 1 MySQL 2 Django 3 Redis 4 Java 5 rear end 6 Golang 7 Computer related majors 8 PyTorch 9 Docker 10 Oracle 11 reptile 12 Flask 13 Machine Learning / Algorithm Engineering 14 C / C++ 15 TensorFlow 16 Linux development / deployment experience 17 Pandas 18 MongoDB 19 Distributed Experience 20 Microservices experience

[0111] Resume data is sensitive data and is encrypted and stored in the local database on the user side. At the same time, the resume data is converted and synchronously stored in the vector database (KV database), where K is the vector information calculated based on plain text; V is the text fragment corresponding to the vector, which is converted into ciphertext and stored in the vector database.

[0112] Since the tag library data does not involve user sensitive information, it is directly loaded and stored into the vector database.

[0113] Resumes are long text data and need to be segmented or segmented according to different user IDs (personnel), and then converted into vectors and stored in the vector database. The tags in the tag library are short texts, and each tag is directly stored in the vector database after being converted into a vector.

[0114] (3) Transmission of private data.

[0115] The ciphertext data (resume information) of the specified user is passed to the data computing sandbox, and the user's ciphertext information is decrypted in the data computing sandbox memory. At this time, the user's plaintext resume data information is obtained in the memory.

[0116] (4) Initial label recall

[0117] The user's plaintext resume data and independently randomly sampled label examples are combined to form a prompt language template prompt1, and questions are asked to multiple different LLMs (only 2 are used as examples in this embodiment and are not limited) at the same time. The returned results are constrained to be a label list (each LLM returns the top N labels in descending order of importance, and 4 labels are taken as an example).

[0118] An example of a prompt language template (prompt1) is Figure 2 and Figure 3 As shown (for privacy reasons, the resume data here has been simplified and the actual resume text is longer).

[0119] like Figure 2 , Figure 3 As shown, prompts are given from two different LLMs (llama3 and qwen2), and the label sets output by the above two LLMs are not exactly the same.

[0120] Figure 2 The job skill tags "python, data analysis, software development, project management, human resource management, sales" in the prompt, Figure 3 The “large model, autonomous driving, satellite navigation, FPGA, marketing, and financial management” in the prompts come from two completely independent random samplings of the initial label library (six labels were sampled as examples respectively).

[0121] Finally, the result sets of labels generated by the two-way LLM are merged (taking the union) to obtain a set S containing the following 5 labels: [algorithm development, CNN, RNN, JAVA, GO].

[0122] (5) Label normalization and expansion

[0123] Based on the similarity between the embedded vectors, the set S is calculated with the vectors in the initial tag library for similarity (cosine similarity is optional) and the topK (K is 8 as an example) tags are retained. The expanded set is shown below:

[0124] Collection K: [Algorithm engineer, deep learning, machine vision, JAVA language, GO language, software development, PYTHON language, C language]

[0125] After label normalization and expansion, it can be seen that some skill terms are more standardized, such as "java" normalized to "java language"; but while expanding the labels, some skill labels that may not exist or are wrong are recalled (such as C language, although C language and JAVA language have certain similarities), and the expanded labels need to be re-tested in the next step.

[0126] (6) Tag verification based on RAG retrieval

[0127] The skill labels to be tested, such as "algorithm engineer" and "PYTHON language", are converted into vectors of retrieval query questions, and the vector library corresponding to the user's original resume information is retrieved. The document fragment most relevant to the query is selected through vector similarity calculation, and then the matching document fragment is inserted into the template of the improvement project Prompt2 (the template is obtained by executing the blockchain smart contract), and a new query instruction is dynamically generated to ask questions to LLM1 / LLM2 at the same time.

[0128] A prompt language template (prompt2) is as follows Figure 4 As shown in , P1 is the context information used to retrieve enhancement after matching from the vector database, and P2 is the label to be tested. After insertion, specific query instructions are dynamically generated, such as Figure 5-Figure 8 As shown. Figure 5 As shown, the factual information of the dynamic query instruction "having many years of experience in algorithm development projects" is the contextual information used for retrieval enhancement after matching from the vector database.

[0129] (7) Label filtering based on hybrid expert soft decision

[0130] The set K in step (6) has 8 labels to be tested: [algorithm engineer, deep learning, machine vision, JAVA language, GO language, software development, PYTHON language, C language]

[0131] As mentioned above, the label filtering logic is divided into the following three cases: 1. Both check1 and check2 are no, output "no". 2. Both check1 and check2 are yes, output "yes". 3. Other cases (that is, one outputs "yes" and the other outputs "no". In this embodiment, N=2, then the weight in other cases is 0.5. In this embodiment, the first preset threshold is 0.7, and the second preset threshold is 0.3. Between the first preset threshold and the second preset threshold, the label is marked as a label to be determined), output "to be determined". After this step, the label with an output of "yes" can be directly output to the next link as a confirmed label. The label with an output of "no" is directly discarded (indicating that the credibility of the label is insufficient).

[0132] After filtering the set K, the set is divided into three sets as follows:

[0133] K1:[Algorithm engineer, deep learning, machine vision, JAVA language, GO language]

[0134] K2: [Software Development]

[0135] K3: [PYTHON language, C language]

[0136] All the labels in the K1 set have passed the inspection, the labels in the K3 set have failed the inspection and are discarded directly, and the labels in the K2 set need to be further inspected.

[0137] (8) Label secondary recall based on knowledge distillation

[0138] First, a local classifier model is built using the Teacher-Student Training Paradigm architecture. LLM1 / LLM2 acts as the teacher model, and the local classifier model acts as the student model. The local classifier model is modeled as a text matching problem between questions and evidence, and fine-tuned based on the Bert pre-trained model (it can also be replaced with other pre-trained language models, which is not limited here). The core method is shown in the figure below: Fig. 9 shown.

[0139] After the local student model training is completed, the labels in the K2 set in the previous step can be further tested. If the output result is "yes", a second recall can be performed, and if it is "no", it will be discarded.

[0140] After this step, the final result label set R (including 6 valid labels) is:

[0141] R:[Algorithm engineer, deep learning, machine vision, JAVA language, GO language, software development]

[0142] (9) Result output

[0143] The final output label result is encrypted and output to the user side through the data security gateway for storage.

[0144] Example 2: Tagging the natural resources of a city for use in the field of smart cities.

[0145] Based on the descriptive information in the introductory text of the city archives, the labels of the Chinese medicinal plant resources in the city are extracted. This can be used for the analysis and decision-making of medicinal material origins and urban resources.

[0146] The implementation steps are as follows:

[0147] (1) Prepare the system computing environment.

[0148] Same as described in Example 1.

[0149] (2) Data preparation

[0150] The data sources mainly include: text data of city archives (such as archive information of hundreds of cities in China), initial Chinese medicinal materials resource tag library (mainly including the names of Chinese medicinal materials plants, with thousands of tags). Examples of some tags are shown in Table 2:

[0151] Table 2: Examples of some Chinese medicinal herb planting labels

[0152] tagname 0 Wuzhi rock ginger 1 Five finger orange 2 Dongbai Tea 3 Mat grass 4 Rock Tea 5 Plantain 6 Gentiana australis 7 Chicken bone grass 8 Golden Buddha Grass 9 Golden grass 10 Taurus grass 11 Dandelion 12 flat wood 13 Kudi Ding 14 Cistanche deserticola 15 Polygonum multiflorum 16 Huai Niu Xi 17 Black aconite 18 Polygonatum 19 Astragalus 20 Picrorhizoma 21 Coptis chinensis

[0153] The urban archive data of the user (government department) is sensitive data and can be stored in the local database on the user side after encryption. At the same time, the urban archive text data is converted and synchronously stored in the vector database (KV database), where K is the vector information calculated based on plain text; V is the text fragment corresponding to the vector, which is converted into ciphertext and stored in the vector database.

[0154] Since the tag library data does not involve user sensitive information, it is directly loaded and stored into the vector database.

[0155] The city archive text is long text data, which needs to be segmented or segmented according to different city IDs, and then converted into vectors and stored in the vector database; the labels in the label library are short texts, and each label is directly stored in the vector database after being converted into a vector.

[0156] (3) Transmission of private data.

[0157] The ciphertext data (city archive text) of the specified user is passed to the data computing sandbox, and the user's ciphertext information is decrypted in the data computing sandbox memory. At this time, the user's plaintext city archive text data information is obtained in the memory.

[0158] (4) Initial label recall

[0159] The user's plaintext city archive text data and independently randomly sampled label examples are combined to form a prompt language template prompt1, which is asked to multiple different LLMs (only two are used as examples here) at the same time, and the returned results are constrained to be a label list (each LLM returns the top N labels in descending order of importance).

[0160] Fig.10 and Fig.11 This is an example of a prompt language template (prompt1) provided in Embodiment 2 of the present invention.

[0161] like Fig.10 and Fig.11 As shown, prompts are given from two different LLMs (llama3 and qwen2), and the label sets output by the above two LLMs are not exactly the same.

[0162] Finally, the result sets of labels generated by the two-way LLM are merged (taking the union) to obtain a set S containing the following 10 labels: [Atractylodes macrocephala, White Peony Root, Corydalis yanhusuo, Radix Yuanshen, Camellia sinensis, Mat Grass, Citron, Rock Tea, Ginger, Daylily].

[0163] (5) Label normalization and expansion

[0164] Based on the similarity between the embedded vectors, the set S is calculated with the vectors in the initial tag library for similarity (optionally cosine similarity) and the topK tags are retained. The expanded set is shown below:

[0165] Collection K: [Atractylodes macrocephala, white peony root, Corydalis yanhusuo, Radix radix radix, Dongbai tea, mat grass, Juyan tea, daylily, Wuzhiyan ginger, Wuzhigan]

[0166] Among them, "Wuzhijiang" was normalized to the standard name "Wuzhiyan Ginger" through semantic similarity calculation. "Fo Shou" was not in the initial Chinese medicinal material resource tag library, but it was corresponding to the existing tag "Wuzhigan" in the tag library after corpus semantic expansion.

[0167] Note: Since medicinal materials usually have aliases, and the semantic correlation between the aliases and the original names is not high, when performing semantic expansion of the medicinal material names, you can use special medicinal material corpus / dictionary or knowledge graphs for assistance, and the medicinal material corpus information (such as: bergamot aliases include bergamot citron and five-finger orange) is also vectorized according to the above method and stored in the vector database to support the subsequent prompt engineering context information.

[0168] (6) Label verification based on RAG retrieval

[0169] The skill labels to be tested, such as "Wuzhiyan Ginger", "Wuzhigan", etc., are converted into vectors of retrieval query questions, and the vector library corresponding to the original city archive information is retrieved. The document fragment most relevant to the query is selected through vector similarity calculation, and then the matching document fragment is inserted into the template of the promotion project Prompt2 (the template is obtained by executing the blockchain smart contract), and a new query instruction is dynamically generated to ask questions to LLM1 / LLM2 at the same time.

[0170] A prompt language template (prompt2) is as follows Fig.12 As shown in the figure, P1 is the context information for retrieval enhancement after matching from the city archive vector database, P1a is the context information from another source for retrieval enhancement after matching from the vector database of medicinal material corpus, and P2 is the label to be tested. After insertion, a specific query instruction is dynamically generated. Figure 13-Figure 16As shown in the figure, part of the fact information in the dynamic query instruction is matched from the city archive vector database and used to retrieve enhanced context information, and another part of the fact information, such as "Foshou's aliases include citron and five-finger orange," is matched from the vector database of the medicinal material corpus and used to retrieve enhanced context information.

[0171] like Figure 13-Figure 16 As shown, taking the two labels "Wuzhiyan Ginger" and "Wuzhigan" as examples, the label test outputs of multiple LLMs for "Wuzhigan" are consistent, while the label test outputs for "Wuzhiyan Ginger" are not consistent.

[0172] (7) Label filtering based on hybrid expert soft decision

[0173] The set K in step (6) has 10 labels to be tested: [Atractylodes macrocephala, White peony root, Corydalis yanhusuo, Radix radix scutellariae, Camellia sinensis, Mat grass, Rock tea, Daylily, Five finger rock ginger, Five finger orange]

[0174] As mentioned above, the tag filtering logic is divided into the following three cases: 1. If both check1 and check2 are no, output "no". 2. If both check1 and check2 are yes, output "yes". 3. For other cases (same as Example 1), output "to be determined". After this step, the tag with the output of "yes" can be directly output to the next link as a confirmed tag. The tag with the output of "no" is directly discarded (indicating that the credibility of the tag is insufficient).

[0175] After filtering the set K, the set is divided into three sets as follows:

[0176] K1: [Atractylodes macrocephala, white peony root, Corydalis yanhusuo, Radix radix scutellariae, white tea, mat grass, rock tea, day lily, tangerine peel]

[0177] K2:[Wuzhiyan Ginger]

[0178] K3:[]

[0179] All the labels in the K1 set have passed the inspection, the labels in the K3 set have failed the inspection and are discarded directly, and the labels in the K2 set need to be further inspected.

[0180] (8) Label secondary recall based on knowledge distillation

[0181] First, build a local classifier model using the "Teacher-Student Training Paradigm" architecture. LLM1 / LLM2 acts as the teacher model and the local classifier model acts as the student model. The local classifier model is modeled as a text matching problem between questions and evidence, and fine-tuned for local training based on the Bert pre-trained model (it can also be replaced with other pre-trained language models, which is not limited here).

[0182] After the local student model training is completed, the labels in the K2 set in the previous step can be further tested. If the output result is "yes", a second recall can be performed, and if it is "no", it will be discarded.

[0183] After this step, the final result label set R (containing 10 valid labels) is:

[0184] R: [Atractylodes macrocephala, white peony root, Corydalis yanhusuo, Radix radix radix, white tea, mat grass, rock tea, daylily, five-finger rock ginger, five-finger orange]

[0185] (9) Result output

[0186] The final output label result is encrypted and output to the user side through the data security gateway for storage.

[0187] The above embodiments are only used to illustrate the design ideas and features of the present invention, and their purpose is to enable those skilled in the art to understand the content of the present invention and implement it accordingly. The protection scope of the present invention is not limited to the above embodiments. Therefore, any equivalent changes or modifications made based on the principles and design ideas disclosed by the present invention are within the protection scope of the present invention.

Claims

1. A label calculation method based on hybrid expert LLM, characterized in that: include: Get user information and build the corresponding tag library; Based on the user information and the tags in the tag library, prompt1 is formed to ask questions to M different LLMs in the first hybrid expert model system, the returned results are constrained to be a tag list, and all the results are merged to obtain a first tag set; Calculate the similarity between each tag in the first tag set and the tags in the tag library, and return a set of similar tags for each tag in the first tag set to obtain a second tag set; Converting tags in the second tag set into vectors of search query questions, and searching a vector database to obtain context information most relevant to each tag; the vector database stores user information; Insert the context information and its corresponding label into prompt2, and ask questions to N different LLMs in the second hybrid expert model system respectively to determine whether the label is correct or not; if the LLM determines that it is correct, a weight of 1 / N is assigned, and if it is wrong, the weight is 0; if the sum of the weights is greater than or equal to the first preset threshold, the label is retained, and if it is less than or equal to the second preset threshold, the label is discarded; If it is between the first preset threshold and the second preset threshold, the tag is marked as a tag to be determined; If there is a label to be determined, the label to be determined is input into the classification model to determine whether the label to be determined is correct or not. If it is determined to be correct, the label is retained, otherwise the label is discarded.

2. The method according to claim 1, characterized in that Each label in prompt1 is randomly sampled independently from the label library.

3. The method according to claim 1, characterized in that: The return result constraint is a label list including: sorting the labels returned by each LLM from most important to least important, and returning the top N labels; The returning of a set of similar tags includes: sorting by similarity from large to small and taking at most the top K tags according to a third preset threshold.

4. The method according to claim 1, characterized in that: The user in the user information is a pointer to the main object of the calculation tag, and the user information is information about the text description data type related to the main object.

5. The method according to claim 1, characterized in that The classification model is trained as follows: At least one LLM in the second hybrid expert model system is used as a teacher model and the classification model is used as a student model, and distillation training is performed on the classification model.

6. The method according to claim 1, characterized in that It also includes extending the tag library, specifically: According to the tag list generated by LLM in the first hybrid expert model system, if the frequency of occurrence of the generated tag is greater than the fourth preset threshold and / or the similarity between the generated tag and the tag in the tag library is greater than the fifth threshold, the tag is added to the tag library.

7. The method according to claim 1, characterized in that It also includes expanding the vector database, specifically: Semantic expansion is performed according to the acquired user information, and the semantic information obtained by the expansion is vectorized and stored in the vector database or a new vector database is established and stored in the newly established vector database.

8. The method according to claim 1, characterized in that: It also includes reputation scoring for the LLM in the second hybrid expert model system; The reputation calculation method is: R-LLM(i)=sum(LLM(i)==nLLM Output) / accumulated number of judgments; where LLM(i)==nLLM Output means judging whether the single output of the i-th LLM is equal to the final output, if so, output 1, otherwise 0; If the reputation is lower than the third preset threshold, the LLM exits the tag calculation.

9. A trusted smart tag computing device that combines expert LLM and privacy protection, characterized in that: Including user side and data computing sandbox; The user side includes a local database and a vector database, both of which store encrypted user information; The data computing sandbox is used to execute the method described in claim 1, obtain a retained label, encrypt the label and output it to the user side for storage; wherein the obtained user information is obtained by obtaining the specified user ciphertext information from the local database and decrypting it.

10. The device according to claim 9, characterized in that It also includes regulators to conduct independent and public audits of calculation data, processes and results.

Citation Information

Patent Citations

  • Text classification method and device, computing equipment and computer readable medium

    CN113177102A

  • Text classification method and device and related product

    CN116975295A

  • Text content multi-label classification method and device

    CN117150026A

  • Label value determination method and device, equipment and storage medium

    CN117574286A

  • Text classification method and device based on large language model

    CN117609493A

Cited By

  • Emergency information generation method and device based on multiple modes, electronic equipment and medium

    CN119938858A

  • Multimodal emergency information generation methods, devices, electronic equipment, and media

    CN119938858B

  • Breast cancer segmentation architecture generation method based on text processing

    CN119988523A

  • Retrieval enhancement prompt optimization method for automobile network security standard interpretation

    CN121562838A

  • A retrieval enhancement prompt optimization method for automobile network security standard interpretation

    CN121562838B