Model training method and device, computer device, and storage medium

CN117291245BActive Publication Date: 2026-09-11SOUNDAI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311244963.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-25
Publication Date
2026-09-11
Estimated Expiration
2043-09-25

AI Technical Summary

Technical Problem

但是,当模型在中文数据集上微调后,其对其他语言的理解可能会显著下降

Benefits of technology

[0031] This application provides a model training method. After pre-training a large language model, a second dataset is constructed by extracting language texts from the first dataset used for pre-training and language texts related to the model task. This allows the large language model to relearn the language texts used in pre-training during subsequent parameter adjustments based on the model task, enabling it to review and utilize the experience gained during the pre-training phase. Furthermore, parameter constraints are determined based on the importance of the parameters in the large language model to language learning during the pre-training phase. This ensures that the changes in parameters are constrained during subsequent parameter adjustments based on the model task, preventing the large language model from excessively modifying the knowledge learned during the pre-training phase. Both of these methods effectively suppress catastrophic forgetting during parameter adjustment, allowing the model to achieve excellent performance on the task while retaining the rich knowledge learned during the pre-training phase.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117291245B_ABST
    Figure CN117291245B_ABST
Patent Text Reader

Abstract

The application provides a model training method and device, computer equipment and a storage medium, and belongs to the technical field of computers. The method comprises: pre-training a large language model based on a first data set; determining a second data set based on the first data set and a model task; determining a parameter constraint condition based on the weight of a parameter in the large language model, wherein the weight is used to represent the importance of the corresponding parameter in the pre-training stage for the large language model to learn language, and the parameter constraint condition is used to constrain the variation of the parameter; and adjusting the parameters of the pre-trained large language model based on the second data set and the parameter constraint condition. The above method can effectively inhibit the catastrophic forgetting phenomenon of the large language model in the parameter adjustment process, so that the model can retain the rich knowledge learned in the pre-training stage while achieving excellent performance in the task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a model training method, apparatus, computer equipment, and storage medium. Background Technology

[0002] In model training, training and fine-tuning of neural network models are two core steps. Specifically, models are typically pre-trained on large-scale general datasets and then fine-tuned on task-specific datasets to better adapt to new tasks and scenarios. However, this training approach faces a significant challenge: catastrophic forgetting. That is, when the model begins learning a new task, it may forget the original knowledge learned during the pre-training phase. For example, a model pre-trained on multilingual datasets might have the ability to recognize and understand various languages. However, after fine-tuning the model on a Chinese dataset, its understanding of other languages ​​may significantly decline. Therefore, how to suppress catastrophic forgetting during model training has become a key research focus. Summary of the Invention

[0003] This application provides a model training method, apparatus, computer device, and storage medium that can effectively suppress the catastrophic forgetting phenomenon in the parameter tuning process of large language models, enabling the model to achieve excellent performance on the task while retaining the rich knowledge learned during the pre-training stage. The technical solution is as follows:

[0004] On the one hand, a model training method is provided, the method comprising:

[0005] Based on the first dataset, a large language model is pre-trained, which includes language texts from multiple languages.

[0006] Based on the first dataset and the model task, a second dataset is determined, which includes a portion of the language text in the first dataset and language text related to the model task.

[0007] Based on the weights of the parameters in the large language model, parameter constraints are determined. The weights represent the importance of the corresponding parameters to the large language model's language learning during the pre-training phase, and the parameter constraints constrain the amount of change in the parameters.

[0008] Based on the second dataset and the parameter constraints, the parameters of the pre-trained large language model are adjusted, and the parameter-adjusted large language model is used to perform the model task in any of the multiple languages.

[0009] On the other hand, a model training apparatus is provided, the apparatus comprising:

[0010] The first training module is used to pre-train a large language model based on a first dataset, which includes language texts from multiple languages.

[0011] The first determining module is used to determine a second dataset based on the first dataset and the model task, wherein the second dataset includes a portion of the language text in the first dataset and language text related to the model task;

[0012] The second determining module is used to determine parameter constraints based on the weights of the parameters in the large language model. The weights represent the importance of the corresponding parameters to the large language model's language learning during the pre-training phase, and the parameter constraints constrain the amount of change of the parameters.

[0013] The second training module is used to adjust the parameters of the pre-trained large language model based on the second dataset and the parameter constraints. The parameter-adjusted large language model is used to perform the model task in any of the multiple languages.

[0014] In some embodiments, the first determining module is configured to: obtain language text belonging to any language in the first dataset; take the language text of the plurality of languages ​​as a first text subset; obtain a second text subset based on the model task; and take the combination of the first text subset and the second text subset as the second dataset.

[0015] In some embodiments, the first determining module includes:

[0016] The first determining unit is configured to determine the topic of any language text in the first dataset based on the semantics of the language text.

[0017] The first acquisition unit is used to acquire language text related to the topic of the model task from the first dataset to obtain a third text subset;

[0018] The second acquisition unit is used to acquire a second subset of text based on the model task;

[0019] The merging unit is used to combine the second text subset and the third text subset as the second dataset.

[0020] In some embodiments, the first acquisition unit is configured to, for any language text in the first dataset, determine topic similarity based on the topic of the language text and the model task, wherein the topic similarity is used to represent the degree of correlation between the topic of the language text and the model task; and acquire language texts from the first dataset whose topic similarity reaches a similarity threshold to obtain the third text subset.

[0021] In some embodiments, the second determining module includes:

[0022] The third acquisition unit is used to acquire the weights of the parameters in the large language model;

[0023] The processing unit is configured to, for any parameter of the large language model, multiply the parameter by the weight of the parameter to obtain the constraint term of the parameter;

[0024] The second determining unit is used to determine the parameter constraints based on the constraints of multiple parameters in the large language model, wherein the parameter constraints are part of the loss of the large language model.

