Large model fine-tuning method, device, electronic device, storage medium and program product

By obtaining the training samples of multiple related domains in the target domain, fine -tuning the pre -training model solves the problem of the lack of the number of training samples in the target domain, which causes the model to fit the fitting, and realizes the full fine -tuning and the improvement of the data processing effect.

CN118228049BActive Publication Date: 2025-01-28MOORE THREADS TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410329949.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-21
Publication Date
2025-01-28
Estimated Expiration
2044-03-21

AI Technical Summary

Technical Problem

In the case of low resources with a small number of training samples in the target domain, it is difficult for the prior art to fine-tune the pre-trained model, resulting in underfitting the model and making it difficult to achieve the ideal effect.

Method used

By obtaining the training samples corresponding to the N related domains of the target domain, initialize the first parameter matrix and the second parameter matrix, and fine -tuned the target data processing model to obtain the updated parameter matrix, thereby determining the new parameter matrix of the target to add the new parameter matrix , Update model parameters.

Benefits of technology

In the case of a small number of training samples in the target domain, the model can be fine -tuned by using the training samples of related domains to fine -tune the model, which can achieve fully fine -tuning of the model and improve the data processing effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118228049B_ABST
    Figure CN118228049B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the field of electronic digital data processing technology, and in particular to a large model fine-tuning method, device, electronic device, storage medium and program product. The method includes: obtaining N related domain training sample sets of the target domain; initializing the first parameter matrix and the second parameter matrix; using the N related domain training sample sets to fine-tune the target data processing model respectively, and obtain N updated first parameter matrices and N updated second parameter matrices; according to the N updated first parameter matrices and the N updated second parameter matrices, determine the target newly added parameter matrix; according to the original parameter matrix and the target newly added parameter matrix, determine the updated parameter matrix of the target data processing model. The present disclosure can obtain better data processing effects in the target domain by fine-tuning the target data processing model using the training sample sets corresponding to the N related domains of the target domain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of electrical digital data processing, and in particular to a large model fine-tuning method, a data processing method, a large model fine-tuning device, a data processing device, an electronic device, a storage medium and a program product. Background Art

[0002] Before applying the pre-trained model to the target domain, the model needs to be fine-tuned using the target domain dataset. However, in the case of low resources where the number of training samples in the training sample set corresponding to the target domain is very small, the model cannot be fully fine-tuned whether using LoRA fine-tuning, PTuning fine-tuning or full fine-tuning. In other words, in the case of low resources where the number of training samples in the training sample set of the target domain is very small, the model is usually under-fitting and it is difficult to achieve the desired effect. Summary of the invention

[0003] The present disclosure provides a large model fine-tuning technical solution.

[0004] According to one aspect of the present disclosure, a large model fine-tuning method is provided, comprising:

[0005] Obtain N related domain training sample sets corresponding to N related domains of the target domain;

[0006] Initializing a first parameter matrix and a second parameter matrix according to the number of rows and columns of the original parameter matrix corresponding to the target data processing model, wherein the number of rows of the first parameter matrix is ​​equal to the number of rows of the original parameter matrix, the number of columns of the first parameter matrix is ​​less than the number of columns of the original parameter matrix, the number of columns of the second parameter matrix is ​​equal to the number of columns of the original parameter matrix, and the number of rows of the second parameter matrix is ​​equal to the number of columns of the first parameter matrix;

[0007] Using the N related domain training sample sets to fine-tune the target data processing model respectively, to obtain N updated first parameter matrices and N updated second parameter matrices corresponding to the N related domains;

[0008] Determining a target newly added parameter matrix according to the N updated first parameter matrices and the N updated second parameter matrices;

[0009] An updated parameter matrix of the target data processing model is determined according to the original parameter matrix and the target newly added parameter matrix.

[0010] In a possible implementation, determining a target newly added parameter matrix according to the N updated first parameter matrices and the N updated second parameter matrices includes:

[0011] Determine N first target weights corresponding to the N updated first parameter matrices, and N second target weights corresponding to the N updated second parameter matrices;

[0012] Determining a first target parameter matrix according to the N first target weights and the N updated first parameter matrices;

[0013] Determining a second target parameter matrix according to the N second target weights and the N updated second parameter matrices;

[0014] A target new parameter matrix is ​​determined according to the first target parameter matrix and the second target parameter matrix.

[0015] In a possible implementation, determining N first target weights corresponding to the N updated first parameter matrices and N second target weights corresponding to the N updated second parameter matrices includes:

[0016] Generate multiple weight candidate schemes, wherein any weight candidate scheme includes N first candidate weights corresponding to the N updated first parameter matrices and N second candidate weights corresponding to the N updated second parameter matrices;

[0017] Using a verification sample set to verify the multiple weight candidate solutions;

[0018] The N first target weights and the N second target weights are determined according to the candidate weight scheme with the best verification effect.

[0019] In a possible implementation, the N first candidate weights in any weight candidate scheme are N first multivariate normal distribution matrices, and the N second candidate weights are N second multivariate normal distribution matrices;

[0020] The generating of multiple weight candidate solutions comprises:

[0021] Randomly generate N first covariance matrices corresponding to the N updated first parameter matrices, and N second covariance matrices corresponding to the N updated second parameter matrices;

[0022] Randomly generate a first mean vector and a second mean vector;

[0023] Based on the N first covariance matrices and the first mean vector, N first multivariate normal distribution matrices corresponding to the N updated first parameter matrices are generated, and based on the N second covariance matrices and the second mean vector, N second multivariate normal distribution matrices corresponding to the N updated second parameter matrices are generated.

[0024] In a possible implementation, generating multiple candidate weight solutions further includes:

[0025] Obtaining N first deviation matrices according to the N first multivariate normal distribution matrices and the first mean vector;

[0026] updating the N first covariance matrices according to the N first deviation matrices, the N first covariance matrices and a preset learning rate;

[0027] Obtaining N second deviation matrices according to the N second multivariate normal distribution matrices and the second mean vector;

[0028] Updating the N second covariance matrices according to the N second deviation matrices, the N second covariance matrices and the preset learning rate;

[0029] An updated weight candidate solution is obtained according to the updated N first covariance matrices and the updated N second covariance matrices.

[0030] In a possible implementation manner, the number of training samples in any related domain training sample set of the N related domain training sample sets is greater than the number of training samples in the target domain training sample set corresponding to the target domain.

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

