Large model parameter adjustment method, device, electronic device and storage medium

By dividing the training sample set into subsets and adjusting the parameter matrix, the problem of insufficient forgetfulness and generalization ability when the source data processing model is migrated to the target domain is solved, and the model generalization ability and data processing accuracy are improved without increasing the total number of training samples.

CN117688386BActive Publication Date: 2025-09-02MOORE THREADS TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311705544.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-12
Publication Date
2025-09-02
Estimated Expiration
2043-12-12

AI Technical Summary

Technical Problem

When migrating the source data processing model to the target domain, too large the training sample set of the target domain leads to an increase in forgetfulness, while too small the number leads to insufficient generalization ability.

Method used

The training sample set is divided into at least two training sample subsets, and the decomposition parameter values ​​that are different from each subset are determined for each subset, the corresponding first and second parameter matrices are initialized, and these matrices are updated by the training sample subset to adjust the parameters of the target data processing model.

Benefits of technology

Without increasing the total number of training samples, the generalization ability of the target data processing model is enhanced and the accuracy of data processing is improved, reducing the memory requirement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117688386B_ABST
    Figure CN117688386B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a parameter adjustment method, device, electronic device and storage medium for a large model. The method comprises: dividing a training sample set into at least two training sample subsets, and determining at least two decomposition parameter values ​​corresponding to the at least two training sample subsets, wherein the at least two decomposition parameter values ​​are different from each other; for any training sample subset of the at least two training sample subsets, initializing a first parameter matrix and a second parameter matrix corresponding to the training sample subset according to the number of rows and columns of an original parameter matrix corresponding to the target data processing model and the decomposition parameter value corresponding to the training sample subset; training the target data processing model based on the training sample subset to obtain an updated first parameter matrix and an updated second parameter matrix corresponding to the training sample subset, so as to update the parameters of the target data processing model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a large model parameter adjustment method, a large model parameter adjustment device, an electronic device, and a storage medium. Background Art

[0002] When migrating a source data processing model to a target domain, we need to use the target domain's training sample set to adjust the model's parameters. We've found that if the target domain's training sample set contains too many training samples, the model's forgetfulness tends to increase; if the target domain's training sample set contains too few training samples, the model's generalization ability is insufficient. Summary of the Invention

[0003] The present disclosure provides a technical solution for parameter adjustment of a large model.

[0004] According to one aspect of the present disclosure, a method for adjusting parameters of a large model is provided, comprising:

[0005] Dividing the training sample set into at least two training sample subsets, and determining at least two decomposition parameter values ​​corresponding one-to-one to the at least two training sample subsets, wherein the at least two decomposition parameter values ​​are different from each other;

[0006] For any training sample subset of the at least two training sample subsets, initializing a first parameter matrix and a second parameter matrix corresponding to the training sample subset according to the number of rows and columns of the original parameter matrix corresponding to the target data processing model and the decomposition parameter value corresponding to the training sample subset, wherein the number of rows of the first parameter matrix corresponding to the training sample subset is equal to the number of rows of the original parameter matrix, the number of columns of the second parameter matrix corresponding to the training sample subset is equal to the number of columns of the original parameter matrix, the number of columns of the first parameter matrix corresponding to the training sample subset and the number of rows of the second parameter matrix corresponding to the training sample subset are equal to the decomposition parameter value corresponding to the training sample subset, and the decomposition parameter value corresponding to the training sample subset is less than the number of rows and columns of the original parameter matrix;

[0007] Training the target data processing model based on the training sample subset to obtain an updated first parameter matrix and an updated second parameter matrix corresponding to the training sample subset;

[0008] The parameters of the target data processing model are updated according to the updated first parameter matrix and the updated second parameter matrix corresponding to the at least two training sample subsets.

[0009] In a possible implementation, the decomposition parameter value corresponding to the training sample subset is at least one order of magnitude smaller than the number of rows and columns of the original parameter matrix.

[0010] In a possible implementation, during the parameter adjustment process of the target data processing model, the original parameter matrix remains fixed.

[0011] In a possible implementation, the training of the target data processing model based on the training sample subset to obtain an updated first parameter matrix and an updated second parameter matrix corresponding to the training sample subset includes:

[0012] For any training sample in the training sample subset, input the training sample into the target data processing model, and output a prediction result corresponding to the training sample through the target data processing model;

[0013] Determining a value of a loss function corresponding to the training sample subset according to prediction results and labels corresponding to the training samples in the training sample subset;

[0014] According to the value of the loss function corresponding to the training sample subset, an updated first parameter matrix and an updated second parameter matrix corresponding to the training sample subset are determined.

[0015] In a possible implementation, inputting the training sample into the target data processing model, and outputting a prediction result corresponding to the training sample through the target data processing model, includes:

[0016] Calculating the product of the latest first parameter matrix and the latest second parameter matrix corresponding to the training sample subset to obtain a first product corresponding to the training sample subset;

[0017] Determine the sum of the original parameter matrix and the first product corresponding to the training sample subset as the latest total parameter matrix corresponding to the training sample subset;

[0018] The training samples are input into the target data processing model, and based on the latest total parameter matrix corresponding to the training sample subset, prediction results corresponding to the training samples are obtained.

[0019] In a possible implementation, determining the updated first parameter matrix and the updated second parameter matrix corresponding to the training sample subset according to the value of the loss function corresponding to the training sample subset includes:

[0020] Determining, according to a value of the loss function corresponding to the training sample subset, a first gradient of a first parameter matrix corresponding to the training sample subset and a second gradient of a second parameter matrix corresponding to the training sample subset;

[0021] determining an updated first parameter matrix corresponding to the training sample subset according to a first gradient of the first parameter matrix corresponding to the training sample subset;

[0022] An updated second parameter matrix corresponding to the training sample subset is determined according to a second gradient of the second parameter matrix corresponding to the training sample subset.

[0023] In a possible implementation, the method further includes:

[0024] In the video memory, a first gradient of a first parameter matrix corresponding to the training sample subset and a second gradient of a second parameter matrix corresponding to the training sample subset are stored.

[0025] In a possible implementation, the method further includes:

[0026] In the video memory, first optimizer state information of a first parameter matrix corresponding to the training sample subset and second optimizer state information of a second parameter matrix corresponding to the training sample subset are saved.

[0027] In a possible implementation, updating the parameters of the target data processing model according to the updated first parameter matrix and the updated second parameter matrix corresponding to the at least two training sample subsets includes:

[0028] For any training sample subset of the at least two training sample subsets, calculating the product of the latest first parameter matrix corresponding to the training sample subset and the latest second parameter matrix to obtain a second product corresponding to the training sample subset;

[0029] An updated parameter matrix of the target data processing model is determined according to the second products corresponding to the at least two training sample subsets and the original parameter matrix.

[0030] In a possible implementation, the loss function includes a first loss function corresponding to a task of predicting the next word.

[0031] In a possible implementation, the loss function includes a second loss function corresponding to the reinforcement learning task.

[0032] In a possible implementation, the target data processing model is a text processing model, and the training sample is a training text.

[0033] According to one aspect of the present disclosure, there is provided a data processing method, comprising:

[0034] Obtaining a target data processing model trained by the parameter adjustment method of the large model;

[0035] The data to be processed is input into the target data processing model, and the data processing results corresponding to the data to be processed are output through the target data processing model.

[0036] In a possible implementation, the data to be processed is text to be processed.

[0037] According to one aspect of the present disclosure, a parameter adjustment device for a large model is provided, comprising:

[0038] a partitioning module, configured to partition the training sample set into at least two training sample subsets, and determine at least two decomposition parameter values ​​corresponding one-to-one to the at least two training sample subsets, wherein the at least two decomposition parameter values ​​are different from each other;