[0025] In some embodiments, the second determining unit is configured to select multiple parameters whose weights reach a weight threshold from all parameters in the large language model; and sum the constraint terms of the multiple parameters to obtain parameter constraint conditions.

[0026] In some embodiments, the second determining module is configured to determine the learning rate of any parameter of the large language model based on the weight of the parameter, wherein the learning rate of the parameter is negatively correlated with the weight of the parameter; and to determine parameter constraints based on the learning rates of multiple parameters in the large language model.

[0027] In some embodiments, the second training module is further configured to adjust the parameters of the large language model using at least one of a weight decay strategy and Dropout.

[0028] On the other hand, a computer device is provided, the computer device including a processor and a memory, the memory being used to store at least one computer program, the at least one computer program being loaded and executed by the processor to implement the model training method in the embodiments of this application.

[0029] On the other hand, a computer-readable storage medium is provided, wherein at least one computer program is stored in the computer-readable storage medium, the at least one computer program being loaded and executed by a processor to implement the model training method as described in the embodiments of this application.

[0030] On the other hand, a computer program product is provided, including a computer program stored in a computer-readable storage medium, a processor of a computer device reading the computer program from the computer-readable storage medium, and the processor executing the computer program, causing the computer device to perform the model training method provided in the above aspects or various alternative implementations of the above aspects.

[0031] This application provides a model training method. After pre-training a large language model, a second dataset is constructed by extracting language texts from the first dataset used for pre-training and language texts related to the model task. This allows the large language model to relearn the language texts used in pre-training during subsequent parameter adjustments based on the model task, enabling it to review and utilize the experience gained during the pre-training phase. Furthermore, parameter constraints are determined based on the importance of the parameters in the large language model to language learning during the pre-training phase. This ensures that the changes in parameters are constrained during subsequent parameter adjustments based on the model task, preventing the large language model from excessively modifying the knowledge learned during the pre-training phase. Both of these methods effectively suppress catastrophic forgetting during parameter adjustment, allowing the model to achieve excellent performance on the task while retaining the rich knowledge learned during the pre-training phase. Attached Figure Description

[0032] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0033] Figure 1 This is a schematic diagram of the implementation environment of a model training method provided in an embodiment of this application;

[0034] Figure 2 This is a flowchart of a model training method provided according to an embodiment of this application;

[0035] Figure 3 This is a flowchart of another model training method provided according to an embodiment of this application;

[0036] Figure 4 This is a block diagram of a model training apparatus provided according to an embodiment of this application;

[0037] Figure 5 This is a block diagram of another model training apparatus provided according to an embodiment of this application;

[0038] Figure 6 This is a structural block diagram of a terminal provided according to an embodiment of this application;

[0039] Figure 7 This is a schematic diagram of the structure of a server according to an embodiment of this application. Detailed Implementation

[0040] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0041] In this application, the terms "first," "second," etc., are used to distinguish identical or similar items with essentially the same function. It should be understood that there is no logical or temporal dependency between "first," "second," and "nth," nor are there any restrictions on quantity or execution order.

[0042] In this application, the term "at least one" means one or more, and "multiple" means two or more.

[0043] It should be noted that all information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in this application have been authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the language texts involved in this application were obtained with full authorization.

[0044] The model training method provided in this application can be executed by a computer device. In some embodiments, the computer device is a terminal or a server. The following section first uses a computer device as a server as an example to describe the implementation environment of the model training method provided in this application. Figure 1 This is a schematic diagram illustrating the implementation environment of a model training method provided in an embodiment of this application. See also... Figure 1 The implementation environment includes terminal 101 and server 102. Terminal 101 and server 102 can be connected directly or indirectly via wired or wireless communication, which is not limited herein.

[0045] In some embodiments, terminal 101 is a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, smart voice interaction device, smart home appliance, in-vehicle terminal, etc., but is not limited to these. Terminal 101 runs an application capable of acquiring spoken text. This application can be a communication application, a conferencing application, a question-and-answer application, or a document reading application. Illustratively, terminal 101 is a terminal used by a user. Terminal 101 can acquire spoken text input by the user. Then, terminal 101 can send the spoken text to server 102, where server 102 trains a large language model based on the acquired spoken text.

[0046] Those skilled in the art will understand that the number of terminals described above can be more or less. For example, there may be only one terminal, or there may be dozens or hundreds of terminals, or even more. This application does not limit the number of terminals or the type of device.

[0047] In some embodiments, server 102 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), big data, and artificial intelligence platforms. Server 102 can construct a dataset from language text obtained from multiple terminals 101. Then, server 102 trains a large language model based on the dataset. In some embodiments, server 102 undertakes the main computational work, and terminal 101 undertakes the secondary computational work; or, server 102 undertakes the secondary computational work, and terminal 101 undertakes the main computational work; or, server 102 and terminal 101 collaborate on computation using a distributed computing architecture.

[0048] Figure 2 This is a flowchart of a model training method provided according to an embodiment of this application. See also... Figure 2 In this embodiment, server execution is used as an example for illustration. The model training method includes the following steps:

[0049] 201. The server pre-trains a large language model based on the first dataset, which includes language texts from multiple languages.

[0050] In this embodiment, for any language text in the first dataset, the language to which the text belongs can be Chinese, English, Japanese, or Italian; this embodiment does not impose any restrictions. The Large Language Model (LLM) can be GPT-3 (Generative Pretrained Transformer-3), PaLM (Pathways Language Model), or LLaMA (Large Language Model Meta Artificial Intelligence); this embodiment does not impose any restrictions. The server pre-trains the large language model based on the first dataset. During the pre-training phase, the large language model can learn language knowledge from language texts in multiple languages. Language knowledge can be vocabulary, grammar, or contextual information of the language texts, etc.; this embodiment does not impose any restrictions.

[0051] 202. Based on the first dataset and the model task, the server determines the second dataset, which includes a portion of the language text in the first dataset and language text related to the model task.

