Task processing method and device based on hybrid expert model and storage medium

By dividing self-programming tasks into five categories and sharing the base model, combining the joint reasoning of expert schedulers and mix-review strategy, the problem of large video memory requirements in the existing technology is solved, and the processing efficiency and accuracy of the hybrid expert model is improved. sex.

CN119292579APending Publication Date: 2025-01-10GUANGDONG POWER GRID CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411366857.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

The existing task processing methods based on hybrid expert models are completely independent models, resulting in large memory requirements and low processing efficiency.

Method used

Dividing self-programming tasks into five types of tasks. Each type of tasks corresponds to a LoRA expert model. Multiple LoRA expert models share a base multilingual model. Joint reasoning through expert scheduler, the mix-review strategy fine-tuning model is used to improve the generalization ability and adaptability.

Benefits of technology

It effectively reduces the memory requirements, improves the processing efficiency and accuracy of expert models, avoids overfitting, and adapts the model to new or rare programming modes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119292579A_ABST
    Figure CN119292579A_ABST
Patent Text Reader

Abstract

The invention discloses a task processing method and device based on a hybrid expert model and a storage medium, and the method comprises the steps: dividing a self-programming task into five types of tasks which comprise a function name and grammar prediction task, a variable name prediction task, a character string parameter prediction task, a base model prediction task and a grammar prediction task; for each type of tasks, training based on the labeled example codes to obtain a LoRA expert model corresponding to each type of tasks; and based on the trained expert scheduler, according to the task type of the current self-programming task, performing reasoning in combination with a plurality of LoRA expert models to obtain a task code. According to the method, the self-programming tasks are divided into five types of tasks, each type of task corresponds to one LoRA expert model, the multiple LoRA expert models share one base multi-language model, reasoning is conducted on the self-programming tasks, the video memory requirement can be effectively reduced, and therefore the expert model processing efficiency can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a task processing method, device and storage medium of a hybrid expert model. Background Art

[0002] Robot self-programming technology refers to the process in which a large language model receives natural language instructions from the user and generates new code that can be compiled by the compiler by referring to sample code. From the perspective of effect, self-programming technology uses the inductive reasoning ability of the large language model to disassemble the user instructions step by step, and finally generates a series of codes to call the robot's underlying control functions. However, the large language model itself has a certain degree of randomness, and there is a certain probability that it will generate code with grammatical errors, causing the compiler to terminate the program due to an error. For the industry-leading large models with a large number of parameters (such as l lama 2 70B and GLM-4), the probability of grammatical errors in the generated code is very small, but for large models with a small number of parameters, such as l lama 13B, 7B and GLM 36B, the code generated in the self-programming test is logically correct but often has several grammatical errors, so some technical means are needed to enhance its performance. In practical applications, it is necessary to use large models with a small number of parameters to a large extent. Because the smaller the number of parameters, the faster the execution speed and the lower the hardware requirements. Llama13b can achieve an inference speed of 46 tokens / s with a single A100, while Llama70B can only achieve a speed of 32 tokens / s with eight A100s. In actual application scenarios, there is often no such luxury as eight A100s.

[0003] "Hybrid experts" is a relatively feasible technical idea, which is intended to train specialized models for different tasks to improve overall reliability. At the application level of large language models, the existing hybrid expert model task processing method usually treats each expert model as a completely independent model. According to the scheduler and aggregator, the results of all experts are comprehensively considered. Multiple independent expert models need to occupy a large amount of video memory, resulting in low processing efficiency of the expert model. Summary of the invention

[0004] The present invention provides a task processing method, device and storage medium based on a hybrid expert model to solve the technical problem that the existing task processing method based on a hybrid expert model usually takes each expert model as a completely independent model, comprehensively considers the results of all experts according to the scheduler and aggregator, and multiple independent expert models need to occupy a large video memory, resulting in low processing efficiency of the expert model.

[0005] The present invention provides a task processing method based on a hybrid expert model, comprising:

[0006] The self-programming tasks are divided into five categories, including function name and syntax prediction tasks, variable name prediction tasks, string parameter prediction tasks, base model prediction tasks and writing style prediction tasks;

[0007] For each type of task, the LoRA expert model corresponding to each type of task is trained based on the labeled sample code;

[0008] Based on the trained expert scheduler, multiple LoRA expert models are combined to perform reasoning to obtain the task code according to the task type of the current self-programming task.