[0039] an initialization module, configured to initialize, for any one of the at least two training sample subsets, a first parameter matrix and a second parameter matrix corresponding to the training sample subset according to the number of rows and columns of the original parameter matrix corresponding to the target data processing model and the decomposition parameter value corresponding to the training sample subset, wherein the number of rows of the first parameter matrix corresponding to the training sample subset is equal to the number of rows of the original parameter matrix, the number of columns of the second parameter matrix corresponding to the training sample subset is equal to the number of columns of the original parameter matrix, the number of columns of the first parameter matrix corresponding to the training sample subset and the number of rows of the second parameter matrix corresponding to the training sample subset are equal to the decomposition parameter value corresponding to the training sample subset, and the decomposition parameter value corresponding to the training sample subset is less than the number of rows and columns of the original parameter matrix;

[0040] A first updating module is configured to train the target data processing model based on the training sample subset to obtain an updated first parameter matrix and an updated second parameter matrix corresponding to the training sample subset;

[0041] The second updating module is used to update the parameters of the target data processing model according to the updated first parameter matrix and the updated second parameter matrix corresponding to the at least two training sample subsets.

[0042] In a possible implementation, the decomposition parameter value corresponding to the training sample subset is at least one order of magnitude smaller than the number of rows and columns of the original parameter matrix.

[0043] In a possible implementation, during the parameter adjustment process of the target data processing model, the original parameter matrix remains fixed.

[0044] In a possible implementation, the first update module is configured to:

[0045] For any training sample in the training sample subset, input the training sample into the target data processing model, and output a prediction result corresponding to the training sample through the target data processing model;

[0046] Determining a value of a loss function corresponding to the training sample subset according to prediction results and labels corresponding to the training samples in the training sample subset;

[0047] According to the value of the loss function corresponding to the training sample subset, an updated first parameter matrix and an updated second parameter matrix corresponding to the training sample subset are determined.

[0048] In a possible implementation, the first update module is configured to:

[0049] Calculating the product of the latest first parameter matrix and the latest second parameter matrix corresponding to the training sample subset to obtain a first product corresponding to the training sample subset;

[0050] Determine the sum of the original parameter matrix and the first product corresponding to the training sample subset as the latest total parameter matrix corresponding to the training sample subset;

[0051] The training samples are input into the target data processing model, and based on the latest total parameter matrix corresponding to the training sample subset, prediction results corresponding to the training samples are obtained.

[0052] In a possible implementation, the first update module is configured to:

[0053] Determining, according to a value of the loss function corresponding to the training sample subset, a first gradient of a first parameter matrix corresponding to the training sample subset and a second gradient of a second parameter matrix corresponding to the training sample subset;

[0054] determining an updated first parameter matrix corresponding to the training sample subset according to a first gradient of the first parameter matrix corresponding to the training sample subset;

[0055] An updated second parameter matrix corresponding to the training sample subset is determined according to a second gradient of the second parameter matrix corresponding to the training sample subset.

[0056] In a possible implementation, the apparatus further includes:

[0057] The first saving module is used to save, in a video memory, a first gradient of a first parameter matrix corresponding to the training sample subset and a second gradient of a second parameter matrix corresponding to the training sample subset.

[0058] In a possible implementation, the method further includes:

[0059] The second saving module is used to save, in a video memory, first optimizer state information of a first parameter matrix corresponding to the training sample subset and second optimizer state information of a second parameter matrix corresponding to the training sample subset.

[0060] In a possible implementation, the second update module is configured to:

[0061] For any training sample subset of the at least two training sample subsets, calculating the product of the latest first parameter matrix corresponding to the training sample subset and the latest second parameter matrix to obtain a second product corresponding to the training sample subset;

[0062] An updated parameter matrix of the target data processing model is determined according to the second products corresponding to the at least two training sample subsets and the original parameter matrix.

[0063] In a possible implementation, the loss function includes a first loss function corresponding to a task of predicting the next word.

[0064] In a possible implementation, the loss function includes a second loss function corresponding to the reinforcement learning task.

[0065] In a possible implementation, the target data processing model is a text processing model, and the training sample is a training text.

[0066] According to one aspect of the present disclosure, there is provided a data processing apparatus, comprising:

[0067] A first acquisition module is used to acquire a target data processing model trained by the parameter adjustment device of the large model;

[0068] The data processing module is used to input the data to be processed into the target data processing model and output the data processing results corresponding to the data to be processed through the target data processing model.

[0069] In a possible implementation, the data to be processed is text to be processed.

[0070] According to one aspect of the present disclosure, an electronic device is provided, comprising: one or more processors; a memory for storing executable instructions; wherein the one or more processors are configured to call the executable instructions stored in the memory to execute the above method.

[0071] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the above method is implemented.

[0072] According to one aspect of the present disclosure, a computer program product is provided, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in an electronic device, a processor in the electronic device executes the above method.

[0073] In an embodiment of the present disclosure, a training sample set is divided into at least two training sample subsets, and at least two decomposition parameter values ​​corresponding to the at least two training sample subsets are determined, wherein the at least two decomposition parameter values ​​are different from each other. For any training sample subset of the at least two training sample subsets, a first parameter matrix and a second parameter matrix corresponding to the training sample subset are initialized according to the number of rows and columns of the original parameter matrix corresponding to the target data processing model and the decomposition parameter values ​​corresponding to the training sample subset, wherein the number of rows of the first parameter matrix corresponding to the training sample subset is equal to the number of rows of the original parameter matrix, the number of columns of the second parameter matrix corresponding to the training sample subset is equal to the number of columns of the original parameter matrix, and the number of columns of the first parameter matrix corresponding to the training sample subset and the number of columns of the second parameter matrix corresponding to the training sample subset are equal to the number of columns of the original parameter matrix. The number of rows of the matrix is ​​equal to the decomposition parameter value corresponding to the training sample subset, and the decomposition parameter value corresponding to the training sample subset is less than the number of rows and columns of the original parameter matrix. The target data processing model is trained based on the training sample subset to obtain an updated first parameter matrix and an updated second parameter matrix corresponding to the training sample subset, and the parameters of the target data processing model are updated according to the updated first parameter matrix and the updated second parameter matrix corresponding to the at least two training sample subsets. Therefore, without increasing the total amount of training samples and thus increasing the forgetting property of the target data processing model, the parameters of the target data processing model are adjusted using at least two training sample subsets with different decomposition parameter values, thereby enhancing the generalization ability of the target data processing model and improving the accuracy of data processing by the target data processing model.

[0074] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.

[0075] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0076] The accompanying drawings herein are incorporated into and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and, together with the specification, are used to explain the technical solutions of the present disclosure.

[0077] Figure 1 A flow chart of a large model parameter adjustment method provided by an embodiment of the present disclosure is shown.

[0078] Figure 2 A block diagram of a large model parameter adjustment device provided by an embodiment of the present disclosure is shown.

[0079] Figure 3 A block diagram of an electronic device 1900 provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0080] Various exemplary embodiments, features, and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise indicated.

[0081] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0082] The term "and / or" herein simply describes an association relationship between associated objects, indicating that three relationships can exist. For example, "A and / or B" can represent the existence of three situations: A alone, A and B simultaneously, and B alone. Furthermore, the term "at least one" herein refers to any combination of at least two of any one or more of a plurality of items. For example, "at least one of A, B, and C" can represent any one or more elements selected from the set consisting of A, B, and C.

[0083] In addition, numerous specific details are provided in the following detailed description to better illustrate the present disclosure. Those skilled in the art will appreciate that the present disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art are not described in detail in order to highlight the main points of the present disclosure.