[0052] In this embodiment, the server obtains a portion of the language text from a first dataset. This embodiment does not limit the method of obtaining the language text. Based on the model task, the server obtains language text related to the model task. Then, the server can aggregate the portion of language text obtained from the first dataset and the obtained language text related to the model task into a second dataset. Accordingly, the second dataset includes data used in the pre-training phase and data related to the model task. This embodiment does not limit the model task.

[0053] 203. The server determines parameter constraints based on the weights of the parameters in the large language model. The weights represent the importance of the corresponding parameters to the large language model's language learning during the pre-training phase, and the parameter constraints constrain the amount of change in the parameters.

[0054] In this embodiment, for any parameter in a large language model, the server can determine the weight of that parameter based on its importance to the language learning process during the pre-training phase. Then, the server determines the corresponding parameter constraints based on those weights. These constraints can limit the magnitude of the parameter's change in step 204, preventing excessive changes.

[0055] 204. Based on the second dataset and parameter constraints, the server adjusts the parameters of the pre-trained large language model. The parameter-adjusted large language model is used to perform model tasks in any of the multiple languages.

[0056] In this embodiment, the server adjusts the parameters of the pre-trained large language model based on a second dataset, enabling the large language model to both learn knowledge for the model task and review knowledge learned during the pre-training phase. Furthermore, the server can adjust the parameters of the pre-trained large language model based on parameter constraints to limit excessive parameter changes and prevent the large language model from over-modifying the knowledge learned during the pre-training phase. For any of the multiple languages, the server can perform the model task using the language text in that language. That is, based on the large language model's understanding of language text in a particular language, the server can perform the model task using the large language model. The parameter-adjusted large language model supports model tasks in multiple languages. For example, the large language model supports tax question-answering tasks in multiple languages.

[0057] This application provides a model training method. After pre-training a large language model, a second dataset is constructed by extracting language texts from the first dataset used for pre-training and language texts related to the model task. This allows the large language model to relearn the language texts used in pre-training during subsequent parameter adjustments based on the model task, enabling it to review and utilize the experience gained during the pre-training phase. Furthermore, parameter constraints are determined based on the importance of the parameters in the large language model to language learning during the pre-training phase. This ensures that the changes in parameters are constrained during subsequent parameter adjustments based on the model task, preventing the large language model from excessively modifying the knowledge learned during the pre-training phase. Both of these methods effectively suppress catastrophic forgetting during parameter adjustment, allowing the model to achieve excellent performance on the task while retaining the rich knowledge learned during the pre-training phase.

[0058] Figure 3 This is a flowchart of another model training method provided according to an embodiment of this application, see [link / reference]. Figure 3 In this embodiment, the method is described using server-side execution as an example. The model training method includes the following steps:

[0059] 301. The server pre-trains a large language model based on the first dataset, which includes language texts from multiple languages.

[0060] In this embodiment, the first dataset can be a large-scale multilingual dataset, including language texts from multiple languages. This embodiment does not limit the number of languages ​​or the number of language texts in each language. For any language text in the first dataset, the language text can be everyday language or specialized terminology; this embodiment does not impose any restrictions on this. The server can obtain the first dataset from local storage or from other computer devices; this embodiment does not restrict the method of obtaining the first dataset. Then, the server pre-trains a large language model using the first dataset to enable the large language model to learn language knowledge from multiple languages.

[0061] The pre-training method can be self-supervised learning, semi-supervised learning, or contrastive learning, etc., and this application embodiment does not limit this. The large-scale language model can be a Transformer-based model, and this application embodiment does not limit this. The language knowledge learned by the large-scale language model during the pre-training phase includes at least one type of information such as vocabulary, grammar, or contextual information of the language text.

[0062] 302. Based on the first dataset and the model task, the server determines the second dataset, which includes a portion of the language text in the first dataset and language text related to the model task.

[0063] In this embodiment, the server may randomly obtain a portion of language text from the first dataset; alternatively, the server may obtain a portion of language text from the first dataset based on certain rules, and this embodiment does not impose any restrictions on this. The server determines the language text related to the model task based on the model task. The model task may be a text classification, sentiment analysis, question answering, intent recognition, or machine translation, or similar tasks. The language text related to the model task may be language text from multiple languages ​​or language text from a single language, and this embodiment does not impose any restrictions on this. "Single language" may refer to a specific language in the first dataset, and this embodiment does not impose any restrictions on this. The server constructs a second dataset based on the portion of language text obtained from the first dataset and the language text related to the model task.

[0064] In the case where the model task is text classification, the language text for the model task can include language text from multiple topics, enabling the subsequent large-scale language model to understand the topics of the input language text. These multiple topics can include finance, sports, society, and entertainment, among others. Accordingly, the server acquires language text from multiple topics. Then, based on the first dataset and the language text from multiple topics, the server constructs a second dataset. Then, based on the second dataset, the server adjusts the parameters of the pre-trained large-scale language model. The parameter-adjusted large-scale language model is able to recognize the topics of the language text. This application embodiment does not limit the number of language texts for each topic.

[0065] In the case of sentiment analysis as the model task, the language text for the task can include language text with multiple sentiments, enabling the subsequent large-scale language model to understand the sentiment of the input language text. These multiple sentiments can include categories such as positive, negative, and neutral. Accordingly, the server acquires language text with multiple sentiments. Then, based on the first dataset and the language text with multiple sentiments, the server constructs a second dataset. Then, based on the second dataset, the server adjusts the parameters of the pre-trained large-scale language model. The parameter-adjusted large-scale language model is able to recognize the sentiment reflected in the language text. This application embodiment does not limit the number of language texts with each sentiment.