[0009] Furthermore, the LoRA expert model corresponding to each type of task is obtained based on the labeled sample code training, including:

[0010] Initialize the dataset for training;

[0011] Execute a loop process until a preset condition is met, wherein the loop process includes: selecting an untrained data from the data set as sample data, determining the LoRA expert model to be called according to the task type marked in the sample data, and fine-tuning the selected LoRA expert model according to the sample data with a mix-review strategy, and storing the current sample data in the cache after the selected LoRA expert model is fitted; the preset condition includes: all data in the data are trained.

[0012] Furthermore, for each type of task, after obtaining the LoRA expert model corresponding to each type of task based on the labeled sample code training, it also includes:

[0013] Freeze the weights of the large language model and all LoRA expert models, use the cross entropy of the multi-classification task as the loss function, and train the expert scheduler.

[0014] Furthermore, the task code is obtained by reasoning with multiple LoRA expert models, including:

[0015] Building a joint reasoning network based on the multiple LoRA expert models and the large language model; inputting the current self-programming task into the joint reasoning network, and outputting a preliminary processing result through the large language model;

[0016] Different LoRA expert models are switched by an expert scheduler, and the preliminary processing results are offset by the LoRA expert model to obtain output results of different LoRA expert models, and all output results are integrated to obtain the task code of the self-programming task.

[0017] Furthermore, the joint reasoning network includes several layers of converter modules, each of which includes a stacked connected attention layer and a feedforward neural network layer.

[0018] Furthermore, the expert scheduler is provided with two linear layers, a ReLU activation function is used between the two linear layers, and a softmax activation function is added after the linear layer for output; the ReLU activation function is used to introduce nonlinearity, and the softmax activation function is used to convert the output of the linear layer into a probability distribution.

[0019] The present invention also provides a task processing device based on a hybrid expert model, comprising:

[0020] The task type classification module is used to classify the self-programming tasks into five types of tasks, including function name and syntax prediction tasks, variable name prediction tasks, string parameter prediction tasks, base model prediction tasks and writing style prediction tasks;

[0021] The expert model training module is used to train the LoRA expert model corresponding to each type of task based on the annotated sample code;

[0022] The task reasoning module is used to obtain the task code by combining multiple LoRA expert models based on the trained expert scheduler and the task type of the current self-programming task.

[0023] Furthermore, the expert model training module is also used for:

[0024] Initialize the dataset for training;

[0025] The loop process is executed until the preset conditions are met, wherein the loop process includes: selecting an untrained data from the data set as sample data, determining the LoRA expert model to be called according to the task type marked in the sample data, fine-tuning the selected LoRA expert model according to the sample data with a mix-review strategy, and storing the current sample data in the cache after the selected LoRA expert model is fitted; the preset conditions include: all data in the data are trained

[0026] The present invention also provides a terminal device, comprising: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, the task processing method based on the hybrid expert model as described above is implemented.

[0027] The present invention also provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the task processing method based on the hybrid expert model as described above.

[0028] The present invention divides self-programming tasks into five categories, each category of tasks corresponds to a LoRA expert model, and multiple LoRA expert models share a base multi-language model to perform reasoning on self-programming tasks, which can effectively reduce the demand for video memory and thus effectively improve the efficiency of expert model processing.

[0029] Furthermore, the present invention trains each LoRA expert model for a specific type of programming task, thereby effectively improving the processing efficiency and accuracy of each LoRA expert model in its corresponding programming task; using the mix-review strategy to fine-tune the model can improve the generalization ability of the model, avoid overfitting, and enable the trained LoRA expert model to adapt to new or rare programming modes, thereby improving the processing efficiency of the expert model. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 is a flowchart of a task processing method based on a hybrid expert model provided by an embodiment of the present invention;

[0031] Figure 2 is a schematic diagram of a joint reasoning process provided by an embodiment of the present invention;

[0032] Figure 3 is a schematic diagram of the structure of a joint reasoning network provided by an embodiment of the present invention;

[0033] Figure 4 is a schematic diagram of the structure of a feedforward network layer provided by an embodiment of the present invention;

[0034] Figure 5 is a schematic diagram of joint reasoning of multiple expert models provided by an embodiment of the present invention;

