Large language model training method, interaction method, device, equipment and medium
By obtaining the encrypted training corpus and generating the synthetic corpus, the training data integrity and prediction accuracy problems caused by private information processing in the prior art are solved, and the training effect and prediction accuracy of large language models are improved on the basis of protecting private information.
Patent Information
- Application Number
- CN202510124828.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-26
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2045-01-26
AI Technical Summary
When training large language models, the prior art processes sensitive data by deleting private information, resulting in a decrease in the integrity of the training data and the accuracy of model prediction.
By obtaining the encrypted training corpus, a synthetic corpus is generated based on entities and paragraphs in the encrypted training corpus document, and combining it with the encrypted training corpus, the large language model is trained using the encrypted training corpus to ensure the security of private information.
While protecting private information, it improves the training effect and prediction accuracy of large language models, and enhances the learning ability of encrypted data.
Smart Images

Figure CN119558411B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a training method, interaction method, device, equipment and medium for a large language model. Background Art
[0002] Training language models (LLMs) typically involves large amounts of user data, which may contain sensitive or private information such as names, addresses, and phone numbers. To address this issue, the most common approach is to filter training text for private information. This approach detects private information in the text and removes it to prevent it from being used to train large language models. However, this approach compromises the integrity of the training data, resulting in reduced training effectiveness and potentially impacting the model's prediction accuracy.
[0003] Therefore existing technology still needs to be improved and improved. Summary of the Invention
[0004] The technical problem to be solved by this application is to provide a training method, interaction method, device, equipment and medium for a large language model in response to the shortcomings of the existing technology.
[0005] In order to solve the above technical problems, the first aspect of the present application provides a large language model training method, wherein the large language model training method specifically includes:
[0006] Obtaining an encrypted training corpus, wherein the encrypted training corpus includes a plurality of encrypted training corpus documents;
[0007] Generate a synthetic corpus based on the entities and / or paragraphs in each of the encrypted training corpus documents;
[0008] Combining the synthetic corpus and the encrypted training corpus to obtain a training corpus;
[0009] The first large language model is trained using the training corpus to obtain an encrypted trained large language model.
[0010] The large language model training method, wherein obtaining the encrypted training corpus specifically includes:
[0011] Divide the original training corpus into several original corpora according to privacy permissions, and obtain the key corresponding to each original corpus;
[0012] The original corpus documents in each original corpus are encrypted using the key corresponding to each original corpus to obtain an encrypted training corpus set.
[0013] The large language model training method, wherein the encryption of the original corpus documents in each original corpus using the key corresponding to each original corpus to obtain the encrypted training corpus specifically includes:
[0014] Detecting private information in each original corpus document in each original corpus;
[0015] The private information in each original corpus document is encrypted using the key corresponding to each original corpus to obtain an encrypted training corpus.
[0016] The large language model training method, wherein generating a synthetic corpus based on entities in each of the encrypted training corpus documents specifically includes:
[0017] Extracting the entity set of each of the encrypted training corpus documents;
[0018] Selecting a number of entities from each entity set, and generating a synthetic corpus document based on the selected entities from each entity set;
[0019] A synthetic corpus set is determined based on all generated synthetic corpus documents.
[0020] The large language model training method, wherein generating a synthetic corpus document based on a number of entities selected from each entity set specifically includes:
[0021] Input several entities and encrypted training corpus documents corresponding to each entity set into the second language model;
[0022] The synthesized corpus document is output through the second largest language model.
[0023] The large language model training method, wherein generating a synthetic corpus based on paragraphs in each of the encrypted training corpus documents specifically includes:
[0024] Filtering several related paragraphs corresponding to each paragraph in the encrypted training corpus document;
[0025] Generate a synthetic corpus document based on each paragraph and its corresponding related paragraphs;
[0026] A synthetic corpus set is determined based on all generated synthetic corpus documents.
[0027] In the large language model training method, the step of screening several related paragraphs corresponding to each paragraph in the encrypted training corpus document specifically includes:
[0028] Get the paragraph relevance between any two paragraphs in each encrypted training corpus document;
[0029] Several relevant paragraphs are selected for the paragraphs in the encrypted training corpus document in order of paragraph relevance.
[0030] In the large language model training method, obtaining the paragraph relevance between any two paragraphs in each encrypted training corpus document specifically includes:
[0031] For any two paragraphs in each encrypted training corpus document, obtain the sentence vector of each paragraph;
[0032] The semantic similarity between the two paragraphs is calculated based on the sentence vectors corresponding to the two paragraphs, and the paragraph relevance between the two paragraphs is determined according to the semantic similarity.
[0033] In the large language model training method, the step of screening several related paragraphs corresponding to each paragraph in the encrypted training corpus document specifically includes:
[0034] For any two paragraphs in each encrypted training corpus document, identify the entities contained in each paragraph;
[0035] The number of identical entities between the two paragraphs is determined based on the entities contained in the two paragraphs, and the paragraph relevance between the two paragraphs is determined according to the number of identical entities.
[0036] The large language model training method, wherein generating a synthetic corpus document based on each paragraph and its corresponding related paragraphs specifically includes:
[0037] Combine each paragraph with its corresponding related paragraphs to form a paragraph text;
[0038] The paragraph text corresponding to each paragraph is input into a third language model, and a synthetic corpus document is output through the third language model.
[0039] The large language model training method, wherein the training of the first large language model using the training corpus to obtain the encrypted trained large language model specifically includes:
[0040] Performing word segmentation on each training corpus in the training corpus set to obtain a word-segmented training corpus;
[0041] The first large language model is trained based on the training corpus after word segmentation to obtain a large language model after encryption training.
[0042] The training method of the large language model, wherein the segmentation of each training corpus in the training corpus to obtain the segmented training corpus specifically includes:
[0043] Obtaining the vocabulary and ciphertext tokens of the first language model;
[0044] Constructing an encrypted vocabulary of the first language model based on the vocabulary and the ciphertext token;
[0045] Each training corpus document is segmented using the encrypted vocabulary of the first language model to obtain a segmented training corpus document.
[0046] A second aspect of the present application provides an interactive method for a large language model, using an encrypted large language model trained using the large language model training method described above. The interactive method for the large language model specifically includes:
[0047] Obtaining user interaction question corpus, wherein private information in the question corpus is represented in ciphertext;
[0048] The question corpus is input into the large language model, a response corpus is generated by the large language model, and the response corpus is exchanged with the user, where the private information in the response corpus is represented by ciphertext.
[0049] A third aspect of the present application provides a large language model training device, wherein the large language model training device specifically includes:
[0050] An acquisition module is used to acquire an encrypted training corpus set, wherein the encrypted training corpus set includes a plurality of encrypted training corpus documents;
[0051] a generating module, configured to generate a synthetic corpus based on entities and / or paragraphs in each of the encrypted training corpus documents, and combine the synthetic corpus with the encrypted training corpus to obtain a training corpus;
[0052] The training module is used to train the first large language model using the training corpus to obtain an encrypted large language model.
[0053] In a fourth aspect, the present application provides a computer-readable storage medium storing one or more programs, which can be executed by one or more processors to implement the steps in any of the above-described large language model training methods, and / or to implement the steps of the above-described large language model-oriented interactive method.
[0054] A fifth aspect of the present application provides a terminal device, comprising: a processor and a memory;
[0055] The memory stores a computer-readable program executable by the processor;
[0056] When the processor executes the computer-readable program, it implements the steps of any of the above-described large language model training methods, and / or implements the steps of the above-described large language model-oriented interactive method.
[0057] Beneficial effects: Compared with the prior art, the present application provides a training method, interactive method, apparatus, device and medium for a large language model, wherein the training method comprises obtaining an encrypted training corpus, generating a synthetic corpus based on the entities and / or paragraphs in each of the encrypted training corpus documents; and training a first large language model using the training corpus to obtain an encrypted trained large language model. The present application determines the training corpus through encryption technology, and uses the training corpus to train the large language model, thereby ensuring the integrity of the training corpus while ensuring the security of privacy information, and improving the training effect and prediction accuracy of the large language model. At the same time, after obtaining the encrypted training corpus, the present application generates a synthetic corpus based on the entities and / or paragraphs in each of the encrypted training corpus documents, and combines the synthetic corpus with the encrypted training corpus to expand the encrypted training corpus, thereby enhancing the large language model's ability to learn encrypted data, enabling the trained large language model to better understand and process encrypted data, and further improving the large language model's learning effect on the knowledge in the encrypted training corpus documents. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0059] Figure 1 A flowchart of a method for training a large language model provided in an embodiment of the present application.
[0060] Figure 2 This is a flow chart of the principles of the large language model training method provided in the embodiment of the present application.
[0061] Figure 3 This is an example flow chart of the large language model training method provided in an embodiment of the present application.
[0062] Figure 4 A flow chart illustrating the principles of the large language model interaction method provided in an embodiment of the present application.
[0063] Figure 5 This is an example flow chart of the interactive method for a large language model provided in an embodiment of the present application.
[0064] Figure 6This is a functional block diagram of the large language model training device provided in an embodiment of the present application.
[0065] Figure 7 This is a block diagram of the principles of the terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0066] The embodiments of the present application provide a large language model training method, interaction method, apparatus, device, and medium. To make the objectives, technical solutions, and effects of the present application more clear and explicit, the present application is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are intended only to explain the present application and are not intended to limit the present application.
[0067] It will be understood by those skilled in the art that, unless expressly stated otherwise, the singular forms "a", "an", "said" and "the" used herein may also include the plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, "connected" or "coupled" as used herein may include wireless connections or wireless couplings. The term "and / or" used herein includes all or any units and all combinations of one or more associated listed items.
[0068] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those skilled in the art to which this application belongs. It should also be understood that terms such as those defined in common dictionaries should be understood to have meanings consistent with their meanings in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0069] It should be understood that the sequence numbers and sizes of the steps in this embodiment do not imply the order of execution. The order of execution of each process is determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of this application.
[0070] Research has found that training language models (LLMs) typically involves large amounts of user data, which may contain sensitive or private information such as names, addresses, and mobile phone numbers. To address this issue, the most common approach is to filter the training text for private information. This involves detecting private information in the text and removing it to prevent it from being used to train large language models. While this approach can prevent the direct exposure of sensitive information to a certain extent, its overly simplistic data processing compromises the integrity of the original data. This compromise can not only reduce the effectiveness of large language models but also affect their predictive accuracy by losing key information features. For example, removing names or phone numbers from training data can cause the large language model to misunderstand such information and fail to accurately recognize similar patterns.
[0071] In order to solve the above problems, in an embodiment of the present application, an encrypted training corpus is obtained, and a synthetic corpus is generated based on the entities and / or paragraphs in each of the encrypted training corpus documents; the first large language model is trained by the training corpus to obtain the large language model after encryption training. The present application determines the training corpus through encryption technology, and uses the training corpus to train the large language model, thereby ensuring the integrity of the training corpus on the basis of ensuring the security of privacy information, and improving the training effect and prediction accuracy of the large language model. At the same time, after obtaining the encrypted training corpus, the present application generates a synthetic corpus based on the entities and / or paragraphs in each of the encrypted training corpus documents, and combines the synthetic corpus with the encrypted training corpus to expand the encrypted training corpus, thereby enhancing the learning ability of the large language model for encrypted data, so that the trained large language model can better understand and process encrypted data, and further improve the learning effect of the large language model on the knowledge in the encrypted training corpus documents.
[0072] The application content will be further explained below through description of embodiments in conjunction with the accompanying drawings.
[0073] This embodiment provides a method for training a large language model. Figure 1 、 Figure 2 and Figure 3 As shown, the method includes:
[0074] S10. Obtain an encrypted training corpus.
[0075] Specifically, the encrypted training corpus can be obtained by encrypting the original training corpus. The encrypted training data set may include several encrypted training corpus documents, each of which corresponds to an original corpus document in the original training corpus. The encrypted training corpus document is obtained by encrypting the corresponding original corpus document. The original corpus document can be saved in a file format such as JSON, TXT, or PDF. In addition, when encrypting the original training corpus, a single key can be used to encrypt all original corpus documents to obtain the encrypted training corpus, or multiple keys can be used, with each key used to encrypt a portion of the original corpus documents in the original corpus to obtain the encrypted training corpus.
[0076] In practical applications, the original training corpus may include original corpus documents from multiple different users, and the original corpus documents of multiple different users may be kept confidential. Therefore, in the embodiment of the present application, in order to ensure the independence of the original corpus documents of different users, when obtaining the encrypted training corpus, the original corpus documents are encrypted according to the privacy permissions corresponding to the original corpus documents, so that the original corpus documents with different privacy permissions are independent of each other.
[0077] Exemplarily, the step of obtaining the encrypted training corpus specifically includes:
[0078] Divide the original training corpus into several original corpora according to privacy permissions, and obtain the key corresponding to each original corpus;
[0079] The original corpus documents in each original corpus are encrypted using the key corresponding to each original corpus to obtain an encrypted training corpus set.
[0080] Specifically, privacy permissions restrict access to original corpus documents, meaning only users with privacy permissions can access them. For example, the original training corpus includes original corpus document a and original corpus document b. The privacy permission for original corpus document a is bank a1, and the privacy permission for original corpus document b is bank b1. This means employees of bank a1 can access original corpus document a, and employees of bank b1 can access original corpus document b. Therefore, after the original training corpus is divided into several original corpora according to privacy permissions, each original corpus corresponds to a privacy permission, and the privacy permissions corresponding to each original corpus are different.
[0081] Furthermore, since each original corpus has a different corresponding privacy permission, a different key is configured for each original corpus to ensure independence. The key configured for each original corpus can be held by one or more users with privacy permission for the original corpus. The key configured for each original corpus can be randomly generated, obtained through interaction with users, or configured for the original corpus by a user with privacy permission for each original corpus.
[0082] In one implementation, encrypting the original corpus documents in each original corpus using a key corresponding to each original corpus to obtain an encrypted training corpus specifically includes:
[0083] Detecting private information in each original corpus document in each original corpus;
[0084] The private information in each original corpus document is encrypted using the key corresponding to each original corpus to obtain an encrypted training corpus.
[0085] Specifically, private information refers to information in the original corpus document that needs to be kept confidential. Private information can include entities in the original corpus document, user-specified corpus content in the original corpus document, and numerical content in the original corpus document. In the implementation of this application, taking the example of private information including entities in the original corpus document, entities refer to objects with special meaning in the text, such as names of people, places, and organizations. Entities are usually fixed words and phrases that can be automatically identified and classified using entity recognition technology. Entity recognition is an important task in natural language processing, which can help us better understand and analyze entity information in text. In addition, when encrypting an entity, the entity can be encrypted first and then the encrypted entity can be used to replace the entity in the original corpus document. Alternatively, after encrypting the entity, the encrypted entity can be combined with the entity type to replace the entity in the original corpus document. Entity types can include names of people, organizations, places, times, dates, and organization names, among others.
[0086] When detecting private information in the original corpus documents, entity recognition models and regular expressions are used to detect private information in the original corpus documents to determine the private information in the original corpus documents. For example, a BERT-based entity detection model is used as an entity recognition model and embedded into the privacy information detection tool Microsoft Predisio. This entity recognition model is used to detect entities in the original corpus documents and select entities as private information. For example, all entities may be considered private information, or some entities that need to be kept confidential may be considered private information.
[0087] After detecting the privacy information in the original corpus document, the private information is encrypted using the key corresponding to the original corpus to which the original corpus document belongs to obtain an encrypted training corpus document. The corpus consisting of all encrypted training corpus documents is used as the encrypted training corpus. The original corpus documents in each original corpus can only be obtained by users with privacy permissions through the large language model after encryption training. For example, Figure 2 As shown in the figure, a user who has privacy rights to the original corpus A has the key A1 of the original corpus A. This user can and can only query and decode the original corpus documents in the original corpus A through the encrypted trained large language model, but cannot query or decode the original corpus documents in the original corpus B.
[0088] In addition, it should be noted that when using a key to encrypt private information, an existing encryption method can be used to encrypt the private information. The encryption method used is not limited here, and only an example is given as an illustration. For example, the encryption method uses the ECB mode of the AES encryption algorithm. The original corpus document is "Witness Zhang San's home address is XXX." First, the entities "Zhang San" and "XXX" in the original corpus document are extracted as private information, and the entity type identifiers "Person" and "Location" are added, respectively. Then, the entities "Zhang San" and "XXX" are encrypted to encode the entities into Base-64 ciphertext token strings. The ciphertext token string and the entity type identifier are combined to replace the plaintext private information in the original corpus document, resulting in the encrypted training corpus document "Witness Person_[bDqAi7+ slxdVeM9V5OAnrg==]'s home address is Location_[5q8mKpQV8 / 4Yl4GuZm5FRwsGwQPXP5ztdTkObt6 / IuY=]." "Person" and "Location" are entity type identifiers, and the Base-64 string in parentheses after the identifiers is the encrypted private information. Of course, when encrypting each original corpus, the key corresponding to each original corpus will be used to encrypt the private information in the original corpus documents in the original corpus. For example, the encrypted training corpus documents obtained by encrypting the original corpus A using key A1 constitute the encrypted training corpus document library A*, and the encrypted training corpus documents obtained by encrypting the original corpus B using key B1 constitute the encrypted training corpus document library B*. Users who do not have privacy permissions for the original corpus A and do not possess key A1 cannot decrypt the private information in the encrypted training corpus documents in the encrypted training corpus document library A*.
[0089] In the embodiment of the present application, the original training corpus is encrypted to obtain an encrypted training corpus, and the privacy information in the original corpus document is encrypted without destroying the integrity of the original corpus. This not only fundamentally avoids the leakage of privacy information, but also effectively improves the training effect and prediction accuracy. At the same time, when encrypting the original training corpus, the present application also uses different keys to encrypt the original corpus documents according to privacy permissions. Users can query the original corpus documents with privacy permissions when using the large language model after encryption training, but cannot access the original corpus documents without permissions, thereby avoiding the leakage of private content in the original corpus documents of other users. Compared with the situation where existing privacy protection methods cannot effectively ensure the independence of each user's data, the mutual independence and isolation of original corpus documents with different privacy permissions are achieved in the embodiment of the present application, further strengthening the security of multi-user data privacy.
[0090] S20: Generate a synthetic corpus based on the entities and / or paragraphs in each of the encrypted training corpus documents, and combine the synthetic corpus with the encrypted training corpus to obtain a training corpus.
[0091] Specifically, the synthetic corpus is used to expand the encrypted training corpus to improve the first language model's ability to understand encrypted data. The synthetic corpus documents of the synthetic corpus will be added to the encrypted training corpus as training corpus. That is, after obtaining the synthetic corpus, the synthetic corpus and the encrypted training corpus will be combined, and the combined corpus will be used as the training corpus. The synthetic corpus includes a number of synthetic corpus documents, and the synthetic corpus documents in the number of synthetic corpus documents can be generated entirely based on entities in the encrypted training corpus documents, or entirely based on paragraphs in the encrypted training corpus documents, or partially based on entities in the encrypted training corpus documents and partially based on paragraphs in the encrypted training corpus documents.
[0092] Furthermore, when the encrypted training corpus is obtained by encrypting an original training corpus comprising several original corpora with different privacy permissions, since the encrypted training corpus includes several encrypted training corpus document repositories with different privacy permissions, in order to improve the first language model's ability to understand each encrypted training corpus document repositories, a synthetic corpus document repositories can be generated for each encrypted training corpus document repositories, and the collection of all generated synthetic corpus document repositories is then used as the synthetic corpus. The generation process for generating synthetic corpus documents for encrypted training corpus documents in each encrypted training corpus document repositories is the same. Therefore, the generation process of synthetic corpus documents will be described here using the example of generating synthetic corpus documents from encrypted training corpus documents in the encrypted training corpus set.
[0093] In one implementation, generating a synthetic corpus based on entities in each of the encrypted training corpus documents specifically includes:
[0094] S210, extracting the entity set of each encrypted training corpus document;
[0095] S211, selecting a number of entities from each entity set, and generating a synthetic corpus document based on the selected entities from each entity set;
[0096] S212: Determine a synthetic corpus set based on all generated synthetic corpus documents.
[0097] Specifically, entity sets can be identified by performing entity recognition on encrypted training corpus documents, where the entity set may include ciphertexts of private entities encrypted with a key and plaintexts of non-private entities not encrypted with a key. In other words, a named entity model can be used to extract entities from the encrypted training corpus documents, obtaining ciphertexts of private entities encrypted with a key and plaintexts of non-private entities not encrypted with a key. For example, the open-source Erlangshen-UniEx-RoBERTa-330M-Chinese model on Huggingface can be used to perform named entity recognition on the encrypted training corpus documents. Several entities can be randomly selected from the entity set or from the ciphertexts of private entities encrypted with a key within the entity set. The number of entities can be one or more. In other words, when selecting several entities from each entity set, one or more entities can be randomly selected from each entity set to obtain the entities. It should be noted that when generating a synthetic corpus, a synthetic corpus document can be generated for each encrypted training corpus document, or for a subset of the encrypted training corpus documents within the encrypted training corpus. Here we take the example of generating a synthetic corpus document for each encrypted training corpus document in the encrypted training corpus set as an example to illustrate.
[0098] The synthetic corpus documents are determined based on a number of entities. Using the synthetic corpus documents, the first language model can better understand the encrypted training corpus documents. The synthetic corpus documents can be question-answer pairs for the entities, or they can be rewritten from the encrypted training corpus documents for the entities. That is, after obtaining the entities, question-answer pairs for the entities can be generated from the encrypted training corpus documents, or the encrypted training corpus documents can be rewritten for the entities to obtain rewritten corpus corresponding to the encrypted training corpus documents.
[0099] Exemplarily, generating a synthetic corpus document based on several entities selected from each entity set specifically includes:
[0100] Input several entities and encrypted training corpus documents corresponding to each entity set into the second language model;
[0101] The synthesized corpus document is output through the second largest language model.
[0102] Specifically, the second largest language model is used to generate a synthetic corpus document based on several entities and encrypted training corpus documents, wherein the synthetic corpus document can be a question-answer pair, for example, a question-answer pair for several entities; or a rewritten document, for example, a rewritten corpus document of an encrypted training corpus document for several entities. That is, the second largest language model can be used to rewrite the encrypted training corpus document and / or generate question-answer pairs for several entities based on the encrypted training corpus document to generate a synthetic corpus, wherein the question-answer pairs include questions for several entities and answers for several entities. That is, when several entities and encrypted training corpus documents corresponding to each entity set are input into the second largest language model, prompt words are pre-defined to inform the second largest language model of the synthesis task to be performed, for example, the prompt word is to rewrite the encrypted training corpus document, or to generate question-answer pairs for several entities based on the encrypted training corpus document. Based on this, before sending the multiple entities and the encrypted training corpus documents to the second language model, a first prompt word is generated based on the multiple entities and the encrypted training corpus documents. The first prompt word includes a first preset instruction, the multiple entities, and the encrypted training corpus documents. The first preset instruction is used to inform the second language model of the task to be performed. Of course, in actual applications, the first prompt word may also include multiple synthetic corpus document examples. The multiple synthetic corpus document examples are used as prior knowledge to provide knowledge information for the second language model. The encrypted training corpus documents in the synthetic corpus document examples can have the same privacy permissions as the encrypted training corpus documents from which the synthetic corpus documents are to be generated.
[0103] For example, suppose the encrypted training corpus document is "Witness Person_[bDqAi7+slxdVeM9V5OAnrg==]'s home address is Location_[5q8mKpQV8 / 4Yl4GuZm5FRwsGwQPXP5ztdTkObt6 / IuY=]", and the entities corresponding to the encrypted training corpus document are "Person_[bDqAi7+slxdVeM9V5OAnrg==". The second language model is responsible for generating question-answer pairs based on the encrypted training corpus. Then the first prompt word can be:
[0104] The first preset instruction: Generate question-answer pairs related to the entity "Person_[bDqAi7+slxdVeM9V5OAnrg==";
[0105] Encrypted training corpus document: "Witness Person_[bDqAi7+slxdVeM9V5OAnrg==]'s home address is Location_[5q8mKpQV8 / 4Yl4GuZm5FRwsGwQPXP5ztdTkObt6 / IuY=]";
[0106] Several entities: "Person_[bDqAi7+slxdVeM9V5OAnrg==".
[0107] The second largest language model generates the following question-answer pair based on the first prompt word:
[0108] Question: Where does Person_[bDqAi7+slxdVeM9V5OAnrg==] live?
[0109] Answer: "Person_[bDqAi7+slxdVeM9V5OAnrg==] lives at Location_[5q8mKpQV8 / 4Yl4GuZm5FRwsGwQPXP5ztdTkObt6 / IuY=]".
[0110] In one implementation, generating a synthetic corpus based on paragraphs in each of the encrypted training corpus documents specifically includes:
[0111] S220, screening several related paragraphs corresponding to each paragraph in the encrypted training corpus document;
[0112] S221, generating a synthetic corpus document based on each paragraph and its corresponding related paragraphs;
[0113] S222: Determine a synthetic corpus set based on all generated synthetic corpus documents.
[0114] Specifically, in step S220, each of the several related paragraphs is included in the encrypted training corpus document to which the paragraph belongs, that is, several related paragraphs are selected from the encrypted training corpus document for the paragraph in the encrypted training corpus document. When selecting several related paragraphs from the encrypted training corpus document for the paragraph in the encrypted training corpus document, several related paragraphs can be selected for each paragraph in the encrypted training corpus document, or several related paragraphs can be selected for some of the paragraphs in the encrypted training corpus document. Furthermore, the number of the several related paragraphs corresponding to the paragraph can be pre-set, determined based on the number of paragraphs included in the encrypted training corpus document, or randomly generated, etc. The number of related paragraphs and the method of determining them are not specifically limited, as long as relevant paragraphs can be selected for the paragraph.
[0115] Exemplarily, the step of screening the related paragraphs corresponding to each paragraph in the encrypted training corpus document specifically includes:
[0116] Get the paragraph relevance between any two paragraphs in each encrypted training corpus document;
[0117] Several relevant paragraphs are selected for the paragraphs in the encrypted training corpus document in order of paragraph relevance.
[0118] Specifically, paragraph relevance reflects the degree of similarity between paragraphs. A higher paragraph relevance indicates a higher degree of similarity between the two paragraphs, while a lower paragraph relevance indicates a lower degree of similarity between the two paragraphs. Paragraph relevance can be determined based on the relevance of semantic information between the two paragraphs, entities contained in the two paragraphs, or keywords within the paragraphs.
[0119] In one implementation, obtaining the paragraph relevance between any two paragraphs in each encrypted training corpus document specifically includes:
[0120] For any two paragraphs in each encrypted training corpus document, obtain the sentence vector of each paragraph;
[0121] The semantic similarity between the two paragraphs is calculated based on the sentence vectors corresponding to the two paragraphs, and the paragraph relevance between the two paragraphs is determined according to the semantic similarity.
[0122] Specifically, sentence vector is used to reflect the semantic information of paragraph, and sentence vector can be obtained by text vector model, and paragraph is input to text vector model, and sentence vector of paragraph is output by text vector model.After obtaining the sentence vector of paragraph, calculate the similarity between sentence vectors corresponding to two paragraphs respectively to determine the semantic similarity between two paragraphs, for example, can determine the semantic similarity between two paragraphs by calculating the covariance between two sentence vectors, also can be by calculating the cosine similarity between two sentence vectors to determine the semantic similarity between two paragraphs.After calculating the semantic similarity, the semantic similarity between two paragraphs can be used as the paragraph correlation between two paragraphs, the higher the semantic similarity between two paragraphs, the higher the paragraph correlation between two paragraphs, on the contrary, the lower the semantic similarity between two paragraphs, the lower the paragraph correlation between two paragraphs. Of course, in actual application, semantic similarity can also be adjusted with user interaction, and the adjusted semantic similarity can be used as the paragraph correlation between two paragraphs.
[0123] In another implementation, screening the related paragraphs corresponding to each paragraph in the encrypted training corpus document specifically includes:
[0124] For any two paragraphs in each encrypted training corpus document, identify the entities contained in each paragraph;
[0125] The number of identical entities between the two paragraphs is determined based on the entities contained in the two paragraphs, and the paragraph relevance between the two paragraphs is determined according to the number of identical entities.
[0126] Specifically, the entities included in the paragraph can be identified by an entity recognition model, which is the same as the identification method for identifying the entities contained in the encrypted training corpus document, and will not be described in detail here. After obtaining the entities contained in the paragraph, the entities contained in the two paragraphs are compared to select the same entities contained in both paragraphs, and then the number of the same entities is counted to obtain the number of the same entities. After obtaining the number of the same entities between the two paragraphs, the number of the same entities is used as the paragraph correlation between the two paragraphs, wherein the greater the number of the same entities between the two paragraphs, the higher the paragraph correlation between the two paragraphs, and conversely, the smaller the number of the same entities between the two paragraphs, the smaller the paragraph correlation between the two paragraphs. Of course, when the number of the same entities is obtained, the paragraph correlation can also be determined by other means, for example, by determining the paragraph correlation corresponding to the number of the same entities through a preset mapping relationship between the number of the same entities and the paragraph correlation, so as to obtain the paragraph correlation between the two paragraphs, etc.
[0127] It should be noted that when determining paragraph relevance, a paragraph relevance can also be determined based on semantic similarity, and then a paragraph relevance can be determined based on the number of identical entities, and finally the two paragraph relevances can be weighted to determine the final paragraph relevance between the two paragraphs.
[0128] After obtaining the paragraph correlation between any two paragraphs, several related paragraphs can be selected for the paragraph in descending order of paragraph correlation, so that the paragraph correlation between several related paragraphs is high. This can make several related paragraphs more similar to each other, so that when generating synthetic corpus documents based on the paragraphs and their corresponding related paragraphs, the paragraph content of the paragraph can be better understood, and then a synthetic corpus document that is closer to the paragraph content can be generated, so as to help the first language model better understand the paragraph content through the synthetic corpus document.
[0129] Furthermore, in step S221, when determining a synthetic corpus document based on a paragraph and its corresponding several related paragraphs, the paragraph and its corresponding several related paragraphs' paragraph profiles may be used as the synthetic corpus document, or the question-answer pairs for the paragraph and its corresponding several related paragraphs may be used as the synthetic corpus document, that is, the synthetic corpus document includes the paragraph profile of the paragraph text and / or the question-answer pairs for the paragraph text. Based on this, generating a synthetic corpus document based on each paragraph and its corresponding several related paragraphs specifically includes:
[0130] Combine each paragraph with its corresponding related paragraphs to form a paragraph text;
[0131] The paragraph text corresponding to each paragraph is input into a third language model, and a synthetic corpus document is output through the third language model.
[0132] Specifically, the paragraph text includes the paragraph and its corresponding several related paragraphs, wherein the positions of the paragraph and the several related paragraphs in the paragraph text can be random, or can be in the order of paragraph-several related paragraphs, and the several related paragraphs are arranged in order of paragraph relevance from high to low, etc.
[0133] After forming the paragraph text, the paragraph text is sent to the third language model so that the third language model can output a synthetic corpus document based on the paragraph text. The synthetic corpus document may include a paragraph overview and / or a question-answer pair for the paragraph text. That is, the third language model can generate a paragraph overview corresponding to the paragraph text, and can also generate a question-answer pair for the paragraph text. To this end, before sending the paragraph text to the third language model, a second prompt word is generated based on the paragraph text. The second prompt word includes a second preset instruction and the paragraph text. The second preset instruction is used to inform the third language model of the synthesis task to be performed, wherein the synthesis task can be a task of generating a paragraph overview of the paragraph text, or a task of generating a question-answer pair for the paragraph text, etc. Of course, in actual applications, the second prompt word can also include several synthetic corpus document examples, and the several synthetic corpus document examples are used to provide knowledge information for the third language model as prior knowledge, wherein the encrypted training corpus document to which the paragraph text in the synthetic corpus document example belongs can have the same privacy rights as the encrypted training corpus document to which the paragraph text of the synthetic corpus document to be generated belongs.
[0134] For example, the paragraph text is "The home address of witness Person_[bDqAi7+slxdVeM9V5OAnrg==] is Location_[5q8mKpQV8 / 4Yl4GuZm5FRwsGwQPXP5ztdTkObt6 / IuY=]", and "The home address of victim Person_[slxsdF Rw7sGwQnr58bTmKpQ=] is Location_[5q8mKpQV8 / 4Yl4GuZm5FRwsGwQPXP5ztdTk Obt6 / IuY=]". The synthesis task is to generate question-answer pairs based on the paragraph text. Then the second prompt word can be:
[0135] The second preset instruction: generating a question-answer pair for the paragraph text;
[0136] Paragraph text: "The home address of witness Person_[bDqAi7+slxdVeM9V5OAnrg==] is Location_[5q8mKpQV8 / 4Yl4GuZm5FRwsGwQPXP5ztdTkObt6 / IuY=]", "The home address of victim Person_[slxsdFRw7sGwQnr 58bTmKpQ=] is Location_[5q8mKpQV8 / 4Yl4GuZm5FRwsGwQPXP5ztdTkObt6 / IuY=]".
[0137] The question-answer pairs generated by the third largest language model are:
[0138] Question: Did the witness Person_[bDqAi7+slxdVeM9V5OAnrg==] and the victim Person_[slxsdFRw7sGwQ nr58bTmKpQ=] live together?
[0139] Answer: Yes, they all live in Location_[5q8mKpQV8 / 4Yl4GuZm5FRwsGwQPXP5ztdTkObt6 / IuY=]”.
[0140] The embodiment of the present application adds a synthetic corpus to the encrypted training corpus and expands the encrypted training corpus through the synthetic corpus, so as to provide the large language model with more knowledge information about the encrypted content in the encrypted data, thereby enhancing the learning ability of the large language model for the encrypted data, enabling the trained model to understand and process the encrypted data, and improving the model's learning effect on the knowledge in the encrypted text, thereby avoiding the problem that the large language model is difficult to understand because the encrypted characters do not contain any semantic information.
[0141] S30: Train the first large language model using the training corpus to obtain an encrypted trained large language model.
[0142] Specifically, the training corpus is used as a knowledge base for the first large language model. The first large language model is trained using the training corpus so that the first large language model learns the knowledge information included in the training corpus. When the first large language model is trained using the training corpus, in order to enable the first large language model to understand the training corpus in the training corpus, the training corpus in the training corpus can first be segmented, and then the first large language model can be trained based on the segmented training corpus.
[0143] Exemplarily, the training of the first large language model using the training corpus to obtain the encrypted trained large language model specifically includes:
[0144] Performing word segmentation on each training corpus in the training corpus set to obtain a word-segmented training corpus;
[0145] The first large language model is trained based on the training corpus after word segmentation to obtain a large language model after encryption training.
[0146] Specifically, the training corpus in the training corpus set can be an encrypted training corpus document or a synthetic corpus document generated based on the encrypted training corpus document. Segmenting the training corpus refers to breaking the training corpus into words, so as to divide the training corpus into a number of words. Segmentation can be performed based on string matching or statistical methods.
[0147] In one implementation, segmenting each training corpus in the training corpus to obtain the segmented training corpus specifically includes:
[0148] Obtaining the vocabulary and ciphertext tokens of the first language model;
[0149] Constructing an encrypted vocabulary of the first language model based on the vocabulary and the ciphertext token;
[0150] Each training corpus document is segmented using the encrypted vocabulary of the first language model to obtain a segmented training corpus document.
[0151] Specifically, the first language model includes a vocabulary, and the first language model's tokenizer performs token segmentation on the training corpus based on the vocabulary. That is, the first language model breaks down the training corpus into different tokens based on the vocabulary in the first language model. For example, "b is behind a" will be broken down into "b", "in", "a", and "behind". The vocabulary is a dictionary containing various tokens.
[0152] In one implementation, ciphertext tokens are added to the vocabulary of the first language model to obtain an encrypted vocabulary, wherein the vocabulary is a dictionary containing various tokens, each ciphertext token corresponds to a Base64 ciphertext character, and is used to represent the ciphertext in the training corpus, and the encrypted vocabulary includes ciphertext tokens and plaintext tokens. In other words, the encrypted vocabulary of the first language model includes ciphertext tokens and plaintext tokens, wherein the ciphertext tokens are used to represent the ciphertext in the training corpus (i.e., encrypted private information), and the plaintext tokens are used to represent the plaintext in the training corpus. This ensures that the original plaintext tokens in the vocabulary of the first language model will not be destroyed when the first language model learns the ciphertext, and the encrypted vocabulary in the first language model can also be used to directly perform word segmentation processing on all training corpora in the training corpus. For example, the word segmentation process of the training corpus in each training corpus document is performed using the encrypted word list in the first language model as follows: first, the ciphertext token of the first language model is obtained, and the ciphertext token and the word list are combined to obtain the encrypted word list of the first language model; then, each training corpus is decomposed into different tokens using the encrypted word list of the first language model, and each ciphertext character included in the training corpus in each training corpus corresponds to a Base64 ciphertext token, and each plaintext character corresponds to a Base64 plaintext token, wherein the Base64 ciphertext token corresponding to each ciphertext character is represented by a newly added ciphertext token after word segmentation, rather than the token corresponding to the Base64 character in the original word list. In this way, the encrypted word list in the first language model can be used to directly perform word segmentation on all training corpuses in the training corpus.
[0153] Based on the above-mentioned large language model training method, this embodiment provides an interactive method for a large language model, using the encrypted trained large language model obtained by the above-mentioned large language model training method. The interactive method for a large language model specifically includes:
[0154] Obtaining user interaction question corpus, wherein private information in the question corpus is represented in ciphertext;
[0155] The question corpus is input into the encrypted trained large language model, and a response corpus is generated by the encrypted trained large language model, wherein the private information in the response corpus is represented by ciphertext.
[0156] Specifically, if Figure 4 and Figure 5As shown, the question corpus is user interaction with the encrypted, trained large language model. The question corpus can be either encrypted or unencrypted. When the question corpus is encrypted, the private information in the question corpus is represented in ciphertext. The private information in the question corpus is included in the private information in the training corpus. For example, if the training corpus includes private information about Zhang San and Zhang San's home address, the private information in the question corpus can be Zhang San or Zhang San's home address.
[0157] To this end, before sending the question corpus to the encrypted and trained large language model, it will first be checked whether the user has the key. If the key is possessed, the private information in the question corpus will be encrypted with the key. If the key is not possessed, the question corpus will not be encrypted. In this way, the private information in the question corpus can be sent to the encrypted and trained large language model in ciphertext form, avoiding the problem of private information leakage during the transmission of the question corpus. For example, if the user corresponding to the question corpus has the key corresponding to the original corpus A, then the key corresponding to the original corpus A will be used to encrypt the question corpus. Of course, in actual applications, it is also possible to detect whether the question corpus contains private information before encryption, or to inquire whether the private information in the question corpus needs to be encrypted.
[0158] Furthermore, since the private information in the training corpus is encrypted during the training of the encrypted large language model, the encrypted large language model can only understand the ciphertext of the encrypted private information. Therefore, after receiving the question corpus, the encrypted large language model can only effectively generate the corresponding response corpus after the private information in the question corpus is encrypted using the same encryption method as the training corpus documents in the training corpus. This means that only users with privacy rights to the private information in the question corpus and the corresponding key can effectively query and ask questions about the private information in the question corpus, further improving the security of private information.
[0159] Furthermore, the response corpus may contain private information included in the training corpus, and when the response corpus contains private information, the private information is represented in ciphertext. In other words, the private information in the question corpus and the private information in the response corpus are both included in the private information in the training corpus, and the information content of the private information in the question corpus can be different from the information content of the private information in the response corpus. For example, suppose "Witness Zhang San's home address is XXX" is used as the training corpus document, and "Zhang San" and "XXX" are encrypted. The question corpus is "Where is Zhang San's address?" Then, if the question corpus is input in plaintext form into the encrypted large language model, the encrypted large language model cannot effectively answer the question. Instead, "Zhang San" in the question corpus needs to be encrypted to obtain the encrypted question corpus "Where is the address of Person_[bDqAi7+slxdVeM9V5OAnrg==]". Only then can the encrypted large language model effectively answer the question and obtain the reply corpus. In addition, "XXX" in the reply corpus is represented in ciphertext. Therefore, if the user does not have the privacy permission for the corpus "Witness Zhang San's home address is XXX", he or she cannot obtain the correct key. Therefore, the private information "Zhang San" cannot be correctly encrypted, and the address information of "XXX" cannot be obtained, thus avoiding the leakage of private information during the reasoning process.
[0160] Furthermore, when the private information in the question corpus is expressed in ciphertext, since the private information of the training corpus is encrypted during the training process of the large language model after encryption training, the private information in the reply corpus generated by the large language model after encryption training will also be expressed in ciphertext, and the large language model after encryption training directly exchanges the reply corpus with the private information expressed in ciphertext to the user, so that the user uses the locally owned key to decrypt the reply corpus. For example, at the user's local site, the ciphertext in the reply corpus can be detected by regularization, and then the ciphertext is decrypted using the owned key, and finally the plaintext corpus corresponding to the reply corpus is obtained. This application can avoid the private information in the reply corpus from being leaked during the transmission process by directly transmitting the reply corpus with the private information expressed in ciphertext, and on the other hand, only users with privacy rights for the private information in the reply corpus can access the plaintext of the private information.
[0161] For example: assuming the question corpus is "Where is the address of Person_[bDqAi7+slxdVeM9V5OAnrg==]", the response corpus generated by the encrypted and trained large language model is "The home address of Person_[bDqAi7+slxdVeM9V5OAnrg==] is Location_[5q8mKpQV8 / 4Yl4GuZm5FRwsGwQPXP5ztdTkObt6 / IuY=]", and the response corpus is exchanged with the user, and the response corpus is decrypted using the user's key to obtain the plaintext corpus "Zhang San's home address is XXX".
[0162] The embodiment of the present application receives encrypted question corpus interacted by the user, uses a large language model that has been encrypted and trained to generate a reply corpus in which private information is represented in ciphertext, and directly interacts the reply corpus in which the private information is represented in ciphertext tokens to the user. This not only prevents private information from being leaked during transmission, but also prevents private information in the question corpus interacted with the large language model that has been encrypted and trained from being captured and leaked by the large language model, thereby improving the security of private information.
[0163] Based on the above-mentioned large language model training method, this application also provides a large language model training device, such as Figure 6 As shown, the training device of the large language model specifically includes:
[0164] An acquisition module 100 is configured to acquire an encrypted training corpus, wherein the encrypted training corpus includes a plurality of encrypted training corpus documents;
[0165] A generating module 200 is configured to generate a synthetic corpus based on entities and / or paragraphs in each of the encrypted training corpus documents, and combine the synthetic corpus with the encrypted training corpus to obtain a training corpus;
[0166] The training module 300 is used to train the first large language model using the training corpus to obtain an encrypted and trained large language model.
[0167] This embodiment provides a computer-readable storage medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement the steps in the large language model training method as described in the above embodiment.
[0168] Based on the above large language model training method, the present application also provides a terminal device, such as Figure 7As shown, it includes at least one processor 20; a display screen 21; and a memory 22. It may also include a communications interface 23 and a bus 24. The processor 20, display screen 21, memory 22, and communications interface 23 can communicate with each other via bus 24. The display screen 21 is configured to display a preset user guidance interface in the initial setup mode. The communications interface 23 can transmit information. The processor 20 can invoke logic instructions in the memory 22 to execute the method described in the above embodiment.
[0169] In addition, the logic instructions in the memory 22 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
[0170] The memory 22, as a computer-readable storage medium, can be configured to store software programs or computer-executable programs, such as program instructions or modules corresponding to the methods in the embodiments of the present disclosure. The processor 20 executes the software programs, instructions, or modules stored in the memory 22 to perform functional applications and data processing, thereby implementing the methods in the above embodiments.
[0171] The memory 22 may include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function; the data storage area may store data created based on the use of the terminal device. In addition, the memory 22 may include high-speed random access memory and non-volatile memory. For example, various media that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, may also be transient storage media.
[0172] In addition, the specific process of loading and executing the multiple instructions in the storage medium and the processor in the terminal device has been described in detail in the above method and will not be described here one by one.
[0173] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for training a large language model, characterized in that: The training method of the large language model specifically includes: Obtaining an encrypted training corpus, wherein the encrypted training corpus includes a plurality of encrypted training corpus documents; generating a synthetic corpus based on entities and / or paragraphs in each of the encrypted training corpus documents, wherein the synthetic corpus is used to improve the first language model's ability to understand the encrypted data; Combining the synthetic corpus and the encrypted training corpus to obtain a training corpus; Training the first large language model using the training corpus to obtain an encrypted trained large language model; The step of generating a synthetic corpus based on entities in each of the encrypted training corpus documents specifically includes: Extracting the entity set of each of the encrypted training corpus documents; Selecting a plurality of entities from each entity set, and generating a synthetic corpus document based on the plurality of entities selected from each entity set, wherein the synthetic corpus document is a question-answer pair for the plurality of entities and / or a rewritten corpus for the plurality of entities; A synthetic corpus set is determined based on all generated synthetic corpus documents.
2. The large language model training method according to claim 1, characterized in that: The obtaining of the encrypted training corpus specifically includes: Divide the original training corpus into several original corpora according to privacy permissions, and obtain the key corresponding to each original corpus; The original corpus documents in each original corpus are encrypted using the key corresponding to each original corpus to obtain an encrypted training corpus set.
3. The large language model training method according to claim 2, characterized in that: The method of encrypting the original corpus documents in each original corpus using the key corresponding to each original corpus to obtain the encrypted training corpus specifically includes: Detecting private information in each original corpus document in each original corpus; The private information in each original corpus document is encrypted using the key corresponding to each original corpus to obtain an encrypted training corpus.
4. The large language model training method according to claim 1, characterized in that The generating of synthetic corpus documents based on the entities selected from each entity set specifically includes: Input several entities and encrypted training corpus documents corresponding to each entity set into the second language model; The synthesized corpus document is output through the second largest language model.
5. The large language model training method according to claim 1, characterized in that Generating a synthetic corpus based on the paragraphs in each of the encrypted training corpus documents specifically includes: Filtering several related paragraphs corresponding to each paragraph in the encrypted training corpus document; Generate a synthetic corpus document based on each paragraph and its corresponding related paragraphs; A synthetic corpus set is determined based on all generated synthetic corpus documents.
6. The method for training a large language model according to claim 5, wherein: The step of screening the relevant paragraphs corresponding to each paragraph in the encrypted training corpus document specifically includes: Get the paragraph relevance between any two paragraphs in each encrypted training corpus document; Several relevant paragraphs are selected for the paragraphs in the encrypted training corpus document in order of paragraph relevance.
7. The large language model training method according to claim 6, characterized in that: The obtaining of the paragraph relevance between any two paragraphs in each encrypted training corpus document specifically includes: For any two paragraphs in each encrypted training corpus document, obtain the sentence vector of each paragraph; The semantic similarity between the two paragraphs is calculated based on the sentence vectors corresponding to the two paragraphs, and the paragraph relevance between the two paragraphs is determined according to the semantic similarity.
8. The method for training a large language model according to claim 5, wherein: The step of screening the relevant paragraphs corresponding to each paragraph in the encrypted training corpus document specifically includes: For any two paragraphs in each encrypted training corpus document, identify the entities contained in each paragraph; The number of identical entities between the two paragraphs is determined based on the entities contained in the two paragraphs, and the paragraph relevance between the two paragraphs is determined according to the number of identical entities.
9. The large language model training method according to claim 5, characterized in that: Generating a synthetic corpus document based on each paragraph and its corresponding related paragraphs specifically includes: Combine each paragraph with its corresponding related paragraphs to form a paragraph text; The paragraph text corresponding to each paragraph is input into a third language model, and a synthetic corpus document is output through the third language model.
10. The method for training a large language model according to any one of claims 1 to 9, characterized in that: The training of the first large language model using the training corpus to obtain the encrypted trained large language model specifically includes: Performing word segmentation on each training corpus in the training corpus set to obtain a word-segmented training corpus; The first large language model is trained based on the training corpus after word segmentation to obtain a large language model after encryption training.
11. The method for training a large language model according to claim 10, wherein: The word segmentation of each training corpus in the training corpus set to obtain the training corpus after word segmentation specifically includes: Obtaining the vocabulary and ciphertext tokens of the first language model; Constructing an encrypted vocabulary of the first language model based on the vocabulary and the ciphertext token; Each training corpus document is segmented using the encrypted vocabulary of the first language model to obtain a segmented training corpus document.
12. An interactive method for a large language model, characterized in that: The encrypted trained large language model is obtained by training the large language model according to any one of claims 1 to 11, wherein the interaction method for the large language model specifically includes: Obtaining user interaction question corpus, wherein private information in the question corpus is represented in ciphertext; The question corpus is input into the encrypted trained large language model, and a response corpus is generated by the encrypted trained large language model, wherein the private information in the response corpus is represented by ciphertext.
13. A large language model training device, characterized in that: The large language model training device specifically includes: An acquisition module is used to acquire an encrypted training corpus set, wherein the encrypted training corpus set includes a plurality of encrypted training corpus documents; a generation module, configured to generate a synthetic corpus based on entities and / or paragraphs in each of the encrypted training corpus documents, and combine the synthetic corpus with the encrypted training corpus to obtain a training corpus, wherein the synthetic corpus is used to improve the first language model's ability to understand encrypted data; A training module, configured to train the first large language model using the training corpus to obtain an encrypted trained large language model; The step of generating a synthetic corpus based on entities in each of the encrypted training corpus documents specifically includes: Extracting the entity set of each of the encrypted training corpus documents; Selecting a plurality of entities from each entity set, and generating a synthetic corpus document based on the plurality of entities selected from each entity set, wherein the synthetic corpus document is a question-answer pair for the plurality of entities and / or a rewritten corpus for the plurality of entities; A synthetic corpus set is determined based on all generated synthetic corpus documents.
14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the training method of the large language model as described in any one of claims 1 to 11, and / or to implement the steps of the interactive method for the large language model as described in claim 12.
15. A terminal device, characterized in that: include: processor and memory; The memory stores a computer-readable program executable by the processor; When the processor executes the computer-readable program, it implements the steps of the training method for a large language model as described in any one of claims 1 to 11, and / or implements the steps of the interaction method for a large language model as described in claim 12.
Citation Information
Patent Citations
Method, system and equipment for protecting data privacy in big language model training
CN118171325A
Data enhancement method and device based on large language model
CN118277645A