[0032] The target data processing model is fine-tuned using a target domain training sample set corresponding to the target domain.

[0033] In a possible implementation manner, the number of columns of the first parameter matrix is ​​at least one order of magnitude smaller than the number of columns of the original parameter matrix.

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

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

[0036] Inputting the data to be processed into the target data processing model to obtain the data processing result corresponding to the data to be processed;

[0037] Wherein, the target data processing model is obtained based on the large model fine-tuning method.

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

[0039] According to one aspect of the present disclosure, a large model fine-tuning device is provided, comprising:

[0040] An acquisition module, used for acquiring N related domain training sample sets corresponding to N related domains of the target domain;

[0041] An initialization module, used to initialize a first parameter matrix and a second parameter matrix according to the number of rows and columns of an original parameter matrix corresponding to a target data processing model, wherein the number of rows of the first parameter matrix is ​​equal to the number of rows of the original parameter matrix, the number of columns of the first parameter matrix is ​​less than the number of columns of the original parameter matrix, the number of columns of the second parameter matrix is ​​equal to the number of columns of the original parameter matrix, and the number of rows of the second parameter matrix is ​​equal to the number of columns of the first parameter matrix;

[0042] A first fine-tuning module, used to fine-tune the target data processing model respectively by using the N related domain training sample sets to obtain N updated first parameter matrices and N updated second parameter matrices corresponding to the N related domains;

[0043] A first determination module, configured to determine a target newly added parameter matrix according to the N updated first parameter matrices and the N updated second parameter matrices;

[0044] The second determination module is used to determine the updated parameter matrix of the target data processing model according to the original parameter matrix and the target newly added parameter matrix.

[0045] In a possible implementation manner, the first determining module is used to:

[0046] Determine N first target weights corresponding to the N updated first parameter matrices, and N second target weights corresponding to the N updated second parameter matrices;

[0047] Determining a first target parameter matrix according to the N first target weights and the N updated first parameter matrices;

[0048] Determining a second target parameter matrix according to the N second target weights and the N updated second parameter matrices;

[0049] A target new parameter matrix is ​​determined according to the first target parameter matrix and the second target parameter matrix.

[0050] In a possible implementation manner, the first determining module is used to:

[0051] Generate multiple weight candidate schemes, wherein any weight candidate scheme includes N first candidate weights corresponding to the N updated first parameter matrices and N second candidate weights corresponding to the N updated second parameter matrices;

[0052] Using a verification sample set to verify the multiple weight candidate solutions;

[0053] The N first target weights and the N second target weights are determined according to the candidate weight scheme with the best verification effect.

[0054] In a possible implementation, the N first candidate weights in any weight candidate scheme are N first multivariate normal distribution matrices, and the N second candidate weights are N second multivariate normal distribution matrices;

[0055] The first determining module is used for:

[0056] Randomly generate N first covariance matrices corresponding to the N updated first parameter matrices, and N second covariance matrices corresponding to the N updated second parameter matrices;

[0057] Randomly generate a first mean vector and a second mean vector;

[0058] Based on the N first covariance matrices and the first mean vector, N first multivariate normal distribution matrices corresponding to the N updated first parameter matrices are generated, and based on the N second covariance matrices and the second mean vector, N second multivariate normal distribution matrices corresponding to the N updated second parameter matrices are generated.

[0059] In a possible implementation manner, the first determining module is used to:

[0060] Obtaining N first deviation matrices according to the N first multivariate normal distribution matrices and the first mean vector;

[0061] updating the N first covariance matrices according to the N first deviation matrices, the N first covariance matrices and a preset learning rate;

[0062] Obtaining N second deviation matrices according to the N second multivariate normal distribution matrices and the second mean vector;

[0063] Updating the N second covariance matrices according to the N second deviation matrices, the N second covariance matrices and the preset learning rate;

[0064] An updated weight candidate solution is obtained according to the updated N first covariance matrices and the updated N second covariance matrices.

[0065] In a possible implementation manner, the number of training samples in any related domain training sample set of the N related domain training sample sets is greater than the number of training samples in the target domain training sample set corresponding to the target domain.

[0066] In a possible implementation manner, the device further includes:

[0067] The second fine-tuning module is used to fine-tune the target data processing model using a target domain training sample set corresponding to the target domain.

[0068] In a possible implementation manner, the number of columns of the first parameter matrix is ​​at least one order of magnitude smaller than the number of columns of the original parameter matrix.

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

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

[0071] A data processing module is used to input the data to be processed into a target data processing model to obtain a data processing result corresponding to the data to be processed;

[0072] Wherein, the target data processing model is obtained based on the large model fine-tuning device.

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

[0074] 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.

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

[0076] 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.

[0077] In the embodiment of the present disclosure, by obtaining N related domain training sample sets corresponding to N related domains of the target domain, a first parameter matrix and a second parameter matrix are initialized according to the number of rows and columns of the original parameter matrix corresponding to the target data processing model, wherein the number of rows of the first parameter matrix is ​​equal to the number of rows of the original parameter matrix, the number of columns of the first parameter matrix is ​​less than the number of columns of the original parameter matrix, the number of columns of the second parameter matrix is ​​equal to the number of columns of the original parameter matrix, and the number of rows of the second parameter matrix is ​​equal to the number of columns of the first parameter matrix, and the number of rows of the second parameter matrix is ​​equal to the number of columns of the first parameter matrix, and the target data processing model is fine-tuned respectively using the N related domain training sample sets to obtain the target data processing model corresponding to the N related domain training sample sets. According to the N updated first parameter matrices and the N updated second parameter matrices corresponding to the N related domains, a target newly added parameter matrix is ​​determined according to the N updated first parameter matrices and the N updated second parameter matrices, and according to the original parameter matrix and the target newly added parameter matrix, an updated parameter matrix of the target data processing model is determined, thereby, when the number of training samples in the training sample set corresponding to the target domain is small, the training sample set corresponding to the N related domains of the target domain is used to fine-tune the target data processing model, so that the training sample set corresponding to the N related domains can be used to fully fine-tune the target data processing model. The target data processing model obtained by fine-tuning can obtain better data processing effect in the target domain.

[0078] 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.

[0079] 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

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

[0081] Figure 1 A flowchart of a large model fine-tuning method provided by an embodiment of the present disclosure is shown.

[0082] Figure 2 A block diagram of a large model fine-tuning device provided by an embodiment of the present disclosure is shown.

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