[0035] Figure 6 is a schematic diagram of video memory occupancy before optimization provided by an embodiment of the present invention;

[0036] Figure 7 is a schematic diagram of optimized video memory occupancy provided by an embodiment of the present invention;

[0037] Figure 8 It is a structural diagram of a task processing device based on a hybrid expert model provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0038] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0039] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the feature. In the description of this application, unless otherwise specified, "plurality" means two or more.

[0040] In the description of this application, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.

[0041] See also Figure 1 The present invention provides a task processing method based on a hybrid expert model, comprising:

[0042] S1. Divide the self-programming tasks into five categories, including function name and syntax prediction tasks, variable name prediction tasks, string parameter prediction tasks, base model prediction tasks, and writing style prediction tasks;

[0043] In the embodiment of the present invention, the self-programming task may be a self-programming token generation task, which is a self-programming task for generating a token, wherein the token may be a code element.

[0044] In the embodiment of the present invention, the base model is an original large language model without any modification, such as the open source large language model Qianwen and L l ama series. The base model prediction task is used to deal with general token generation problems, which specifically means that if there is no special situation, the result of the original large language model is not modified.

[0045] S2. For each type of task, the LoRA expert model corresponding to each type of task is obtained based on the labeled sample code training;

[0046] In the embodiment of the present invention, the sample code is annotated according to the five tasks, and the annotated example code is classified into the above five tasks. For each type of task, the annotated sample code is used for model training to obtain the corresponding five LoRA expert models. Among them, the LoRA model is a low-rank adaptive model that can adapt to new tasks or data by adjusting a small number of parameters in the model without retraining the entire model.

[0047] In an embodiment of the present invention, the LoRA expert model can be used to perform special adjustments and optimizations for different code generation tasks (such as function name prediction, variable name prediction, etc.) without retraining the entire large model, thereby effectively improving the adaptability and flexibility of the model while reducing the consumption of computing resources.

[0048] S3. Based on the trained expert scheduler, multiple LoRA expert models are combined to perform reasoning to obtain the task code according to the task type of the current self-programming task.

[0049] In the embodiment of the present invention, the expert scheduler may be a text classifier. In the embodiment of the present invention, the scheduler may call a third-party text encoding module BAAI / l lm-embedder. L lm-embedder is a text encoder developed for text retrieval, which can convert a string of any length into a fixed-length vector of 768 dimensions, and can directly calculate the semantic similarity of two strings through vector dot product.

[0050] The embodiment of the present invention divides the self-programming tasks into five categories, each category of tasks corresponds to a LoRA expert model, and multiple LoRA expert models share a base multi-language model to perform reasoning on the self-programming tasks, which can effectively reduce the video memory requirements and thus effectively improve the efficiency of expert model processing.

[0051] In one embodiment, the generated target code is: composer("Grasp the paper ball.")

[0052] The analysis is as follows: compos: part of the function name, classified as 1;