[0084] An embodiment of the present disclosure provides a parameter adjustment method for a large model, which divides a training sample set into at least two training sample subsets, and determines at least two decomposition parameter values ​​corresponding to the at least two training sample subsets, wherein the at least two decomposition parameter values ​​are different from each other. For any training sample subset of the at least two training sample subsets, according to the number of rows and columns of the original parameter matrix corresponding to the target data processing model and the decomposition parameter value corresponding to the training sample subset, a first parameter matrix and a second parameter matrix corresponding to the training sample subset are initialized, wherein the number of rows of the first parameter matrix corresponding to the training sample subset is equal to the number of rows of the original parameter matrix, the number of columns of the second parameter matrix corresponding to the training sample subset is equal to the number of columns of the original parameter matrix, and the number of columns of the first parameter matrix corresponding to the training sample subset is equal to the number of columns of the training sample subset. The number of rows of the corresponding second parameter matrix is ​​equal to the decomposition parameter value corresponding to the training sample subset, and the decomposition parameter value corresponding to the training sample subset is less than the number of rows and columns of the original parameter matrix. The target data processing model is trained based on the training sample subset to obtain the updated first parameter matrix and the updated second parameter matrix corresponding to the training sample subset, and the parameters of the target data processing model are updated according to the updated first parameter matrix and the updated second parameter matrix corresponding to the at least two training sample subsets. Therefore, without increasing the total amount of training samples and thus increasing the forgetting property of the target data processing model, the parameters of the target data processing model are adjusted using at least two training sample subsets with different decomposition parameter values, thereby enhancing the generalization ability of the target data processing model and improving the accuracy of data processing by the target data processing model.

[0085] The parameter adjustment method of the large model provided by the embodiment of the present disclosure is described in detail below with reference to the accompanying drawings.

[0086] Figure 1 A flow chart of the parameter adjustment method of the large model provided by an embodiment of the present disclosure is shown. In one possible implementation, the execution subject of the parameter adjustment method of the large model may be a parameter adjustment device of the large model. For example, the parameter adjustment method of the large model may be executed by a terminal device or a server or other electronic device. The terminal device may be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device or a wearable device, etc. In some possible implementations, the parameter adjustment method of the large model may be implemented by a processor calling computer-readable instructions stored in a memory. As Figure 1As shown, the parameter adjustment method of the large model includes steps S11 to S14.

[0087] In step S11 , the training sample set is divided into at least two training sample subsets, and at least two decomposition parameter values ​​corresponding to the at least two training sample subsets are determined, wherein the at least two decomposition parameter values ​​are different from each other.

[0088] In step S12, for any training sample subset of the at least two training sample subsets, the first parameter matrix and the second parameter matrix corresponding to the training sample subset are initialized according to the number of rows and columns of the original parameter matrix corresponding to the target data processing model and the decomposition parameter value corresponding to the training sample subset, wherein the number of rows of the first parameter matrix corresponding to the training sample subset is equal to the number of rows of the original parameter matrix, the number of columns of the second parameter matrix corresponding to the training sample subset is equal to the number of columns of the original parameter matrix, the number of columns of the first parameter matrix corresponding to the training sample subset and the number of rows of the second parameter matrix corresponding to the training sample subset are equal to the decomposition parameter value corresponding to the training sample subset, and the decomposition parameter value corresponding to the training sample subset is less than the number of rows and columns of the original parameter matrix.

[0089] In step S13, the target data processing model is trained based on the training sample subset to obtain an updated first parameter matrix and an updated second parameter matrix corresponding to the training sample subset.

[0090] In step S14, the parameters of the target data processing model are updated according to the updated first parameter matrix and the updated second parameter matrix corresponding to the at least two training sample subsets.

[0091] The embodiments of the present disclosure can be applied to technical fields such as text, voice, image, video, and multimodality. In addition, the target data processing model in the embodiments of the present disclosure can be used for AIGC (Artificial Intelligence Generative Content), etc., without limitation herein.

[0092] In one possible implementation, the target data processing model is a text processing model, and the training sample is training text. When the disclosed embodiments are applied to the field of text processing technology, the target data processing model can be a target text processing model, and the training sample can be training text. After the parameters of the target text processing model are adjusted, the input of the target text processing model can be the text to be processed.

[0093] For example, the target text processing model can use a network structure such as ChatGLM-6B, LLaMA-13B, or BLOOM, without limitation here. The text processing model can also be called a language model, etc., without limitation here.

[0094] The target text processing model can be used in application areas such as dialogue systems (such as medical question-and-answer systems), text generation, language error correction, text classification, information retrieval and search engines, speech recognition, speech synthesis, automatic summarization, machine translation, and intelligent text analysis, without limitation here.

[0095] When the embodiments of the present disclosure are applied to the field of speech processing technology, the target data processing model may be a target speech processing model, and the training sample may be a training speech. After the parameters of the target speech processing model are adjusted, the input of the target speech processing model may be a speech to be processed.

[0096] When the embodiments of the present disclosure are applied to the field of image processing technology, the target data processing model may be a target image processing model, and the training samples may be training images. After the parameters of the target image processing model are adjusted, the input of the target image processing model may be an image to be processed.

[0097] When the embodiments of the present disclosure are applied to the field of video processing technology, the target data processing model may be a target video processing model, and the training sample may be a training video. After the parameters of the target video processing model are adjusted, the input of the target video processing model may be a video to be processed.

[0098] When the embodiments of the present disclosure are applied to the field of multimodal processing technology, the target data processing model can be a target multimodal processing model, and the training samples can be training multimodal data. After the parameters of the target multimodal processing model are adjusted, the input of the target multimodal processing model can be the multimodal data to be processed.

[0099] In the embodiment of the present disclosure, the target data processing model may be a large model.

[0100] In the embodiments of the present disclosure, the domain corresponding to the source data processing model may be referred to as the source domain, and the domain corresponding to the target data processing model may be referred to as the target domain. The network structure of the target data processing model may be the same as that of the source data processing model, and the parameters of the target data processing model may be adjusted based on the source data processing model.

[0101] In the embodiment of the present disclosure, the original parameter matrix may represent the matrix corresponding to all parameters in the target data processing model (i.e., the source data processing model) before the parameter adjustment. That is, in the embodiment of the present disclosure, the original parameter matrix may include all parameters in the target data processing model before the parameter adjustment.

[0102] In embodiments of the present disclosure, a target domain training sample set can be used to adjust the parameters of a target data processing model, where the training sample set can include multiple training samples. For any training sample, the training sample can be input into the target data processing model, and a feature vector corresponding to the training sample can be extracted by the target data processing model. Based on the feature vector corresponding to the training sample, a prediction result corresponding to the training sample can be obtained.

[0103] In an embodiment of the present disclosure, a training sample set may be divided into at least two training sample subsets, wherein the number of training samples in different training sample subsets may be the same or different. In an embodiment of the present disclosure, different training sample subsets correspond to different decomposition parameter values, wherein the decomposition parameter values ​​are used to decompose the original parameter matrix corresponding to the target data processing model.

[0104] For example, the training sample set may be divided into a first training sample subset and a second training sample subset, wherein the decomposition parameter value corresponding to the first training sample subset is r0, and the decomposition parameter value corresponding to the second training sample subset is r1.

[0105] For another example, the training sample set can be divided into a first training sample subset, a second training sample subset, and a third training sample subset, where the decomposition parameter value corresponding to the first training sample subset is r0, the decomposition parameter value corresponding to the second training sample subset is r1, and the decomposition parameter value corresponding to the third training sample subset is r2. For example, if the training sample set includes 60,000 conversation data, it can be divided into three training sample subsets, each including 20,000 conversation data.