[0084] 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 specified.

[0085] 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.

[0086] The term "and / or" herein is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set consisting of A, B, and C.

[0087] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.

[0088] The disclosed embodiment provides a large model fine-tuning method, by obtaining N related domain training sample sets corresponding to N related domains of the target domain, and initializing a first parameter matrix and a second parameter matrix according to the number of rows and columns of the original parameter matrix corresponding to the target data processing model, wherein the number of rows of the first parameter matrix is ​​equal to the number of rows of the original parameter matrix, the number of columns of the first parameter matrix is ​​less than the number of columns of the original parameter matrix, the number of columns of the second parameter matrix is ​​equal to the number of columns of the original parameter matrix, and the number of rows of the second parameter matrix is ​​equal to the number of columns of the first parameter matrix, and the number of rows of the second parameter matrix is ​​equal to the number of columns of the first parameter matrix, and the target data processing model is fine-tuned respectively using the N related domain training sample sets, and the obtained According to the N updated first parameter matrices and the N updated second parameter matrices corresponding to the N related domains, a target newly added parameter matrix is ​​determined according to the N updated first parameter matrices and the N updated second parameter matrices, and according to the original parameter matrix and the target newly added parameter matrix, an updated parameter matrix of the target data processing model is determined, thereby, when the number of training samples in the training sample set corresponding to the target domain is small, the training sample set corresponding to the N related domains of the target domain is used to fine-tune the target data processing model, so that the training sample set corresponding to the N related domains can be used to fully fine-tune the target data processing model. The target data processing model obtained by fine-tuning can obtain better data processing effect in the target domain.

[0089] The large model fine-tuning method provided by the embodiment of the present disclosure is described in detail below with reference to the accompanying drawings.

[0090] Figure 1 A flow chart of a large model fine-tuning method provided by an embodiment of the present disclosure is shown. In one possible implementation, the execution subject of the large model fine-tuning method may be a large model fine-tuning device. For example, the large model fine-tuning method 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 large model fine-tuning method may be implemented by a processor calling computer-readable instructions stored in a memory. For example Figure 1 As shown, the large model fine-tuning method includes steps S11 to S15.

[0091] In step S11, N related domain training sample sets corresponding to N related domains of the target domain are obtained.

[0092] In step S12, the first parameter matrix and the second parameter matrix are initialized according to the number of rows and columns of the original parameter matrix corresponding to the target data processing model, wherein the number of rows of the first parameter matrix is ​​equal to the number of rows of the original parameter matrix, the number of columns of the first parameter matrix is ​​less than the number of columns of the original parameter matrix, the number of columns of the second parameter matrix is ​​equal to the number of columns of the original parameter matrix, and the number of rows of the second parameter matrix is ​​equal to the number of columns of the first parameter matrix.

[0093] In step S13, the target data processing model is fine-tuned using the N related domain training sample sets to obtain N updated first parameter matrices and N updated second parameter matrices corresponding to the N related domains.

[0094] In step S14, a target newly added parameter matrix is ​​determined according to the N updated first parameter matrices and the N updated second parameter matrices.

[0095] In step S15, an updated parameter matrix of the target data processing model is determined according to the original parameter matrix and the target newly added parameter matrix.

[0096] The embodiments of the present disclosure can be applied to technical fields such as text, voice, image, video, multimodality, etc. Moreover, the target data processing model in the embodiments of the present disclosure can be used for AIGC (Artificial Intelligence Generative Content), etc., which is not limited here.

[0097] In a possible implementation, the target data processing model is a text processing model, and the training sample is a training text. When the disclosed embodiment is applied to the field of text processing technology, the target data processing model may be a target text processing model, and the training sample may be a training text. After the fine-tuning of the target text processing model is completed, the input of the target text processing model may be the text to be processed.

[0098] For example, the target text processing model may adopt a network structure such as ChatGLM-6B, LLaMA-13B, BLOOM, etc., which is not limited here. The text processing model may also be called a language model, etc., which is not limited here.

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

[0100] Since language grammar has certain standardization, such as subject-verb-object format, language and text have certain mobility. In this implementation, by obtaining N related domain training text sets corresponding to N related domains of the target domain, the first parameter matrix and the second parameter matrix are initialized according to the number of rows and columns of the original parameter matrix corresponding to the target text processing model, wherein the number of rows of the first parameter matrix is ​​equal to the number of rows of the original parameter matrix, the number of columns of the first parameter matrix is ​​less than the number of columns of the original parameter matrix, the number of columns of the second parameter matrix is ​​equal to the number of columns of the original parameter matrix, and the number of rows of the second parameter matrix is ​​equal to the number of columns of the first parameter matrix, and the number of rows of the second parameter matrix is ​​equal to the number of columns of the first parameter matrix, and the N related domain training text sets are used to fine-tune the target text processing model respectively, and obtain the same parameters as the N related domain training text sets. According to the N updated first parameter matrices and the N updated second parameter matrices corresponding to the N related domains, a target newly added parameter matrix is ​​determined, and according to the original parameter matrix and the target newly added parameter matrix, an updated parameter matrix of the target text processing model is determined, so that when the number of training texts in the training text set corresponding to the target domain is small, the training text set corresponding to the N related domains of the target domain is used to fine-tune the target text processing model, so that the training text set corresponding to the N related domains can be used to fully fine-tune the target text processing model. The target text processing model obtained by fine-tuning can obtain better data processing effect in the target domain.

[0101] 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 target speech processing model is fine-tuned, the input of the target speech processing model may be a speech to be processed.

[0102] 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 target image processing model is fine-tuned, the input of the target image processing model may be an image to be processed.

[0103] 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 target video processing model is fine-tuned, the input of the target video processing model may be a video to be processed.

[0104] 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 target multimodal processing model is fine-tuned, the input of the target multimodal processing model can be the multimodal data to be processed.

[0105] In the embodiments of the present disclosure, the target data processing model may be a large model. For example, the target data processing model may be an LLM (Large Language Model).

[0106] In the embodiments of the present disclosure, the field corresponding to the source data processing model may be referred to as the source domain, and the field 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 target data processing model may be fine-tuned based on the source data processing model.

[0107] In the embodiments of the present disclosure, the original parameter matrix may represent the matrix corresponding to all the parameters in the target data processing model (i.e., the source data processing model) before fine-tuning. That is, in the embodiments of the present disclosure, the original parameter matrix may include all the parameters in the target data processing model before fine-tuning. In one example, the original parameter matrix may be represented by Wold.