[0066] In the case of a question-answering task, the language text for the model task can include multiple dialogue texts to enable a subsequent large-scale language model to understand the input language text and provide an answer. Each dialogue text includes text belonging to the "question" and text belonging to the "answer". Accordingly, the server acquires multiple dialogue texts. Each dialogue text includes question text and answer text. Then, the server constructs a second dataset based on the first dataset and the multiple dialogue texts. Then, the server adjusts the parameters of the pre-trained large-scale language model based on the second dataset. The parameter-adjusted large-scale language model is able to answer language texts. This application embodiment does not limit the language of each dialogue text.

[0067] For example, the first dataset includes language texts in multiple languages, including Chinese, English, Japanese, and Italian. Correspondingly, a large-scale language model can learn language knowledge in multiple languages, including Chinese, English, Japanese, and Italian, based on the first dataset. The model task is tax question answering. Language texts related to tax question answering include Chinese language texts. The server retrieves a portion of the language texts from the first dataset. This portion of language texts can include language texts from multiple languages, or it can be language texts from a single language. This "single language" can be Chinese, meaning that the language texts related to the model task belong to the same language.

[0068] When the model task is intent recognition, the language text for the model task can include language text with multiple intents, enabling the subsequent large-scale language model to understand the user's intent based on the input language text. These multiple intents could be, for example, weather queries, song searches, or casual conversation. Accordingly, the server acquires the language text with multiple intents. Then, based on the first dataset and the language text with multiple intents, the server constructs a second dataset. Then, based on the second dataset, the server adjusts the parameters of the pre-trained large-scale language model. The parameter-adjusted large-scale language model can recognize the semantics of the language text, thereby understanding the user's intent. This application embodiment does not limit the number of language texts for each intent. The language text for each intent can contain keywords indicating the intent.

[0069] In the case of machine translation as the model task, the language text for the task can include multiple text pairs, enabling a subsequent large language model to translate the input language text into another language. Accordingly, the server acquires multiple text pairs. Each text pair contains text belonging to the source language and text belonging to the target language. The source and target languages ​​are different languages. Then, based on the first dataset and the multiple text pairs, the server constructs a second dataset. Then, based on the second dataset, the server tunes the parameters of the pre-trained large language model. The parameter-tuned large language model is able to translate language text belonging to the source language into language text belonging to the target language; or, translate language text belonging to the target language into language text belonging to the source language.

[0070] In some embodiments, the server can acquire language texts of various languages ​​from the first dataset to construct a second dataset. Accordingly, the process of the server determining the second dataset based on the first dataset and the model task includes: for any language in the first dataset, the server acquires the language text belonging to that language. The server uses the language texts of multiple languages ​​as a first text subset. Then, the server acquires a second text subset based on the model task. Finally, the server combines the first and second text subsets as the second dataset. The first text subset can be considered a replay buffer for reviewing experience from the pre-training phase. The solution provided in this application constructs a second dataset by acquiring language texts of various languages ​​in the first dataset and language texts related to the model task. This allows subsequent adjustments to the parameters of a large language model based on the second dataset to not only learn model task knowledge from language texts related to the model task, but also to adjust based on language texts of various languages ​​in the first dataset. This achieves the purpose of reviewing and utilizing experience from the pre-training phase, effectively suppressing catastrophic forgetting in the parameter adjustment process of large language models. This ensures that the model achieves excellent performance on the task while maintaining the ability to understand multiple languages ​​after parameter adjustment.

[0071] The number of language texts for each language obtained by the server from the first dataset can be the same or different, and this embodiment of the application does not impose any restrictions on this. Optionally, the server can obtain language texts for each language from the first dataset according to the proportion of the number of language texts for each language in the first dataset.

[0072] In some embodiments, the server may also obtain language text related to the model task from the first dataset to construct a second dataset. Accordingly, the process by which the server determines the second dataset based on the first dataset and the model task includes: for any language text in the first dataset, the server determines the topic of the language text based on its semantics. Then, the server obtains language text from the first dataset whose topic is related to the model task, resulting in a third text subset. The server then obtains a second text subset based on the model task. Finally, the server combines the second and third text subsets to form the second dataset. The solution provided in this application constructs a second dataset by acquiring language text related to the model task from a first dataset. This allows for subsequent parameter adjustments to a large language model based on the second dataset. Not only can adjustments be made based on the language text related to the model task in the first dataset, enabling the review and utilization of experience from the pre-training phase and effectively suppressing catastrophic forgetting during parameter adjustment, but adjustments can also be made based on additional language text related to the model task to learn the model task's knowledge. This achieves learning of the model task from both learned and unlearned language texts, improving both the performance of the large language model on the model task and training efficiency.

[0073] The first dataset contains language texts related to the model task that may include multiple languages. Accordingly, a second dataset is constructed using the language texts related to the model task from the first dataset. This allows the large language model to learn the model task from the perspective of multiple languages. In other words, it enables the model to achieve excellent performance on the task while still maintaining the ability to understand multiple languages ​​after parameter tuning.

[0074] In the process of obtaining the third text subset, the server can filter language texts from the first dataset based on the similarity between the language text's topic and the model task. Accordingly, the process of the server obtaining language texts from the first dataset whose topics are related to the model task, thus obtaining the third text subset, includes: for any language text in the first dataset, the server determines the topic similarity based on the language text's topic and the model task. This topic similarity is used to represent the degree of relevance between the language text's topic and the model task. The server then obtains language texts from the first dataset whose topic similarity reaches a similarity threshold, thus obtaining the third text subset. This embodiment of the application does not limit the size of the similarity threshold. The solution provided in this application constructs a second dataset by acquiring language texts from a first dataset whose relevance to the model task reaches a similarity threshold. This allows subsequent parameter adjustments to a large language model based on the second dataset to not only utilize language texts related to the model task in the first dataset to review and leverage pre-training experience, effectively suppressing catastrophic forgetting during parameter adjustment, but also to learn model task knowledge from additional language texts related to the model task. This achieves learning of the model task from both learned and unlearned language texts, improving both the performance of the large language model on the model task and training efficiency.