[0106] In an embodiment of the present disclosure, after determining the decomposition parameter values ​​corresponding to each training sample subset, the first parameter matrix and the second parameter matrix corresponding to each training sample subset can be initialized according to the number of rows and columns of the original parameter matrix corresponding to the target data processing model. For any training sample subset, the number of rows of the first parameter matrix corresponding to the training sample subset is equal to the number of rows of the original parameter matrix, the number of columns of the second parameter matrix corresponding to the training sample subset is equal to the number of columns of the original parameter matrix, the number of columns of the first parameter matrix corresponding to the training sample subset and the number of rows of the second parameter matrix corresponding to the training sample subset are equal to the decomposition parameter value corresponding to the training sample subset, and the decomposition parameter value corresponding to the training sample subset is less than the number of rows and columns of the original parameter matrix.

[0107] For example, the training sample set is divided into a first training sample subset, a second training sample subset, and a third training sample subset, where the decomposition parameter value corresponding to the first training sample subset is r0, the decomposition parameter value corresponding to the second training sample subset is r1, and the decomposition parameter value corresponding to the third training sample subset is r2. The size of the original parameter matrix corresponding to the target data processing model is m×n, that is, the number of rows of the original parameter matrix corresponding to the target data processing model is m, and the number of columns is n.

[0108] Then, the size of the first parameter matrix corresponding to the first training sample subset can be m×r0, that is, the number of rows of the first parameter matrix corresponding to the first training sample subset can be m, and the number of columns can be r0. The size of the second parameter matrix corresponding to the first training sample subset can be r0×n, that is, the number of rows of the second parameter matrix corresponding to the first training sample subset can be r0, and the number of columns can be n. Where r0<m and r0<n.

[0109] The size of the first parameter matrix corresponding to the second training sample subset may be m×r1, that is, the number of rows of the first parameter matrix corresponding to the second training sample subset may be m, and the number of columns may be r1. The size of the second parameter matrix corresponding to the second training sample subset may be r1×n, that is, the number of rows of the second parameter matrix corresponding to the second training sample subset may be r1, and the number of columns may be n. Where r1<m, and r1<n.

[0110] The size of the first parameter matrix corresponding to the third training sample subset may be m×r², that is, the number of rows of the first parameter matrix corresponding to the third training sample subset may be m, and the number of columns may be r². The size of the second parameter matrix corresponding to the third training sample subset may be r²×n, that is, the number of rows of the second parameter matrix corresponding to the third training sample subset may be r², and the number of columns may be n. Where r²<m, and r²<n.

[0111] In a possible implementation, the decomposition parameter value corresponding to the training sample subset is at least one order of magnitude smaller than the number of rows and columns of the original parameter matrix.

[0112] For example, the decomposition parameter values ​​corresponding to the first training sample subset can be one order of magnitude smaller than the number of rows and columns of the original parameter matrix; for another example, the decomposition parameter values ​​corresponding to the first training sample subset can be two orders of magnitude smaller than the number of rows and columns of the original parameter matrix; for another example, the decomposition parameter values ​​corresponding to the first training sample subset can be three orders of magnitude smaller than the number of rows and columns of the original parameter matrix; and so on.

[0113] For example, the decomposition parameter values corresponding to the second training sample subset can be one order of magnitude smaller than the number of rows and columns of the original parameter matrix; for another example, the decomposition parameter values corresponding to the second training sample subset can be two orders of magnitude smaller than the number of rows and columns of the original parameter matrix; for another example, the decomposition parameter values corresponding to the second training sample subset can be three orders of magnitude smaller than the number of rows and columns of the original parameter matrix; and so on.

[0114] For example, the decomposition parameter values corresponding to the third training sample subset can be one order of magnitude smaller than the number of rows and columns of the original parameter matrix; for another example, the decomposition parameter values corresponding to the third training sample subset can be two orders of magnitude smaller than the number of rows and columns of the original parameter matrix; for another example, the decomposition parameter values corresponding to the third training sample subset can be three orders of magnitude smaller than the number of rows and columns of the original parameter matrix; and so on.

[0115] For example, the size of the original parameter matrix corresponding to the target data processing model is m×n, the size of the first parameter matrix corresponding to the i-th training sample subset is m×ri, the size of the second parameter matrix is ri×n, ri << m, and ri << n. For example, ri can be 8, 16, 4, 64, 2, etc., which is not limited here.

[0116] In this implementation manner, by setting the decomposition parameter values corresponding to the training sample subset to be at least one order of magnitude smaller than the number of rows and columns of the original parameter matrix corresponding to the target data processing model, it helps to save a large amount of video memory resources.

[0117] In a possible implementation manner, the first parameter matrix and the second parameter matrix corresponding to each training sample subset can be initialized with a Gaussian distribution to increase the generalization ability of the target data processing model.

[0118] In the embodiments of the present disclosure, during the process of adjusting the parameters of the target data processing model using any training sample subset, W + BiAi can be used as the total parameter matrix corresponding to the training sample subset to participate in the calculations of forward propagation and backward propagation. Here, W can represent the original parameter matrix corresponding to the target data processing model, Ai can represent the first parameter matrix corresponding to the training sample subset, and Bi can represent the second parameter matrix corresponding to the training sample subset. When updating the parameters of the target data processing model, W can remain fixed, and only Ai and Bi are updated.

[0119] In related technologies, fine-tuning the source data processing model to obtain the target data processing model is mainly performed through full fine-tuning, fixed parameter fine-tuning, adapter fine-tuning, or prefix fine-tuning. However, for large data processing models, full fine-tuning is prohibitively expensive. In the fixed parameter fine-tuning approach, only the parameters of a few network layers of the source data processing model are fine-tuned, while the parameters of the remaining network layers are frozen. However, when the source domain corresponding to the source data processing model differs significantly from the target domain corresponding to the target data processing model, fine-tuning only the parameters of a few network layers is difficult to guarantee. Furthermore, due to the close connection between layers and the transmission of semantic information layer by layer, fine-tuning only the parameters of a few layers results in a significant discrepancy between the semantic information of the frozen layers and the fine-tuned layers, resulting in poor fine-tuning results. Adapter fine-tuning increases inference costs, and fine-tuning only a small number of parameters makes it difficult to guarantee results. Prefix fine-tuning is difficult to train, and fine-tuning only a small number of parameters results in poor results.

[0120] When using the target domain's training sample set to adjust the parameters of the source data processing model, if all parameters of the source data processing model are not adjusted, the resulting target data processing model will perform poorly in the target domain. However, full fine-tuning is costly. Full fine-tuning of a large-scale source data processing model typically requires a graphics card with 80GB of video memory. However, not all application scenarios offer such a graphics card. In some scenarios, only graphics cards with approximately 32GB of video memory are available. In these scenarios, full fine-tuning is not possible.

[0121] In the embodiment of the present disclosure, in the parameter adjustment of the target data processing model, there is no need to update the original parameter matrix with a larger parameter amount, and only the first parameter matrix and the second parameter matrix with a smaller parameter amount need to be updated. Compared with full-scale fine-tuning, the embodiment of the present disclosure can reduce video memory overhead and reduce the requirements for video memory capacity, and the data processing effect of the fine-tuned target data processing model in the target domain is close to that of full-scale fine-tuning. Compared with the solutions of fixed partial parameter fine-tuning, adapter fine-tuning, and prefix fine-tuning, the target data processing model obtained by fine-tuning in the embodiment of the present disclosure has a significantly improved data processing effect in the target domain.

[0122] In one possible implementation, during the parameter adjustment process of the target data processing model, the original parameter matrix remains fixed. In this implementation, during the parameter adjustment process of the target data processing model, the original parameter matrix corresponding to the target data processing model remains fixed, that is, the original parameter matrix corresponding to the target data processing model remains frozen and is not further adjusted. By keeping the original parameter matrix fixed during the parameter adjustment process of the target data processing model, a large amount of video memory resources can be saved.