[0108] The first parameter matrix and the second parameter matrix may be initialized according to the number of rows and columns of the original parameter matrix. Among them, the number of rows of the first parameter matrix is equal to the number of rows of the original parameter matrix, the number of columns of the second parameter matrix is equal to the number of columns of the original parameter matrix, the number of columns of the first parameter matrix is less than the number of columns of the original parameter matrix corresponding to the first network layer group, and the number of rows of the second parameter matrix is equal to the number of columns of the first parameter matrix.

[0109] For example, the size of the original parameter matrix is a×b, that is, the number of rows of the original parameter matrix is a, and the number of columns is b. Then, the size of the first parameter matrix may be a×r, that is, the number of rows of the first parameter matrix may be a, and the number of columns may be r. The size of the second parameter matrix may be r×b, that is, the number of rows of the second parameter matrix may be r, and the number of columns may be b. Wherein, r < a and r < b.

[0110] In one possible implementation, the number of columns of the first parameter matrix is at least one order of magnitude smaller than the number of columns of the original parameter matrix.

[0111] For example, the number of columns of the first parameter matrix may be one order of magnitude smaller than the number of columns of the original parameter matrix; for another example, the number of columns of the first parameter matrix may be two orders of magnitude smaller than the number of columns of the original parameter matrix; for another example, the number of columns of the first parameter matrix may be three orders of magnitude smaller than the number of columns of the original parameter matrix; and so on.

[0112] For example, the size of the original parameter matrix is a×b, the size of the first parameter matrix is a×r, the size of the second parameter matrix is r×b, r << a, and r << b. For example, r may be 8, 16, 4, 64, 2, etc., which is not limited herein.

[0113] In this implementation, by setting the number of columns of the first parameter matrix and the number of rows of the second parameter matrix to be at least one order of magnitude smaller than the number of rows and columns of the original parameter matrix, a large amount of computing resources can be saved.

[0114] In a possible implementation, the first parameter matrix and the second parameter matrix may be initialized using Gaussian distribution to increase the generalization capability of the target data processing model.

[0115] In the embodiment of the present disclosure, data of N related domains of the target domain may be collected, and the data of the N related domains may be preprocessed to obtain N related domain training sample sets corresponding to the N related domains. Wherein, N may be an integer greater than or equal to 1. For example, N may be greater than 1.

[0116] In a possible implementation manner, the number of training samples in any related domain training sample set of the N related domain training sample sets is greater than the number of training samples in the target domain training sample set corresponding to the target domain.

[0117] Among them, the number of training samples of any of the N related domain training sample sets can be at least one order of magnitude greater than the number of training samples of the target domain training sample set corresponding to the target domain. For example, the target domain is "automotive industry failure event extraction task", and the target domain training text set corresponding to the target domain "automotive industry failure event extraction task" includes 100 training texts; the related domains of the target domain include 5, namely "company entity extraction task", "literary work entity extraction task", "medical entity extraction task", "novel name entity extraction task" and "power grid equipment entity extraction task", and the related domain training text sets corresponding to the 5 related domains include more than 5,000 training texts respectively.

[0118] By fine-tuning the target data processing model using a related domain training text set with a large number of training samples, the target data processing model can be fully fine-tuned.

[0119] After obtaining N related domain training sample sets, the target data processing model can be fine-tuned using the N related domain training sample sets to obtain N updated first parameter matrices and N updated second parameter matrices corresponding to the N related domains. For example, the N updated first parameter matrices can be represented by A1, A2, ..., AN, and the N updated second parameter matrices can be represented by B1, B2, ..., BN. The size of Ai is a×r, 1≤i≤N; the size of Bi is r×b, 1≤i≤N. Among them, A1B1 can be recorded as the parameter matrix of the first LoRA module, A2B2 can be recorded as the parameter matrix of the second LoRA module, and so on, ANBN can be recorded as the parameter matrix of the Nth LoRA module.

[0120] In a possible implementation, determining the target new parameter matrix based on the N updated first parameter matrices and the N updated second parameter matrices includes: determining N first target weights corresponding to the N updated first parameter matrices, and N second target weights corresponding to the N updated second parameter matrices; determining the first target parameter matrix based on the N first target weights and the N updated first parameter matrices; determining the second target parameter matrix based on the N second target weights and the N updated second parameter matrices; and determining the target new parameter matrix based on the first target parameter matrix and the second target parameter matrix.

[0121] In this implementation, the N first target weights correspond one-to-one to the N updated first parameter matrices, and the N second target weights correspond one-to-one to the N updated second parameter matrices. The first target weight and the second target weight can be weight matrices. In an example, the N first target weights can be represented by w1, w2, ..., wN, and the N second weights can be represented by v1, v2, ..., vN. Among them, the matrix size of each first target weight can be a×a, and the matrix size of each second target weight can be r×r.

[0122] In this implementation, the weighted sum of the N updated first parameter matrices may be calculated according to the N first target weights to obtain the first target parameter matrix. For example, the first target parameter matrix may be w1A1+w2A2+…+wNAN.

[0123] The weighted sum of the N updated second parameter matrices may be calculated according to the N second target weights to obtain the second target parameter matrix. For example, the second target parameter matrix may be v1B1+v2B2+…+vNBN.

[0124] The target new parameter matrix may be determined according to the first target parameter matrix and the second target parameter matrix. For example, the target new parameter matrix M = (w1A1+w2A2+…+wNAN)(v1B1+v2B2+…+vNBN). The size of the target new parameter matrix M may be a×b.

[0125] In this implementation, by determining the N first target weights corresponding to the N updated first parameter matrices and the N second target weights corresponding to the N updated second parameter matrices, the first target parameter matrix is ​​determined according to the N first target weights and the N updated first parameter matrices, the second target parameter matrix is ​​determined according to the N second target weights and the N updated second parameter matrices, and the target new parameter matrix is ​​determined according to the first target parameter matrix and the second target parameter matrix. This enables the fine-tuning effect of the target data processing model to be improved based on the N first target weights and the N second target weights, so that the target data processing model can obtain higher data processing accuracy in the target domain.

[0126] In another possible implementation, the average value of the N updated first parameter matrices can be calculated to obtain a first target parameter matrix; the average value of the N updated second parameter matrices can be calculated to obtain a second target parameter matrix; the first target parameter matrix is ​​multiplied by the second target parameter matrix to obtain a target new parameter matrix.