[0075] 303. The server determines parameter constraints based on the weights of the parameters in the large language model. The weights represent the importance of the corresponding parameters to the large language model's language learning during the pre-training phase, and the parameter constraints constrain the amount of change in the parameters.

[0076] In this embodiment, the server can determine the weights of the parameters in the large language model based on their importance to the learned language during the pre-training phase. The weights of the parameters are positively correlated with their importance. Then, the server determines parameter constraints based on these weights. These constraints, implemented in step 304, limit the variation in the parameters of the large language model, preventing excessive variation that could cause the model to forget the language knowledge learned during pre-training. The constraints can limit the variation in parameters to a preset range; alternatively, they can be used as part of the loss of the large language model to constrain parameter variation; or, they can be used to constrain parameter variation by controlling the learning rate, etc. This embodiment does not impose any limitations on these methods.

[0077] In some embodiments, the server may use parameter constraints as part of the loss of a large language model to constrain parameter variations. Accordingly, the process by which the server determines parameter constraints based on the weights of the parameters in the large language model includes: the server obtaining the weights of the parameters in the large language model; then, for any parameter of the large language model, the server multiplying the parameter by its weights to obtain a parameter constraint term; then, the server determining parameter constraints based on the constraint terms of multiple parameters in the large language model. Here, the parameter constraints are part of the loss of the large language model. That is, the server sums the constraint terms of multiple parameters in the large language model to obtain the parameter constraints. Then, the server adds the parameter constraints to the loss function to determine the loss of the large language model. The solution provided in this application determines parameter constraints based on the importance of parameters in the large language model to language learning during the pre-training stage. These parameter constraints are incorporated as part of the loss of the large language model. As the loss of the large language model decreases during training, the corresponding values ​​of the parameter constraints in the loss also decrease, thereby achieving the purpose of constraining the amount of parameter change. This prevents the large language model from excessively modifying the knowledge learned during the pre-training stage, effectively suppressing the catastrophic forgetting phenomenon during parameter adjustment. This allows the model to achieve excellent performance on the task while retaining the rich knowledge learned during the pre-training stage.

[0078] The multiple parameters can be all the parameters of a large language model. Accordingly, the server determines the parameter constraints based on the constraints of all the parameters in the large language model. Alternatively, the multiple parameters can be a subset of the parameters in the large language model whose weights satisfy certain conditions. Accordingly, the server determines the parameter constraints based on the constraints of a subset of the parameters in the large language model. This application does not impose limitations on these methods.

[0079] Optionally, the multiple parameters are a subset of the parameters whose weights satisfy certain conditions among all parameters of the large language model. This application embodiment does not restrict the conditions satisfied by the weights. Accordingly, the process by which the server determines the parameter constraints based on the constraints of multiple parameters in the large language model includes: the server selecting multiple parameters whose weights reach a weight threshold from all parameters in the large language model. Then, the server sums the constraints of the multiple parameters to obtain the parameter constraints. The solution provided in this application embodiment determines the parameter constraints based on parameters that are highly important to the learned language during the pre-training stage. This ensures that during subsequent adjustments to the parameters of the large language model based on the model task, the changes in the parameters in the model can be constrained, preventing the large language model from excessively modifying the knowledge learned during the pre-training stage. This effectively suppresses the catastrophic forgetting phenomenon in the parameter adjustment process of the large language model, allowing the model to achieve excellent performance on the task while retaining the rich knowledge learned during the pre-training stage. Furthermore, compared to a solution that restricts the changes of all parameters, only parameters with high importance need to be restricted, eliminating the need to overemphasize parameters that are unimportant to language learning. This not only saves runtime costs but also improves training efficiency.

[0080] In some embodiments, the server can constrain parameter changes by controlling the learning rate of the parameters. Accordingly, the process of determining parameter constraints based on the weights of parameters in a large language model includes: for any parameter of the large language model, the server determines the learning rate of the parameter based on its weight. Then, the server determines parameter constraints based on the learning rates of multiple parameters in the large language model. The learning rate of a parameter is negatively correlated with its weight. The solution provided in this application determines the learning rate of a parameter based on its importance to the language being learned during the pre-training stage. Parameters with higher importance have lower learning rates, thereby limiting the amount of parameter change through the learning rate. This prevents the large language model from excessively modifying the knowledge learned during the pre-training stage, effectively suppressing catastrophic forgetting during parameter adjustment, and enabling the model to achieve excellent performance on the task while retaining the rich knowledge learned during the pre-training stage.

[0081] The multiple parameters can be all the parameters of a large language model. Accordingly, the server determines the parameter constraints based on the learning rate of all parameters in the large language model. Alternatively, the multiple parameters can be a subset of the parameters in the large language model whose weights satisfy certain conditions. Accordingly, the server determines the parameter constraints based on the learning rate of a subset of parameters in the large language model. This application embodiment does not impose limitations on this. The conditions satisfied by the weights can refer to the weights reaching a weight threshold; this application embodiment does not impose limitations on this.

[0082] This application does not limit the method for determining the weights of the parameters in its embodiments. Optionally, the process by which the server determines the weights of the parameters in a large language model includes: the server fitting a Gaussian distribution to the posterior probabilities of the pre-trained large language model; then, the server determining the Fischer information matrix based on the Gaussian distribution; then, the server determining the variance of the posterior probabilities of the large language model based on the Fischer information matrix; and finally, the server using the variance of the posterior probabilities of the large language model as the weights of the parameters in the large language model.

[0083] 304. The server adjusts the parameters of the pre-trained large language model based on the second dataset and parameter constraints. The parameter-adjusted large language model is used to perform model tasks in any of the multiple languages.

[0084] In this embodiment, the server adjusts the parameters of the pre-trained large language model based on the second dataset, enabling the large language model to both learn knowledge from the model task and review knowledge learned during the pre-training phase. This parameter adjustment method can be considered as experience replay. Furthermore, the server can also adjust the parameters of the pre-trained large language model based on parameter constraints to limit excessive parameter changes and prevent the large language model from over-modifying the knowledge learned during the pre-training phase. This parameter adjustment method can be considered as Elastic Weight Consolidation (EWC). Here, "adjustment" can also be referred to as "fine-tuning."

