Large language model training method and device, interaction method and device, equipment and medium
By generating and combining synthetic corpus of encrypted training corpus, the problem of training data integrity damage caused by privacy data filtering in the prior art is solved, efficient training and accurate prediction of large language models are achieved, and the security of private information is ensured.
Patent Information
- Application Number
- CN202510124828.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-26
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2045-01-26
AI Technical Summary
When training large language models, in order to protect private data, the training text is usually filtered, resulting in impairment of the integrity of the training data, which in turn affects the training effect and prediction accuracy of the model.
By obtaining the encrypted training corpus, a synthetic corpus is generated based on the entities and/or paragraphs in each encrypted training corpus document, and a synthetic corpus is combined with the encrypted training corpus to form a training corpus, and a large language model is trained to ensure the security of private information.
On the basis of ensuring the security of private information, the integrity of the training data is maintained, the training effect and prediction accuracy of large language models are improved, and the model's learning ability of encrypted data is enhanced.
Smart Images

Figure CN119558411A_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] The training of language models (LLMs) usually involves a large amount of user data, which may contain sensitive or private information, such as names, addresses, mobile phone numbers, etc. To solve the problem of private data, the most common method is to filter the training text for private data. By detecting the private information in the text, the text with private information is deleted to prevent the private data from being used to train the large language model. However, this method will damage the integrity of the training data, which will not only lead to a decline in training results, but also may affect the prediction accuracy of the model.
[0003] Therefore the prior art still needs to be improved and enhanced. Summary of the invention
[0004] The technical problem to be solved by the present application is to provide a training method, interaction method, device, equipment and medium for a large language model in view of the deficiencies in the prior art.
[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: Obtaining an encrypted training corpus set, wherein the encrypted training corpus set includes a plurality of encrypted training corpus documents; Generate a synthetic corpus based on entities and / or paragraphs in each of the encrypted training corpus documents; Combining the synthetic corpus with the encrypted training corpus to obtain a training corpus; The first large language model is trained using the training corpus to obtain an encrypted trained large language model.
[0006] The large language model training method, wherein the step of obtaining an encrypted training corpus specifically comprises: 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.
[0007] The training method of the large language model, wherein the step of encrypting the original corpus documents in each original corpus using the key corresponding to each original corpus to obtain the encrypted training corpus set 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.
[0008] The training method of the large language model, wherein the step of generating a synthetic corpus based on entities in each of the encrypted training corpus documents specifically comprises: Extracting the entity set of each of the encrypted training corpus documents; Selecting a number of entities from each of the entity sets, and generating a synthetic corpus document based on the selected entities from each entity set; A synthetic corpus set is determined based on all generated synthetic corpus documents.
[0009] The training method of the large language model, wherein the step of generating a synthetic corpus document based on a number of entities selected from each entity set specifically includes: Input several entities and encrypted training corpus documents corresponding to each entity set into the second largest language model; The synthetic corpus document is outputted through the second largest language model.
[0010] The training method of the large language model, wherein the step of generating a synthetic corpus based on the paragraphs in each of the encrypted training corpus documents specifically comprises: According to the paragraphs in each encrypted training corpus document, several related paragraphs corresponding to the paragraph are selected; 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.
[0011] In the training method of the large language model, the step of screening a number of related paragraphs corresponding to each paragraph in the encrypted training corpus document specifically includes: Get the paragraph correlation 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.
[0012] In the training method of the large language model, the step of obtaining the paragraph correlation 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.
[0013] In the training method of the large language model, the step of screening a number of related 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 respectively contained in the two paragraphs, and the paragraph relevance between the two paragraphs is determined according to the number of identical entities.
[0014] The training method of the large language model, wherein the generating of the synthetic corpus document based on each paragraph and its corresponding several related paragraphs specifically comprises: 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.
[0015] The method for training a large language model, wherein the step of training the first large language model using the training corpus to obtain the encrypted trained large language model specifically comprises: 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 encrypted training.
[0016] The training method of the large language model, wherein the segmentation of each training corpus in the training corpus set to obtain the segmented training corpus specifically includes: Obtaining the vocabulary and ciphertext tokens of the first language model; Constructing an encrypted vocabulary of the first language model according to 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.
[0017] The second aspect of the present application provides an interactive method for a large language model, using the encrypted trained large language model obtained by the training method of the large language model as described above, and the interactive method for the large language model specifically includes: Obtaining a question corpus of user interaction, wherein private information in the question corpus is represented in ciphertext; 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 interacted with the user, and the private information in the response corpus is represented by ciphertext.
[0018] The third aspect of the present application provides a large language model training device, wherein the large language model training device specifically includes: An acquisition module, used to acquire an encrypted training corpus set, wherein the encrypted training corpus set includes a plurality of encrypted training corpus documents; 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; The training module is used to train the first large language model through the training corpus to obtain the encrypted trained large language model.
[0019] A fourth aspect of the present application provides a computer-readable storage medium, which 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 a large language model as described above, and / or to implement the steps of the interactive method for a large language model as described above.
[0020] A fifth aspect of the present application provides a terminal device, comprising: a processor and a 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 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.
[0021] Beneficial effects: Compared with the prior art, the present application provides a training method, interactive method, device, equipment and medium for a large language model, wherein the training method includes obtaining an encrypted training corpus, generating a synthetic corpus based on entities and / or paragraphs in each of the encrypted training corpus documents; training the first large language model through 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 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. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0023] Figure 1 A flowchart of a method for training a large language model provided in an embodiment of the present application.
[0024] Figure 2 A flow chart of the principles of the large language model training method provided in an embodiment of the present application.
[0025] Figure 3 An example flowchart of a method for training a large language model provided in an embodiment of the present application.
[0026] Figure 4 A flow chart of the principles of the interaction method for a large language model provided in an embodiment of the present application.
[0027] Figure 5 An example flowchart of an interactive method for a large language model provided in an embodiment of the present application.
[0028] Figure 6 A functional block diagram of a large language model training device provided in an embodiment of the present application.
[0029] Figure 7 A functional block diagram of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] The embodiments of the present application provide a training method, interactive method, device, equipment and medium for a large language model. In order to make the purpose, technical solution and effect of the present application clearer and more specific, the present application is further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0031] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include 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 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, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0032] 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 those generally understood by those skilled in the art to which this application belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with those in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as here.
[0033] It should be understood that the sequence numbers and sizes of the steps in this embodiment do not mean the order of execution. The execution order 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 the present application.
[0034] After research, it was found that the training of language models (LLMs) usually involves a large amount of user data, which may contain sensitive or private information, such as names, addresses, mobile phone numbers, etc. To solve the problem of private data, the most common method is to filter the training text for private data, by detecting the private information in the text and deleting the text with private information to prevent the private data from being used to train the large language model. Although this method can avoid the direct exposure of sensitive information to a certain extent, the integrity of the original data is damaged due to its overly simple data processing method. This damage may not only reduce the training effect of the large language model, but also affect the prediction accuracy of the large language model due to the loss of key information features. For example, the training corpus with deleted names or phone numbers may cause the large language model to have misunderstandings when processing such information and fail to accurately identify similar patterns.
[0035] 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, which ensures the integrity of the training corpus on the basis of ensuring the security of privacy information, and improves 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, which enhances 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 improves the learning effect of the large language model on the knowledge in the encrypted training corpus documents.
[0036] The application content is further explained below through the description of embodiments in conjunction with the accompanying drawings.
[0037] This embodiment provides a method for training a large language model. Figure 1 , Figure 2 and Figure 3 As shown, the method includes: S10. Obtain an encrypted training corpus.
[0038] Specifically, the encrypted training corpus can be obtained by encrypting the original training corpus. The encrypted training data set may include a number of 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, wherein the original corpus document can be saved in file formats such as json, txt, and pdf. In addition, when encrypting the original training corpus, one key may be used to encrypt all the original corpus documents to obtain the encrypted training corpus, or multiple keys may be used, and each key may be used to encrypt part of the original corpus documents in the original corpus to obtain the encrypted training corpus.
[0039] In practical applications, the original training corpus may include original corpus documents from multiple different users, and the original corpus documents between 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 will be encrypted according to the privacy rights corresponding to the original corpus documents, so that the original corpus documents with different privacy rights are independent of each other.
[0040] Exemplarily, the step of obtaining 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.
[0041] Specifically, the privacy authority is the authority to restrict access to the original corpus document, that is, only users with privacy authority can obtain the original corpus document. For example, the original training corpus set includes original corpus document a and original corpus document b. The privacy authority of original corpus document a is bank a1, and the privacy authority of original corpus document b is bank b1, that is, employees of bank a1 can obtain original corpus document a, and employees of bank b1 can obtain original corpus document b. Therefore, after the original training corpus set is divided into several original corpora according to privacy authority, each original corpus corresponds to a privacy authority, and the privacy authority corresponding to each original corpus is different.
[0042] Furthermore, since the privacy permissions corresponding to each original corpus are different, in order to make each original corpus independent of each other, a different key is configured for each original corpus, and the key configured for each original corpus can be held by one or more users with the privacy permission of the original corpus. Among them, the key configured for each original corpus can be randomly generated, or obtained through interaction with the user, or configured for the original corpus by a user with the privacy permission of each original corpus, etc.
[0043] In one implementation, the step of encrypting the original corpus documents in each original corpus using a key corresponding to each original corpus to obtain an encrypted training corpus set 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.
[0044] Specifically, the private information is the information that needs to be kept confidential in the original corpus document. The private information may include entities in the original corpus document, or may include corpus content specified by the user in the original corpus document, or may include numerical content in the original corpus document, etc. In the implementation of this application, taking the example that the private information includes entities in the original corpus document, entities refer to objects with special meanings in the text, such as names of people, places, names of organizations, etc. Entities are usually fixed words and phrases, which can be automatically identified and classified by entity recognition technology. Entity recognition is an important task in natural language processing, which can help us better understand and analyze entity information in texts. 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 file, or after the entity is encrypted, the encrypted entity and the entity type can be combined to replace the entity in the original corpus file, where the entity type can be a name of a person, an organization name, a place name, a time, a date, an organization name, etc.
[0045] When detecting the privacy information in the original corpus document, the original corpus document is detected for privacy information using entity recognition models and regular expressions to determine the privacy information in the original corpus document. For example, a BERT-based entity detection model is used as an entity recognition model, and the entity recognition model is embedded in the privacy information detection tool Microsoft Predisio. The entity recognition model is used to detect entities in the original corpus document, and entities are selected as privacy information, for example, all entities are used as privacy information, or some entities that need to be kept confidential are used as privacy information.
[0046] 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 encrypted trained large language model interaction. For example, Figure 2 As shown, 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.
[0047] 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 is the ECB mode using the AES encryption algorithm, and the original corpus document is "The home address of witness Zhang San 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 strings are combined with the entity type identifiers to replace the plaintext of the private information in the original corpus document, and the encrypted training corpus document "The home address of witness Person_[bDqAi7+ slxdVeM9V5OAnrg==] is Location_[5q8mKpQV8 / 4Yl4GuZm5FRwsGwQPXP5ztdTkObt6 / IuY=]" is obtained. Among them, "Person" and "Location" are the entity type identifiers, and the Base-64 string in the brackets 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 have key A1 cannot decrypt the private information in the encrypted training corpus documents in the encrypted training corpus document library A*.
[0048] 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, which 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 using the large language model after encryption training, but cannot access the original corpus documents without permissions, thereby avoiding the leakage of privacy content in the original corpus documents of other users. Compared with the situation that the existing privacy protection method 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.
[0049] 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.
[0050] Specifically, the synthetic corpus is used to expand the encrypted training corpus to enhance 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. Among them, the synthetic corpus includes a number of synthetic corpus documents, and the synthetic corpus documents in the number of synthetic corpus documents can all be generated based on entities in the encrypted training corpus documents, or all be generated based on paragraphs in the encrypted training corpus documents, or partly be generated based on entities in the encrypted training corpus documents, and partly be generated based on paragraphs in the encrypted training corpus documents.
[0051] In addition, when the encrypted training corpus is obtained by encrypting an original training corpus including several original corpora with different privacy permissions, since the encrypted training corpus includes several encrypted training corpus document libraries with different privacy permissions, in order to improve the understanding ability of the first language model for each encrypted training corpus document library, a synthetic corpus document library can be generated for each encrypted training corpus document library, and then the collection of all the generated synthetic corpus document libraries is used as the synthetic corpus set. Among them, the generation process of generating a synthetic corpus document for the encrypted training corpus document in each encrypted training corpus document library is the same. For this reason, here we directly take the generation process of the synthetic corpus document from the encrypted training corpus document in the encrypted training corpus set as an example to illustrate the generation process of the synthetic corpus document.
[0052] In one implementation, generating a synthetic corpus based on entities in each of the encrypted training corpus documents specifically includes: S210, extracting the entity set of each of the encrypted training corpus documents; S211, selecting a number of entities from each of the entity sets, and generating a synthetic corpus document based on the selected entities from each entity set; S212: Determine a synthetic corpus set based on all generated synthetic corpus documents.
[0053] Specifically, the entity set can be obtained by performing entity recognition on the encrypted training corpus document, wherein the entity set may include the ciphertext of the privacy entity encrypted by the key and the plaintext of the non-privacy entity not encrypted by the key. That is, the named entity model can be used to extract entities from the encrypted training corpus document to obtain the ciphertext of the privacy entity encrypted by the key and the plaintext of the non-privacy entity not encrypted by the key. For example, the Erlangshen-UniEx-RoBERTa-330M- Chinese model open sourced on Huggingface is used to perform named entity recognition on the encrypted training corpus document. Several entities can be randomly selected from the entity set, or randomly selected from the ciphertext of the privacy entity encrypted by the key in the entity set, wherein the several entities can be one or more. That is, when selecting several entities in each entity set, one or more entities can be randomly selected in each entity set to obtain several entities. It should be noted that when generating a synthetic corpus set, a synthetic corpus document can be generated for each encrypted training corpus document, or a synthetic corpus document can be generated for some encrypted training corpus documents in the encrypted training corpus set. 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.
[0054] The synthetic corpus document is determined based on several entities, and the first language model is allowed to better understand the encrypted training corpus document through the synthetic corpus document, wherein the synthetic corpus document can be a question-answer pair for several entities, or a rewritten corpus of the encrypted training corpus document for several entities. That is to say, after obtaining several entities, question-answer pairs for several entities can be generated based on the encrypted training corpus document, or the encrypted training corpus document can be rewritten for several entities to obtain the rewritten corpus corresponding to the encrypted training corpus document.
[0055] Exemplarily, the generating of synthetic corpus documents based on a number of entities selected from each entity set specifically includes: Input several entities and encrypted training corpus documents corresponding to each entity set into the second largest language model; The synthetic corpus document is outputted through the second largest language model.
[0056] 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 it can be a rewritten document, for example, a rewritten corpus document of an encrypted training corpus document for several entities, etc. That is, the encrypted training corpus document can be rewritten by the second largest language model and / or a question-answer pair for several entities can be generated based on the encrypted training corpus document to generate a synthetic corpus, wherein the question-answer pair includes 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, etc. Based on this, before sending the several entities and the encrypted training corpus document to the second largest language model, a first prompt word is generated based on the several entities and the encrypted training corpus document, and the first prompt word includes a first preset instruction, several entities and the encrypted training corpus document, and the first preset instruction is used to inform the second largest language model of the task to be performed. Of course, in actual applications, the first prompt word may also include several synthetic corpus document examples, and the several synthetic corpus document examples are used as prior knowledge to provide knowledge information for the second largest language model, wherein the encrypted training corpus document in the synthetic corpus document example may have the same privacy authority as the encrypted training corpus document of the synthetic corpus document to be generated.
[0057] For example, suppose the encrypted training corpus document is "The home address of the witness Person_[bDqAi7+slxdVeM9V5OAnrg==] is Location_[5q8mKpQV8 / 4Yl4GuZm5FRwsGwQPXP5ztdTkObt6 / IuY=]", and the entities corresponding to the encrypted training corpus document are "Person_[bDqAi7+slxdVeM9V5OAnrg==", and the task performed by the second language model is to generate question-answer pairs based on the encrypted training corpus. Then the first prompt word can be: First preset instruction: Generate question-answer pairs related to the entity "Person_[bDqAi7+slxdVeM9V5OAnrg=="; Encrypted training corpus document: "The home address of witness Person_[bDqAi7+slxdVeM9V5OAnrg==] is Location_[5q8mKpQV8 / 4Yl4GuZm5FRwsGwQPXP5ztdTkObt6 / IuY=]"; Several entities: "Person_[bDqAi7+slxdVeM9V5OAnrg==".
[0058] The second largest language model generates the following question-answer pair based on the first prompt word: Question: Where does Person_[bDqAi7+slxdVeM9V5OAnrg==] live? Answer: "Person_[bDqAi7+slxdVeM9V5OAnrg==] lives at Location_[5q8mKpQV8 / 4Yl4GuZm5FRwsGwQPXP5ztdTkObt6 / IuY=]".
[0059] In one implementation, generating a synthetic corpus based on paragraphs in each of the encrypted training corpus documents specifically includes: S220, screening a number of related paragraphs corresponding to each paragraph in the encrypted training corpus document; S221, generating a synthetic corpus document based on each paragraph and its corresponding related paragraphs; S222: Determine a synthetic corpus set based on all generated synthetic corpus documents.
[0060] 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 in the encrypted training corpus document for the paragraphs in the encrypted training corpus document. Among them, when selecting several related paragraphs in the encrypted training corpus document for the paragraphs 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 paragraphs in the encrypted training corpus document. In addition, the number of the several related paragraphs corresponding to the paragraph can be preset, or it can be determined according to the number of paragraphs included in the encrypted training corpus document, or it can be randomly generated, etc. Here, the number of related paragraphs and the determination method are not specifically limited, as long as the relevant paragraphs can be selected for the paragraph.
[0061] Exemplarily, the step of screening a plurality of related paragraphs corresponding to each paragraph in each encrypted training corpus document specifically includes: Get the paragraph correlation 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.
[0062] Specifically, paragraph relevance is used to reflect the similarity between paragraphs. The higher the paragraph relevance, the higher the similarity between the two paragraphs. Conversely, the lower the paragraph relevance, the lower the similarity between the two paragraphs. The paragraph relevance can be determined based on the relevance of the semantic information of the two paragraphs, based on the entities contained in the two paragraphs, based on the keywords in the paragraphs, etc.
[0063] In one implementation, obtaining the paragraph correlation 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.
[0064] Specifically, sentence vector is used to reflect the semantic information of paragraph, and sentence vector can be obtained by text vector model, that is, paragraph is input into text vector model, and sentence vector of paragraph is output by text vector model. After obtaining sentence vector of paragraph, the similarity between sentence vectors corresponding to two paragraphs is calculated to determine the semantic similarity between two paragraphs, for example, the semantic similarity between two paragraphs can be determined by calculating the covariance between two sentence vectors, or the semantic similarity between two paragraphs can be determined by calculating the cosine similarity between two sentence vectors. 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 practical application, the semantic similarity can also be adjusted by interacting with users, and the adjusted semantic similarity can be used as the paragraph correlation between two paragraphs.
[0065] In another implementation, the step of screening a plurality of related 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 respectively contained in the two paragraphs, and the paragraph relevance between the two paragraphs is determined according to the number of identical entities.
[0066] Specifically, the entities included in the paragraph can be identified by an entity recognition model, which is the same as the identification method of the entities included 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 the two 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 larger the number of the same entities between the two paragraphs, the higher the paragraph correlation between the two paragraphs, and vice versa, 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, the paragraph correlation corresponding to the number of the same entities is determined by the mapping relationship between the preset number of the same entities and the paragraph correlation, so as to obtain the paragraph correlation between the two paragraphs, etc.
[0067] It should be noted that when determining paragraph relevance, a paragraph relevance may be determined based on semantic similarity, and then a paragraph relevance may be determined based on the number of identical entities, and finally the two paragraph relevances may be weighted to determine the final paragraph relevance between the two paragraphs.
[0068] After obtaining the paragraph correlation between any two paragraphs, several related paragraphs can be selected for the paragraph in order of paragraph correlation from high to low, so that the paragraph correlation between several related paragraphs is high. In this way, several related paragraphs can be made more similar to each other, so that when generating synthetic corpus documents based on 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.
[0069] Further, in step S221, when determining a synthetic corpus document based on a paragraph and its corresponding several related paragraphs, the paragraph and the paragraph overview of the several related paragraphs can be used as the synthetic corpus document, and the question-answer pair for the paragraph and its corresponding several related paragraphs can also be used as the synthetic corpus document, that is, the synthetic corpus document includes the paragraph overview of the paragraph text and / or the question-answer pair for the paragraph text. Based on this, the generation of the synthetic corpus document based on each paragraph and its corresponding several 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.
[0070] 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.
[0071] After forming the paragraph text, the paragraph text is sent to the third language model to output a synthetic corpus document based on the paragraph text through the third language model. Wherein, the synthetic corpus document may include a paragraph overview and / or a question-answer pair for the paragraph text. That is to say, the paragraph overview corresponding to the paragraph text can be generated by the third language model, and a question-answer pair for the paragraph text can also be generated. For this reason, before the paragraph text is sent to the third language model, a second prompt word will be generated based on the paragraph text, the second prompt word includes a second preset instruction and the paragraph text, and 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 practical applications, the second prompt word may also include several synthetic corpus document examples, and 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 authority as the encrypted training corpus document to which the paragraph text of the synthetic corpus document to be generated belongs.
[0072] For example, the paragraph text is "The home address of the witness Person_[bDqAi7+slxdVeM9V5OAnrg==] is Location_[5q8mKpQV8 / 4Yl4GuZm5FRwsGwQPXP5ztdTkObt6 / IuY=]", "The home address of the victim Person_[slxsdF Rw7sGwQnr58bTmKpQ=] is Location_[5q8mKpQV8 / 4Yl4GuZm5FRwsGwQPXP5ztdTk Obt6 / IuY=]"; the synthesis task is to generate a question-answer pair for the paragraph text. Then the second prompt word can be: The second preset instruction: generating a question-answer pair for the paragraph text; 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=]".
[0073] The question-answer pairs generated by the third largest language model are: Question: Did the witness Person_[bDqAi7+slxdVeM9V5OAnrg==] and the victim Person_[slxsdFRw7sGwQ nr58bTmKpQ=] live together? Answer: Yes, they all live in Location_[5q8mKpQV8 / 4Yl4GuZm5FRwsGwQPXP5ztdTkObt6 / IuY=]”.
[0074] 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 learning effect of the model 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.
[0075] S30: training the first large language model using the training corpus to obtain an encrypted trained large language model.
[0076] Specifically, the training corpus is used as a knowledge base of the first large language model, and the first large language model is trained by the training corpus so that the first large language model learns the knowledge information included in the training corpus. When the training corpus is used to train the first large language model, 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 be first segmented, and then the first large language model can be trained based on the segmented training corpus.
[0077] Exemplarily, the training of the first large language model by 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 encrypted training.
[0078] Specifically, the training corpus in the training corpus set may be an encrypted training corpus document, or a synthetic corpus document generated based on the encrypted training corpus document. Segmenting the training corpus means splitting the training corpus into words, so as to split the training corpus into several words, wherein the segmentation may be based on a string matching method or a statistical method.
[0079] In one implementation, the segmenting each training corpus in the training corpus set to obtain the segmented training corpus specifically includes: Obtaining the vocabulary and ciphertext tokens of the first language model; Constructing an encrypted vocabulary of the first language model according to 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.
[0080] Specifically, the first language model includes a vocabulary, and the word segmenter of the first language model performs word segmentation processing on the training corpus based on the vocabulary. That is to say, the first language model will decompose the training corpus into different tokens according to the vocabulary in the first language model. For example: "b is behind a" will be decomposed into "b", "in", "a", and "behind". The vocabulary is a dictionary containing various tokens.
[0081] In one implementation, a ciphertext token is added to the vocabulary of the first largest 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, which is used to represent the ciphertext in the training corpus, and the encrypted vocabulary contains ciphertext tokens and plaintext tokens. In other words, the encrypted vocabulary of the first largest language model includes ciphertext tokens and plaintext tokens, wherein the ciphertext tokens are used to represent the ciphertext in the training corpus (i.e., the 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 largest language model will not be destroyed when the first largest language model learns the ciphertext, and the encrypted vocabulary in the first largest language model can also be used to directly perform word segmentation processing on all the training corpus in the training corpus. For example, the word segmentation process of the training corpus in each training corpus document is performed by 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 by 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 the 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 process on all the training corpus in the training corpus.
[0082] 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, and the interactive method for a large language model specifically includes: Obtaining a question corpus of user interaction, 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.
[0083] Specifically, Figure 4 and Figure 5As shown, the question corpus is the user's interaction with the encrypted and trained large language model. The question corpus can be an encrypted question corpus or an unencrypted question corpus. When the question corpus is an encrypted question corpus, the private information in the question corpus is represented by ciphertext, wherein the private information in the question corpus is included in the private information included in the training corpus. For example, if the private information included in the training corpus includes Zhang San and the address information of Zhang San's home, then the private information in the question corpus can be Zhang San or the address information of Zhang San's home.
[0084] To this end, before sending the question corpus to the encrypted and trained large language model, it will first be detected whether the user has the key. If the user has the key, the key will be used to encrypt the private information in the question corpus. If the user does not have the key, 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, 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 ask whether the private information in the question corpus needs to be encrypted.
[0085] Furthermore, since the private information of the training corpus in the training corpus is encrypted during the training process 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 answer corpus corresponding to the question corpus after the private information in the question corpus is encrypted using the same encryption method as in the training corpus document in the training corpus. This means that only users who have the privacy rights for the private information in the question corpus and the keys corresponding to the privacy rights can effectively query and ask questions about the private information in the question corpus, further improving the security of the private information.
[0086] In addition, the reply corpus may contain private information included in the training corpus, and when the reply corpus contains private information, the private information is expressed in ciphertext. That is, the private information in the question corpus and the private information in the reply corpus are both included in the private information included in the training corpus, and the information content of the private information in the question corpus may be different from the information content of the private information in the reply corpus. For example, suppose that "Witness Zhang San's home address is XXX" is used as a training corpus document to encrypt "Zhang San" and "XXX", and the question corpus is "Where is Zhang San's address?" Then, if the question corpus is input into the encrypted and trained large language model in plain text form as "Where is Zhang San's address?", the encrypted and trained large language model cannot effectively answer it. Instead, it is necessary to encrypt "Zhang San" in the question corpus to obtain the encrypted question corpus "Where is the address of Person_ [bDqAi7+slxdVeM9V5OAnrg==]" and the encrypted and trained large language model can effectively answer it to obtain the reply corpus. Moreover, the "XXX" in the reply corpus is represented by ciphertext, so that when the user does not have the privacy permission for the corpus "Witness Zhang San's home address is XXX", he cannot have the correct key, and therefore cannot correctly encrypt the private information "Zhang San" or obtain the address information of "XXX", thereby avoiding the leakage of private information caused during the reasoning process.
[0087] Furthermore, when the private information in the question corpus is expressed in ciphertext, since the private information of the training corpus is encrypted in 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 interacts the reply corpus with the private information expressed in ciphertext to the user, so that the user uses the key owned locally to decrypt the reply corpus. For example, the ciphertext in the reply corpus can be detected by regularization method in the user's local area, and then the ciphertext is decrypted using the key owned, and finally the plaintext corpus corresponding to the reply corpus is obtained. The present application can avoid the leakage of private information in the reply corpus during the transmission process by directly transmitting the reply corpus with 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.
[0088] 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 interacted with the user, and the response corpus is decrypted using the key owned by the user to obtain the plaintext corpus "Zhang San's home address is XXX".
[0089] The embodiment of the present application receives a question corpus in encrypted form interacted by a user, uses a large language model that has been encrypted and trained to generate a reply corpus in which private information is represented by ciphertext, and directly interacts the reply corpus in which the private information is represented by ciphertext tokens to the user. This not only prevents the private information from being leaked during transmission, but also prevents the 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 the private information.
[0090] Based on the above large language model training method, the present 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: An acquisition module 100 is used to acquire an encrypted training corpus set, wherein the encrypted training corpus set includes a plurality of encrypted training corpus documents; A generating module 200, configured to generate a synthetic corpus based on entities and / or paragraphs in each of the encrypted training corpus documents, and to combine the synthetic corpus with the encrypted training corpus to obtain a training corpus; 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.
[0091] 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.
[0092] 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, and may also include a communications interface 23 and a bus 24. The processor 20, the display screen 21, the memory 22, and the communications interface 23 may communicate with each other through the bus 24. The display screen 21 is configured to display a preset user guide interface in the initial setting mode. The communications interface 23 may transmit information. The processor 20 may call the logic instructions in the memory 22 to execute the method in the above embodiment.
[0093] 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.
[0094] The memory 22 is a computer-readable storage medium that can be configured to store software programs, computer executable programs, such as program instructions or modules corresponding to the methods in the embodiments of the present disclosure. The processor 20 executes functional applications and data processing by running the software programs, instructions or modules stored in the memory 22, that is, implementing the methods in the above embodiments.
[0095] The memory 22 may include a program storage area and a data storage area, wherein 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 according to the use of the terminal device, etc. In addition, the memory 22 may include a high-speed random access memory and may also include a non-volatile memory. For example, a variety of media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, may also be a transient storage medium.
[0096] In addition, the specific process of loading and executing the multiple instruction processors in the above-mentioned storage medium and the terminal device has been described in detail in the above-mentioned method, and will not be described one by one here.
[0097] 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 it. 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 set, wherein the encrypted training corpus set includes a plurality of encrypted training corpus documents; Generate a synthetic corpus based on entities and / or paragraphs in each of the encrypted training corpus documents; Combining the synthetic corpus with the encrypted training corpus to obtain a training corpus; The first large language model is trained using the training corpus to obtain an encrypted trained large language model.
2. The method for training a large language model 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 method for training a large language model 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 set 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 method for training a large language model according to claim 1, characterized in that: The generating of 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 number of entities from each of the entity sets, and generating a synthetic corpus document based on the selected entities from each entity set; A synthetic corpus set is determined based on all generated synthetic corpus documents.
5. The method for training a large language model according to claim 4, characterized in that: The step of generating a synthetic corpus document based on a number of entities selected from each entity set specifically includes: Input several entities and encrypted training corpus documents corresponding to each entity set into the second largest language model; The synthetic corpus document is outputted through the second largest language model.
6. The method for training a large language model according to claim 1, characterized in that: The generating of a synthetic corpus based on the paragraphs in each of the encrypted training corpus documents specifically comprises: According to the paragraphs in each encrypted training corpus document, several related paragraphs corresponding to the paragraph are selected; 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.
7. The method for training a large language model according to claim 6, characterized in that: The step of selecting a number of related paragraphs corresponding to each paragraph in the encrypted training corpus document specifically includes: Get the paragraph correlation 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.
8. The method for training a large language model according to claim 7, characterized in that: The step of obtaining the paragraph correlation 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.
9. The method for training a large language model according to claim 6, characterized in that: The step of selecting a number of related 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 respectively contained in the two paragraphs, and the paragraph relevance between the two paragraphs is determined according to the number of identical entities.
10. The method for training a large language model according to claim 6, characterized in that: The generating of the synthetic corpus document based on each paragraph and its corresponding several 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.
11. The method for training a large language model according to any one of claims 1 to 10, characterized in that: The training of the first large language model by the training corpus to obtain the encrypted 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 encrypted training.
12. The method for training a large language model according to claim 11, characterized in that: 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 according to 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.
13. 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 12, and the interactive method for the large language model specifically includes: Obtaining a question corpus of user interaction, 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.
14. A training device for a large language model, characterized in that: The large language model training device specifically includes: An acquisition module, used to acquire an encrypted training corpus set, wherein the encrypted training corpus set includes a plurality of encrypted training corpus documents; 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; The training module is used to train the first large language model through the training corpus to obtain the encrypted trained large language model.
15. 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-12, and / or to implement the steps of the interactive method for the large language model as described in claim 13.
16. 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 12, and / or implements the steps of the interactive method for a large language model as described in claim 13.
Citation Information
Patent Citations
Synthetic corpus generation method and device
CN114648033A
Knowledge question-answering method, knowledge question-answering system, storage medium and computer equipment
CN117688580A
Large model encryption method and device, equipment and storage medium
CN117768219A
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
Cited By
Encryption enhancement generation method and system applying large language model, and program product
CN120337268A
Encryption enhancement generation method, system and program product using large language model
CN120337268B