[0127] In one possible implementation, the determining of the N first target weights corresponding to the N updated first parameter matrices and the N second target weights corresponding to the N updated second parameter matrices includes: generating multiple weight candidate schemes, wherein any weight candidate scheme includes the N first candidate weights corresponding to the N updated first parameter matrices and the N second candidate weights corresponding to the N updated second parameter matrices; using a verification sample set to verify the multiple weight candidate schemes; and determining the N first target weights and the N second target weights based on the weight candidate scheme with the best verification effect.

[0128] As an example of this implementation, a verification sample set may be obtained based on at least part of the training samples in the target domain training sample set. For example, the target domain training sample set may be used as the verification sample set.

[0129] In this implementation, non-gradient optimization algorithms such as simulated annealing algorithm, particle optimization algorithm, covariance matrix adaptive evolution strategy algorithm, etc. can be used to search for the weight candidate scheme with the best verification effect. In the process of determining the N first target weights and the N second target weights by using the non-gradient optimization algorithm, a loss function such as the cross entropy loss function can be used, which is not limited here.

[0130] In this implementation method, the N first candidate weights in the weight candidate scheme with the best verification effect can be determined as N first target weights, and the N second candidate weights in the weight candidate scheme with the best verification effect can be determined as N second target weights, so that the target new parameter matrix can be determined based on the N first target weights and the N second target weights.

[0131] In this implementation, multiple weight candidate schemes are generated, wherein any weight candidate scheme includes N first candidate weights corresponding to the N updated first parameter matrices and N second candidate weights corresponding to the N updated second parameter matrices, and a verification sample set is used to verify the multiple weight candidate schemes, and the N first target weights and the N second target weights are determined according to the weight candidate scheme with the best verification effect, thereby searching for the N first target weights and the N second target weights that have the best verification effect through a non-gradient optimization method. This method has a small amount of calculation, a fast training speed, does not rely on a GPU, can be trained on a CPU, and compared with a gradient optimization algorithm, the effect can be significantly improved.

[0132] In another possible implementation, a gradient optimization algorithm may be used to determine the N first target weights and the N second target weights. For example, an SGD (Stochastic Gradient Descent) algorithm, an Adam (Adaptive Moment Estimation) algorithm, etc. may be used, which are not limited here.

[0133] In one possible implementation, the N first candidate weights in any weight candidate scheme are N first multivariate normal distribution matrices, and the N second candidate weights are N second multivariate normal distribution matrices; the generation of multiple weight candidate schemes includes: randomly generating N first covariance matrices corresponding to the N updated first parameter matrices, and N second covariance matrices corresponding to the N updated second parameter matrices; randomly generating a first mean vector and a second mean vector; based on the N first covariance matrices and the first mean vector, generating N first multivariate normal distribution matrices corresponding to the N updated first parameter matrices, and based on the N second covariance matrices and the second mean vector, generating N second multivariate normal distribution matrices corresponding to the N updated second parameter matrices.

[0134] For example, N first covariance matrices may be represented by m1, m2, ..., mN, N second covariance matrices may be represented by n1, n2, ..., nN, the first mean vector may be represented by mean1, and the second mean vector may be represented by mean2. The size of each first covariance matrix may be a×a, and the size of each second covariance matrix may be r×r.

[0135] A first multivariate normal distribution matrix wi may be generated according to the first covariance matrix mi and the first mean vector mean1; a second multivariate normal distribution matrix vi may be generated according to the second covariance matrix ni and the second mean vector mean2; wherein 1≤i≤N.

[0136] In a possible implementation, the generating of multiple weight candidate schemes also includes: obtaining N first deviation matrices based on the N first multivariate normal distribution matrices and the first mean vector; updating the N first covariance matrices based on the N first deviation matrices, the N first covariance matrices and a preset learning rate; obtaining N second deviation matrices based on the N second multivariate normal distribution matrices and the second mean vector; updating the N second covariance matrices based on the N second deviation matrices, the N second covariance matrices and the preset learning rate; and obtaining updated weight candidate schemes based on the updated N first covariance matrices and the updated N second covariance matrices.

[0137] In this implementation, in the process of searching for the best weight candidate solution, the weight candidate solution with the best verification effect can be saved, and a new weight candidate solution can be updated based on the weight candidate solution with the best verification effect.

[0138] For example, the first deviation matrix can be obtained according to deviation_1i=wi-mean1. The updated first covariance matrix can be obtained according to mi=(1-learning_rate)×mi+learning_rate×(deviation_1i.T×deviation_1i) / len(wi). Wherein, learning_rate can represent the preset learning rate, deviation_1i.T can represent the transposed matrix of deviation_1i, and len(wi) can represent the number of elements in wi.

[0139] The second deviation matrix can be obtained according to deviation_2i=vi-mean2. The updated second covariance matrix can be obtained according to ni=(1-learning_rate)×ni+learning_rate×(deviation_2i.T×deviation_2i) / len(vi). Wherein, learning_rate can represent the preset learning rate, deviation_2i.T can represent the transposed matrix of deviation_2i, and len(vi) can represent the number of elements in vi.

[0140] In this implementation, the search may be terminated in response to reaching a preset number of iterations or the convergence of the optimal weight candidate solution.

[0141] In the embodiment of the present disclosure, after determining the target newly added parameter matrix, the updated parameter matrix of the target data processing model can be determined according to the original parameter matrix and the target newly added parameter matrix. For example, Wnew=Wold+M, where Wnew represents the updated parameter matrix of the target data processing model, Wold represents the original parameter matrix, and M represents the target newly added parameter matrix.

[0142] In a possible implementation manner, the method further includes: using a target domain training sample set corresponding to the target domain to fine-tune the target data processing model.

[0143] In this implementation, after determining the updated parameter matrix of the target data processing model, the target data processing model may be fine-tuned using a target domain training sample set corresponding to the target domain.

[0144] In this implementation, after determining the updated parameter matrix of the target data processing model, the target data processing model is fine-tuned using the target domain training sample set corresponding to the target domain. After fine-tuning the target data processing model using the related domain training sample set, the target data processing model is fine-tuned using the target domain training sample set, thereby improving the effect of the target data processing model in the target domain.