[0085] In some embodiments, the server can train a large language model using the following formula 1.

[0086] Formula 1:

[0087]

[0088] in, A represents the loss of a large language model; B represents the pre-training task; C represents the modeling task. λ represents the loss of the model task; λ represents the importance of the old pre-trained task A relative to the new model task B; θ represents the parameters in the large language model; i represents the parameter number, used to distinguish the parameters in the large language model.

[0089] In some embodiments, the server may also employ at least one of weight decay and dropout to adjust the parameters of large language models. This method, by employing regularization strategies such as weight decay and dropout, can prevent overfitting in large language models and further suppress catastrophic forgetting, thereby improving the generalization ability of large language models. Weight decay refers to suppressing overfitting by penalizing the model's weights. Dropout refers to increasing the model's robustness by randomly discarding a portion of the neurons' outputs.

[0090] 305. The server evaluates large language models based on a third dataset, which includes multiple language texts related to the model task.

[0091] In this embodiment, the third dataset is a test set independent of the first and second datasets. That is, the language text in the third dataset is different from any language text in the first and second datasets. The third dataset may include language text related to the model task, or it may include language text of the same language as that in the first dataset; this embodiment does not impose any limitations on this. The server evaluates the large language model using the third dataset. This embodiment does not impose any limitations on the specific evaluation method. The evaluation results of the large language model can indicate the performance of the large language model in performing the aforementioned model task, or it can indicate the large language model's ability to understand multiple languages; this embodiment does not impose any limitations on this.

[0092] This application provides a model training method. After pre-training a large language model, a second dataset is constructed by extracting language texts from the first dataset used for pre-training and language texts related to the model task. This allows the large language model to relearn the language texts used in pre-training during subsequent parameter adjustments based on the model task, enabling it to review and utilize the experience gained during the pre-training phase. Furthermore, parameter constraints are determined based on the importance of the parameters in the large language model to language learning during the pre-training phase. This ensures that the changes in parameters are constrained during subsequent parameter adjustments based on the model task, preventing the large language model from excessively modifying the knowledge learned during the pre-training phase. Both of these methods effectively suppress catastrophic forgetting during parameter adjustment, allowing the model to achieve excellent performance on the task while retaining the rich knowledge learned during the pre-training phase.

[0093] Figure 4This is a block diagram of a model training apparatus according to an embodiment of this application. The model training apparatus is used to perform the steps of the above-described model training method, see [link to relevant documentation]. Figure 4 The model training device includes: a first training module 401, a first determining module 402, a second determining module 403, and a second training module 404.

[0094] The first training module 401 is used to pre-train a large language model based on a first dataset, which includes language texts from multiple languages.

[0095] The first determining module 402 is used to determine the second dataset based on the first dataset and the model task. The second dataset includes a portion of the language text in the first dataset and language text related to the model task.

[0096] The second determining module 403 is used to determine parameter constraints based on the weights of parameters in a large language model. The weights represent the importance of the corresponding parameters to the large language model's language learning during the pre-training phase, and the parameter constraints are used to constrain the amount of change of the parameters.

[0097] The second training module 404 is used to adjust the parameters of the pre-trained large language model based on the second dataset and parameter constraints. The parameter-adjusted large language model is used to perform model tasks in any of the multiple languages.

[0098] In some embodiments, Figure 5 This is a block diagram of another model training apparatus provided according to an embodiment of this application. See also Figure 5 The first determining module 402 is used to obtain language text belonging to any language in the first dataset; take the language text of multiple languages ​​as a first text subset; obtain a second text subset based on the model task; and take the combination of the first text subset and the second text subset as the second dataset.

[0099] In some embodiments, see continue to see Figure 5 The first determining module 402 includes:

[0100] The first determining unit 4021 is used to determine the topic of any language text in the first dataset based on the semantics of the language text.

[0101] The first acquisition unit 4022 is used to acquire language text related to the topic and model task from the first dataset to obtain the third text subset;

[0102] The second acquisition unit 4023 is used to acquire a second subset of text based on the model task;

[0103] Merging unit 4024 is used to combine the second and third text subsets into a second dataset.

[0104] In some embodiments, see continue to see Figure 5 The first acquisition unit 4022 is used to determine the topic similarity for any language text in the first dataset based on the topic of the language text and the model task. The topic similarity is used to represent the degree of correlation between the topic of the language text and the model task. From the first dataset, language texts with topic similarity reaching the similarity threshold are acquired to obtain the third text subset.

[0105] In some embodiments, see continue to see Figure 5 The second determining module 403 includes:

[0106] The third acquisition unit 4031 is used to acquire the weights of parameters in a large language model;

[0107] The processing unit 4032 is used to multiply the parameter with the weight of the parameter for any parameter of a large language model to obtain the constraint term of the parameter;

[0108] The second determining unit 4033 is used to determine parameter constraints based on the constraints of multiple parameters in a large language model. The parameter constraints are part of the loss of the large language model.

[0109] In some embodiments, see continue to see Figure 5 The second determining unit 4033 is used to select multiple parameters whose weights reach the weight threshold from all parameters in the large language model; and to sum the constraint terms of the multiple parameters to obtain the parameter constraint conditions.

[0110] In some embodiments, see continue to see Figure 5 The second determining module 403 is used to determine the learning rate of any parameter in a large language model based on the parameter weights, wherein the learning rate of the parameter is negatively correlated with the parameter weights; and to determine parameter constraints based on the learning rates of multiple parameters in the large language model.

[0111] In some embodiments, see continue to see Figure 5 The second training module 404 is also used to adjust the parameters of a large language model using at least one of a weight decay strategy and Dropout.