[0123] In one possible implementation, the target data processing model is trained based on the training sample subset to obtain an updated first parameter matrix and an updated second parameter matrix corresponding to the training sample subset, including: for any training sample in the training sample subset, the training sample is input into the target data processing model, and the prediction result corresponding to the training sample is output through the target data processing model; according to the prediction results and labels corresponding to the training samples in the training sample subset, the value of the loss function corresponding to the training sample subset is determined; according to the value of the loss function corresponding to the training sample subset, the updated first parameter matrix and the updated second parameter matrix corresponding to the training sample subset are determined.

[0124] In this implementation, for any training sample, the training sample can be input into the target data processing model, the feature vector corresponding to the training sample can be extracted by the target data processing model, and the prediction result corresponding to the training sample can be obtained based on the feature vector corresponding to the training sample.

[0125] For any training sample subset, the value of the loss function corresponding to the training sample subset can be determined according to the prediction results and labels corresponding to each training sample in the training sample subset.

[0126] For any training sample subset, the updated first parameter matrix and the updated second parameter matrix corresponding to the training sample subset may be determined according to the value of the loss function corresponding to the training sample subset.

[0127] In this implementation, for any training sample in the training sample subset, the training sample is input into the target data processing model, and the prediction result corresponding to the training sample is output through the target data processing model. According to the prediction result and label corresponding to the training sample in the training sample subset, the value of the loss function corresponding to the training sample subset is determined, and according to the value of the loss function corresponding to the training sample subset, the updated first parameter matrix and the updated second parameter matrix corresponding to the training sample subset are determined, thereby enabling the first parameter matrix and the second parameter matrix to be updated respectively based on each training sample subset.

[0128] As an example of this implementation method, the training sample is input into the target data processing model, and the prediction result corresponding to the training sample is output through the target data processing model, including: calculating the product of the latest first parameter matrix and the latest second parameter matrix corresponding to the training sample subset to obtain the first product corresponding to the training sample subset; determining the sum of the original parameter matrix and the first product corresponding to the training sample subset as the latest total parameter matrix corresponding to the training sample subset; inputting the training sample into the target data processing model, and obtaining the prediction result corresponding to the training sample based on the latest total parameter matrix corresponding to the training sample subset.

[0129] In this implementation, for any training sample subset, the first product corresponding to the training sample subset can represent the product of the latest first parameter matrix corresponding to the training sample subset and the latest second parameter matrix corresponding to the training sample subset during the parameter adjustment process of the target data processing model.

[0130] For example, for any training sample subset, the total parameter matrix corresponding to the training sample subset can be determined based on W + BiAi, where W can represent the original parameter matrix corresponding to the target data processing model, Ai can represent the first parameter matrix corresponding to the training sample subset, and Bi can represent the second parameter matrix corresponding to the training sample subset. When the parameters of the target data processing model are updated, BiAi can represent the first product corresponding to the training sample subset.

[0131] In this example, the first product corresponding to the training sample subset is obtained by calculating the product of the latest first parameter matrix and the latest second parameter matrix corresponding to the training sample subset, and the sum of the original parameter matrix and the first product corresponding to the training sample subset is determined as the latest total parameter matrix corresponding to the training sample subset. The training sample is input into the target data processing model, and the prediction result corresponding to the training sample is obtained based on the latest total parameter matrix corresponding to the training sample subset. Therefore, in the parameter adjustment process of the target data processing model, the forward propagation calculation can be realized based on the total parameter matrix corresponding to the training sample subset.

[0132] In one example, determining the updated first parameter matrix and the updated second parameter matrix corresponding to the training sample subset based on the value of the loss function corresponding to the training sample subset includes: determining the first gradient of the first parameter matrix corresponding to the training sample subset and the second gradient of the second parameter matrix corresponding to the training sample subset based on the value of the loss function corresponding to the training sample subset; determining the updated first parameter matrix corresponding to the training sample subset based on the first gradient of the first parameter matrix corresponding to the training sample subset; and determining the updated second parameter matrix corresponding to the training sample subset based on the second gradient of the second parameter matrix corresponding to the training sample subset.

[0133] In this example, for any training sample subset, the first gradient of the first parameter matrix corresponding to the training sample subset can represent the gradient of the first parameter matrix corresponding to the training sample subset, and the second gradient of the second parameter matrix corresponding to the training sample subset can represent the gradient of the second parameter matrix corresponding to the training sample subset.

[0134] In this example, for any training sample subset, the gradient of the total parameter matrix corresponding to the training sample subset can be determined based on the value of the loss function corresponding to the training sample subset. Furthermore, based on the gradient of the total parameter matrix corresponding to the training sample subset, a first gradient of the first parameter matrix corresponding to the training sample subset and a second gradient of the second parameter matrix corresponding to the training sample subset can be obtained. In this example, during the parameter adjustment process of the target data processing model, backpropagation calculations can be implemented based on the total parameter matrix corresponding to the training sample subset.

[0135] In a possible implementation, the method further includes: storing, in a video memory, a first gradient of a first parameter matrix corresponding to the training sample subset and a second gradient of a second parameter matrix corresponding to the training sample subset.

[0136] In this implementation, during the parameter adjustment process of the target data processing model, only the first gradient of the first parameter matrix corresponding to each training sample subset and the second gradient of the second parameter matrix corresponding to each training sample subset can be saved in the video memory, without saving the gradient corresponding to the original parameter matrix in the video memory, thereby saving video memory.

[0137] Compared to full fine-tuning, which requires saving the gradients corresponding to the original parameter matrix of the target data processing model on the graphics card, this implementation only requires saving the first gradient of the first parameter matrix and the second gradient of the second parameter matrix corresponding to each training sample subset on the graphics card. For example, the number of parameters in the original parameter matrix corresponding to the target data processing model is m×n, and the total number of parameters in the first parameter matrix and the second parameter matrix corresponding to the i-th training sample subset is (m+n)×ri. Since ri can be set to be at least an order of magnitude smaller than m and n, this implementation can save a lot of memory compared to full fine-tuning, which requires saving the gradients corresponding to the original parameter matrix of the target data processing model on the graphics card.

[0138] As an example of this implementation, the method further includes: saving, in a video memory, first optimizer state information of a first parameter matrix corresponding to the training sample subset and second optimizer state information of a second parameter matrix corresponding to the training sample subset.

[0139] In this example, for any training sample subset, the first optimizer state information of the first parameter matrix corresponding to the training sample subset can represent the state information of the optimizer corresponding to the first parameter matrix corresponding to the training sample subset, and the second optimizer state information of the second parameter matrix corresponding to the training sample subset can represent the state information of the optimizer corresponding to the second parameter matrix corresponding to the training sample subset.

[0140] The optimizer state information may represent the data used by the optimizer when performing gradient updates. For example, when using the SGD (Stochastic Gradient Descent) optimizer, the optimizer state information may include momentum; when using the Adam optimizer, the optimizer state information may include first-order momentum and second-order momentum; and so on.

[0141] In this example, during the parameter adjustment process of the target data processing model, only the first optimizer state information of the first parameter matrix and the second optimizer state information of the second parameter matrix corresponding to each training sample subset can be saved in the video memory, without saving the optimizer state information corresponding to the original parameter matrix in the video memory, thereby saving video memory.

[0142] Compared to full fine-tuning, which requires saving the optimizer state information corresponding to the original parameter matrix on the graphics card, this implementation only requires saving the first optimizer state information for the first parameter matrix and the second optimizer state information for the second parameter matrix corresponding to each training sample subset on the graphics card. For example, the original parameter matrix corresponding to the target data processing model has a parameter count of m×n, and the total number of parameters in the first parameter matrix and the second parameter matrix corresponding to the i-th training sample subset is (m+n)×ri. Because ri can be set to be at least an order of magnitude smaller than m and n, this implementation can save a significant amount of memory compared to full fine-tuning, which requires saving the optimizer state information corresponding to the original parameter matrix corresponding to the target data processing model on the graphics card.

