Language model training method, language task processing method and system
By blocking the original incremental matrix of the large language model, a low-rank target incremental matrix is formed, which solves the problem of insufficient accuracy in handling dynamic, sparse, and composite data dependency tasks in the existing technology, and achieves a significant reduction in high-precision language task processing and computing resources.
Patent Information
- Application Number
- CN202411951357.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-03-28
AI Technical Summary
In the prior art, large language models cannot effectively capture important features when dealing with dynamic, sparse, and composite data dependencies, resulting in poor language task processing accuracy.
By blocking the original incremental matrix of the large language model, derank the rank processing according to the data distribution characteristics of each sub-matrix, a low rank target increment matrix is formed, which is used to update the model parameters, thereby building a high-precision target language model.
It realizes that while maintaining high precision in language task processing, it significantly reduces the requirements of computing resources and data storage, effectively preventing the loss of important features in the matrix of sparseness or approximate sparseness.
Smart Images

Figure CN119721297A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and in particular to a language model training method, a language task processing method and a system. Background Art
[0002] Large language models are usually pre-trained with large-scale language data. By fine-tuning them on downstream tasks, the trained large language models can perform well on downstream tasks. Therefore, large language models are widely used in processing various language tasks.
[0003] In related technologies, large language models are usually fine-tuned through parameter-efficient fine-tuning (PEFT) methods such as low-rank adaptation, so that the trained large language model can perform well on downstream tasks.
[0004] Although low-rank adaptive fine-tuning training can significantly reduce computing resources and improve computing efficiency, it cannot capture important features for dynamic, sparse, and complex data-dependent tasks, resulting in poor accuracy in language task processing of large language models after training. Summary of the invention
[0005] The present invention provides a language model training method, a language task processing method and a system, which are used to solve the defect of poor accuracy of language task processing in the prior art, and achieve high accuracy of language task processing while significantly reducing computing resources and data storage requirements.
[0006] The present invention provides a language model training method, comprising: According to the sample language data and the annotation labels of the sample language tasks corresponding to the sample language data, obtaining an original incremental matrix corresponding to the current model parameter matrix of the large language model in the current cycle; According to the data distribution characteristics of each submatrix in the original incremental matrix, the original incremental matrix is subjected to rank reduction processing to obtain a target incremental matrix corresponding to the current model parameter matrix; The current model parameter matrix is updated according to the target increment matrix, and a target language model corresponding to the sample language task is constructed according to the update result.
[0007] According to a language model training method provided by the present invention, the original incremental matrix is subjected to rank reduction processing according to the data distribution characteristics of each submatrix in the original incremental matrix to obtain a target incremental matrix corresponding to the current model parameter matrix, including: According to the data distribution characteristics of each of the sub-matrices, obtaining the singular values, the first orthogonal matrix and the second orthogonal matrix corresponding to each of the sub-matrices; Performing pruning processing on the singular values corresponding to the plurality of sub-matrices to obtain at least one target singular value; According to each of the target singular values, the first orthogonal matrix corresponding to each of the target singular values, and the second orthogonal matrix corresponding to each of the target singular values, the original incremental matrix is subjected to rank reduction processing to obtain the target incremental matrix.
[0008] According to a language model training method provided by the present invention, the original incremental matrix is subjected to rank reduction processing according to each of the target singular values, the first orthogonal matrix corresponding to each of the target singular values, and the second orthogonal matrix corresponding to each of the target singular values to obtain the target incremental matrix, including: Multiplying each of the target singular values, a column vector in the first orthogonal matrix corresponding to each of the target singular values, and a column vector in the second orthogonal matrix corresponding to each of the target singular values, respectively, to obtain a reconstruction matrix corresponding to each of the target singular values; The reconstruction matrices corresponding to all the target singular values are combined to obtain the target incremental matrix.
[0009] According to a language model training method provided by the present invention, the pruning process is performed on the singular values corresponding to the plurality of sub-matrices to obtain at least one target singular value, including: In descending order, the singular values corresponding to all the sub-matrices are synthesized into diagonal matrices to obtain a target diagonal matrix; According to at least one singular value with a top sorting position in the target diagonal matrix, pruning processing is performed on the singular values in the target diagonal matrix to obtain at least one target singular value.
[0010] According to a language model training method provided by the present invention, the method of obtaining an original incremental matrix corresponding to a current model parameter matrix of a large language model in a current cycle according to sample language data and annotated labels of a sample language task corresponding to the sample language data comprises: According to the current model parameter matrix, obtaining a task processing result of the sample language data under the sample language task; Determining a first loss function according to the task processing result and the annotation label; Determining a second loss function according to data distribution characteristics of an original incremental matrix corresponding to a historical model parameter matrix of the large language model in a previous period; Gradient calculation is performed according to the first loss function and the second loss function to obtain an original incremental matrix corresponding to the current model parameter matrix.
[0011] According to a language model training method provided by the present invention, determining the second loss function according to the data distribution characteristics of the original incremental matrix corresponding to the historical model parameter matrix of the large language model in the previous period includes: According to the data distribution characteristics of the original incremental matrix corresponding to the historical model parameter matrix, a first orthogonal matrix and a second orthogonal matrix of each submatrix in the original incremental matrix corresponding to the historical model parameter matrix are obtained; Calculating a first norm value according to a first orthogonal matrix of each submatrix in the original incremental matrix corresponding to the historical model parameter matrix; Calculating a second norm value according to a second orthogonal matrix of each submatrix in the original incremental matrix corresponding to the historical model parameter matrix; The orthogonalization loss calculation is performed based on the first norm value, the second norm value, and the rank of the first orthogonal matrix and the rank of the second orthogonal matrix of each sub-matrix in the original incremental matrix corresponding to the historical model parameter matrix to obtain the second loss function.
[0012] The present invention also provides a language task processing method, comprising: Acquire target language data and a task type of a target language task corresponding to the target language data; According to the task type, determining a target language model corresponding to the target language task from target language models corresponding to a plurality of different types of sample language tasks; Inputting the target language data into a target language model corresponding to the target language task to obtain a task processing result of the target language data under the target language task; Among them, the target language task includes at least one of a question-answering task, a translation task, and a semantic understanding task; the target language model corresponding to each type of the sample language task is trained based on the language model training method as described in any of the above items.
[0013] The present invention also provides a language model training system, comprising: A first acquisition unit is used to acquire an original incremental matrix corresponding to a current model parameter matrix of a large language model in a current cycle according to sample language data and a labeling label of a sample language task corresponding to the sample language data; A data processing unit, configured to perform rank reduction processing on the original incremental matrix according to data distribution characteristics of each submatrix in the original incremental matrix, so as to obtain a target incremental matrix corresponding to the current model parameter matrix; The model building unit is used to update the current model parameter matrix according to the target incremental matrix, and build a target language model corresponding to the sample language task according to the update result.
[0014] The present invention also provides a language task processing system, comprising: A second acquisition unit, configured to acquire target language data and a task type of a target language task corresponding to the target language data; A model selection unit, configured to determine, according to the task type, a target language model corresponding to the target language task from target language models corresponding to a plurality of different types of sample language tasks; A task processing unit, configured to input the target language data into a target language model corresponding to the target language task, and obtain a task processing result of the target language data under the target language task; Among them, the target language task includes at least one of a question-answering task, a translation task, and a semantic understanding task; the target language model corresponding to each type of the sample language task is trained based on the language model training method as described in any of the above items.
[0015] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the language model training method or language task processing method described above is implemented.
[0016] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described language model training methods or language task processing methods.
[0017] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the above-mentioned language model training methods or language task processing methods.
[0018] The language model training method, language task processing method and system provided by the present invention obtain the original incremental matrix corresponding to the current model parameter matrix of the large language model according to the labeled labels of the sample language data and the sample language task corresponding to the sample language data, and perform block processing on the original incremental matrix, so as to explicitly and adaptively reduce the rank of the original incremental matrix according to the data distribution characteristics of the sub-matrices formed by the blocks, so as to approximate the original incremental matrix through a low-rank target incremental matrix, and update the current model parameter matrix according to the low-rank target incremental matrix to obtain the target language model corresponding to the sample language task, thereby realizing the approximation of the original incremental matrix by forming multiple low-rank matrices according to the data distribution characteristics of each sub-matrix in the original incremental matrix, which can more accurately capture the important features in each sub-matrix, and effectively prevent the loss of important features for matrices with sparseness or approximate sparseness, thereby achieving the high precision of language task processing while significantly reducing the computing resources and data storage requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 It is a flowchart of the adapter fine-tuning training steps provided by the prior art.
[0021] Figure 2 It is a flowchart of the Lora fine-tuning training steps provided by the prior art.
[0022] Figure 3 It is a flow chart of the language model training method provided by the present invention.
[0023] Figure 4 It is a flow chart of the language task processing method provided by the present invention.
[0024] Figure 5 It is a structural diagram of the language model training system provided by the present invention.
[0025] Figure 6 It is a structural diagram of the language task processing system provided by the present invention.
[0026] Figure 7 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] Large Language Model (LLM) is a natural language processing (NLP) model with a large number of parameters. The number of model parameters and / or the complexity of the model structure exceeds the preset threshold. The model is pre-trained with large-scale language data and has a high degree of semantic understanding and the ability to generate natural language. Large language models, such as Bidirectional Encoder Representations from Transformers (BERT), generative pre-trained transformers, and Text-to-Text Transfer Transformer (T5), contain hundreds of millions or even tens of billions of parameters. Fully updating these parameters on downstream tasks, especially when the available dataset for the task is small, can easily cause overfitting, resulting in the model possibly just memorizing the training data instead of learning the real data distribution. In addition, fine-tuning all parameters will greatly increase the computational requirements and memory consumption. Therefore, PEFT is particularly important for fine-tuning current large language models. PEFT only updates a small number of parameters and freezes most of the parameters of the large language model. This helps alleviate the catastrophic forgetting that comes with full fine-tuning, while reducing computational cost and hardware requirements and increasing training speed.
[0029] The current mainstream PEFT algorithms include prompt tuning, prefix tuning, and adapter.
[0030] Among them, prompt fine-tuning affects model reasoning by inserting prompt words in a designed way to guide the model to complete specific tasks. For example, if the model is required to continue a story, and the original input is "A long time ago, in a faraway place...", the input of prompt fine-tuning is "Continue this story: A long time ago, in a faraway place...", and the prompt words will guide the model to perform the task of continuing the story.
[0031] Prefix fine-tuning keeps the large language model parameters frozen and only updates a small task-specific continuous vector, the prefix parameter, while only storing the prefix of each task to save space. Specifically, prefix fine-tuning adds a fixed-length prefix vector in front of each layer's transformer module. These vectors are trainable, while the weights of the original model remain unchanged. All fine-tuning occurs only on these additional prefix vectors, which guide the output of the model parameters by optimizing these vectors.
[0032] The adapter first projects the original d-dimensional features into a smaller m-dimensional vector through a linear layer, then applies a nonlinear layer, and finally projects it back to the original dimension d through a linear layer, as shown in Figure 1 The adapter is usually inserted as a whole between the existing layers of the model, and during training only the parameters of the adapter layer are updated, while the original model parameters remain fixed.
[0033] As for prompt fine-tuning, different prompt words need to be designed for different tasks, which has low universality. At the same time, the model performance may be highly sensitive to the choice of prompts, and different prompts will lead to great performance differences. Prefix fine-tuning adjusts by adding additional prefixes before the input sequence, which will occupy the context window of the model. If the original context window of the model is limited, the presence of prefixes will reduce the length of the actual input text, which may lead to reduced model performance when processing long text tasks. For adapters, although adapters reduce the total number of parameters that need to be updated during training, the model structure becomes more complicated, which will increase the inference time. At the same time, for multi-task learning, different adapters need to be stored for each task, which increases storage requirements.
[0034] In this regard, a related technology has proposed low-rank adaptation (Lora) fine-tuning to achieve efficient fine-tuning of parameters of large language models. When fine-tuning downstream tasks, Lora assumes that there is redundancy in the incremental matrix parameters, and the actual effective parameters should be low-rank. Therefore, Lora decomposes the weight parameters of the high-dimensional space into a lower-dimensional subspace to represent the original parameters through low-rank approximation. Figure 2 As shown, is the input, is the output, is the weight matrix before updating, is the incremental weight matrix, are two low-rank matrices, The dimension is , The dimension is , The updated weight matrix can be expressed as , during training only be updated, Remain unchanged. Much smaller than d, most of the parameters are frozen, so Lora significantly saves training time and memory. In addition, there is no need to store huge model parameters for each downstream task, just save different As a result, the model parameters before fine-tuning can be added during inference.
[0035] Although Lora can significantly reduce computing resources and improve computing efficiency, and is effective in some specific types of tasks, such as natural language understanding and machine translation, the dimension of the low-rank matrix after Lora decomposition is much smaller than the dimension of the original matrix. For dynamic, sparse, and complex data-dependent tasks, it cannot capture important features, resulting in poor accuracy in language task processing of large language models trained by Lora fine-tuning.
[0036] In response to the above problems, the present application proposes a language model training method, which proposes a weight approximation method for fine-tuning. The original incremental matrix is approximated by forming multiple low-rank matrices based on the data distribution characteristics of each sub-matrix in the original incremental matrix, so as to more accurately capture the important features in each sub-matrix. For matrices that are sparse or nearly sparse, it can effectively prevent the loss of important features, so as to effectively make up for the shortcomings of fine-tuning algorithms such as Lora when processing sparse and complex tasks, maintain the high precision of language task processing, and significantly reduce computing resources and data storage requirements.
[0037] It should be noted that the execution subject of the method may be an electronic device, a component in an electronic device, an integrated circuit, or a chip. The electronic device may be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer, a netbook, etc., and the non-mobile electronic device may be a server, a network attached storage, a personal computer, etc., which is not specifically limited in the present invention.
[0038] Figure 3 is a flow chart of the language model training method provided by the present invention, such as Figure 3 As shown, the method includes the following steps 310, 320 and 330.
[0039] Step 310, obtaining an original incremental matrix corresponding to a current model parameter matrix of a large language model in a current cycle according to the sample language data and the annotation labels of the sample language tasks corresponding to the sample language data; Step 320, performing rank reduction processing on the original incremental matrix according to the data distribution characteristics of each submatrix in the original incremental matrix to obtain a target incremental matrix corresponding to the current model parameter matrix; Step 330: Update the current model parameter matrix according to the target increment matrix, and construct a target language model corresponding to the sample language task according to the update result.
[0040] Optionally, when fine-tuning the large language model is required so that it can have good performance under a specific sample language task, the following steps may be performed to iteratively update the model parameters of the large language model: For the current iterative training cycle, sample language data and annotation labels of sample language tasks corresponding to the sample language data are first obtained to form a training data set required for the current iterative training cycle.
[0041] The sample language data here can be text or voice, which is not specifically limited in this embodiment. The sample language data here can be collected during the user's historical interaction process, or can be loaded and obtained from the Internet or a database, which is not specifically limited in this embodiment.
[0042] The sample language task here can be at least one of a question-answering task, a translation task, and a semantic understanding task. The annotation labels here are generated by adaptively marking the sample language data based on different sample language tasks. For example, when the sample language task is a question-answering task, the annotation label of the sample language task can be the answer label corresponding to the question of the sample language data; when the sample language task is a translation task, the annotation label of the sample language task can be the target language data label corresponding to the source language data of the sample language data; when the sample language task is a semantic understanding task, the annotation label of the sample language task can be the intent label or entity relationship label corresponding to the sample language data.
[0043] After obtaining the training data set required for the current iterative training cycle, the sample language data in the training data set required for the current iterative training cycle can be input into the large language model, so that the large language model can perform the sample language task on the sample language data according to the current model parameter matrix, thereby obtaining the task processing result of the sample language data under the sample language task. And according to the task processing result and the annotation label, the loss function is calculated to obtain the target loss function, and according to the gradient of the loss function, the gradient of the current model parameter matrix is calculated using the back propagation algorithm, thereby obtaining the original incremental matrix corresponding to the current model parameter matrix.
[0044] The large language model here is a natural language processing model with a huge parameter scale. The number of model parameters and / or the complexity of the model structure exceeds a preset threshold. The model is pre-trained with large-scale language data and has a high degree of semantic understanding and the ability to generate natural language. It can be a converter for bidirectional encoding representation, a generative pre-trained converter, a text-to-text converter, etc. This embodiment does not specifically limit this.
[0045] The loss function calculation here can be directly based on the error between the task processing result and the annotation label to directly calculate the target loss function; or, based on the error between the task processing result and the annotation label, constraint items are added to form the target loss function, such as adding constraint items such as orthogonalization loss items set based on the original incremental matrix of the historical model parameter matrix. This embodiment does not make specific limitations on this.
[0046] After obtaining the original incremental matrix corresponding to the current model parameter matrix, the original incremental matrix may be divided into sub-blocks to divide the original incremental matrix into multiple smaller sub-blocks, thereby obtaining multiple sub-matrices of the original incremental matrix.
[0047] For example, the original increment matrix can be Divide it into several smaller sub-blocks according to a fixed size, and the representation of the multiple sub-matrices obtained by division is as follows: ; in, is the first The submatrix with row and column j can be a The m×n is the number of sub-matrices in the original increment matrix.
[0048] It should be noted that the number of blocks of the sub-matrix here can be adaptively adjusted according to different business requirements to achieve a balance between calculation accuracy and cost.
[0049] After obtaining multiple sub-matrices of the original incremental matrix, data distribution feature extraction may be performed on each sub-matrix to obtain the data distribution feature of each sub-matrix.
[0050] The extraction of data distribution features here can be achieved through model implementation or logical calculation implementation. For example, for logical calculation, each sub-matrix can be subjected to singular value decomposition to obtain the singular values, the first orthogonal matrix and the second orthogonal matrix corresponding to each sub-matrix. The data distribution features of each sub-matrix are generated by combining the singular values, the first orthogonal matrix and the second orthogonal matrix corresponding to each sub-matrix; wherein The specific implementation formula of the singular value decomposition can be expressed as follows: ; In the formula, is a The first orthogonal matrix of , the column vectors of which are left singular vectors; is a A diagonal matrix whose elements are The corresponding singular values; is a A second orthogonal matrix of which the column vectors are right singular vectors.
[0051] After obtaining the data distribution characteristics of each sub-matrix, the original incremental matrix can be rank reduced so that the rank of the target incremental matrix after rank reduction is smaller than the rank of the original incremental matrix, so as to approximate the original incremental matrix through the low-rank target incremental matrix, thereby reducing memory requirements and computing resources while removing noise and unimportant features, effectively alleviating the risk of overfitting during training and maintaining high accuracy in language task processing.
[0052] The rank reduction processing here can be implemented through principal component analysis, singular value pruning, etc., and this embodiment does not make any specific limitation on this.
[0053] After obtaining the target incremental matrix, the current model parameter matrix can be updated according to the target incremental matrix. Specifically, the current model parameter matrix With the target increment matrix Add together to get the new model parameter matrix , the specific calculation formula is as follows: .
[0054] After obtaining the new model parameter matrix After that, it can be determined whether the current model training has reached the preset termination condition, such as whether the number of training steps corresponding to the current iterative training cycle has reached the maximum number of steps, or whether the large language model has reached convergence based on the new model parameter matrix. If the preset termination condition is not reached, the new model parameter matrix As the next model parameter matrix of the large language model in the next cycle, and return to step 310 to iteratively update the next model parameter matrix until the model training reaches the preset termination condition; if the preset termination condition is reached, the model training is stopped to obtain the next model parameter matrix according to the new model parameter matrix. , a target language model is constructed that can perform high-performance processing of sample language tasks.
[0055] The method provided in this embodiment obtains the original incremental matrix corresponding to the current model parameter matrix of the large language model according to the sample language data and the annotated labels of the sample language task corresponding to the sample language data, and divides the original incremental matrix into blocks, so as to explicitly and adaptively reduce the rank of the original incremental matrix according to the data distribution characteristics of the sub-matrices formed by the blocks, so as to approximate the original incremental matrix through a low-rank target incremental matrix, and update the current model parameter matrix according to the low-rank target incremental matrix to obtain the target language model corresponding to the sample language task, thereby realizing the approximation of the original incremental matrix by forming multiple low-rank matrices according to the data distribution characteristics of each sub-matrix in the original incremental matrix, which can more accurately capture the important features in each sub-matrix, and effectively prevent the loss of important features for matrices with sparseness or approximate sparseness, thereby achieving the high precision of language task processing while significantly reducing the computing resources and data storage requirements.
[0056] In some embodiments, step 320 specifically includes: Step 321, obtaining the singular values, the first orthogonal matrix and the second orthogonal matrix corresponding to each of the sub-matrices according to the data distribution characteristics of each of the sub-matrices; Step 322, performing pruning processing on the singular values corresponding to the plurality of sub-matrices to obtain at least one target singular value; Step 323, according to each of the target singular values, the first orthogonal matrix corresponding to each of the target singular values and the second orthogonal matrix corresponding to each of the target singular values, the original incremental matrix is subjected to rank reduction processing to obtain the target incremental matrix.
[0057] Optionally, when performing the incremental matrix rank reduction processing, the singular values, the first orthogonal matrix and the second orthogonal matrix corresponding to each submatrix can be firstly obtained by analyzing the data distribution characteristics of each submatrix. Here, the column vectors of the first orthogonal matrix are left singular vectors, and the column vectors of the second orthogonal matrix are right singular vectors.
[0058] After obtaining the singular values corresponding to each submatrix, the first orthogonal matrix and the second orthogonal matrix, pruning may be performed on the singular values corresponding to all submatrices to select at least one target singular value having a greater impact on the original incremental matrix.
[0059] The pruning process here may be implemented by pruning based on importance ranking or by pruning based on a preset threshold, which is not specifically limited in this embodiment.
[0060] Exemplarily, in some implementations, step 322 specifically includes: In descending order, the singular values corresponding to all the sub-matrices are synthesized into diagonal matrices to obtain a target diagonal matrix; According to at least one singular value with a top sorting position in the target diagonal matrix, pruning processing is performed on the singular values in the target diagonal matrix to obtain at least one target singular value.
[0061] Optionally, the singular values corresponding to all sub-matrices can be merged into the diagonal matrix in descending order to obtain the target diagonal matrix . The diagonal elements of the target diagonal matrix are the sets of singular values of all sub-matrices.
[0062] After obtaining the target diagonal matrix, you can select the top ranked matrix from the target diagonal matrix. singular values, where Greater than or equal to 1. At the same time, except for the top The other singular values are set to 0 to prune the singular values, keeping only the top ones. The singular values are used as target singular values to participate in the subsequent rank reduction process, thereby approximating the original incremental matrix by retaining the most important singular values to reduce memory requirements. At the same time, since noise and unimportant features are removed, the risk of overfitting in the training process is effectively alleviated.
[0063] It should be noted that It can be adaptively adjusted according to different business needs to achieve a balance between computing accuracy and cost.
[0064] After obtaining each target singular value, the original incremental matrix may be reduced in rank by combining each target singular value, the first orthogonal matrix corresponding to each target singular value, and the second orthogonal matrix corresponding to each target singular value to obtain a low-rank target incremental matrix. For example, each target singular value, the first orthogonal matrix corresponding to each target singular value, and the second orthogonal matrix corresponding to each target singular value may be combined to perform matrix reconstruction to obtain a low-rank target incremental matrix; or an initial low-rank matrix may be constructed first, and then each target singular value, the first orthogonal matrix corresponding to each target singular value, and the second orthogonal matrix corresponding to each target singular value may be combined to iteratively optimize the initial low-rank matrix to obtain a low-rank target incremental matrix.
[0065] Exemplarily, in some implementations, step 323 specifically includes: Multiplying each of the target singular values, a column vector in the first orthogonal matrix corresponding to each of the target singular values, and a column vector in the second orthogonal matrix corresponding to each of the target singular values, respectively, to obtain a reconstruction matrix corresponding to each of the target singular values; The reconstruction matrices corresponding to all the target singular values are combined to obtain the target incremental matrix.
[0066] Optionally, the rank reduction process can be achieved through matrix reconstruction. The specific implementation steps include: respectively multiplying each target singular value with the column vector (i.e., left singular value vector) in the first orthogonal matrix corresponding to each target singular value and the column vector (i.e., right singular value vector) in the second orthogonal matrix corresponding to each target singular value to reconstruct the reconstructed matrix corresponding to each target singular value, and then combining the reconstructed matrices corresponding to all target singular values to reconstruct a low-rank target incremental matrix. The target incremental matrix The reconstruction formula is as follows: ; in, is the number of target singular values; is the i-th target singular value; and are the left singular value vector and right singular value vector corresponding to the i-th target singular value, respectively.
[0067] Here, the original incremental matrix is approximated by retaining the most important singular values and singular vectors, which can reduce memory requirements and effectively alleviate the risk of overfitting during training by removing noise and unimportant features.
[0068] It should be noted that the reconstruction matrix corresponding to each target singular value can be calculated in parallel to further improve the calculation efficiency.
[0069] In summary, the method provided in this embodiment divides the weight matrix into blocks when fine-tuning a large model, and then performs singular value pruning and low-rank matrix decomposition on each block to approximate the original incremental matrix. The block size and singular value pruning ratio can be adaptively set to flexibly achieve a balance between computational cost and final effect, so that the model trained in this way can adapt to different application scenarios and data characteristics, while ensuring that important information of each block is accurately captured, ensuring the integrity of important information, and alleviating the problem of loss of important features when the matrix is sparse, thereby improving the flexibility and accuracy of language task processing, as well as computational efficiency.
[0070] In some implementations, step 310 specifically includes: According to the current model parameter matrix, obtaining a task processing result of the sample language data under the sample language task; Determining a first loss function according to the task processing result and the annotation label; Determining a second loss function according to data distribution characteristics of an original incremental matrix corresponding to a historical model parameter matrix of the large language model in a previous period; Gradient calculation is performed according to the first loss function and the second loss function to obtain an original incremental matrix corresponding to the current model parameter matrix.
[0071] Optionally, the specific calculation steps of the original increment matrix include: First, the sample language data is input into the large language model, so that the large language model performs sample language task processing on the sample language data based on the current model parameter matrix, and obtains the task processing result of the sample language data under the sample language task, so as to calculate the first loss function through the error between the task processing result and the annotation label.
[0072] In addition, the data distribution characteristics of the original incremental matrix corresponding to the historical model parameter matrix of the large language model in the previous cycle can be loaded, and constraint terms such as regularization terms and orthogonalization terms can be calculated to obtain the second loss function.
[0073] Exemplarily, in some implementations, determining the second loss function according to the data distribution characteristics of the original incremental matrix corresponding to the historical model parameter matrix of the large language model in the previous period includes: According to the data distribution characteristics of the original incremental matrix corresponding to the historical model parameter matrix, a first orthogonal matrix and a second orthogonal matrix of each submatrix in the original incremental matrix corresponding to the historical model parameter matrix are obtained; Calculating a first norm value according to a first orthogonal matrix of each submatrix in the original incremental matrix corresponding to the historical model parameter matrix; Calculating a second norm value according to a second orthogonal matrix of each submatrix in the original incremental matrix corresponding to the historical model parameter matrix; The orthogonalization loss calculation is performed based on the first norm value, the second norm value, and the rank of the first orthogonal matrix and the rank of the second orthogonal matrix of each sub-matrix in the original incremental matrix corresponding to the historical model parameter matrix to obtain the second loss function.
[0074] Optionally, during the training process, in order to maintain the effectiveness of the incremental matrix decomposition while ensuring the stability of the training, the first norm value may be calculated based on the difference between the first orthogonal matrix of each submatrix in the original incremental matrix corresponding to the historical model parameter matrix and the unit matrix; the second norm value may be calculated based on the difference between the second orthogonal matrix of each submatrix in the original incremental matrix corresponding to the historical model parameter matrix and the unit matrix, and finally the first norm value, the second norm value, and the rank of the first orthogonal matrix and the rank of the second orthogonal matrix of each submatrix in the original incremental matrix corresponding to the historical model parameter matrix are combined to perform orthogonalization loss calculation to obtain a second loss function (also called orthogonalized loss function). Among them, the second loss function The calculation formula is as follows: ; in, is the number of network layers that need to be fine-tuned in the large language model; is the number of blocks of the submatrix of the original incremental matrix decomposition corresponding to each layer of the historical model parameter matrix, is the first orthogonal matrix and the second orthogonal matrix of the original incremental matrix corresponding to the historical model parameter matrix; yes rank, is the Frobenius norm of the matrix, is the identity matrix.
[0075] After obtaining the first loss function and the second loss function, the first loss function and the second loss function can be combined to calculate the target loss function, and the gradient of the current model parameter matrix is calculated using the back propagation algorithm according to the gradient of the loss function, thereby obtaining the original incremental matrix corresponding to the current model parameter matrix. The combination here can be direct addition or weighted addition, etc., which is not specifically limited in this embodiment.
[0076] The method provided in this embodiment determines the incremental matrix by combining a first loss function based on the task processing result and a second loss function based on the data distribution characteristics of the historical model parameter incremental matrix, thereby effectively improving the stability and effectiveness of model training.
[0077] The following is a specific example to illustrate the storage performance of the language model training method provided in this embodiment.
[0078] Assume that the original incremental matrix corresponding to the current model parameter matrix is It is divided into p sub-matrices, each of which has a size of , then each submatrix has min( , ) singular values, each submatrix needs to store left and right singular vectors, and the size of the left and right singular vector matrix of each submatrix is: min( , )and min( , ).
[0079] Then, the storage requirement of the singular value matrix of p blocks is: min( , ); The storage requirement for the left singular vectors of p blocks is: min( , ); The storage requirement for the right singular vectors of p blocks is: min( , ); The total storage requirement is: min( , ) + p min( , ) +p min( , ).
[0080] For example, assuming Size is 1000 There are 10 10 blocks, total storage requirement for all parameter fine-tuning: 1000 = 1,000,000 elements, while the storage requirement of the method provided in this embodiment is: 1,000+100,000+100,000=201,000 elements, which is about 80% less than that of full parameter fine-tuning.
[0081] In some embodiments, this embodiment also provides a language task processing method.
[0082] Figure 4 is a flow chart of the language task processing method provided by the present invention; Figure 4 As shown, the method includes step 410, step 420 and step 430.
[0083] Step 410, obtaining target language data and a task type of a target language task corresponding to the target language data; Step 420, determining, according to the task type, a target language model corresponding to the target language task from target language models corresponding to a plurality of different types of sample language tasks; Step 430, inputting the target language data into the target language model corresponding to the target language task, and obtaining the task processing result of the target language data under the target language task; Among them, the target language task includes at least one of a question-answering task, a translation task, and a semantic understanding task; the target language model corresponding to each type of the sample language task is trained based on the language model training method provided in the above embodiments.
[0084] Optionally, before executing step 410, a corresponding target language model may be trained in advance for different sample language tasks. For details on the training, see Figure 3 The training process shown will not be repeated here.
[0085] After obtaining the target language models corresponding to different sample language tasks, the target language model corresponding to the target language task can be matched among the target language models corresponding to multiple different sample language tasks according to the task type of the target language task. The target language data is input into the target language model corresponding to the target language task, so that the target language model corresponding to the target language task performs the task processing operation under the target language task on the target language data, thereby obtaining the task processing result of the target language data under the target language task.
[0086] Exemplarily, when the target language data is a question text and the target language task is a question-answering task, a target language model corresponding to the question-answering task can be matched among target language models corresponding to multiple different types of sample language tasks. The question text is input into the target language model corresponding to the question-answering task, and the target language model corresponding to the question-answering task performs question-answering processing on the question text to obtain an answer text corresponding to the question text.
[0087] The method provided in this embodiment performs specific language task processing by training a target language model under a specific task using multiple low-rank matrices formed by decomposing the data distribution characteristics of each sub-matrix in the original incremental matrix. This can more accurately capture the important features in each sub-matrix, and for matrices that are sparse or nearly sparse, can effectively prevent the loss of important features, thereby maintaining the high accuracy of language task processing while significantly reducing computing resources and data storage requirements.
[0088] The language model training system provided by the present invention is described below. The language model training system described below and the language model training method described above can be referenced to each other.
[0089] Figure 5 is a structural diagram of the language model training system provided by the present invention; Figure 5 As shown, the system includes: The first acquisition unit 510 is used to acquire an original incremental matrix corresponding to a current model parameter matrix of a large language model in a current cycle according to sample language data and annotated labels of a sample language task corresponding to the sample language data; The data processing unit 520 is used to perform rank reduction processing on the original incremental matrix according to the data distribution characteristics of each sub-matrix in the original incremental matrix to obtain a target incremental matrix corresponding to the current model parameter matrix; The model building unit 530 is used to update the current model parameter matrix according to the target incremental matrix, and build a target language model corresponding to the sample language task according to the update result.
[0090] The system provided by this embodiment obtains the original incremental matrix corresponding to the current model parameter matrix of the large language model according to the labeled labels of the sample language data and the sample language task corresponding to the sample language data, and divides the original incremental matrix into blocks, so as to explicitly and adaptively reduce the rank of the original incremental matrix according to the data distribution characteristics of the sub-matrices formed by the blocks, so as to approximate the original incremental matrix through a low-rank target incremental matrix, and update the current model parameter matrix according to the low-rank target incremental matrix to obtain the target language model corresponding to the sample language task, thereby realizing the approximation of the original incremental matrix by forming multiple low-rank matrices according to the data distribution characteristics of each sub-matrix in the original incremental matrix, which can more accurately capture the important features in each sub-matrix, and effectively prevent the loss of important features for matrices with sparseness or approximate sparseness, thereby achieving the high precision of language task processing while significantly reducing computing resources and data storage requirements.
[0091] In some embodiments, the data processing unit is specifically configured to: According to the data distribution characteristics of each of the sub-matrices, obtaining the singular values, the first orthogonal matrix and the second orthogonal matrix corresponding to each of the sub-matrices; Performing pruning processing on the singular values corresponding to the plurality of sub-matrices to obtain at least one target singular value; According to each of the target singular values, the first orthogonal matrix corresponding to each of the target singular values, and the second orthogonal matrix corresponding to each of the target singular values, the original incremental matrix is subjected to rank reduction processing to obtain the target incremental matrix.
[0092] In some embodiments, the data processing unit is further configured to: Multiplying each of the target singular values, a column vector in the first orthogonal matrix corresponding to each of the target singular values, and a column vector in the second orthogonal matrix corresponding to each of the target singular values, respectively, to obtain a reconstruction matrix corresponding to each of the target singular values; The reconstruction matrices corresponding to all the target singular values are combined to obtain the target incremental matrix.
[0093] In some embodiments, the data processing unit is further configured to: In descending order, the singular values corresponding to all the sub-matrices are synthesized into diagonal matrices to obtain a target diagonal matrix; According to at least one singular value with a top sorting position in the target diagonal matrix, pruning processing is performed on the singular values in the target diagonal matrix to obtain at least one target singular value.
[0094] In some embodiments, the first acquisition unit is specifically configured to: According to the current model parameter matrix, obtaining a task processing result of the sample language data under the sample language task; Determining a first loss function according to the task processing result and the annotation label; Determining a second loss function according to data distribution characteristics of an original incremental matrix corresponding to a historical model parameter matrix of the large language model in a previous period; Gradient calculation is performed according to the first loss function and the second loss function to obtain an original incremental matrix corresponding to the current model parameter matrix.
[0095] In some embodiments, the first acquisition unit is further configured to: According to the data distribution characteristics of the original incremental matrix corresponding to the historical model parameter matrix, a first orthogonal matrix and a second orthogonal matrix of each submatrix in the original incremental matrix corresponding to the historical model parameter matrix are obtained; Calculating a first norm value according to a first orthogonal matrix of each submatrix in the original incremental matrix corresponding to the historical model parameter matrix; Calculating a second norm value according to a second orthogonal matrix of each submatrix in the original incremental matrix corresponding to the historical model parameter matrix; The orthogonalization loss calculation is performed based on the first norm value, the second norm value, and the rank of the first orthogonal matrix and the rank of the second orthogonal matrix of each sub-matrix in the original incremental matrix corresponding to the historical model parameter matrix to obtain the second loss function.
[0096] In some embodiments, this embodiment also provides a language task processing system.
[0097] Figure 6 is a structural diagram of the language task processing system provided by the present invention; Figure 6 As shown, the system includes: The second acquisition unit 610 is used to acquire the target language data and the task type of the target language task corresponding to the target language data; The model selection unit 620 is used to determine, according to the task type, a target language model corresponding to the target language task from target language models corresponding to a plurality of different types of sample language tasks; The task processing unit 630 is used to input the target language data into the target language model corresponding to the target language task, and obtain the task processing result of the target language data under the target language task; Among them, the target language task includes at least one of a question-answering task, a translation task, and a semantic understanding task; the target language model corresponding to each type of the sample language task is trained based on the language model training method provided in the above embodiments.
[0098] The system provided in this embodiment performs specific language task processing by training a target language model under a specific task using multiple low-rank matrices formed by decomposing the data distribution characteristics of each sub-matrix in the original incremental matrix. This can more accurately capture the important features in each sub-matrix and effectively prevent the loss of important features for sparse or nearly sparse matrices, thereby maintaining high accuracy in language task processing while significantly reducing computing resources and data storage requirements.
[0099] The system provided by the present invention is used to execute the above-mentioned method embodiments. Please refer to the above-mentioned embodiments for the specific processes and detailed contents, which will not be repeated here.
[0100] Figure 7 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 7 As shown, the electronic device may include: a processor (processor) 710 , a communication interface (Communications Interface) 720 , a memory (memory) 730 and a communication bus 740 , wherein the processor 710 , the communication interface 720 , and the memory 730 communicate with each other through the communication bus 740 . The processor 710 may call the logic instructions in the memory 730 to execute the language model training method, which includes: obtaining the original incremental matrix corresponding to the current model parameter matrix of the large language model in the current cycle according to the sample language data and the labeling label of the sample language task corresponding to the sample language data; performing rank reduction processing on the original incremental matrix according to the data distribution characteristics of each submatrix in the original incremental matrix to obtain the target incremental matrix corresponding to the current model parameter matrix; updating the current model parameter matrix according to the target incremental matrix, and constructing the target language model corresponding to the sample language task according to the update result; or, a language task processing method, which includes obtaining the target language data and the task type of the target language task corresponding to the target language data; determining the target language model corresponding to the target language task among the target language models corresponding to multiple different types of sample language tasks according to the task type; inputting the target language data into the target language model corresponding to the target language task to obtain the task processing result of the target language data under the target language task; wherein the target language task includes at least one of a question-answering task, a translation task, and a semantic understanding task; and the target language models corresponding to the sample language tasks of each type are obtained by training based on the language model training method.
[0101] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0102] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the language model training method provided by the above-mentioned methods, and the method includes: according to the sample language data and the label label of the sample language task corresponding to the sample language data, obtaining the original incremental matrix corresponding to the current model parameter matrix of the large language model in the current cycle; according to the data distribution characteristics of each sub-matrix in the original incremental matrix, performing rank reduction processing on the original incremental matrix to obtain the target incremental matrix corresponding to the current model parameter matrix; according to the target incremental matrix, updating the current model parameter matrix, according to Update result, construct a target language model corresponding to the sample language task; or, a language task processing method, the method comprising obtaining target language data and a task type of the target language task corresponding to the target language data; according to the task type, determining the target language model corresponding to the target language task among target language models corresponding to multiple different types of sample language tasks; inputting the target language data into the target language model corresponding to the target language task, and obtaining a task processing result of the target language data under the target language task; wherein the target language task comprises at least one of a question-answering task, a translation task, and a semantic understanding task; and the target language models corresponding to the sample language tasks of each type are trained based on a language model training method.
[0103] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the language model training method provided by the above methods, the method comprising: obtaining an original incremental matrix corresponding to a current model parameter matrix of a large language model in a current cycle according to sample language data and annotated labels of a sample language task corresponding to the sample language data; performing rank reduction processing on the original incremental matrix according to data distribution characteristics of each submatrix in the original incremental matrix to obtain a target incremental matrix corresponding to the current model parameter matrix; updating the current model parameter matrix according to the target incremental matrix, and constructing the sample language task according to the update result. A target language model corresponding to a task; or a language task processing method, the method comprising obtaining target language data and a task type of a target language task corresponding to the target language data; determining, according to the task type, a target language model corresponding to the target language task among target language models corresponding to a plurality of different types of sample language tasks; inputting the target language data into the target language model corresponding to the target language task, and obtaining a task processing result of the target language data under the target language task; wherein the target language task comprises at least one of a question-answering task, a translation task, and a semantic understanding task; and the target language models corresponding to the sample language tasks of each type are trained based on a language model training method.
[0104] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0105] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0106] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A language model training method, characterized in that: include: According to the sample language data and the annotation labels of the sample language tasks corresponding to the sample language data, obtaining an original incremental matrix corresponding to the current model parameter matrix of the large language model in the current cycle; According to the data distribution characteristics of each submatrix in the original incremental matrix, the original incremental matrix is subjected to rank reduction processing to obtain a target incremental matrix corresponding to the current model parameter matrix; The current model parameter matrix is updated according to the target increment matrix, and a target language model corresponding to the sample language task is constructed according to the update result.
2. The language model training method according to claim 1, characterized in that: The step of performing rank reduction processing on the original incremental matrix according to the data distribution characteristics of each submatrix in the original incremental matrix to obtain a target incremental matrix corresponding to the current model parameter matrix includes: According to the data distribution characteristics of each of the sub-matrices, obtaining the singular values, the first orthogonal matrix and the second orthogonal matrix corresponding to each of the sub-matrices; Performing pruning processing on the singular values corresponding to the plurality of sub-matrices to obtain at least one target singular value; According to each of the target singular values, the first orthogonal matrix corresponding to each of the target singular values, and the second orthogonal matrix corresponding to each of the target singular values, the original incremental matrix is subjected to rank reduction processing to obtain the target incremental matrix.
3. The language model training method according to claim 2, characterized in that: The step of performing rank reduction processing on the original incremental matrix according to each of the target singular values, the first orthogonal matrix corresponding to each of the target singular values, and the second orthogonal matrix corresponding to each of the target singular values to obtain the target incremental matrix includes: Multiplying each of the target singular values, a column vector in the first orthogonal matrix corresponding to each of the target singular values, and a column vector in the second orthogonal matrix corresponding to each of the target singular values, respectively, to obtain a reconstruction matrix corresponding to each of the target singular values; The reconstruction matrices corresponding to all the target singular values are combined to obtain the target incremental matrix.
4. The language model training method according to claim 2, characterized in that: The pruning of the singular values corresponding to the plurality of sub-matrices to obtain at least one target singular value includes: In descending order, the singular values corresponding to all the sub-matrices are synthesized into diagonal matrices to obtain a target diagonal matrix; According to at least one singular value with a top sorting position in the target diagonal matrix, pruning processing is performed on the singular values in the target diagonal matrix to obtain at least one target singular value.
5. The language model training method according to any one of claims 1 to 4, characterized in that: The step of obtaining, according to the sample language data and the label of the sample language task corresponding to the sample language data, an original incremental matrix corresponding to the current model parameter matrix of the large language model in the current cycle includes: According to the current model parameter matrix, obtaining a task processing result of the sample language data under the sample language task; Determining a first loss function according to the task processing result and the annotation label; Determining a second loss function according to data distribution characteristics of an original incremental matrix corresponding to a historical model parameter matrix of the large language model in a previous period; Gradient calculation is performed according to the first loss function and the second loss function to obtain an original incremental matrix corresponding to the current model parameter matrix.
6. The language model training method according to claim 5, characterized in that: The determining of the second loss function according to the data distribution characteristics of the original incremental matrix corresponding to the historical model parameter matrix of the large language model in the previous period includes: According to the data distribution characteristics of the original incremental matrix corresponding to the historical model parameter matrix, a first orthogonal matrix and a second orthogonal matrix of each submatrix in the original incremental matrix corresponding to the historical model parameter matrix are obtained; Calculating a first norm value according to a first orthogonal matrix of each submatrix in the original incremental matrix corresponding to the historical model parameter matrix; Calculating a second norm value according to a second orthogonal matrix of each submatrix in the original incremental matrix corresponding to the historical model parameter matrix; The orthogonalization loss calculation is performed based on the first norm value, the second norm value, and the rank of the first orthogonal matrix and the rank of the second orthogonal matrix of each sub-matrix in the original incremental matrix corresponding to the historical model parameter matrix to obtain the second loss function.
7. A language task processing method, characterized in that: include: Acquire target language data and a task type of a target language task corresponding to the target language data; According to the task type, determining a target language model corresponding to the target language task from target language models corresponding to a plurality of different types of sample language tasks; Inputting the target language data into a target language model corresponding to the target language task to obtain a task processing result of the target language data under the target language task; Among them, the target language task includes at least one of a question-answering task, a translation task, and a semantic understanding task; the target language model corresponding to each type of the sample language task is trained based on the language model training method according to any one of claims 1 to 6.
8. A language model training system, characterized in that: include: A first acquisition unit is used to acquire an original incremental matrix corresponding to a current model parameter matrix of a large language model in a current cycle according to sample language data and a labeling label of a sample language task corresponding to the sample language data; A data processing unit, configured to perform rank reduction processing on the original incremental matrix according to data distribution characteristics of each submatrix in the original incremental matrix, so as to obtain a target incremental matrix corresponding to the current model parameter matrix; The model building unit is used to update the current model parameter matrix according to the target incremental matrix, and build a target language model corresponding to the sample language task according to the update result.
9. A language task processing system, characterized in that: include: A second acquisition unit, configured to acquire target language data and a task type of a target language task corresponding to the target language data; A model selection unit, configured to determine, according to the task type, a target language model corresponding to the target language task from target language models corresponding to a plurality of different types of sample language tasks; A task processing unit, configured to input the target language data into a target language model corresponding to the target language task, and obtain a task processing result of the target language data under the target language task; Among them, the target language task includes at least one of a question-answering task, a translation task, and a semantic understanding task; the target language model corresponding to each type of the sample language task is trained based on the language model training method according to any one of claims 1 to 6.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the language model training method according to any one of claims 1 to 6 or the language task processing method according to any one of claim 7 is implemented.
11. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the language model training method according to any one of claims 1 to 6 or the language task processing method according to any one of claim 7 is implemented.
Citation Information
Cited By
Knowledge migration method for multi-language machine translation
CN120354865A
A knowledge transfer method for multilingual machine translation
CN120354865B
Text reasoning method, product, equipment and storage medium
CN120851223A
Large language model training method and device, electronic equipment and readable storage medium
CN121998093A
Large language model training method and device, electronic equipment and readable storage medium
CN121998093B