[0145] The following is an explanation of the large model fine-tuning method provided by the embodiment of the present disclosure through a specific application scenario. In this application scenario, the target data processing model is a text processing model, the training sample is a training text, and the target text processing model can adopt the network structure of ChatGLM-6B.

[0146] In this application scenario, the target domain is the "automotive industry failure event extraction task", and the target domain has five related domains, namely, "company entity extraction task", "literary work entity extraction task", "medical entity extraction task", "novel name entity extraction task" and "power grid equipment entity extraction task".

[0147] Among them, the target domain training text set corresponding to the target domain "automotive industry fault event extraction task" includes 100 training texts, and the related domain training text sets corresponding to the 5 related domains each include more than 5,000 training texts.

[0148] For example, a training text in the target domain training text set is {"text":"Fault report of car No. 411. Fault phenomenon: the right rear door cannot be opened from the outside, and the gap between the outer handle of the right rear door is particularly large","h":{"name":"Right rear door","id":"b60482d5-534b-423d-a65e-ea23345725f6","pos":[14,17]},"t":{"name":"Cannot open","id":"a769f766-60e3-4fa9-b57a-fadd7bf2c2dc","pos":[20,23]},"relation":"Component failure"}. Among them, "pos":[14,17] can indicate the position of "right rear door" in "Fault report of vehicle No. 411: Fault phenomenon: right rear door cannot be opened from the outside, and the gap between the outer handle of the right rear door is particularly large"; "pos":[20,23] can indicate the position of "cannot be opened" in "Fault report of vehicle No. 411: Fault phenomenon: right rear door cannot be opened from the outside, and the gap between the outer handle of the right rear door is particularly large".

[0149] For another example, another training text in the target domain training text set is {"text":"Then check the gear shift mechanism. After checking that the cable and bracket are not deformed or loose, remove the cable from the gearbox, start the engine and step on the clutch, directly swing the gearbox selector lever and relay lever to the 1st gear position by hand, and then slowly lift the clutch. There is still a gear shift phenomenon. Repeated tests have failed. Therefore, it can be concluded that the fault is in the gearbox. The gearbox is disassembled and it is found that the 1st gear gear has a processing defect. After replacing the 1st gear gear and related parts and installing them on the vehicle, the fault is Exclude","h":{"name":"1st gear","id":"c163b2df-6287-4da5-9008-15095ad1f621","pos":[125,129]},"t":{"name":"Processing defect","id":"4cb1ffff-6dfb-4ecc-9a0f-39c61f8efbb4","pos":[130,134]},"relation":"Component failure"}.

[0150] The first parameter matrix and the second parameter matrix may be initialized according to the number of rows a and the number of columns b of the original parameter matrix Wold corresponding to the target text processing type, wherein the size of the first parameter matrix is ​​a×r, and the size of the second parameter matrix is ​​r×b.

[0151] The target text processing model can be fine-tuned using the relevant domain training text set corresponding to the relevant domain "company entity extraction task" to obtain an updated first parameter matrix A1 and an updated second parameter matrix B1; the target text processing model can be fine-tuned using the relevant domain training text set corresponding to the relevant domain "literary work entity extraction task" to obtain an updated first parameter matrix A2 and an updated second parameter matrix B2; the target text processing model can be fine-tuned using the relevant domain training text set corresponding to the relevant domain "medical entity extraction task" to obtain an updated first parameter matrix A3 and an updated second parameter matrix B3; the target text processing model can be fine-tuned using the relevant domain training text set corresponding to the relevant domain "novel name entity extraction task" to obtain an updated first parameter matrix A4 and an updated second parameter matrix B4; the target text processing model can be fine-tuned using the relevant domain training text set corresponding to the relevant domain "power grid equipment entity extraction task" to obtain an updated first parameter matrix A5 and an updated second parameter matrix B5.

[0152] In this application scenario, the covariance matrix adaptation evolutionary strategy (CMA-ES) can be used to determine five first objective weights and five second objective weights.

[0153] A weight candidate scheme may be randomly generated. The generation of the weight candidate scheme may include: randomly generating 5 first covariance matrices m1, m2, ..., m5 corresponding to 5 updated first parameter matrices, and 5 second covariance matrices n1, n2, ..., n5 corresponding to 5 updated second parameter matrices; randomly generating a first mean vector mean1 and a second mean vector mean2; generating 5 first multivariate normal distribution matrices w1, w2, ..., w5 corresponding to 5 updated first parameter matrices based on the 5 first covariance matrices and the first mean vector, and generating 5 second multivariate normal distribution matrices v1, v2, ..., v5 corresponding to 5 updated second parameter matrices based on the 5 second covariance matrices and the second mean vector.

[0154] The target domain training text set corresponding to the target domain "automotive industry fault event extraction task" can be used as a verification text set to verify the weight candidate scheme, and the weight candidate scheme with the best verification effect can be saved.

[0155] In the process of searching for the optimal weight candidate scheme, the weight candidate scheme with the best verification effect can be saved, and a new weight candidate scheme can be updated based on the weight candidate scheme with the best verification effect. Five first deviation matrices can be obtained according to the five first multivariate normal distribution matrices and the first mean vector; five first covariance matrices can be updated according to the five first deviation matrices, the five first covariance matrices and the preset learning rate; five second deviation matrices can be obtained according to the five second multivariate normal distribution matrices and the second mean vector; five second covariance matrices can be updated according to the five second deviation matrices, the five second covariance matrices and the preset learning rate; and updated weight candidate schemes can be obtained according to the updated five first covariance matrices and the updated five second covariance matrices. The updated weight candidate scheme can also be verified using a verification text set.

[0156] The search may be terminated in response to reaching a preset number of iterations or the convergence of the optimal weight candidate solution.

[0157] The five first candidate weights in the weight candidate scheme with the best verification effect can be determined as the five first target weights, and the five second candidate weights in the weight candidate scheme with the best verification effect can be determined as the five second target weights. The target new parameter matrix can be determined according to M=(w1A1+w2A2+…+w5A5)(v1B1+v2B2+…+v5B5). The updated parameter matrix of the target text processing model can be determined according to Wnew=Wold+M.

[0158] By adopting this application scenario to fine-tune the target text processing model, the accuracy of the target text processing model in the automotive industry fault event extraction task was improved from 53% to 64.5%.

[0159] The disclosed embodiment also provides a data processing method, including: obtaining a target data processing model trained by the large model fine-tuning method; inputting the data to be processed into the target data processing model, and outputting a data processing result corresponding to the data to be processed through the target data processing model.

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