[0143] In one possible implementation, updating the parameters of the target data processing model based on the updated first parameter matrix and the updated second parameter matrix corresponding to the at least two training sample subsets includes: for any training sample subset of the at least two training sample subsets, calculating the product of the latest first parameter matrix and the latest second parameter matrix corresponding to the training sample subset to obtain the second product corresponding to the training sample subset; and determining the updated parameter matrix of the target data processing model based on the second product corresponding to the at least two training sample subsets and the original parameter matrix.

[0144] For example, the training sample set is divided into a first training sample subset, a second training sample subset, and a third training sample subset, where the decomposition parameter value corresponding to the first training sample subset is r0, the decomposition parameter value corresponding to the second training sample subset is r1, and the decomposition parameter value corresponding to the third training sample subset is r2. The first parameter matrix corresponding to the first training sample subset is A0, and the second parameter matrix corresponding to the first training sample subset is B0; the first parameter matrix corresponding to the second training sample subset is A1, and the second parameter matrix corresponding to the second training sample subset is B1; the first parameter matrix corresponding to the third training sample subset is A2, and the second parameter matrix corresponding to the third training sample subset is B2. The second product corresponding to the first training sample subset can be calculated as W0 = A0B0, the second product corresponding to the second training sample subset is W1 = A1B1, and the second product corresponding to the third training sample subset is W2 = A2B2.

[0145] As an example of this implementation, the sum of the average value of the second product corresponding to the at least two training sample subsets and the original parameter matrix can be used to determine the updated parameter matrix of the target data processing model. For example, the average value of W0, W1, and W2 can be calculated to obtain Wm, and the updated parameter matrix Wf of the target data processing model can be obtained according to Wf=Wm+W. Where W represents the original parameter matrix.

[0146] As another example of this implementation, the weighted sum of the second products corresponding to the at least two training sample subsets and the sum of the original parameter matrix can be determined as the updated parameter matrix of the target data processing model. For another example, the weighted sum of W0, W1, and W2 can be calculated to obtain Wm, and the updated parameter matrix Wf of the target data processing model can be obtained according to Wf=Wm+W, where W represents the original parameter matrix.

[0147] In this implementation, during the parameter adjustment process of the target data processing model, the original parameter matrix W does not need to be updated. It only needs to be added to Wm after the parameter adjustment of the target data processing model is completed to obtain the updated parameter matrix.

[0148] In one possible implementation, the loss function includes a first loss function corresponding to the task of predicting the next word. In this implementation, adjusting parameters of the target data processing model using the first loss function corresponding to the task of predicting the next word helps improve the accuracy of data processing performed by the target data processing model.

[0149] In other possible implementations, a loss function corresponding to the task of predicting the next word, a loss function corresponding to the task of predicting the next token, etc. may also be used, which is not limited here.

[0150] In one possible implementation, the loss function includes a second loss function corresponding to the reinforcement learning task. In this implementation, adjusting parameters of the target data processing model using the second loss function corresponding to the reinforcement learning task helps improve semantic security.

[0151] The parameter adjustment method for the large model provided in the embodiments of the present disclosure can be applied to technical fields such as artificial intelligence and natural language processing, and is not limited here. The parameter adjustment method for the large model provided in the embodiments of the present disclosure can be used to adjust the parameters of a large-scale data processing model (i.e., a large model), and is not limited here.

[0152] The following describes the parameter adjustment method for a large model provided by an embodiment of the present disclosure using a specific application scenario. In this application scenario, the graphics card's memory capacity can be 32GB; the target data processing model can adopt the ChatGLM-6B network structure, and the input data length can be 256. The target data processing model can be used in the field of medical question answering.

[0153] In this application scenario, the training sample set includes 60,000 conversation data, which can be divided into 3 training sample subsets, and each training sample subset includes 20,000 conversation data. The 3 training sample subsets can be respectively called the first training sample subset, the second training sample subset, and the third training sample subset. Among them, the decomposition parameter value corresponding to the first training sample subset is r0, the decomposition parameter value corresponding to the second training sample subset is r1, and the decomposition parameter value corresponding to the third training sample subset is r2.

[0154] The size of the original parameter matrix W corresponding to the target data processing model can be m×n.

[0155] The first parameter matrix A0 and the second parameter matrix B0 corresponding to the first training sample subset can be initialized. Among them, the size of the first parameter matrix A0 corresponding to the first training sample subset can be m×r0, and the size of the second parameter matrix B0 corresponding to the first training sample subset can be r0×n. Among them, r0 << m, and r0 << n. The first parameter matrix A0 and the second parameter matrix B0 corresponding to the first training sample subset can be initialized using a Gaussian distribution.

[0156] The first parameter matrix A1 and the second parameter matrix B1 corresponding to the second training sample subset can be initialized. Among them, the size of the first parameter matrix A1 corresponding to the second training sample subset can be m×r1, and the size of the second parameter matrix B1 corresponding to the second training sample subset can be r1×n. Among them, r1 << m, and r1 << n. The first parameter matrix A1 and the second parameter matrix B1 corresponding to the second training sample subset can be initialized using a Gaussian distribution.

[0157] The first parameter matrix A2 and the second parameter matrix B2 corresponding to the third training sample subset can be initialized. Among them, the size of the first parameter matrix A2 corresponding to the third training sample subset can be m×r2, and the size of the second parameter matrix B2 corresponding to the third training sample subset can be r2×n. Among them, r2 << m, and r2 << n. The first parameter matrix A2 and the second parameter matrix B2 corresponding to the third training sample subset can be initialized using a Gaussian distribution.

[0158] In the process of adjusting the parameters of the target data processing model using any training sample subset, W+BiAi can be used as the total parameter matrix corresponding to the training sample subset to participate in the calculation of forward propagation and backward propagation. Among them, W can represent the original parameter matrix corresponding to the target data processing model, Ai can represent the latest first parameter matrix corresponding to the training sample subset, and Bi can represent the latest second parameter matrix corresponding to the training sample subset, where i is 0, 1 or 2. When the parameters of the target data processing model are updated, W can be fixed and only Ai and Bi are updated. In addition, in the process of adjusting the parameters of the target data processing model, it is only necessary to save the gradients and optimizer state information of the first parameter matrix Ai and the second parameter matrix Bi corresponding to each training sample subset in the video memory, without saving the gradients and optimizer state information of the original parameter matrix W in the video memory.

[0159] In addition, in this application scenario, the first loss function corresponding to the task of predicting the next word can be used to adjust the parameters of the target data processing model.

[0160] The embodiment of the present disclosure also provides a data processing method, including: obtaining a target data processing model trained by the parameter adjustment method of the large model; inputting the data to be processed into the target data processing model, and outputting the data processing results corresponding to the data to be processed through the target data processing model.

[0161] In a possible implementation, the data to be processed is text to be processed.

[0162] It is understood that the above-mentioned various method embodiments mentioned in this disclosure can be combined with each other to form combined embodiments without violating the principle logic. Due to space limitations, this disclosure will not go into details. It is understood by those skilled in the art that in the above-mentioned methods of specific implementation, the specific execution order of each step should be determined by its function and possible internal logic.

[0163] In addition, the present disclosure also provides a parameter adjustment device, a data processing device, an electronic device, a computer-readable storage medium, and a computer program product for a large model. The above can all be used to implement any large model parameter adjustment method or data processing method provided by the present disclosure. The corresponding technical solutions and technical effects can be found in the corresponding records in the method section and will not be repeated here.

[0164] Figure 2 FIG. 1 is a block diagram of a parameter adjustment device for a large model provided by an embodiment of the present disclosure. Figure 2 As shown, the parameter adjustment device of the large model includes:

