Incremental pre-training method of large language model
Through recursive data collection and hierarchical training, it solves the problem of poor performance of large-scale language models on Chinese tasks, achieves a more efficient and stable incremental pre-training process, and avoids catastrophic forgetting and incomplete data sets. A question of balance.
Patent Information
- Application Number
- CN202411260420.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2024-10-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing large-scale language models perform poorly on Chinese language generation tasks, mainly due to the lack of sufficient Chinese training data and the difficulty in obtaining high-quality data sets, resulting in a time-consuming and resource-intensive training process, and are prone to problems during incremental pre-training. Catastrophic forgetting problem and uneven distribution of data sets.
It adopts technical means such as recursive data collection, MinHash deduplication, data translation, byte pair encoding vocabulary generation and expansion, hierarchical fixed training, experience buffer pool and experience playback, and learning rate warm-up and annealing to form a large-scale Incremental pre-training method for language models, automatically collects and deduplicates data, and stabilizes the training process through hierarchical training and priority playback.
It is possible to generate more training samples from the model itself, avoid catastrophic forgetting, improve training stability and efficiency, solve the problem of uneven distribution of data sets, and improve the performance of the model in Chinese tasks.
Smart Images

Figure CN118798218A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and in particular to an incremental pre-training method for a large language model. Background Art
[0002] In recent years, large-scale pre-trained language models have achieved remarkable results in the field of natural language processing. These models are pre-trained on a large amount of text data through unsupervised learning, and can be subsequently adapted to specific downstream tasks through fine-tuning. However, training a large-scale language model from scratch is very time-consuming and resource-intensive, usually requiring a lot of computing resources and a long training cycle.
[0003] In order to reduce time and resource costs, researchers often use existing open source or commercial pre-trained models as baselines. However, most open source models are mainly trained on English corpora, which means they may encounter challenges when dealing with Chinese and other non-English language tasks. In particular, due to the lack of sufficient Chinese training data, these models often perform poorly on Chinese generation tasks.
[0004] To improve this situation, researchers have explored different methods to enhance the model's ability to process Chinese, while also trying to introduce expertise from other fields. An effective way is through incremental pre-training, that is, using additional data for further training based on the existing pre-trained model to improve the model's performance in a specific field. However, obtaining high-quality Chinese training data remains a major challenge.
[0005] On the one hand, there are relatively few Chinese datasets suitable for training; on the other hand, manually creating or annotating high-quality Chinese datasets requires a lot of time and human resources, and is costly.
[0006] In order to solve the above problems, obtain more training samples, and improve the stability and efficiency of the training process, the present invention proposes an incremental pre-training method for a large language model. Summary of the invention
[0007] In order to overcome the defects of the prior art, the present invention provides a simple and efficient incremental pre-training method for a large language model.
[0008] The present invention is achieved through the following technical solutions: A method for incremental pre-training of a large language model, characterized in that it comprises the following steps: Step S1, recursive data collection; Customize domain nouns and design prompts to generate relevant questions from the big language model; send the combined nouns and questions to the big language model to generate answers, and store the answers; set prompts to re-extract key nouns from the questions; repeat the above process to obtain questions, and generate a tree structure from top to bottom; Step S2, deduplication of data; The MinHash algorithm is used to estimate the similarity between texts. If the absolute value of the difference between the MinHash values of two texts is less than a custom threshold, the two texts are considered duplicates, and one of the texts is retained and the other is deleted to achieve data deduplication. Step S3: data translation; Use the translation model to translate English data into Chinese data and store it; then merge the English data, translated Chinese data, and self-built data set as an incremental pre-training data set; Step S4, generation and expansion of vocabulary; Using the Byte Pair Encoding (BPE) algorithm, a new vocabulary is trained using the incremental pre-training dataset and added to the vocabulary until the custom threshold of the number of vocabularies is reached; the generated vocabulary is then merged with the original vocabulary; Step S5: model dimension adjustment and parameter initialization; Re-adjust the dimensions of the word embedding layer and output layer of the large language model according to the size of the merged vocabulary to keep it consistent with the number of new vocabulary; New word embedding matrix , initialized by the following formula: ; Among them, matrix E is the original word embedding matrix, and matrix R is a randomly initialized matrix used to represent the newly added words; Step S6: hierarchical fixed training; Adopt layer-fixed training, fix other layers each time, and focus on training one type of layer; and so on, until all layers are trained; Step S7, experience buffer pool and experience playback; Calculate the loss function value of each batch of data , the loss function value The higher the value, the higher the data priority of the corresponding batch. During the training process, you can customize the experience buffer pools with different priorities and place each batch of batch data into the experience buffer pool with the corresponding priority. Every k update steps, a batch of data is randomly extracted from the experience buffer pool for training as experience playback, the experience buffer pool with high priority is extracted first, and the corresponding batch of data is removed from the experience buffer pool; Step S8: Set learning rate warm-up and annealing to ensure training stability.
[0009] In step S1, the implementation process of recursive data collection is as follows: Step S1.1: Customize the keyword set according to the needs, denoted as ,in A noun represents a field, and n is the total number of fields in the set U; Step S1.2: Use the API of the large language model to obtain the set of m questions corresponding to each field through the set prompt, denoted as ; Combine n fields with m questions respectively to generate n*m questions; Step S1.3, sending n*m questions as prompt words to the large language model, and saving the returned results locally as pre-training data; Step S1.4: After completing an epoch, set a prompt so that the large language model can extract a noun for each answer and put the extracted noun into the set middle; Step S1.5, execute the above steps again to obtain the problem, obtain data from the whole to the specific, and the overall data is a tree structure.
[0010] In step S4, all characters in the vocabulary are initialized, the frequencies of occurrence of adjacent words in the vocabulary are counted, the words with the highest frequency are selected for merging, and added to the vocabulary as a new word, and the above steps are repeated until the custom threshold of the number of words in the vocabulary is reached; The generated vocabulary is then merged with the original vocabulary. When merging the vocabulary, only the word units that are not in the original vocabulary are added, and the newly added word units are placed after the original vocabulary to avoid destroying the index of each word unit in the original vocabulary.
[0011] In step S7, three levels of experience buffer pools are set for priority experience playback. The three experience buffer pools are respectively , and , with priorities from high to low; Calculate the loss function value of each batch of batch data , and the average loss of all batches of batch data in each epoch ; If the loss function value , add the batch of batch data to the experience buffer pool middle; If the loss function value , add the batch of batch data to the experience buffer pool middle; If the loss function value , add the batch of batch data to the experience buffer pool middle; Among them, the coefficient 1.
[0012] In step S7, when a batch of batch data is randomly selected from the experience buffer pool for training as experience playback, the experience buffer pool , Experience Buffer Pool Experience Buffer Pool The probabilities of being selected are 50%, 30% and 20% respectively.
[0013] In step S8, at the beginning of each epoch, the learning rate increases from the minimum value to the maximum value. Increases linearly to a preset maximum value ; At the end of each epoch, the learning rate is reduced from the maximum value Reduce to minimum ; The learning rate adjustment formula is expressed as:
[0014] Where x is the index of the current update step and X is the total number of update steps in the epoch.
[0015] An incremental pre-training system for a large language model, comprising: The recursive data collection module is responsible for customizing domain nouns, designing prompts to generate relevant questions from the large language model; sending the combined nouns and questions to the large language model to generate answers, and storing the answers; setting prompts to re-extract key nouns from the questions; repeating the above process to obtain questions, and generating a tree structure from top to bottom; The data deduplication module is responsible for estimating the similarity between texts using the MinHash algorithm. If the absolute value of the difference between the MinHash values of two texts is less than a custom threshold, the two texts are considered duplicates, and one of them is retained and the other is deleted to achieve data deduplication. The data translation module is responsible for using the translation model to translate English data into Chinese data and store it; then the English data, the translated Chinese data, and the self-built data set are merged as an incremental pre-training data set; The vocabulary generation and expansion module is responsible for training new vocabulary using the incremental pre-training dataset using the Byte Pair Encoding (BPE) algorithm, and adding new vocabulary to the vocabulary until the custom threshold of vocabulary number is reached; then the generated vocabulary is merged with the original vocabulary; The model dimension adjustment and parameter initialization module is responsible for re-adjusting the dimensions of the word embedding layer and output layer of the large language model according to the size of the merged vocabulary to keep it consistent with the number of new vocabulary; the new word embedding matrix , through the formula Initialize the original word embedding matrix E, where the matrix R is a randomly initialized matrix used to represent the newly added words; The hierarchical fixed training module is responsible for adopting hierarchical fixed training, fixing other layers each time and focusing on training one type of layer; and so on, until all layers are trained; The experience buffer pool and experience replay module are responsible for calculating the loss function value of each batch of data , the loss function value The higher the value, the higher the data priority of the corresponding batch. During the training process, you can customize the experience buffer pools with different priorities and place each batch of batch data into the experience buffer pool with the corresponding priority. Every k update steps, a batch of data is randomly extracted from the experience buffer pool for training as experience playback, the experience buffer pool with high priority is extracted first, and the corresponding batch of data is removed from the experience buffer pool; The learning rate warmup and annealing module is responsible for setting the learning rate warmup and annealing to ensure training stability.
[0016] An incremental pre-training device for a large language model, characterized in that it includes a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the above method when executing the computer program.
[0017] A readable storage medium, characterized in that: a computer program is stored on the readable storage medium, and the computer program implements the above method when executed by a processor.
[0018] The beneficial effects of the present invention are: the incremental pre-training method of the large language model can not only recursively obtain more training samples from the data generated by the model itself, but also avoid the catastrophic forgetting problem during incremental training, perform multiple playback training on rare data, make the training more stable, and avoid the problem of uneven distribution of data sets. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Attached Figure 1 Schematic diagram of the incremental pre-training method of the large language model of the present invention. DETAILED DESCRIPTION
[0021] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0022] As attached Figure 1 As shown, the incremental pre-training method of the large language model includes the following steps: Step S1, recursive data collection; Customize domain nouns and design prompts to generate relevant questions from the big language model; send the combined nouns and questions to the big language model to generate answers, and store the answers; set prompts to re-extract key nouns from the questions; repeat the above process to obtain questions, and generate a tree structure from top to bottom; Step S2, deduplication of data; The MinHash algorithm is used to estimate the similarity between texts. If the absolute value of the difference between the MinHash values of two texts is less than a custom threshold, the two texts are considered duplicates, and one of the texts is retained and the other is deleted to achieve data deduplication. Step S3: data translation; Use the translation model to translate English data into Chinese data and store it; then merge the English data, translated Chinese data, and self-built data set as an incremental pre-training data set; Step S4, generation and expansion of vocabulary; Use the Byte Pair Encoding (BPE) algorithm to train a new vocabulary using an incremental pre-training dataset, and add the new vocabulary to the vocabulary until the custom threshold of the number of vocabularies is reached; then merge the generated vocabulary with the original vocabulary; Step S5: model dimension adjustment and parameter initialization; Re-adjust the dimensions of the embedding layer and output layer of the large language model according to the size of the merged vocabulary to keep it consistent with the number of new vocabulary; New word embedding matrix , initialized by the following formula: ; Among them, matrix E is the original word embedding matrix, and matrix R is a randomly initialized matrix used to represent the newly added words; Step S6: hierarchical fixed training; Adopt layer-fixed training, fix other layers each time, and focus on training one type of layer; and so on, until all layers are trained; Step S7, experience buffer pool and experience playback; Calculate the loss function value of each batch of data , the loss function value The higher the value, the higher the data priority of the corresponding batch. During the training process, you can customize the experience buffer pools with different priorities and place each batch of batch data into the experience buffer pool with the corresponding priority. Every k update steps, a batch of data is randomly extracted from the experience buffer pool for training as experience playback, the experience buffer pool with high priority is extracted first, and the corresponding batch of data is removed from the experience buffer pool; Step S8: Set learning rate warm-up and annealing to ensure training stability.
[0023] The collected content is all in English, so the input content also needs to be in English, the purpose is to extract data from the original model. In step S1, the implementation process of recursive data collection is as follows: Step S1.1: Customize a keyword set according to the needs. The content of this set is mainly field names, such as medical, energy, mechanical engineering, etc. ,in A noun represents a field, and n is the total number of fields in the set U; Step S1.2, using the application interface API of the large language model, through the set prompt, for example: "In the field of {domain noun}, list m questions, each question should contain {domain name}, and {domain noun} should be wrapped with [ ]". Get the set of m questions corresponding to each field, recorded as ; Combine n fields with m questions respectively to generate n*m questions; Step S1.3, sending n*m questions as prompt words to the large language model, and saving the returned results locally as pre-training data; Step S1.4: After completing an epoch, set a prompt so that the large language model can extract a noun for each answer and put the extracted noun into the set middle; Step S1.5, execute the above steps again to obtain the problem, obtain data from the whole to the specific, and the overall data is a tree structure.
[0024] Data collection without human intervention will have some duplication, which needs to be deduplicated. In step S2, the MinHash algorithm is used to dedupe the collected question set; The MinHash algorithm maps text to a smaller numerical space through a hash function, and then compares these numerical values to estimate the similarity between texts; Set text collection , the MinHash function is , then the MinHash value is calculated by the following formula:
[0025] Where w is the number of hash functions, The jth hash function.
[0026] For each piece of data, calculate its MinHash value.
[0027] Set a similarity threshold If the absolute value of the difference between the MinHash values of the two texts is less than , the two texts are considered duplicates, one is kept and the other is deleted.
[0028] Suppose the original text set is In step S4, all possible characters in the vocabulary are initialized, the frequencies of occurrence of adjacent words in the vocabulary are counted, the words with the highest frequency are selected for merging, and added to the vocabulary as a new word, and the above steps are repeated until the custom threshold of the number of words is reached; The generated vocabulary is then merged with the original vocabulary. When merging the vocabulary, only the word units that are not in the original vocabulary are added, and the newly added word units are placed after the original vocabulary to avoid destroying the index of each word unit in the original vocabulary.
[0029] In step S6, the model is divided into multiple layers, such as a linear layer D, an activation layer A, a normalization layer V, etc. During the training process, the following strategies can be adopted: In the first training stage, the linear layer D, the normalization layer V and other layers are frozen, and only the activation layer A is trained.
[0030] In the second training stage, the activation layer A, linear layer D and other layers are frozen, and only the normalization layer V is trained.
[0031] And so on, until all layers are trained.
[0032] In step S7, three levels of experience buffer pools are set for priority experience playback. The three experience buffer pools are respectively , and , with priorities from high to low; Calculate the loss function value of each batch of batch data , and the average loss of all batches of batch data in each epoch ; If the loss function value , add the batch of batch data to the experience buffer pool middle; If the loss function value , add the batch of batch data to the experience buffer pool middle; If the loss function value , add the batch of batch data to the experience buffer pool middle; Among them, the coefficient 1.
[0033] In step S7, when a batch of batch data is randomly selected from the experience buffer pool for training as experience playback, the experience buffer pool , Experience Buffer Pool Experience Buffer Pool The probabilities of being selected are 50%, 30% and 20% respectively.
[0034] An epoch refers to the process of completing a forward propagation and a backward propagation on the entire training data set. In short, an epoch means that the model traverses the entire data set once.
[0035] The update step (also called iteration) refers to the process of training a batch each time in an epoch, including forward propagation, loss calculation, back propagation, and parameter update.
[0036] A batch refers to a group of samples that are input into the model at one time, and the batch size refers to the number of samples in this group, that is, the number of samples input into the network each time training.
[0037] In step S8, at the beginning of each epoch, the learning rate increases from the minimum value to the maximum value. Increases linearly to a preset maximum value ; At the end of each epoch, the learning rate is reduced from the maximum value Reduce to minimum ; The learning rate adjustment formula is expressed as:
[0038] Where x is the index of the current update step and X is the total number of update steps in the epoch.
[0039] The incremental pre-training system of the large language model includes: The recursive data collection module is responsible for customizing domain nouns, designing prompts to generate relevant questions from the large language model; sending the combined nouns and questions to the large language model to generate answers, and storing the answers; setting prompts to re-extract key nouns from the questions; repeating the above process to obtain questions, and generating a tree structure from top to bottom; The data deduplication module is responsible for estimating the similarity between texts using the MinHash algorithm. If the absolute value of the difference between the MinHash values of two texts is less than a custom threshold, the two texts are considered duplicates, and one of them is retained and the other is deleted to achieve data deduplication. The data translation module is responsible for using the translation model to translate English data into Chinese data and store it; then the English data, the translated Chinese data, and the self-built data set are merged as an incremental pre-training data set; The vocabulary generation and expansion module is responsible for training new vocabulary using the incremental pre-training dataset using the Byte Pair Encoding (BPE) algorithm, and adding new vocabulary to the vocabulary until the custom threshold of vocabulary number is reached; then the generated vocabulary is merged with the original vocabulary; The model dimension adjustment and parameter initialization module is responsible for re-adjusting the dimensions of the word embedding layer and output layer of the large language model according to the size of the merged vocabulary to keep it consistent with the number of new vocabulary; the new word embedding matrix , through the formula Initialize the original word embedding matrix E, where the matrix R is a randomly initialized matrix used to represent the newly added words; The hierarchical fixed training module is responsible for adopting hierarchical fixed training, fixing other layers each time and focusing on training one type of layer; and so on, until all layers are trained; The experience buffer pool and experience replay module are responsible for calculating the loss function value of each batch of data , the loss function value The higher the value, the higher the data priority of the corresponding batch. During the training process, you can customize the experience buffer pools with different priorities and place each batch of batch data into the experience buffer pool with the corresponding priority. Every k update steps, a batch of data is randomly extracted from the experience buffer pool for training as experience playback, the experience buffer pool with high priority is extracted first, and the corresponding batch of data is removed from the experience buffer pool; The learning rate warmup and annealing module is responsible for setting the learning rate warmup and annealing to ensure training stability.
[0040] The incremental pre-training device of the large language model includes a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the above method when executing the computer program.
[0041] The readable storage medium stores a computer program, and the computer program implements the above method when executed by a processor.
[0042] In summary, compared with the existing technology, the incremental pre-training method of the large language model has the following characteristics: First, a new data collection method was established, which automatically collects data from the model recursively and forms a tree-like data structure. More training samples can be recursively obtained from the data generated by the model itself.
[0043] Second, an incremental pre-training hierarchical training method is proposed, which fixes certain layers for training and only updates the remaining parts, avoiding the catastrophic forgetting problem during incremental training.
[0044] Third, an experience buffer pool and experience replay strategy are proposed to perform multiple replay training on rare data, making the training stable and avoiding the problem of uneven distribution of data sets.
[0045] The embodiment described above is only one specific implementation of the present invention. Common changes and substitutions made by those skilled in the art within the scope of the technical solution of the present invention should be included in the protection scope of the present invention.
Claims
1. An incremental pre-training method for large language models, Features: The following steps are involved: Step S1, recursive data collection; Customize domain nouns and design prompts to generate relevant questions from the big language model; send the combined nouns and questions to the big language model to generate answers, and store the answers; set prompts to re-extract key nouns from the questions; repeat the above process to obtain questions, and generate a tree structure from top to bottom; Step S2, deduplication of data; The MinHash algorithm is used to estimate the similarity between texts. If the absolute value of the difference between the MinHash values of two texts is less than a custom threshold, the two texts are considered duplicates, and one of the texts is retained and the other is deleted to achieve data deduplication. Step S3: data translation; Use the translation model to translate English data into Chinese data and store it; then merge the English data, translated Chinese data, and self-built data set as an incremental pre-training data set; Step S4, generation and expansion of vocabulary; Using the Byte Pair Encoding (BPE) algorithm, a new vocabulary is trained using the incremental pre-training dataset and added to the vocabulary until the custom threshold of the number of vocabularies is reached; the generated vocabulary is then merged with the original vocabulary; Step S5: model dimension adjustment and parameter initialization; Re-adjust the dimensions of the word embedding layer and output layer of the large language model according to the size of the merged vocabulary to keep it consistent with the number of new vocabulary; New word embedding matrix , initialized by the following formula: ; Among them, matrix E is the original word embedding matrix, and matrix R is a randomly initialized matrix used to represent the newly added words; Step S6: hierarchical fixed training; Adopt layer-fixed training, fix other layers each time, and focus on training one type of layer; and so on, until all layers are trained; Step S7, experience buffer pool and experience playback; Calculate the loss function value of each batch of data , the loss function value The higher the value, the higher the data priority of the corresponding batch. During the training process, you can customize the experience buffer pools with different priorities and place each batch of batch data into the experience buffer pool with the corresponding priority. Every k update steps, a batch of data is randomly extracted from the experience buffer pool for training as experience playback, the experience buffer pool with high priority is extracted first, and the corresponding batch of data is removed from the experience buffer pool; Step S8: Set learning rate warm-up and annealing to ensure training stability.
2. The incremental pre-training method for a large language model according to claim 1, Features: In step S1, the implementation process of recursive data collection is as follows: Step S1.1: Customize the keyword set according to the needs, denoted as ,in A noun represents a field, and n is the total number of fields in the set U; Step S1.2: Use the API of the large language model to obtain the set of m questions corresponding to each field through the set prompt, denoted as ; Combine n fields with m questions respectively to generate n*m questions; Step S1.3, sending n*m questions as prompt words to the large language model, and saving the returned results locally as pre-training data; Step S1.4: After completing an epoch, set a prompt so that the large language model can extract a noun for each answer and put the extracted noun into the set middle; Step S1.5, execute the above steps again to obtain the problem, obtain data from the whole to the specific, and the overall data is a tree structure.
3. The incremental pre-training method for a large language model according to claim 1, Features: In step S4, all characters in the vocabulary are initialized, the frequencies of occurrence of adjacent words in the vocabulary are counted, the words with the highest frequency are selected for merging, and added to the vocabulary as a new word, and the above steps are repeated until the custom threshold of the number of words in the vocabulary is reached; The generated vocabulary is then merged with the original vocabulary. When merging the vocabulary, only the word units that are not in the original vocabulary are added, and the newly added word units are placed after the original vocabulary to avoid destroying the index of each word unit in the original vocabulary.
4. The incremental pre-training method for a large language model according to claim 1, Features: In step S7, three levels of experience buffer pools are set for priority experience playback. The three experience buffer pools are respectively , and , with priorities from high to low; Calculate the loss function value of each batch of batch data , and the average loss of all batches of batch data in each epoch ; If the loss function value , add the batch of batch data to the experience buffer pool middle; If the loss function value , add the batch of batch data to the experience buffer pool middle; If the loss function value , add the batch of batch data to the experience buffer pool middle; Among them, the coefficient 1.
5. The incremental pre-training method for a large language model according to claim 4, Features: In step S7, when a batch of batch data is randomly selected from the experience buffer pool for training as experience playback, the experience buffer pool , Experience Buffer Pool Experience Buffer Pool The probabilities of being selected are 50%, 30% and 20% respectively.
6. The incremental pre-training method for a large language model according to claim 1, Features: In step S8, at the beginning of each epoch, the learning rate increases from the minimum value to the maximum value. Increases linearly to a preset maximum value ; At the end of each epoch, the learning rate is reduced from the maximum value Reduce to minimum ; The learning rate adjustment formula is expressed as: ; Where x is the index of the current update step and X is the total number of update steps in the epoch.
7. An incremental pre-training system for large language models, Features: include: The recursive data collection module is responsible for customizing domain nouns and designing prompts to generate relevant questions from the large language model; The combined noun and question are sent to the large language model to generate an answer, and the answer is stored; a prompt is set to re-extract the key noun from the question; the above process is repeated to obtain the question, and the data is generated into a tree structure from top to bottom; The data deduplication module is responsible for estimating the similarity between texts using the MinHash algorithm. If the absolute value of the difference between the MinHash values of two texts is less than a custom threshold, the two texts are considered duplicates, and one of them is retained and the other is deleted to achieve data deduplication. The data translation module is responsible for using the translation model to translate English data into Chinese data and store it; then the English data, the translated Chinese data, and the self-built data set are merged as an incremental pre-training data set; The vocabulary generation and expansion module is responsible for training new vocabulary using the incremental pre-training dataset using the Byte Pair Encoding (BPE) algorithm, and adding new vocabulary to the vocabulary until the custom threshold of vocabulary number is reached; then the generated vocabulary is merged with the original vocabulary; The model dimension adjustment and parameter initialization module is responsible for re-adjusting the dimensions of the word embedding layer and output layer of the large language model according to the size of the merged vocabulary to keep it consistent with the number of new vocabulary; the new word embedding matrix , through the formula Initialize the original word embedding matrix E, where the matrix R is a randomly initialized matrix used to represent the newly added words; The hierarchical fixed training module is responsible for adopting hierarchical fixed training, fixing other layers each time and focusing on training one type of layer; and so on, until all layers are trained; The experience buffer pool and experience replay module are responsible for calculating the loss function value of each batch of data , the loss function value The higher the value, the higher the data priority of the corresponding batch. During the training process, you can customize the experience buffer pools with different priorities and place each batch of batch data into the experience buffer pool with the corresponding priority. Every k update steps, a batch of data is randomly extracted from the experience buffer pool for training as experience playback, the experience buffer pool with high priority is extracted first, and the corresponding batch of data is removed from the experience buffer pool; The learning rate warmup and annealing module is responsible for setting the learning rate warmup and annealing to ensure training stability.
8. An incremental pre-training device for large language models, Features: The method comprises a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the method according to any one of claims 1 to 6 when executing the computer program.
9. A readable storage medium, Features: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Chinese entity recognition model training method and device, equipment and storage medium
CN113408291A
Microblog text sentiment analysis method and system based on adversarial training fusion BERT
CN115392259A
Word list conversion method and device, equipment and storage medium
CN117350279A
Method and device for training target model and generating structured statement
CN118114785A