[0161] It can be understood that the above-mentioned various method embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, the present disclosure will not repeat them. It can be understood by those skilled in the art that in the above-mentioned method of the specific implementation method, the specific execution order of each step should be determined according to its function and possible internal logic.

[0162] In addition, the present disclosure also provides a large model fine-tuning device, a data processing device, an electronic device, a computer-readable storage medium, and a computer program product, all of which can be used to implement any large model fine-tuning 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 part and will not be repeated here.

[0163] Figure 2 FIG. 1 is a block diagram of a large model fine-tuning device provided by an embodiment of the present disclosure. Figure 2 As shown, the large model fine-tuning device includes:

[0164] An acquisition module 21 is used to acquire N related domain training sample sets corresponding to N related domains of the target domain;

[0165] An initialization module 22, used to initialize a first parameter matrix and a second parameter matrix according to the number of rows and columns of the original parameter matrix corresponding to the target data processing model, wherein the number of rows of the first parameter matrix is ​​equal to the number of rows of the original parameter matrix, the number of columns of the first parameter matrix is ​​less than the number of columns of the original parameter matrix, the number of columns of the second parameter matrix is ​​equal to the number of columns of the original parameter matrix, and the number of rows of the second parameter matrix is ​​equal to the number of columns of the first parameter matrix;

[0166] A first fine-tuning module 23, configured to fine-tune the target data processing model using the N related domain training sample sets, respectively, to obtain N updated first parameter matrices and N updated second parameter matrices corresponding to the N related domains;

[0167] A first determination module 24, configured to determine a target newly added parameter matrix according to the N updated first parameter matrices and the N updated second parameter matrices;

[0168] The second determination module 25 is used to determine the updated parameter matrix of the target data processing model according to the original parameter matrix and the target newly added parameter matrix.

[0169] In a possible implementation, the first determining module 24 is configured to:

[0170] Determine N first target weights corresponding to the N updated first parameter matrices, and N second target weights corresponding to the N updated second parameter matrices;

[0171] Determining a first target parameter matrix according to the N first target weights and the N updated first parameter matrices;

[0172] Determining a second target parameter matrix according to the N second target weights and the N updated second parameter matrices;

[0173] A target new parameter matrix is ​​determined according to the first target parameter matrix and the second target parameter matrix.

[0174] In a possible implementation, the first determining module 24 is configured to:

[0175] Generate multiple weight candidate schemes, wherein any weight candidate scheme includes N first candidate weights corresponding to the N updated first parameter matrices and N second candidate weights corresponding to the N updated second parameter matrices;

[0176] Using a verification sample set to verify the multiple weight candidate solutions;

[0177] The N first target weights and the N second target weights are determined according to the candidate weight scheme with the best verification effect.

[0178] In a possible implementation, the N first candidate weights in any weight candidate scheme are N first multivariate normal distribution matrices, and the N second candidate weights are N second multivariate normal distribution matrices;

[0179] The first determining module 24 is used for:

[0180] Randomly generate N first covariance matrices corresponding to the N updated first parameter matrices, and N second covariance matrices corresponding to the N updated second parameter matrices;

[0181] Randomly generate a first mean vector and a second mean vector;

[0182] Based on the N first covariance matrices and the first mean vector, N first multivariate normal distribution matrices corresponding to the N updated first parameter matrices are generated, and based on the N second covariance matrices and the second mean vector, N second multivariate normal distribution matrices corresponding to the N updated second parameter matrices are generated.

[0183] In a possible implementation, the first determining module 24 is configured to:

[0184] Obtaining N first deviation matrices according to the N first multivariate normal distribution matrices and the first mean vector;

[0185] updating the N first covariance matrices according to the N first deviation matrices, the N first covariance matrices and a preset learning rate;

[0186] Obtaining N second deviation matrices according to the N second multivariate normal distribution matrices and the second mean vector;

[0187] Updating the N second covariance matrices according to the N second deviation matrices, the N second covariance matrices and the preset learning rate;

[0188] An updated weight candidate solution is obtained according to the updated N first covariance matrices and the updated N second covariance matrices.

[0189] In a possible implementation manner, the number of training samples in any related domain training sample set of the N related domain training sample sets is greater than the number of training samples in the target domain training sample set corresponding to the target domain.

[0190] In a possible implementation manner, the device further includes:

[0191] The second fine-tuning module is used to fine-tune the target data processing model using a target domain training sample set corresponding to the target domain.

[0192] In a possible implementation manner, the number of columns of the first parameter matrix is ​​at least one order of magnitude smaller than the number of columns of the original parameter matrix.

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

[0194] The present disclosure also provides a data processing device, including:

[0195] A data processing module is used to input the data to be processed into a target data processing model to obtain a data processing result corresponding to the data to be processed;

[0196] Wherein, the target data processing model is obtained based on the large model fine-tuning device.

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

[0198] 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.

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

[0200] The embodiment of the present disclosure further provides a computer program, including 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.

[0201] The embodiments of the present disclosure also provide a computer program product, 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.

[0202] 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.

[0203] The electronic device may be provided as a terminal, a server, or a device in other forms.

[0204] Figure 3 1 is a block diagram of an electronic device 1900 provided in an embodiment of the present disclosure. For example, the electronic device 1900 may be provided as a server. 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 instructions to perform the above method.

[0205] The electronic device 1900 may also 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.

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

[0207] The present disclosure may be a system, a method and / or a 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.

[0208] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may 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 of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) 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 disk 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 of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted 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 a wire.

[0209] 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, optical fiber transmissions, wireless transmissions, 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 for storage in the computer-readable storage medium in each computing / processing device.

[0210] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related 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++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely 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 completely 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., using 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 customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.

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

[0212] 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 that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0213] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating 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 boxes in the flowchart and / or block diagram.

[0214] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.

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

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

[0217] If the technical solution of the embodiments of the present disclosure involves personal information, the product using the technical solution of the embodiments of the present disclosure has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of the embodiments of the present disclosure involves sensitive personal information, the product using the technical solution of the embodiments of the present disclosure has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the requirement of "explicit consent". For example, at 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 he or she agrees to collect his or her personal information; or on the device for processing personal information, 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 his or her 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.