[0165] a partitioning module 21, configured to partition the training sample set into at least two training sample subsets, and determine at least two decomposition parameter values ​​corresponding one-to-one to the at least two training sample subsets, wherein the at least two decomposition parameter values ​​are different from each other;

[0166] an initialization module 22, configured to initialize, for any one of the at least two training sample subsets, a first parameter matrix and a second parameter matrix corresponding to the training sample subset according to the number of rows and columns of the original parameter matrix corresponding to the target data processing model and the decomposition parameter value corresponding to the training sample subset, wherein the number of rows of the first parameter matrix corresponding to the training sample subset is equal to the number of rows of the original parameter matrix, the number of columns of the second parameter matrix corresponding to the training sample subset is equal to the number of columns of the original parameter matrix, the number of columns of the first parameter matrix corresponding to the training sample subset and the number of rows of the second parameter matrix corresponding to the training sample subset are equal to the decomposition parameter value corresponding to the training sample subset, and the decomposition parameter value corresponding to the training sample subset is less than the number of rows and columns of the original parameter matrix;

[0167] A first updating module 23 is configured to train the target data processing model based on the training sample subset to obtain an updated first parameter matrix and an updated second parameter matrix corresponding to the training sample subset;

[0168] The second updating module 24 is configured to update the parameters of the target data processing model according to the updated first parameter matrix and the updated second parameter matrix corresponding to the at least two training sample subsets.

[0169] In a possible implementation, the decomposition parameter value corresponding to the training sample subset is at least one order of magnitude smaller than the number of rows and columns of the original parameter matrix.

[0170] In a possible implementation, during the parameter adjustment process of the target data processing model, the original parameter matrix remains fixed.

[0171] In a possible implementation, the first updating module 23 is configured to:

[0172] For any training sample in the training sample subset, input the training sample into the target data processing model, and output a prediction result corresponding to the training sample through the target data processing model;

[0173] Determining a value of a loss function corresponding to the training sample subset according to prediction results and labels corresponding to the training samples in the training sample subset;

[0174] According to the value of the loss function corresponding to the training sample subset, an updated first parameter matrix and an updated second parameter matrix corresponding to the training sample subset are determined.

[0175] In a possible implementation, the first updating module 23 is configured to:

[0176] Calculating the product of the latest first parameter matrix and the latest second parameter matrix corresponding to the training sample subset to obtain a first product corresponding to the training sample subset;

[0177] Determine the sum of the original parameter matrix and the first product corresponding to the training sample subset as the latest total parameter matrix corresponding to the training sample subset;

[0178] The training samples are input into the target data processing model, and based on the latest total parameter matrix corresponding to the training sample subset, prediction results corresponding to the training samples are obtained.

[0179] In a possible implementation, the first updating module 23 is configured to:

[0180] Determining, according to a value of the loss function corresponding to the training sample subset, a first gradient of a first parameter matrix corresponding to the training sample subset and a second gradient of a second parameter matrix corresponding to the training sample subset;

[0181] determining an updated first parameter matrix corresponding to the training sample subset according to a first gradient of the first parameter matrix corresponding to the training sample subset;

[0182] An updated second parameter matrix corresponding to the training sample subset is determined according to a second gradient of the second parameter matrix corresponding to the training sample subset.

[0183] In a possible implementation, the apparatus further includes:

[0184] The first saving module is used to save, in a video memory, a first gradient of a first parameter matrix corresponding to the training sample subset and a second gradient of a second parameter matrix corresponding to the training sample subset.

[0185] In a possible implementation, the method further includes:

[0186] The second saving module is used to save, in a video memory, first optimizer state information of a first parameter matrix corresponding to the training sample subset and second optimizer state information of a second parameter matrix corresponding to the training sample subset.

[0187] In a possible implementation, the second updating module 24 is configured to:

[0188] For any training sample subset of the at least two training sample subsets, calculating the product of the latest first parameter matrix corresponding to the training sample subset and the latest second parameter matrix to obtain a second product corresponding to the training sample subset;

[0189] An updated parameter matrix of the target data processing model is determined according to the second products corresponding to the at least two training sample subsets and the original parameter matrix.

[0190] In a possible implementation, the loss function includes a first loss function corresponding to a task of predicting the next word.

[0191] In a possible implementation, the loss function includes a second loss function corresponding to the reinforcement learning task.

[0192] In a possible implementation, the target data processing model is a text processing model, and the training sample is a training text.

[0193] According to one aspect of the present disclosure, there is provided a data processing apparatus, comprising:

[0194] An acquisition module, configured to acquire a target data processing model trained by the parameter adjustment device of the large model;

[0195] The data processing module is used to input the data to be processed into the target data processing model and output the data processing results corresponding to the data to be processed through the target data processing model.

[0196] In a possible implementation, the data to be processed is text to be processed.

[0197] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. Its specific implementation and technical effects can refer to the description of the above method embodiments. For the sake of brevity, they will not be repeated here.

[0198] The present disclosure also provides a computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement the above method. The computer-readable storage medium may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium.

[0199] The embodiment of the present disclosure further provides a computer program, comprising a computer-readable code. When the computer-readable code is executed in an electronic device, a processor in the electronic device executes the above method.

[0200] An embodiment of the present disclosure further provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in an electronic device, a processor in the electronic device executes the above method.

[0201] An embodiment of the present disclosure also provides an electronic device, comprising: one or more processors; a memory for storing executable instructions; wherein the one or more processors are configured to call the executable instructions stored in the memory to execute the above method.

[0202] The electronic device may be provided as a terminal, a server, or other forms of devices.

[0203] Figure 3 FIG. 1 is a block diagram of an electronic device 1900 provided by an embodiment of the present disclosure. For example, the electronic device 1900 may be provided as a server or a terminal device. Figure 3 The electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute the instructions to perform the above-described method.

[0204] The electronic device 1900 may further include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output interface 1958 (I / O interface). The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as a Microsoft Server operating system (Windows Server 2003). TM ), a graphical user interface operating system launched by Apple (MacOS X TM ), a multi-user, multi-process computer operating system (Unix TM ), a free and open source Unix-like operating system (Linux TM ), an open-source Unix-like operating system (FreeBSD TM ) or similar.

[0205] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions that can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.

[0206] The present disclosure may be a system, method and / or computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.

[0207] A computer-readable storage medium can be a tangible device that can hold and store instructions for use by an instruction execution device. A computer-readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination thereof. As used herein, a computer-readable storage medium is not to be construed as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through an electrical wire.

[0208] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in the computer-readable storage medium in each computing / processing device.

[0209] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, and conventional procedural programming languages ​​such as "C" language or similar programming languages. Computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., utilizing an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of the computer-readable program instructions. The electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.

[0210] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.

[0211] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[0212] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[0213] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and the part of the module, program segment or instruction contains one or more executable instructions for realizing the prescribed logical function. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the prescribed function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0214] The computer program product may be implemented in hardware, software, or a combination thereof. In one embodiment, the computer program product is implemented as a computer storage medium. In another embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).

[0215] The above description of the various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced with each other and will not be repeated herein for the sake of brevity.

[0216] If the technical solutions of the embodiments of the present disclosure involve personal information, the products applying the technical solutions of the embodiments of the present disclosure have clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solutions of the embodiments of the present disclosure involve sensitive personal information, the products applying the technical solutions of the embodiments of the present disclosure have obtained the individual's separate consent before processing the sensitive personal information, and at the same time meet the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that they agree to the collection of their personal information; or on the personal information processing device, when the personal information processing rules are notified by obvious signs / information, the individual's authorization is obtained through pop-up information or by asking the individual to upload their personal information. The personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.