[0053] er(": function name and part of syntax, category 1;

[0054] Grasp: part of the string parameter, category 3;

[0055] The problem encountered is: the output punctuation is incorrect, that is, composer("Grasp the paper ba l l.').

[0056] In one embodiment, see Figure 2, which is a schematic diagram of a joint reasoning process provided by an embodiment of the present invention.

[0057] In one embodiment, step S2, training a LoRA expert model corresponding to each type of task based on the annotated sample code, includes:

[0058] S21, initialize the data set for training;

[0059] In the embodiment of the present invention, the data set used for training may be annotated sample codes.

[0060] S22. Execute a loop process until a preset condition is met, wherein the loop process includes: selecting an untrained data from the data set as sample data, determining the LoRA expert model to be called according to the task type marked in the sample data, and fine-tuning the selected LoRA expert model according to the sample data with a mix-review strategy, and storing the current sample data in the cache after the selected LoRA expert model is fitted; the preset condition includes: all data in the data are trained.

[0061] In the embodiment of the present invention, the cached data is the sample data used to train the expert model. Since the self-programming project has fewer training samples, the sample data can be directly stored in the memory or database.

[0062] The embodiment of the present invention trains each LoRA expert model for a specific type of programming task, thereby effectively improving the processing efficiency and accuracy of each LoRA expert model in the corresponding programming task; the mix-review strategy is used to fine-tune the model, which can improve the generalization ability of the model and avoid overfitting, and enable the trained LoRA expert model to adapt to new or rare programming modes, thereby improving the processing efficiency of the expert model.

[0063] Furthermore, the embodiment of the present invention stores the current sample data in the cache, and combines the cached data when training the LoRA expert model next time, which can effectively speed up the training process. Especially when the data set is large, the cache can reduce the repeated loading and processing of the same data, thereby effectively improving the processing efficiency of the model.

[0064] In one embodiment, in step S2, after obtaining the LoRA expert model corresponding to each type of task based on the annotated sample code training for each type of task, the method further includes:

[0065] Freeze the weights of the large language model and all LoRA expert models, use the cross entropy of the multi-classification task as the loss function, and train the expert scheduler.

[0066] In an embodiment of the present invention, by freezing the weights of the base model and the expert model, the stability of these models can be maintained when training the scheduler, avoiding interference with the trained models during the scheduler training process, thereby effectively improving the stability and accuracy of model processing.

[0067] In one embodiment, step S3, combining multiple LoRA expert models to perform reasoning to obtain the task code, includes:

[0068] S31. Construct a joint reasoning network based on multiple LoRA expert models and a large language model; input the current self-programming task into the joint reasoning network, and output the preliminary processing result through the large language model;

[0069] S32, switching different LoRA expert models through the expert scheduler, performing offset processing on the preliminary processing results with the LoRA expert model to obtain output results of different LoRA expert models, and integrating all output results to obtain the task code of the self-programming task.

[0070] In the embodiment of the present invention, the expert scheduler switches different LoRA expert models, and five LoRA expert models can be offset processed to obtain five different output results. By integrating and reasoning all the output results, the task code of the self-programming task is obtained.

[0071] See also Figure 3 , which is a structural diagram of a joint reasoning network provided by an embodiment of the present invention.

[0072] In one embodiment, the joint reasoning network includes several layers of converter modules, each converter module includes a stacked connected attention layer and a feedforward neural network layer.

[0073] In this embodiment of the present invention, the joint reasoning network as a whole includes 40 layers of transformer blocks, each of which is divided into two stacked sub-modules: an attention layer and a feedforward neural network layer. Each sub-module has its own normalization layer before receiving input.

[0074] See also Figure 4 , is a structural diagram of a feedforward network layer provided by an embodiment of the present invention.

[0075] In one embodiment, the expert scheduler is provided with two linear layers, a ReLU activation function is used between the two linear layers, and a softmax activation function is added after the linear layer for output; the ReLU activation function is used to introduce nonlinearity, and the softmax activation function is used to convert the output of the linear layer into a probability distribution.

[0076] In the embodiment of the present invention, the expert scheduler can output 5 probabilities, corresponding to the contribution of the five LoRA expert models to the output results. In the embodiment of the present invention, two linear layers are added after the expert scheduler, the hidden dimension of the intermediate result is 1024, the activation function is ReLU, and softmax is added to the final output layer to ensure that the sum of the probabilities is 1.

[0077] In the embodiment of the present invention, the first linear layer can map the input features to a high-dimensional space, so that the expert model can capture more complex feature representations; the ReLU activation function introduces nonlinearity, so that the model can learn and simulate more complex function mappings, thereby effectively enhancing the expressiveness of the model; the hidden dimension is 1024, which provides sufficient capacity to process and learn the complex relationship between input features; the final softmax layer ensures that the output can be interpreted as a probability distribution, and the probability corresponding to each expert model reflects its contribution to the final result; the two linear layers can effectively increase the flexibility of the model design, and the two linear layers can be adjusted to adapt to different task requirements.

[0078] See also Figure 5 , which is a schematic diagram of the joint reasoning of multiple expert models provided by an embodiment of the present invention. In which, + represents weighted sum, for example: output = bw(x) + 0.3w1(x) + 0.7w2(x), bw refers to the parameters of the base large model, and w1 w2 respectively represent the replacement parameters of the LRA model.

[0079] See also Figure 6-7 , is a schematic diagram of video memory usage before and after optimization. The LoRA parts of the five LoRA expert models are placed on GPUs 3 to 7 respectively, and the base large language model is on GPU 2. Figure 6-7 It can be seen that after optimization, the task processing device based on the hybrid expert model according to the embodiment of the present invention can save 300GB of video memory, so that through the aggregation of multiple expert models, a 13B small model can achieve an effect similar to that of a 70B large model.

[0080] The implementation of the embodiments of the present invention has the following beneficial effects:

[0081] The embodiment of the present invention divides the self-programming tasks into five categories, each category of tasks corresponds to a LoRA expert model, and multiple LoRA expert models share a base multi-language model to perform reasoning on the self-programming tasks, which can effectively reduce the video memory requirements and thus effectively improve the efficiency of expert model processing.

[0082] Furthermore, the embodiment of the present invention trains each LoRA expert model for a specific type of programming task, thereby effectively improving the processing efficiency and accuracy of each LoRA expert model in its corresponding programming task; using the mix-review strategy to fine-tune the model can improve the generalization ability of the model, avoid overfitting, and enable the trained LoRA expert model to adapt to new or rare programming modes, thereby improving the processing efficiency of the expert model.

[0083] See also Figure 8 Based on the same inventive concept as the above embodiment, the present invention further provides a task processing device based on a hybrid expert model, comprising:

[0084] The task type classification module 10 is used to classify the self-programming tasks into five types of tasks, wherein the five types of tasks include function name and syntax prediction tasks, variable name prediction tasks, string parameter prediction tasks, base model prediction tasks and writing style prediction tasks;

[0085] An expert model training module 20 is used to train a LoRA expert model corresponding to each type of task based on the annotated sample code;

[0086] The task reasoning module 30 is used to obtain the task code by reasoning with multiple LoRA expert models based on the trained expert scheduler and the task type of the current self-programming task.

[0087] In one embodiment, the expert model training module 20 is further used to:

[0088] Initialize the dataset for training;

[0089] The loop process is executed until the preset conditions are met, wherein the loop process includes: selecting an untrained data from the data set as sample data, determining the LoRA expert model to be called according to the task type marked in the sample data, and fine-tuning the selected LoRA expert model according to the sample data with a mix-review strategy, and storing the current sample data in the cache after the selected LoRA expert model is fitted; the preset conditions include: all data in the data are trained.

[0090] In one embodiment, the task processing device based on the hybrid expert model further includes an expert scheduler training module for:

[0091] Freeze the weights of the large language model and all LoRA expert models, use the cross entropy of the multi-classification task as the loss function, and train the expert scheduler.

[0092] In one embodiment, the task reasoning module 30 is further used to:

[0093] Build a joint reasoning network based on multiple LoRA expert models and a large language model; input the current self-programming task into the joint reasoning network, and output the preliminary processing results through the large language model;

[0094] Different LoRA expert models are switched through the expert scheduler, and the preliminary processing results are offset by the LoRA expert model to obtain the output results of different LoRA expert models. All output results are integrated to obtain the task code of the self-programming task.

[0095] In one embodiment, the joint reasoning network includes several layers of converter modules, each converter module includes a stacked connected attention layer and a feedforward neural network layer.

[0096] In one embodiment, the expert scheduler is provided with two linear layers, a ReLU activation function is used between the two linear layers, and a softmax activation function is added after the linear layer for output; the ReLU activation function is used to introduce nonlinearity, and the softmax activation function is used to convert the output of the linear layer into a probability distribution.

[0097] Accordingly, an embodiment of the present invention also provides a terminal device, comprising: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, it implements the task processing method based on the hybrid expert model of any one of the above embodiments.

[0098] The terminal device of this embodiment includes: a processor, a memory, and a computer program and computer instructions stored in the memory and executable on the processor. When the processor executes the computer program, each step in the above embodiment 1 is implemented, for example Figure 1 Alternatively, when the processor executes the computer program, the functions of each module / unit in the above device embodiment, such as the expert model training module 20, are implemented.

[0099] Exemplarily, the computer program can be divided into one or more modules / units, one or more modules / units are stored in a memory and executed by a processor to complete the present invention. One or more modules / units can be a series of computer program instruction segments that can perform specific functions, and the instruction segments are used to describe the execution process of the computer program in the terminal device. For example, the expert model training module 20 is used to obtain the LoRA expert model corresponding to each type of task based on the labeled example code training for each type of task.

[0100] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server. The terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that the schematic diagram is merely an example of a terminal device and does not constitute a limitation on the terminal device. The terminal device may include more or fewer components than shown in the diagram, or may combine certain components, or different components. For example, the terminal device may also include an input / output device, a network access device, a bus, etc.

[0101] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, and uses various interfaces and lines to connect various parts of the entire terminal device.

[0102] The memory can be used to store computer programs and / or modules. The processor realizes various functions of the terminal device by running or executing the computer programs and / or modules stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the mobile terminal, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Med ia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (F l ash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0103] Among them, if the module / unit integrated in the terminal device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.

[0104] Accordingly, an embodiment of the present invention also provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the task processing method based on the hybrid expert model as described in any one of the above embodiments.

[0105] The above specific embodiments further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above are only specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.

Claims

1. A task processing method based on a hybrid expert model, characterized in that: include: The self-programming tasks are divided into five categories, including function name and syntax prediction tasks, variable name prediction tasks, string parameter prediction tasks, base model prediction tasks and writing style prediction tasks; For each type of task, the LoRA expert model corresponding to each type of task is trained based on the annotated sample code; Based on the trained expert scheduler, according to the task type of the current self-programming task, multiple LoRA expert models are combined to perform reasoning to obtain the task code.

2. The task processing method based on the hybrid expert model according to claim 1, characterized in that: The LoRA expert model corresponding to each type of task is obtained based on the labeled sample code training, including: Initialize the dataset for training; Execute a loop process until a preset condition is met, wherein the loop process includes: selecting an untrained data from the data set as sample data, determining the LoRA expert model to be called according to the task type marked in the sample data, and fine-tuning the selected LoRA expert model according to the sample data with a mix-review strategy. After the selected LoRA expert model is fitted, the current sample data is stored in the cache; the preset condition includes: all data in the data are trained.

3. The task processing method based on the hybrid expert model according to claim 1, characterized in that: For each type of task, after obtaining the LoRA expert model corresponding to each type of task based on the annotated sample code training, it also includes: Freeze the weights of the large language model and all LoRA expert models, use the cross entropy of the multi-classification task as the loss function, and train the expert scheduler.

4. The task processing method based on the hybrid expert model according to claim 1, characterized in that: The task code is obtained by combining multiple LoRA expert models for reasoning, including: Building a joint reasoning network based on the multiple LoRA expert models and the large language model; inputting the current self-programming task into the joint reasoning network, and outputting a preliminary processing result through the large language model; Different LoRA expert models are switched by an expert scheduler, and the preliminary processing results are offset by the LoRA expert model to obtain output results of different LoRA expert models, and all output results are integrated to obtain the task code of the self-programming task.

5. The task processing method based on the hybrid expert model according to claim 4, characterized in that: The joint reasoning network includes several layers of converter modules, each of which includes a stacked connected attention layer and a feedforward neural network layer.

6. The task processing method based on hybrid expert model according to claim 1, characterized in that: The expert scheduler is provided with two linear layers, a ReLU activation function is used between the two linear layers, and a softmax activation function is added after the linear layer for output; the ReLU activation function is used to introduce nonlinearity, and the softmax activation function is used to convert the output of the linear layer into a probability distribution.

7. A task processing device based on a hybrid expert model, characterized in that: include: The task type classification module is used to classify the self-programming tasks into five types of tasks, including function name and syntax prediction tasks, variable name prediction tasks, string parameter prediction tasks, base model prediction tasks and writing style prediction tasks; The expert model training module is used to train the LoRA expert model corresponding to each type of task based on the annotated sample code; The task reasoning module is used to obtain the task code by combining multiple LoRA expert models based on the trained expert scheduler and the task type of the current self-programming task.

8. The task processing device based on the hybrid expert model according to claim 7, characterized in that: The expert model training module is also used for: Initialize the dataset for training; Execute a loop process until a preset condition is met, wherein the loop process includes: selecting an untrained data from the data set as sample data, determining the LoRA expert model to be called according to the task type marked in the sample data, and fine-tuning the selected LoRA expert model according to the sample data with a mix-review strategy. After the selected LoRA expert model is fitted, the current sample data is stored in the cache; the preset condition includes: all data in the data are trained.

9. A terminal device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, the task processing method based on the hybrid expert model as described in any one of claims 1 to 6 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program; wherein, when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the task processing method based on the hybrid expert model according to any one of claims 1 to 6.

Citation Information

Cited By

  • Training method and device of multi-task code representation model based on hybrid experts

    CN121212269A