[0218] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A large model fine-tuning method, characterized in that: include: Obtain N related domain training sample sets corresponding to N related domains of the target domain; wherein the number of training samples of any related domain training sample set among the N related domain training sample sets is greater than the number of training samples of the target domain training sample set corresponding to the target domain; and the training sample is any one of training text, training speech, training image, and training video; Initializing a first parameter matrix and a second parameter matrix according to the number of rows and columns of an original parameter matrix corresponding to a target data processing model, wherein the number of rows of the first parameter matrix is ​​equal to the number of rows of the original parameter matrix, the number of columns of the first parameter matrix is ​​less than the number of columns of the original parameter matrix, the number of columns of the second parameter matrix is ​​equal to the number of columns of the original parameter matrix, and the number of rows of the second parameter matrix is ​​equal to the number of columns of the first parameter matrix; the target data processing model is any one of a target text processing model, a target speech processing model, a target image processing model, and a target video processing model; Using the N related domain training sample sets to fine-tune the target data processing model respectively, to obtain N updated first parameter matrices and N updated second parameter matrices corresponding to the N related domains; Determining a target newly added parameter matrix according to the N updated first parameter matrices and the N updated second parameter matrices; An updated parameter matrix of the target data processing model is determined according to the original parameter matrix and the target newly added parameter matrix.

2. The method according to claim 1, characterized in that The determining a target newly added parameter matrix according to the N updated first parameter matrices and the N updated second parameter matrices includes: Determine N first target weights corresponding to the N updated first parameter matrices, and N second target weights corresponding to the N updated second parameter matrices; Determining a first target parameter matrix according to the N first target weights and the N updated first parameter matrices; Determining a second target parameter matrix according to the N second target weights and the N updated second parameter matrices; A target new parameter matrix is ​​determined according to the first target parameter matrix and the second target parameter matrix.

3. The method according to claim 2, characterized in that The determining of N first target weights corresponding to the N updated first parameter matrices and N second target weights corresponding to the N updated second parameter matrices includes: Generate multiple weight candidate schemes, wherein any weight candidate scheme includes N first candidate weights corresponding to the N updated first parameter matrices and N second candidate weights corresponding to the N updated second parameter matrices; Using a verification sample set to verify the multiple weight candidate solutions; The N first target weights and the N second target weights are determined according to the candidate weight scheme with the best verification effect.

4. The method according to claim 3, characterized in that The N first candidate weights in any weight candidate scheme are N first multivariate normal distribution matrices, and the N second candidate weights are N second multivariate normal distribution matrices; The generating of multiple weight candidate solutions comprises: Randomly generate N first covariance matrices corresponding to the N updated first parameter matrices, and N second covariance matrices corresponding to the N updated second parameter matrices; Randomly generate a first mean vector and a second mean vector; Based on the N first covariance matrices and the first mean vector, N first multivariate normal distribution matrices corresponding to the N updated first parameter matrices are generated, and based on the N second covariance matrices and the second mean vector, N second multivariate normal distribution matrices corresponding to the N updated second parameter matrices are generated.

5. The method according to claim 4, characterized in that The generating of multiple weight candidate solutions also includes: Obtaining N first deviation matrices according to the N first multivariate normal distribution matrices and the first mean vector; updating the N first covariance matrices according to the N first deviation matrices, the N first covariance matrices and a preset learning rate; Obtaining N second deviation matrices according to the N second multivariate normal distribution matrices and the second mean vector; Updating the N second covariance matrices according to the N second deviation matrices, the N second covariance matrices and the preset learning rate; An updated weight candidate solution is obtained according to the updated N first covariance matrices and the updated N second covariance matrices.

6. The method according to any one of claims 1 to 5, characterized in that Also includes: The target data processing model is fine-tuned using a target domain training sample set corresponding to the target domain.

7. The method according to any one of claims 1 to 5, characterized in that The number of columns of the first parameter matrix is ​​at least one order of magnitude smaller than the number of columns of the original parameter matrix.

8. A data processing method, characterized in that: include: Input the data to be processed into the target data processing model to obtain the data processing result corresponding to the data to be processed; wherein the data to be processed is any one of text to be processed, voice to be processed, image to be processed, and video to be processed; Wherein, the target data processing model is obtained based on the large model fine-tuning method described in any one of claims 1 to 7.

9. A large model fine-tuning device, characterized in that: include: An acquisition module is used to acquire N related domain training sample sets corresponding to N related domains of the target domain; wherein the number of training samples of any related domain training sample set among the N related domain training sample sets is greater than the number of training samples of the target domain training sample set corresponding to the target domain; and the training sample is any one of training text, training speech, training image, and training video; An initialization module, used to initialize a first parameter matrix and a second parameter matrix according to the number of rows and columns of an original parameter matrix corresponding to a target data processing model, wherein the number of rows of the first parameter matrix is ​​equal to the number of rows of the original parameter matrix, the number of columns of the first parameter matrix is ​​less than the number of columns of the original parameter matrix, the number of columns of the second parameter matrix is ​​equal to the number of columns of the original parameter matrix, and the number of rows of the second parameter matrix is ​​equal to the number of columns of the first parameter matrix; the target data processing model is any one of a target text processing model, a target speech processing model, a target image processing model, and a target video processing model; A first fine-tuning module, used to fine-tune the target data processing model respectively by using the N related domain training sample sets to obtain N updated first parameter matrices and N updated second parameter matrices corresponding to the N related domains; A first determination module, configured to determine a target newly added parameter matrix according to the N updated first parameter matrices and the N updated second parameter matrices; The second determination module is used to determine the updated parameter matrix of the target data processing model according to the original parameter matrix and the target newly added parameter matrix.

10. A data processing device, characterized in that: include: A data processing module, used for inputting the data to be processed into the target data processing model to obtain the data processing result corresponding to the data to be processed; wherein the data to be processed is any one of text to be processed, voice to be processed, image to be processed, and video to be processed; Wherein, the target data processing model is obtained based on the large model fine-tuning device described in claim 9.

11. 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 8.

12. 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 8 is implemented.

13. A computer program product comprising computer readable code, or a non-volatile computer readable storage medium carrying computer readable code, characterized in that: When the computer readable code is executed in an electronic device, a processor in the electronic device executes the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Large model fine tuning method and device, electronic equipment and storage medium

    CN117217288A

  • Cross-domain semantic analysis method based on transfer learning

    CN117273014A

  • Model training method and device, electronic equipment and storage medium

    CN117437467A