[0217] While various embodiments of the present disclosure have been described above, the above descriptions are illustrative, non-exhaustive, and not intended to be limiting of the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, their practical applications, or improvements to existing technologies, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A parameter adjustment method for a large model, characterized in that: The method is applied to at least one technical field of text, voice, image, and video, and includes: Dividing the training sample set into at least two training sample subsets, and determining at least two decomposition parameter values ​​corresponding one-to-one to the at least two training sample subsets, wherein the at least two decomposition parameter values ​​are different from each other; For any training sample subset of the at least two training sample subsets, initializing a first parameter matrix and a second parameter matrix corresponding to the training sample subset according to the number of rows and columns of the original parameter matrix corresponding to the target data processing model and the decomposition parameter value corresponding to the training sample subset, wherein the number of rows of the first parameter matrix corresponding to the training sample subset is equal to the number of rows of the original parameter matrix, the number of columns of the second parameter matrix corresponding to the training sample subset is equal to the number of columns of the original parameter matrix, the number of columns of the first parameter matrix corresponding to the training sample subset and the number of rows of the second parameter matrix corresponding to the training sample subset are equal to the decomposition parameter value corresponding to the training sample subset, and the decomposition parameter value corresponding to the training sample subset is less than the number of rows and columns of the original parameter matrix; Training the target data processing model based on the training sample subset to obtain an updated first parameter matrix and an updated second parameter matrix corresponding to the training sample subset; The parameters of the target data processing model are updated according to the updated first parameter matrix and the updated second parameter matrix corresponding to the at least two training sample subsets.

2. The method according to claim 1, characterized in that The decomposition parameter value corresponding to the training sample subset is at least one order of magnitude smaller than the number of rows and columns of the original parameter matrix.

3. The method according to claim 1, characterized in that During the parameter adjustment process of the target data processing model, the original parameter matrix remains fixed.

4. The method according to any one of claims 1 to 3, characterized in that The step of training the target data processing model based on the training sample subset to obtain an updated first parameter matrix and an updated second parameter matrix corresponding to the training sample subset includes: For any training sample in the training sample subset, input the training sample into the target data processing model, and output a prediction result corresponding to the training sample through the target data processing model; Determining a value of a loss function corresponding to the training sample subset according to prediction results and labels corresponding to the training samples in the training sample subset; According to the value of the loss function corresponding to the training sample subset, an updated first parameter matrix and an updated second parameter matrix corresponding to the training sample subset are determined.

5. The method according to claim 4, characterized in that Inputting the training sample into the target data processing model, and outputting the prediction result corresponding to the training sample through the target data processing model, includes: Calculating the product of the latest first parameter matrix and the latest second parameter matrix corresponding to the training sample subset to obtain a first product corresponding to the training sample subset; Determine the sum of the original parameter matrix and the first product corresponding to the training sample subset as the latest total parameter matrix corresponding to the training sample subset; The training samples are input into the target data processing model, and based on the latest total parameter matrix corresponding to the training sample subset, prediction results corresponding to the training samples are obtained.

6. The method according to claim 5, characterized in that The step of determining an updated first parameter matrix and an updated second parameter matrix corresponding to the training sample subset according to a value of the loss function corresponding to the training sample subset includes: Determining, according to a value of the loss function corresponding to the training sample subset, a first gradient of a first parameter matrix corresponding to the training sample subset and a second gradient of a second parameter matrix corresponding to the training sample subset; determining an updated first parameter matrix corresponding to the training sample subset according to a first gradient of the first parameter matrix corresponding to the training sample subset; An updated second parameter matrix corresponding to the training sample subset is determined according to a second gradient of the second parameter matrix corresponding to the training sample subset.

7. The method according to claim 6, characterized in that The method further comprises: In the video memory, a first gradient of a first parameter matrix corresponding to the training sample subset and a second gradient of a second parameter matrix corresponding to the training sample subset are stored.

8. The method according to claim 7, characterized in that The method further comprises: In the video memory, first optimizer state information of a first parameter matrix corresponding to the training sample subset and second optimizer state information of a second parameter matrix corresponding to the training sample subset are saved.

9. The method according to any one of claims 1 to 3, characterized in that The updating of the parameters of the target data processing model according to the updated first parameter matrix and the updated second parameter matrix corresponding to the at least two training sample subsets includes: For any training sample subset of the at least two training sample subsets, calculating the product of the latest first parameter matrix corresponding to the training sample subset and the latest second parameter matrix to obtain a second product corresponding to the training sample subset; An updated parameter matrix of the target data processing model is determined according to the second products corresponding to the at least two training sample subsets and the original parameter matrix.

10. The method according to claim 4, characterized in that The loss function includes a first loss function corresponding to the task of predicting the next word.

11. The method according to claim 4, characterized in that The loss function includes a second loss function corresponding to the reinforcement learning task.

12. The method according to any one of claims 1 to 3, characterized in that In the case where the method is applied to the field of text processing technology, the target data processing model is a text processing model, and the training sample is a training text; In the case where the method is applied to the field of speech processing technology, the target data processing model is a target speech processing model, and the training sample is a training speech; In the case where the method is applied to the field of image processing technology, the target data processing model is a target image processing model, and the training samples are training images; When the method is applied to the field of video processing technology, the target data processing model is a target video processing model, and the training sample is a training video.

13. A data processing method, characterized in that: include: Obtaining a target data processing model trained by the large model parameter adjustment method according to any one of claims 1 to 12; The data to be processed is input into the target data processing model, and the data processing results corresponding to the data to be processed are output through the target data processing model.

14. The method according to claim 13, characterized in that The data to be processed is at least one of text to be processed, voice to be processed, image to be processed, and video to be processed.

15. A parameter adjustment device for a large model, characterized in that: The device is applied to at least one technical field of text, voice, image, and video, and includes: a partitioning module, configured to partition the training sample set into at least two training sample subsets, and determine at least two decomposition parameter values ​​corresponding one-to-one to the at least two training sample subsets, wherein the at least two decomposition parameter values ​​are different from each other; an initialization module, configured to initialize, for any one of the at least two training sample subsets, a first parameter matrix and a second parameter matrix corresponding to the training sample subset according to the number of rows and columns of the original parameter matrix corresponding to the target data processing model and the decomposition parameter value corresponding to the training sample subset, wherein the number of rows of the first parameter matrix corresponding to the training sample subset is equal to the number of rows of the original parameter matrix, the number of columns of the second parameter matrix corresponding to the training sample subset is equal to the number of columns of the original parameter matrix, the number of columns of the first parameter matrix corresponding to the training sample subset and the number of rows of the second parameter matrix corresponding to the training sample subset are equal to the decomposition parameter value corresponding to the training sample subset, and the decomposition parameter value corresponding to the training sample subset is less than the number of rows and columns of the original parameter matrix; A first updating module is configured to train the target data processing model based on the training sample subset to obtain an updated first parameter matrix and an updated second parameter matrix corresponding to the training sample subset; The second updating module is used to update the parameters of the target data processing model according to the updated first parameter matrix and the updated second parameter matrix corresponding to the at least two training sample subsets.

16. A data processing device, characterized in that: include: A first acquisition module, configured to acquire a target data processing model trained by the parameter adjustment device for the large model according to claim 15; The data processing module is used to input the data to be processed into the target data processing model and output the data processing results corresponding to the data to be processed through the target data processing model.

17. An electronic device, characterized in that: include: one or more processors; a memory for storing executable instructions; The one or more processors are configured to call the executable instructions stored in the memory to execute the method according to any one of claims 1 to 14.

18. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 14 is implemented.

Citation Information

Patent Citations

  • Model parameter adjustment method and computing device

    CN113536690A

  • Model parameter adjustment method, device and equipment and computer readable storage medium

    CN116644791A