[0112] This application provides a model training device. After pre-training a large language model, it obtains language texts from the first dataset used for pre-training, as well as language texts related to the model task, to form a second dataset. This allows the large language model to relearn the language texts used in pre-training during subsequent parameter adjustments based on the model task, enabling it to review and utilize the experience gained in the pre-training phase. Furthermore, it determines parameter constraints based on the importance of parameters in the large language model to language learning during pre-training. This constrains the amount of parameter changes during subsequent parameter adjustments based on the model task, preventing the large language model from excessively modifying the knowledge learned in the pre-training phase. Both of these methods effectively suppress catastrophic forgetting during parameter adjustment, allowing the model to achieve excellent performance on the task while retaining the rich knowledge learned in the pre-training phase.

[0113] It should be noted that the model training device provided in the above embodiments is only illustrated by the division of the above functional modules when running the application. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the model training device and the model training method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0114] In the embodiments of this application, the computer device can be configured as a terminal or a server. When the computer device is configured as a terminal, the terminal can act as the execution subject to implement the technical solutions provided in the embodiments of this application. When the computer device is configured as a server, the server can act as the execution subject to implement the technical solutions provided in the embodiments of this application. Alternatively, the technical solutions provided in this application can be implemented through the interaction between the terminal and the server. The embodiments of this application do not limit this.

[0115] Figure 6 This is a structural block diagram of a terminal 600 provided according to an embodiment of this application. The terminal 600 can be a portable mobile terminal, such as a smartphone, tablet computer, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), laptop computer, or desktop computer. The terminal 600 may also be referred to as a user device, portable terminal, laptop terminal, desktop terminal, or other names.

[0116] Typically, terminal 600 includes a processor 601 and a memory 602.

[0117] Processor 601 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 601 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 601 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 601 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 601 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0118] The memory 602 may include one or more computer-readable storage media, which may be non-transitory. The memory 602 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 602 are used to store at least one computer program, which is executed by the processor 601 to implement the model training method provided in the method embodiments of this application.

[0119] In some embodiments, the terminal 600 may optionally include a peripheral device interface 603 and at least one peripheral device. The processor 601, memory 602, and peripheral device interface 603 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 603 via a bus, signal line, or circuit board. Specifically, the peripheral device includes at least one of the following: a radio frequency circuit 604, a display screen 605, a camera assembly 606, an audio circuit 607, and a power supply 608.

[0120] Peripheral interface 603 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 601 and memory 602. In some embodiments, processor 601, memory 602 and peripheral interface 603 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 601, memory 602 and peripheral interface 603 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.

[0121] The radio frequency (RF) circuit 604 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 604 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 604 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. In some embodiments, the RF circuit 604 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The RF circuit 604 can communicate with other terminals through at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: the World Wide Web, metropolitan area networks, intranets, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 604 may also include circuitry related to NFC (Near Field Communication), which is not limited in this application.

[0122] Display screen 605 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 605 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 601 for processing. In this case, display screen 605 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 605, disposed on the front panel of terminal 600; in other embodiments, there may be at least two display screens, disposed on different surfaces of terminal 600 or in a folded design; in other embodiments, display screen 605 may be a flexible display screen, disposed on a curved or folded surface of terminal 600. Furthermore, display screen 605 may be configured as a non-rectangular irregular shape, i.e., a non-rectangular screen. Display screen 605 may be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).

[0123] The camera assembly 606 is used to acquire images or videos. In some embodiments, the camera assembly 606 includes a front-facing camera and a rear-facing camera. Typically, the front-facing camera is located on the front panel of the terminal, and the rear-facing camera is located on the back of the terminal. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions. In some embodiments, the camera assembly 606 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash is a combination of a warm-light flash and a cool-light flash, which can be used for light compensation at different color temperatures.

[0124] The audio circuit 607 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, converting the sound waves into electrical signals that are input to the processor 601 for processing, or input to the radio frequency circuit 604 for voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each located at a different part of the terminal 600. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert the electrical signals from the processor 601 or the radio frequency circuit 604 into sound waves. The speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 607 may also include a headphone jack.

[0125] Power supply 608 is used to power the various components in terminal 600. Power supply 608 can be AC ​​power, DC power, a disposable battery, or a rechargeable battery. When power supply 608 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged via a wired line, and a wireless rechargeable battery is a battery that is charged via a wireless coil. The rechargeable battery can also be used to support fast charging technology.

[0126] In some embodiments, the terminal 600 further includes one or more sensors 609. The one or more sensors 609 include, but are not limited to, an accelerometer 610, a gyroscope 611, a pressure sensor 612, an optical sensor 613, and a proximity sensor 614.

[0127] Accelerometer 610 can detect the magnitude of acceleration along the three coordinate axes of a coordinate system established by terminal 600. For example, accelerometer 610 can be used to detect the components of gravitational acceleration along the three coordinate axes. Processor 601 can control display screen 605 to display the user interface in either a landscape or portrait view based on the gravitational acceleration signal acquired by accelerometer 610. Accelerometer 610 can also be used for games or for acquiring user motion data.

[0128] The gyroscope sensor 611 can detect the orientation and rotation angle of the terminal 600. The gyroscope sensor 611 can work in conjunction with the accelerometer sensor 610 to collect the user's 3D movements on the terminal 600. Based on the data collected by the gyroscope sensor 611, the processor 601 can perform the following functions: motion sensing (e.g., changing the UI based on the user's tilt), image stabilization during shooting, game control, and inertial navigation.

[0129] The pressure sensor 612 can be disposed on the side bezel of the terminal 600 and / or on the lower layer of the display screen 605. When the pressure sensor 612 is disposed on the side bezel of the terminal 600, it can detect the user's grip signal on the terminal 600, and the processor 601 can perform left / right hand recognition or quick operation based on the grip signal collected by the pressure sensor 612. When the pressure sensor 612 is disposed on the lower layer of the display screen 605, the processor 601 can control the operable controls on the UI interface based on the user's pressure operation on the display screen 605. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.

[0130] An optical sensor 613 is used to collect ambient light intensity. In one embodiment, the processor 601 can control the display brightness of the display screen 605 based on the ambient light intensity collected by the optical sensor 613. Specifically, when the ambient light intensity is high, the display brightness of the display screen 605 is increased; when the ambient light intensity is low, the display brightness of the display screen 605 is decreased. In another embodiment, the processor 601 can also dynamically adjust the shooting parameters of the camera assembly 606 based on the ambient light intensity collected by the optical sensor 613.

[0131] The proximity sensor 614, also known as a distance sensor, is typically mounted on the front panel of the terminal 600. The proximity sensor 614 is used to detect the distance between the user and the front of the terminal 600. In one embodiment, when the proximity sensor 614 detects that the distance between the user and the front of the terminal 600 is gradually decreasing, the processor 601 controls the display screen 605 to switch from a screen-on state to a screen-off state; when the proximity sensor 614 detects that the distance between the user and the front of the terminal 600 is gradually increasing, the processor 601 controls the display screen 605 to switch from a screen-off state to a screen-on state.

[0132] Those skilled in the art will understand that Figure 6 The structure shown does not constitute a limitation on terminal 600, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0133] Figure 7This is a schematic diagram of a server structure according to an embodiment of this application. The server 700 can vary considerably due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 701 and one or more memories 702. The memory 702 stores at least one computer program, which is loaded and executed by the processor 701 to implement the model training methods provided in the various method embodiments described above. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be elaborated here.

[0134] This application also provides a computer-readable storage medium storing at least one computer program. This computer program is loaded and executed by a processor of a computer device to implement the operations performed by the computer device in the model training method of the above embodiments. For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, floppy disk, and optical data storage device, etc.

[0135] This application also provides a computer program product, including a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the model training methods provided in the various optional implementations described above.

[0136] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0137] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A model training method, characterized in that, The method includes: Based on the first dataset, a large language model is pre-trained, which includes language texts from multiple languages. Based on the first dataset and the model task, a second dataset is determined, which includes partial language texts of each language in the first dataset and language texts related to the model task. Based on the weights of the parameters in the large language model, parameter constraints are determined. The weights represent the importance of the corresponding parameters to the large language model's language learning during the pre-training phase, and the parameter constraints constrain the amount of change in the parameters. Based on the second dataset and the parameter constraints, the parameters of the pre-trained large language model are adjusted, and the parameter-adjusted large language model is used to perform the model task in any of the multiple languages.

2. The method according to claim 1, characterized in that, The step of determining the second dataset based on the first dataset and the model task includes: For any language in the first dataset, obtain the language text belonging to that language; The language texts of the aforementioned multiple languages ​​are taken as the first text subset; Based on the model task, obtain the second text subset; The combination of the first and second text subsets is used as the second dataset.

3. The method according to claim 1, characterized in that, The step of determining the second dataset based on the first dataset and the model task includes: For any language text in the first dataset, determine the topic of the language text based on its semantics; From the first dataset, obtain language texts related to the topic and the model task to obtain a third text subset; Based on the model task, obtain the second text subset; The combination of the second and third text subsets is used as the second dataset.

4. The method according to claim 3, characterized in that, The step of obtaining language text related to the topic of the model task from the first dataset to obtain a third text subset includes: For any language text in the first dataset, a topic similarity is determined based on the topic of the language text and the model task, wherein the topic similarity is used to represent the degree of correlation between the topic of the language text and the model task; From the first dataset, language texts with topic similarity reaching a similarity threshold are obtained to form the third text subset.

5. The method according to claim 1, characterized in that, The determination of parameter constraints based on the weights of parameters in the large language model includes: Obtain the weights of the parameters in the large language model; For any parameter of the large language model, the parameter is multiplied by its weight to obtain the constraint term of the parameter; Based on the constraints of multiple parameters in the large language model, the parameter constraints are determined, and the parameter constraints are part of the loss of the large language model.

6. The method according to claim 5, characterized in that, The determination of the parameter constraints based on the constraints of multiple parameters in the large language model includes: From all parameters in the large language model, select multiple parameters whose weights reach a weight threshold; The parameter constraint conditions are obtained by summing the constraint terms of the multiple parameters.

7. The method according to claim 1, characterized in that, The determination of parameter constraints based on the weights of parameters in the large language model includes: For any parameter of the large language model, the learning rate of the parameter is determined based on the weight of the parameter, and the learning rate of the parameter is negatively correlated with the weight of the parameter. Based on the learning rate of multiple parameters in the large language model, parameter constraints are determined.

8. The method according to claim 1, characterized in that, The method further includes: The parameters of the large language model are adjusted using at least one of the weight decay strategy and Dropout.

9. A model training device, characterized in that, The device includes: The first training module is used to pre-train a large language model based on a first dataset, which includes language texts from multiple languages. The first determining module is used to determine a second dataset based on the first dataset and the model task. The second dataset includes partial language texts of each language in the first dataset and language texts related to the model task. The second determining module is used to determine parameter constraints based on the weights of the parameters in the large language model. The weights represent the importance of the corresponding parameters to the large language model's language learning during the pre-training phase, and the parameter constraints constrain the amount of change of the parameters. The second training module is used to adjust the parameters of the pre-trained large language model based on the second dataset and the parameter constraints. The parameter-adjusted large language model is used to perform the model task in any of the multiple languages.

10. A computer device, characterized in that, The computer device includes a processor and a memory, the memory being used to store at least one computer program, the at least one computer program being loaded by the processor and executed as the model training method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store at least one computer program for performing the model training method according to any one of claims 1 to 8.

12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the model training method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Neural network training method and device

    CN113505883A

  • Unsupervised machine reading understanding method based on large-scale problem self-learning

    CN113836895A