Multi-agent model training method and electronic device
By acquiring text data, determining the target collaborative gain and result type during multi-agent model training, and optimizing model parameters, the problem of limited collaborative ability in multi-agent collaborative systems is solved, and continuous improvement of system performance is achieved.
Patent Information
- Application Number
- CN202611712554.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-11-02
- Publication Date
- 2026-11-27
AI Technical Summary
Most existing multi-agent cooperative systems are built on pre-trained large models with frozen parameters. Their cooperative capabilities are limited by the inherent capabilities of the underlying models. The models cannot adapt to each other through training, resulting in low communication efficiency, redundancy, and error propagation, making it difficult to further improve system performance.
By acquiring text data and inputting it into multiple sub-models, the target collaborative gain and result type corresponding to each output result are determined. The target weight is determined based on the result type, the model parameters of each sub-model are obtained, and all model parameters are optimized based on the target optimization function until the preset training completion conditions are met, thus realizing the training of a multi-agent model.
Explicitly optimizing the incremental value brought by collaboration, distinguishing between true and false collaboration, balancing individual stability and collaborative exploration, breaks through the ceiling limitations of cue engineering, and enables the system performance to be continuously improved through training.
Smart Images

Figure CN123180280A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of communication processing, and more particularly to a multi-agent model training method and electronic device. Background Technology
[0002] With the widespread application of multi-agent systems in complex tasks, how to enable multiple models to truly work together has become a key issue.
[0003] Most current mainstream multi-agent collaborative systems are built on large pre-trained models with frozen parameters, using cue engineering to achieve role-playing, message passing, and task decomposition. While these solutions offer flexible deployment and require no training, they suffer from fundamental drawbacks. For example, collaborative capabilities are limited by the inherent limitations of the underlying model, and models cannot be trained to adapt to each other. Communication efficiency is low, and redundancy and error propagation are easily generated. Once system performance reaches the ceiling of cue engineering, further improvements become difficult. Summary of the Invention
[0004] In view of this, the purpose of this disclosure is to propose a multi-agent model training method and electronic device to solve or partially solve the above problems.
[0005] To achieve the above objectives, the first aspect of this disclosure provides a method for training a multi-agent model, wherein the multi-agent model includes multiple sub-models, including:
[0006] The text data is acquired and input into multiple sub-models. Each sub-model processes the text data to obtain multiple sets of outputs. Each set of outputs includes multiple output results, including independent outputs corresponding to each sub-model and combined outputs between multiple sub-models.
[0007] Determine the target cooperative gain for each output result and the result type for each output result, and determine the target weight for each output result based on the result type;
[0008] Obtain the model parameters corresponding to each sub-model, and determine the objective optimization function corresponding to the multi-agent model based on all model parameters, all objective weights, and all objective cooperative gains.
[0009] The parameters of all models are optimized based on the objective optimization function until the preset training completion conditions are met, resulting in a trained multi-agent model.
[0010] Based on the same inventive concept, a second aspect of this disclosure proposes a multi-agent model training device, comprising:
[0011] The data acquisition module is configured to acquire text data, input the text data into multiple sub-models, process the data through each of the multiple sub-models, and obtain multiple sets of outputs. Each set of outputs includes multiple output results, including independent outputs corresponding to each sub-model and combined outputs between multiple sub-models.
[0012] The weight determination module is configured to determine the target cooperative gain corresponding to each output result and the result type of each output result, and determine the target weight corresponding to each output result based on the result type.
[0013] The optimization function determination module is configured to obtain the model parameters corresponding to each sub-model, and determine the objective optimization function corresponding to the multi-agent model based on all model parameters, all objective weights, and all objective cooperative gains.
[0014] The model training module is configured to optimize all model parameters based on the objective optimization function until the preset training completion conditions are met, thereby obtaining a trained multi-agent model.
[0015] Based on the same inventive concept, a third aspect of this disclosure proposes an electronic device including a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the method described above when executing the computer program.
[0016] Based on the same inventive concept, a fourth aspect of this disclosure provides a non-transitory computer-readable storage medium that stores computer instructions for causing a computer to perform the methods described above.
[0017] As can be seen from the above, this disclosure proposes a multi-agent model training method and electronic device. The method involves acquiring text data, inputting the text data into multiple sub-models, and processing the data through each sub-model to obtain multiple sets of outputs. Each set of outputs includes multiple output results, including independent outputs corresponding to each sub-model and combined outputs from multiple sub-models. The method determines the target collaborative gain and result type for each output result, and determines the target weight for each output result based on the result type. By determining the target collaborative gain, the incremental value brought by collaboration itself is explicitly optimized, fundamentally distinguishing between true and false collaboration. The method acquires the model parameters corresponding to each sub-model, and determines the target optimization function for the multi-agent model based on all model parameters, all target weights, and all target collaborative gains. The method optimizes all model parameters based on the target optimization function until a preset training completion condition is met, resulting in a trained multi-agent model. The method sets corresponding target weights based on the result type of each output result to simultaneously achieve individual stability and collaborative exploration during the same training process. Meanwhile, when determining the objective optimization function, the model parameters of all sub-models are included in the joint optimization objective. Sub-models are no longer regarded as frozen components. As a result, multiple sub-models adapt to each other and evolve together at the training level, so that the upper limit of system performance is no longer locked by the ceiling of the prompting project, but can be continuously improved through training. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in this disclosure or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart of a multi-agent model training method according to an embodiment of the present disclosure;
[0020] Figure 2 This is a schematic diagram of the structure of a multi-agent model training device according to an embodiment of the present disclosure;
[0021] Figure 3 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of this disclosure clearer, the following detailed description is provided in conjunction with specific embodiments and the accompanying drawings.
[0023] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this disclosure should have the ordinary meaning understood by one of ordinary skill in the art to which this disclosure pertains. The terms "first," "second," and similar terms used in the embodiments of this disclosure do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0024] With the widespread application of multi-agent systems in complex tasks, how to enable multiple models to truly work together has become a key issue.
[0025] Most current mainstream multi-agent collaborative systems are built on large pre-trained models with frozen parameters, using cue engineering to achieve role-playing, message passing, and task decomposition. While these solutions offer flexible deployment and require no training, they suffer from fundamental drawbacks. For example, collaborative capabilities are limited by the inherent limitations of the underlying model, and models cannot be trained to adapt to each other. Communication efficiency is low, and redundancy and error propagation are easily generated. Once system performance reaches the ceiling of cue engineering, further improvements become difficult.
[0026] To overcome the limitations imposed by fixed models, current research has begun exploring multi-agent fine-tuning, primarily focusing on multi-role fine-tuning, reinforcement learning integration, communication protocol learning, and task-specific optimization. However, most of these works still aim to optimize the independent rewards of each agent or the final task success rate. Optimizing independent rewards or the final reward does not guarantee that the model learns true collaboration. That is, the models may still perform the task independently or produce a large amount of redundant and repetitive output, and their collaboration is merely a formal juxtaposition. Therefore, the lack of a mechanism that can explicitly measure and reward the incremental value brought by collaboration itself is a core gap in current multi-agent training.
[0027] Furthermore, in reinforcement learning-based model fine-tuning, KL divergence constraints are typically introduced to prevent the model from deviating excessively from the reference model and causing capability collapse. However, in multi-agent collaborative training scenarios, a uniform KL constraint presents a dilemma: if the KL weights are too large, the model is firmly bound to the vicinity of the reference model, making it difficult to explore new collaborative behaviors, and collaborative gains cannot be generated. If the KL weights are too small, the independent basic capabilities of each model are prone to degradation and instability. Existing methods lack a regularization design that can simultaneously satisfy the conflicting needs of individual stability and collaborative exploration.
[0028] At the same time, the industry's demand for trainable and evolvable multi-agent collaborative capabilities is becoming increasingly urgent. As multi-agent systems are rapidly deployed in high-value scenarios such as complex software engineering, scientific research collaboration, and automated decision-making, enabling multiple models to truly learn to collaborate through training, rather than simply relying on prompts for assembly, directly relates to the system's performance ceiling and cost efficiency.
[0029] To solve or partially solve the above-mentioned technical problems, this disclosure proposes a multi-agent model training method. The multi-agent model includes multiple sub-models. When determining the objective optimization function, the model parameters of all sub-models are included in the joint optimization objective. Sub-models are no longer regarded as frozen components. As a result, multiple sub-models can adapt to each other and co-evolve at the training level, so that the upper limit of system performance is no longer locked by the ceiling of the prompt engineering, but can be continuously improved through training.
[0030] Based on the above description, this embodiment proposes a multi-agent model training method, such as... Figure 1 As shown, the multi-agent model includes multiple sub-models, and the method specifically includes:
[0031] Step 101: Obtain text data and input the text data into multiple sub-models. Each sub-model processes the text data to obtain multiple sets of outputs. Each set of outputs includes multiple output results, including independent outputs corresponding to each sub-model and combined outputs between multiple sub-models.
[0032] In practice, text data is acquired, serving as the input task to provide a unified task object for the multi-agent model. This multi-agent model comprises multiple sub-models. Only after the input task is determined can the same task be input into multiple sub-models, and the independent and combined outputs of each sub-model on that task be observed.
[0033] After acquiring the text data, the text data is input into multiple sub-models. Each of the multiple sub-models processes the data to obtain multiple sets of outputs. Each set of outputs includes multiple output results, including independent outputs corresponding to each sub-model and combined outputs between the multiple sub-models.
[0034] Specifically, the same text data is input into each sub-model separately, and each sub-model outputs multiple results for that input task, i.e., independent outputs. Multiple sub-models collaborate to obtain a collaborative result, i.e., a combined output.
[0035] In other words, each sub-model processes the input task independently and produces an independent output. All sub-models then collaborate to process the input task and produce a combined output. Only by simultaneously obtaining both the independent and combined outputs can the differences between working independently and collaboratively be compared, thereby determining the target collaborative gain.
[0036] In this embodiment, reinforcement learning fine-tuning is used when training the multi-agent model. Specifically, GRPO (Group Relative Policy Optimization) is employed. GRPO is a method commonly used for fine-tuning large-scale reinforcement learning models. Unlike traditional PPO (Proximal Policy Optimization), GRPO does not require an additional value network; instead, it estimates advantage through relative comparisons of samples within a group. GRPO uses a group sampling pattern, meaning that for the same problem, the model generates multiple different answer outputs.
[0037] Specifically, if the GRPO algorithm has G rounds, then there are a total of G output results. Each output result includes the independent output of each sub-model in that round and the collaborative combined output of all sub-models in that round. In other words, each round of sampling will produce two types of results: the independent output of each sub-model and the combined output generated by the collaboration of all sub-models.
[0038] In this embodiment, without independent output, it's impossible to know the performance level of a single model working alone. Without combined output, it's impossible to know the performance level achieved by multiple models collaborating. Both are necessary to measure whether collaboration brings a net incremental improvement.
[0039] Step 102: Determine the target cooperative gain for each output result and the result type for each output result, and determine the target weight for each output result based on the result type.
[0040] In practice, the target cooperative gain for each output result is determined. The target cooperative gain is a signal used to measure the net increase in cooperation. That is, the target cooperative gain directly measures the net increase brought by cooperation relative to independent work, and is therefore the core signal for explicit optimization of cooperation.
[0041] In this embodiment, if only the independent output or the final task reward is optimized, the models may complete the task independently or produce redundant splicing, failing to guarantee the value of the collaboration itself. By determining the target collaboration gain corresponding to each output result, the question of whether collaboration brings incremental value is transformed into an optimizable signal, thereby distinguishing between true and false collaboration from a mechanistic perspective.
[0042] Determine the outcome type of each output, that is, whether each output is an independent output or a combined output. Independent outputs correspond to the capabilities of a single sub-model, while combined outputs correspond to the performance of multiple sub-models working together. Without distinguishing the outcome types, it is impossible to differentiate the target weights, and thus impossible to simultaneously consider individual stability and collaborative exploration.
[0043] After determining the result type, a target weight is determined for each output result based on the result type. This target weight is the KL weight corresponding to KL regularization. If the same weight is used for independent and combined outputs, an excessively large KL weight restricts collaborative exploration, while an excessively small KL weight degrades individual capabilities. Therefore, it is impossible to differentiate between maintaining stable individual capabilities and releasing collaborative exploration.
[0044] In this embodiment, different target weights, i.e., different KL weights, are set for independent outputs and combined outputs. Independent outputs correspond to one type of weight, while combined outputs correspond to another. This ensures that different outputs are subject to varying degrees of constraint in the subsequent objective optimization function, thus balancing individual stability and collaborative exploration within the same training framework.
[0045] Step 103: Obtain the model parameters corresponding to each sub-model, and determine the objective optimization function corresponding to the multi-agent model based on all model parameters, all objective weights, and all objective cooperative gains.
[0046] In practice, the model parameters corresponding to each sub-model are obtained, and then the objective optimization function corresponding to the multi-agent model is determined based on all model parameters, all objective weights, and all objective cooperative gains.
[0047] In this embodiment, the objective optimization function is expressed by the formula:
[0048]
[0049] in, Let m be the objective function. m is the model index, where m = 1, ..., M. These are all model parameters, i.e., the variables to be optimized. The weights of the m-th model sub-objective satisfy... =1, Among them, when all models are equally important, take It can also assign greater weight to models that are weaker or more critical.
[0050] Furthermore, for each sub-model m, its sub-objective is:
[0051] ,in, For strategy update items, This is a KL regularization term. Specifically, 'Expectation' represents the expectation for the input task and the sampling process. The average within a group is represented by G samples. For the same input task, GRPO sampling generates a group of G samples. That is, the average of the G samples of each model is taken to obtain the average sub-objective of the model in this round of sampling. For importance sampling ratio, specifically, ,in, Let m be the current strategy for the m-th model. This refers to the old strategy used by the m-th model in this round of sampling, i.e., the strategy that is frozen at the sampling time. This is the i-th output generated by the m-th model for the input task q. q is the input task, i.e., text data.
[0052] Cut the ratio at [ Within the interval, The pruning magnitude hyperparameter for GRPO-style truncation is a small positive number, such as 0.1-0.3. This mechanism ensures that the policy will not collapse due to excessively large single-step updates and is a stable training method inherited by GRPO from PPO. The smaller value before and after truncation is taken, and the two together limit the single-step update range and prevent policy mutation.
[0053] The cooperative advantage is the target cooperative gain. This is for differentiated KL weights, i.e., target weights. Let KL divergence be the KL divergence. The reference strategy for the m-th model is usually the initial model before fine-tuning or the SFT model, which is kept frozen during training and serves as the anchor point for KL regularization. KL divergence measures the degree of deviation of the current policy from the reference policy.
[0054] In this embodiment, and After multiplication, the objective function is added, representing the penalty for deviating from the reference policy. Since the objective function is to maximize, the negative sign indicates a penalty for deviation. The larger the value, the stronger the penalty, and the more the model is pulled back to the reference policy. The smaller the value, or even if it is negative, the weaker the punishment, or it may even encourage deviation.
[0055] Step 104: Optimize all model parameters based on the objective optimization function until the preset training completion conditions are met, and obtain the trained multi-agent model.
[0056] In practice, all model parameters are optimized based on the objective optimization function, which is the joint objective. This means that the model parameters of all sub-models in the multi-agent system are updated based on the joint objective. In other words, the optimization object is all model parameters, and the optimization is based on the objective optimization function, which includes the cooperation advantage and KL weights.
[0057] In this embodiment, the objective optimization function includes the objective cooperative gain. This allows the net incremental benefit of collaboration to be injected into the optimization signal, causing the model update direction to favor strategies that promote effective collaboration. This is because the objective optimization function includes objective weights. It is used to impose constraints of varying strengths on independent and combined outputs, thereby balancing individual stability with collaborative exploration.
[0058] Specifically, the sub-model parameter set is adjusted through stochastic gradient ascent. Joint optimization is performed, meaning the parameters are increased along the gradient direction instead of decreased. Furthermore, the optimization involves not a single model, nor a fixed subset of models, but all trainable parameters of M sub-models. In this case, the parameters of each sub-model... All of them will be updated.
[0059] Specifically, the parameter update process can be expressed by the following formula:
[0060]
[0061] in, Let m be the model parameters of the m-th sub-model. This indicates a parameter update operation. This represents the learning rate, used to control the step size for each update. For the common goal For the m-th model parameter The gradient.
[0062] In this embodiment, the parameter update direction for each model is determined by... Decision, and The target cooperative gain has already been included. and target weight This includes collaborative advantages and differentiated KL weights. Collaborative advantages influence the model update direction through gradients, reinforcing behaviors that promote collaboration. Differentiated KL weights influence the constraint strength through gradients, subjecting independent outputs and combined outputs to different constraints.
[0063] In this embodiment, updates can be performed synchronously or alternately. Specifically, synchronous updates mean that all M models update together in the same step based on shared collaborative rewards; that is, all sub-models calculate gradients and update parameters simultaneously. Since the collaborative rewards are shared, all M models receive the same collaborative signal in the same training round and adjust their respective parameters accordingly.
[0064] The alternating approach means keeping the rest of the models fixed and updating a single model in turn. That is, only one sub-model is updated at a time. The remaining model parameters remain unchanged. Update each model sequentially in turn until all models have been updated.
[0065] In this embodiment, the alternating method reduces memory usage because it does not require simultaneous calculation of gradients for all models. Furthermore, it processes parameter updates for only one model at a time, reducing resource pressure and making it more suitable for large model scenarios. Therefore, in this embodiment, the alternating method is preferred for updating and optimizing sub-model parameters.
[0066] The parameters of all models are optimized based on the objective optimization function until the preset training completion conditions are met, resulting in a trained multi-agent model. That is, the optimization is not performed only once, but rather iteratively until the preset training completion conditions are met. Once these conditions are met, the trained multi-agent model is obtained.
[0067] The above scheme involves acquiring text data and inputting it into multiple sub-models. Each sub-model processes the data to generate multiple sets of outputs, each set including multiple output results. These output results include independent outputs from each sub-model and combined outputs from multiple sub-models. The target collaborative gain and result type for each output result are determined, and the target weight for each output result is determined based on its result type. By determining the target collaborative gain, the incremental value brought by collaboration itself is explicitly optimized, fundamentally distinguishing between true and false collaboration. The model parameters for each sub-model are acquired, and the target optimization function for the multi-agent model is determined based on all model parameters, all target weights, and all target collaborative gains. All model parameters are optimized based on the target optimization function until the preset training completion conditions are met, resulting in a trained multi-agent model. Target weights are set differently based on the result type of each output result to simultaneously achieve individual stability and collaborative exploration during the same training process. Meanwhile, when determining the objective optimization function, the model parameters of all sub-models are included in the joint optimization objective. Sub-models are no longer regarded as frozen components. As a result, multiple sub-models adapt to each other and evolve together at the training level, so that the upper limit of system performance is no longer locked by the ceiling of the prompting project, but can be continuously improved through training.
[0068] In some embodiments, for each output result, determining the target cooperative gain corresponding to each output result in step 102 specifically includes:
[0069] Step 1021: For each sub-model, determine the first independent advantage value corresponding to each independent output in the sub-model;
[0070] Step 1022: For each combination output, determine the first combination advantage value corresponding to each combination output;
[0071] Step 1023: Determine the target cooperative gain corresponding to the output result based on the first independent advantage value and the first combined advantage value.
[0072] In practice, the multi-agent model comprises M sub-models. For each sub-model, under the same input task, multiple rounds of sampling will produce multiple independent outputs. Each independent output has its own evaluation result; that is, for each sub-model, a first independent advantage value is determined for each independent output in that sub-model.
[0073] In this embodiment, the first independent advantage value represents the relative ability of a sub-model to work independently. That is, whether the independent output is relatively better or worse than the sub-model's output within its group, i.e., where it stands relative to the group's average level. This signal needs to be retained when determining the target collaborative gain to prevent the model from losing its ability to independently complete sub-tasks while pursuing collaboration. In other words, the first independent advantage value is an important basis for balancing individual basic capabilities.
[0074] For each combined output, determine the first combined advantage value corresponding to each combined output. Note that the combined output is not the output of a single sub-model, but rather the output jointly generated by multiple sub-models under a given collaborative approach. Each round of sampling corresponds to one combined output, and multiple rounds of sampling result in multiple combined outputs.
[0075] Specifically, multiple combined outputs are compared within the same group. The purpose of the comparison is not to look at the absolute score of a particular combined output, but to see how it performs relative to other combined outputs in the same group. The first combined advantage value represents the overall effect of multi-model collaboration, reflecting whether the combined output produced by this multi-model collaboration is better or worse than other collaborative outputs in the same group, that is, its relative position within the combined output group.
[0076] In this embodiment, the first combined advantage value represents the overall effect of multi-model collaboration. It does not distinguish which specific sub-model contributed more, but rather reflects the relative quality of the collaboration result itself. Subsequent injection of this signal into the update direction of each sub-model can encourage each sub-model to learn behaviors that lead to higher overall collaborative performance. Therefore, the first combined advantage value is a key signal for explicitly optimizing the collaboration itself.
[0077] After determining the first independent advantage value and the first combined advantage value, the target cooperative gain corresponding to the output result is determined based on the first independent advantage value and the first combined advantage value. That is, for each sub-model and each independent output, there is a target cooperative gain value, which is simultaneously affected by the individual relative advantage of the sub-model and the combined relative advantage in the current round.
[0078] Through the above scheme, the first combined advantage value comes from the intra-group comparison of the outputs of multiple models, directly reflecting the overall collaborative effect. After incorporating it into the target collaborative gain, the update signal of each sub-model includes collaborative information. Thus, optimization no longer focuses solely on the independent performance of a single model, but explicitly focuses on the collaboration itself. Simultaneously, the first independent advantage value retains the individual basic capability signal, while the first combined advantage value introduces the collaborative benefit signal. The two are combined into the target collaborative gain, and the bias is adjusted through collaborative weights. This approach can pursue collaboration while avoiding the degradation of individual capabilities.
[0079] In some embodiments, step 1021, which involves determining the first independent dominance value corresponding to each independent output in each sub-model, specifically includes the following for each sub-model:
[0080] Step 10211: Obtain a preset reward function, and determine the independent reward value corresponding to each independent output based on the preset reward function;
[0081] Step 10212: Calculate all independent reward values and determine the first mean and first standard deviation corresponding to all independent reward values;
[0082] Step 10213: For each independent output, determine the first independent advantage value corresponding to the independent output based on the independent reward value, the first mean, and the first standard deviation.
[0083] In practice, a preset reward function is obtained, and an independent reward value corresponding to each independent output is determined based on the preset reward function. Specifically, the preset reward function is a unified evaluation function used to provide a scalar evaluation result for any output. The independent output is then fed into the preset reward function to obtain the evaluation result for that independent output.
[0084] For example, the preset reward function is For the m-th sub-model, its i-th independent output is Each independent output is evaluated using a preset reward function to obtain an independent reward value for each output, expressed by the formula: .
[0085] In other words, each sub-model and each independent output will receive an independent reward value. This reward value reflects the absolute performance of that independent output on the task.
[0086] For the m-th sub-model, after multiple rounds of sampling under the same input task, a set of independent outputs is obtained, which can be expressed by the formula: Then, a preset reward function is used to evaluate each independent output, resulting in a set of independent reward values, which can be expressed by the formula: .
[0087] Statistically calculate all independent reward values and determine the first mean and first standard deviation corresponding to all independent reward values. The first mean reflects the average independent performance level of the sub-model in this group of tasks. The first standard deviation reflects the volatility or dispersion of the sub-model's independent output performance in this group. The first mean is expressed by the formula: The first standard deviation is expressed by the formula: .
[0088] For each independent output, a first independent advantage value is determined based on the independent reward value, the first mean, and the first standard deviation. Specifically, for each independent output, the difference between its independent reward value and the first mean is calculated, and then normalized using the first standard deviation and a preset constant to obtain the first independent advantage value. The first independent advantage value is expressed by the formula:
[0089]
[0090] in, The first independent advantage value, To prevent extremely small positive numbers with a denominator of zero, a preset constant is used. In this embodiment, the denominator is divided by the first standard deviation plus... This is to perform normalization, eliminate the impact of differences in reward scale between different sub-models and different tasks, and make the advantage value more stable and comparable.
[0091] Specifically, if If the value is greater than the first mean, the numerator is positive, and the first independent advantage value is positive, indicating that the independent output is better than the average level of the sub-model in this group, and should be strengthened subsequently. If If the value is less than the first mean, the numerator is negative, and the first independent advantage value is negative, indicating that the independent output is worse than the average level of the sub-model in this group, and should be suppressed subsequently. If If the value is equal to the first mean, then the first independent advantage is zero, indicating that the independent output is at the average level of the group.
[0092] The above scheme involves independently comparing multiple independent outputs of each sub-model within a group to obtain the first independent advantage value for each output. The calculation of independent advantage values between sub-models is independent of each other. In this way, each sub-model obtains a relative advantage signal reflecting its independent working ability, while preventing the degradation of its basic capabilities when pursuing collaboration later.
[0093] In some embodiments, step 1022, determining a first combined advantage value corresponding to each combined output, specifically includes for each combined output:
[0094] Step 10221: Obtain a preset reward function, and determine the combined reward value corresponding to each combination output according to the preset reward function;
[0095] Step 10222: Calculate the total combination reward value and determine the second mean and second standard deviation of the total combination reward value;
[0096] Step 10223: For each combined output, determine the first combined advantage value corresponding to the combined output based on the combined reward value, the second mean, and the second standard deviation.
[0097] In practice, a preset reward function is obtained, and the combined reward value corresponding to each combined output is determined based on the preset reward function. Specifically, the preset reward function is a unified evaluation function used to provide a scalar evaluation result for any output. The combined output is fed into the preset reward function to obtain the evaluation result of the combined output.
[0098] After obtaining the preset reward function, the combined reward value corresponding to each combination output is determined according to the preset reward function.
[0099] For example, a set of combined outputs can be expressed using the formula as follows: Where G is the number of samples within a group, i.e., the number of sampling rounds. In each round, M sub-models generate a combined output according to a predetermined collaboration method. After G rounds of sampling, G combined outputs are obtained. For each combined output... The preset reward function is Use the preset reward function The evaluation is conducted to obtain the corresponding combined reward value. Therefore, the set of combined reward values corresponding to all combined outputs is obtained as follows: .
[0100] Calculate the reward values for all combinations and determine the second mean and second standard deviation for each combination. The second mean represents the average reward level of the G combinations in this group. The second standard deviation represents the dispersion, or fluctuation, of the reward output of the G combinations in this group.
[0101] In this embodiment, the first combination advantage value is not an absolute reward value, but a relative advantage value. To determine whether a combination's output is better or worse than the outputs of other combinations in the same group, it is necessary to first know the average level and volatility of the group's outputs. The second mean provides a benchmark for comparison, and the second standard deviation provides a normalization scale. The second mean is expressed using the formula: The second standard deviation is expressed by the formula: .
[0102] For each combined output, a first combined advantage value is determined based on its combined reward value, second mean, and second standard deviation. Specifically, for the i-th combined output, the difference between its combined reward value and the second mean is calculated, and then normalized using the second standard deviation and a preset constant to obtain the first combined advantage value. The first combined advantage value is expressed by the formula:
[0103]
[0104] in, The first combination advantage value, To prevent extremely small positive numbers with a denominator of zero, a preset constant is used. This calculation transforms the absolute reward value into a relative advantage value within the group, thus weakening the differences in reward scale between different tasks and rounds, allowing subsequent optimizations to utilize collaboration signals more stably.
[0105] Specifically, if the first combination's advantage value is greater than zero, it means that the reward output of this combination is higher than the average output of combinations within the group, indicating that this collaboration is relatively better and should be strengthened. If the first combination's advantage value is less than zero, it means that the reward output of this combination is lower than the average output of combinations within the group, indicating that this collaboration is relatively poor and should be suppressed. If the first combination's advantage value is equal to zero, it means that the reward output of this combination is equal to the average output of the group.
[0106] The above scheme, using the second mean and second standard deviation for within-group standardization, ensures that the first combined advantage value is not excessively affected by the absolute reward scale, facilitating stable use in subsequent training. The first combined advantage value, derived from the relative comparison of combined outputs within groups, directly reflects the quality of multi-model collaboration. This signal can then be used for subsequent optimization to explicitly improve the collaboration itself.
[0107] In some embodiments, the step 1023 of determining the target cooperative gain corresponding to the output result based on the first independent dominance value and the first combined dominance value specifically includes:
[0108] Step 10231, for each group of outputs:
[0109] Obtain a preset reward function, and determine the independent reward value corresponding to each independent output and the combined reward value corresponding to the combined output based on the preset reward function;
[0110] The first collaborative advantage value is determined based on all the individual reward values and the combined reward values.
[0111] Step 10232: Weight the first independent advantage value, the first combined advantage value, and the first cooperative advantage value to obtain the target cooperative gain corresponding to the output result.
[0112] In practice, for each set of outputs, a preset reward function is obtained. Based on this preset reward function, the independent reward value corresponding to each independent output and the combined reward value corresponding to the combined outputs are determined. The preset reward function is used to uniformly evaluate all outputs generated after text data input. It does not distinguish between independent and combined outputs, but rather provides a scalar evaluation result for the input and output results.
[0113] For example, the preset reward function is For each independent output of each sub-model, a pre-defined reward function is used to score it, resulting in an independent reward value. The combined output generated by the collaboration of all sub-models is scored using the same preset reward function to obtain the combined reward value. .
[0114] In this embodiment, each output group is one of the multiple rounds of sampling, and each group includes the independent output of each sub-model and the combined output generated by the collaboration of all sub-models. Therefore, each group will obtain multiple independent reward values and one combined reward value, wherein the multiple independent reward values correspond to the independent outputs of M sub-models, and the one combined reward value corresponds to the combined output of all sub-models.
[0115] Based on all the independent reward values and the combined reward values, a first collaborative advantage value is determined, wherein the first collaborative advantage value is the collaborative gain advantage, which reflects the net increment of the combined output generated by multi-model collaboration relative to the independent operation of each sub-model.
[0116] Specifically, if collaboration brings a high net incremental value, the first collaboration advantage value is positive or relatively high, which will subsequently strengthen this collaborative behavior. If collaboration does not bring a net incremental value, or even causes interference, the first collaboration advantage value is negative or relatively low, which will subsequently suppress this collaborative behavior. Therefore, the first collaboration advantage value does not come directly from whether the combined output itself is good or bad, but rather from whether collaboration brings additional value compared to working alone.
[0117] After determining the first cooperative advantage value, the first independent advantage value, the first combined advantage value, and the first cooperative advantage value are weighted to obtain the target cooperative gain corresponding to the output result. The target cooperative gain is expressed by the formula:
[0118]
[0119] in, For the target cooperative gain, The first cooperative advantage value, The first independent advantage value, This represents the advantage value of the first combination. For collaboration weights, . This is the balance coefficient within the collaborative item. By balancing individual capabilities and collaborative benefits through collaborative weights, and by balancing coefficients within collaborative items, the absolute quality of the combination and the net incremental value of collaboration are balanced.
[0120] Specifically, For individual terms, it represents the signal that preserves the ability of each sub-model to independently complete the sub-task. When The closer this value is to 0, the greater its weight, indicating a greater emphasis on the individual capabilities of each model in independently completing sub-tasks, and a stronger protection against degradation of fundamental capabilities. The closer it is to 1, the smaller the weight of this item, the weaker the individual ability signal, and the more the optimization focuses on collaboration.
[0121] Specifically, For collaboration items, this represents the benefits derived from collaboration. Among them, Indicates the absolute quality of the combined output. This indicates the net gain from collaboration. The larger the value, the more emphasis is placed on the quality of the combined output itself, that is, whether the combined output score is high or not. The smaller the value, the greater the emphasis on the net gain from collaboration, meaning the increment must come from collaboration, rather than a high score from the combined output itself. That is, when... When the size is small, the scheme penalizes pseudo-collaboration more strictly, meaning that although the combined output has a high score, the independent model can achieve a similar effect on its own, and collaboration does not bring real incremental results.
[0122] The above scheme introduces a first collaborative advantage value, explicitly rewarding the incremental gains that can only be achieved through collaboration. This more strictly distinguishes between genuine and pseudo-collaboration and prevents individual ability degradation. Furthermore, since all three types of advantage values are based on intra-group relative comparisons or derived from reward values, they possess relativistic and standardized characteristics, which helps reduce the impact of differences in reward scales across different tasks and rounds, making training more stable.
[0123] In some embodiments, determining the first collaborative advantage value based on all the independent reward values and the combined reward value in step 10231 specifically includes:
[0124] Step 201: For each output group, determine the first collaborative gain value based on all independent reward values and the combined reward value;
[0125] Step 202: Calculate all first cooperative gain values and determine the third mean and third standard deviation corresponding to all first cooperative gain values;
[0126] Step 203: For each output group, determine the first cooperative advantage value based on the first cooperative gain value, the third mean, and the third standard deviation.
[0127] In practice, for each set of outputs, a first collaboration gain value is determined based on all independent reward values and the combined reward value, whereby the first collaboration gain value represents the net increment brought about by collaboration. That is, the net increment brought about by collaboration is obtained by comparing the combined output generated by multi-model collaboration with the reward performance of each sub-model working independently.
[0128] Specifically, if the combined reward value is higher than the overall level of the independent reward values, it indicates that collaboration has brought a positive gain. If the combined reward value is not higher than the overall level of the independent reward values, it indicates that collaboration has not brought a net increase and may even have caused interference.
[0129] Statistically analyze all first cooperative gain values and determine the third mean and third standard deviation corresponding to all first cooperative gain values. The third mean represents the average level of the G first cooperative gain values in this group, and the third standard deviation represents the dispersion of the G first cooperative gain values in this group. In other words, the third mean indicates the general level of the cooperative gain in this group, and the third standard deviation indicates the degree of fluctuation of the cooperative gain in this group.
[0130] For example, the set of first cooperative gain values corresponding to all G group outputs under the same input task is expressed by the formula: Statistical calculations were performed on the first set of cooperative gain values to obtain the third mean value. The third standard deviation is .
[0131] For each output group, a first cooperative advantage value is determined based on the first cooperative gain value, the third mean, and the third standard deviation. Specifically, within-group standardization is performed by subtracting the third mean from the first cooperative gain value of the i-th cooperative session to obtain the deviation of that cooperative session from the group's average level. This deviation is then divided by the third standard deviation plus a preset constant to obtain the degree of deviation relative to standardization, which is the first cooperative advantage value. The first cooperative advantage value is expressed by the formula:
[0132]
[0133] in, The first cooperative advantage value, To prevent extremely small positive numbers with a denominator of zero, a preset constant is used. Specifically, the first cooperative advantage value represents the net gain brought by the i-th cooperation, and its prominence relative to the net gains of other cooperations in the same group.
[0134] Specifically, if the first cooperative advantage value is greater than zero, it indicates that the net gain of this cooperative effort is higher than the group average, meaning that this cooperative effort has brought a more significant net increase compared to other cooperative efforts and should be strengthened. If the first cooperative advantage value is less than zero, it indicates that the net gain of this cooperative effort is lower than the group average, meaning that this cooperative effort has not brought sufficient net increase compared to other cooperative efforts, or is even poor, and should be suppressed. If the first cooperative advantage value is equal to zero, it indicates that the net gain of this cooperative effort is equal to the group average.
[0135] Therefore, the first collaborative advantage value is not determined by the absolute value of the collaborative gain, but by whether it is prominent within the group. This helps to reduce the impact of differences in reward scales between different tasks and rounds.
[0136] The above scheme uses a first collaboration gain value derived from a comparison of the independent reward value and the combined reward value, while the first collaboration advantage value further standardizes the collaboration gain. In this way, the optimization signal directly includes information on whether collaboration brings a net increment, rather than solely considering the final task reward or the independent reward.
[0137] In some embodiments, determining the first collaborative gain value based on all independent reward values and the combined reward value in step 201 specifically includes:
[0138] Step 2011: Average all independent reward values to obtain the fourth average;
[0139] Step 2012: Subtract the combined reward value and the fourth mean value to obtain the first collaborative gain value.
[0140] In practice, for each output group, the independent reward values of all M sub-models in that group are taken. The average of all independent reward values is then calculated to obtain a fourth average. The difference between the combined reward value and the fourth average is then calculated to obtain a first collaboration gain value. That is, the combined output reward generated by multi-model collaboration is subtracted from the average reward of each sub-model working independently, thus obtaining the net value additionally brought by collaboration relative to their individual independent work.
[0141] For example, the first cooperative gain value is expressed by the formula:
[0142]
[0143] in, Let M be the first collaborative gain value of the i-th group output, and M be the number of models participating in collaborative training, i.e., the number of models included in the multi-agent system. Let be the independent reward value of the m-th model in the i-th group output. This is the combined reward value for the i-th group's output.
[0144] Specifically, if the first collaboration gain is greater than zero, the combined reward value is higher than the average of the independent reward values, indicating that the collaboration result is worse than the average level of each model working independently. If the first collaboration gain is less than zero, the combined reward value is lower than the average of the independent reward values, indicating that the collaboration result is worse than the average level of each model working independently, and the collaboration has a negative effect. If the first collaboration gain is equal to zero, the combined reward value is equal to the average of the independent reward values, indicating that the collaboration does not bring any additional net value.
[0145] The above approach directly subtracts the average of the individual reward values from the combined reward value to obtain the net incremental value of collaboration. A larger value indicates greater additional value from collaboration. Subsequent optimizations will reinforce this collaborative behavior. Thus, the optimization signal no longer only considers whether the task is completed or how a single model performs, but explicitly includes whether collaboration is better than working alone, thereby explicitly optimizing collaboration itself.
[0146] In some embodiments, determining the first collaborative gain value based on all independent reward values and the combined reward value in step 201 specifically includes:
[0147] Step 201A: Traverse all independent reward values and take the maximum value among all independent reward values as the target independent reward value;
[0148] Step 201B: Subtract the combined reward value and the target independent reward value to obtain the first cooperative gain value.
[0149] In practice, all independent reward values are iterated through, and the maximum value among all independent reward values is taken as the target independent reward value. That is, we look at the independent reward values of each of the M sub-models in the output of this group, find the maximum value among them as the target independent reward value, which represents the reward level that the strongest single model can achieve when working alone.
[0150] After obtaining the target independent reward value, the difference between the combined reward value and the target independent reward value is calculated to obtain the first cooperative gain value. The first cooperative gain value is expressed by the formula:
[0151]
[0152] in, Let be the first collaborative gain value of the i-th group's output, and M be the number of models participating in collaborative training. The target is an independent reward value.
[0153] Specifically, if the first collaboration gain is greater than zero, the combined reward is greater than the independent reward of the strongest single model, meaning the collaboration result is better than the strongest single model working alone. This indicates that the collaboration truly brings a net increment exceeding the strongest individual model, classifying it as true collaboration. If the first collaboration gain is less than zero, the combined reward is less than the independent reward of the strongest single model, meaning the collaboration result is worse than the strongest single model working alone. This suggests that the collaboration may produce interference, redundancy, or free-riding, classifying it as negative or pseudo-collaboration. If the first collaboration gain is equal to zero, the combined reward is equal to the independent reward of the strongest single model, meaning the collaboration result is on par with the strongest single model working alone, and the collaboration does not bring any additional net increment.
[0154] The above scheme sets the benchmark as the strongest single model, allowing the collaboration gain to directly reflect whether the collaboration surpasses the strongest individual. Only when it truly delivers a net increment exceeding the strongest single model will a positive first collaboration gain value be obtained. This makes the optimization signal more clearly point to the collaboration itself.
[0155] In some embodiments, the specific preset training completion condition is that the first collaborative gain value converges to a positive value and the independent reward value of each sub-model does not degrade. Specifically:
[0156] The first collaboration gain value is the core indicator for measuring the net incremental value of collaboration. If the first collaboration gain value is positive, that is, greater than zero, it means that the combined output reward is higher than the average level of the individual output of each model. This indicates that collaboration has generated a net incremental value that exceeds the average level of individuals, which is true collaboration.
[0157] Furthermore, if the first collaborative gain value converges to positive, it indicates that the first collaborative gain value no longer fluctuates drastically in the later stages of training, and that the collaborative gain is sustainable rather than appearing by chance. Therefore, the training objective at this point directly targets true collaboration, rather than a formal juxtaposition, ensuring that the collaboration has real value upon completion of training.
[0158] The independent reward values of each sub-model do not degrade, meaning that the independent reward values of each sub-model after training have not decreased compared to before training, or compared to a certain benchmark, and remain at a reasonable level. In other words, each sub-model still possesses the basic ability to independently complete sub-tasks after training, preventing the collapse of individual capabilities due to collaborative training.
[0159] In this embodiment, if only the first collaboration gain value converges to a positive value, but the independent reward value of each sub-model degrades, it means that the model sacrifices its individual basic capabilities in exchange for collaboration. The degradation of individual capabilities will lead to an unstable foundation for collaboration, making collaboration unsustainable. In the long run, the model may not be able to complete the sub-task independently, and the quality of collaboration will also decline.
[0160] In this embodiment, if only the independent reward values of each sub-model do not degenerate, but the first collaborative gain value does not converge to positive, it indicates that the model has not learned true collaboration. Each model may simply be working independently, with the collaborative gain being zero or negative. Consequently, the training has not achieved the purpose of the invention, i.e., trainable collaborative intelligence has not been realized.
[0161] By setting the preset training completion conditions as the first collaborative gain value converges to positive and the independent reward value of each sub-model does not degenerate, the collaboration generates a net increment exceeding the average level of individuals, and the independent basic capabilities of each model do not degenerate. Thus, the trained multi-agent model has both collaborative capabilities and retains individual capabilities.
[0162] In some embodiments, determining the target weight corresponding to each output result based on the result type in step 102 specifically includes:
[0163] Step 102A: In response to the result type being independent, determine the target weight corresponding to the output result as the first weight; or,
[0164] Step 102B: In response to the result type being a combination type, determine the target weight corresponding to the output result as a second weight, wherein the second weight is less than the first weight.
[0165] In practice, if the result type is determined to be independent (i.e., the output is an independent output of a single model), the target weight corresponding to that output is determined as the first weight. If the result type is determined to be combined (i.e., the output is a combined output of multiple models), the target weight corresponding to that output is determined as the second weight. The second weight is less than the first weight.
[0166] Specifically, if the output is independent, the target weight is determined to be the larger first weight, and then the gradient of the KL term with respect to the parameters is calculated. It always points in the direction of pulling back the reference model. Due to the first weight... With a relatively large pull force, the individual behavior is firmly stabilized near the reference model, achieving the goal of individual stability.
[0167] If the output is a combined output, then the target weight is determined to be the smaller second weight, because the second weight... With a smaller size and weaker pull, the model can freely explore collaborative paradigms that the reference model itself does not possess in collaborative scenarios. If If the gradient is less than zero, the gradient is reversed, actively pushing the combined behavior away from the reference model, maximizing the release of collaborative increments, and achieving the goal of collaborative exploration.
[0168] The above scheme determines the corresponding target weights based on the result type and utilizes the difference in the strength of gradient pull force to achieve the dual effect of independently outputting strictly anchored reference models to ensure stability and combining outputs with weak constraints or reverse push to promote exploration during training. This systematically solves the core contradiction in existing schemes where unified KL regularization cannot balance stability and exploration.
[0169] Based on the same inventive concept, another embodiment of this disclosure provides a multi-agent model training method applied to the field of traditional Chinese medicine. The multi-agent model includes model A, model B, and model C. Model A is a TCM syndrome differentiation model, responsible for determining the patient's syndrome and pathogenesis. Model B is a TCM prescription model, responsible for generating candidate treatments and prescriptions. Model C is a TCM safety review model, responsible for checking risks such as drug dosage, contraindications, allergies, and the patient's physical condition.
[0170] The task is to obtain text data, specifically the patient's medical record text, which reads: "Patient, male, 52 years old, has had recurrent epigastric bloating and pain for half a year, which worsens after meals, accompanied by belching, loss of appetite, loose stools, pale tongue with a white and greasy coating, and a slow and weak pulse. He has a history of mild liver dysfunction and is allergic to aconite."
[0171] During training, each model was first allowed to process the case independently, specifically:
[0172] Model A's independent output is "The patient may have spleen and stomach deficiency and internal dampness obstruction; the treatment principle is to strengthen the spleen and replenish qi, harmonize the stomach and resolve dampness." Model B's independent output is "It is recommended to use Xiangsha Liujunzi Decoction with modifications; candidate drugs include Codonopsis pilosula, Atractylodes macrocephala, Poria cocos, Glycyrrhiza uralensis (processed), Citrus reticulata peel, Pinellia ternata, Aucklandia lappa, Amomum villosum, etc." Model C's independent output is "The patient is allergic to Aconitum carmichaelii and should avoid using formulas containing Aconitum carmichaelii; at the same time, there is mild liver dysfunction, and drugs and dosages that may increase the burden on the liver should be controlled."
[0173] Subsequently, the system transmits the diagnostic results of Model A to Model B, helping Model B generate more targeted candidate prescriptions. The candidate prescriptions are then passed to Model C for safety review. After identifying risks, Model C provides feedback to Model B, which then modifies the prescriptions accordingly.
[0174] For example, Model A first outputs "Spleen and Stomach Damp-Heat Syndrome" and its diagnostic basis based on the patient's symptoms. Model B reads the patient information and the diagnostic results from Model A to generate candidate prescriptions. Model C reads the aforementioned results, checks for allergies, dosage, processing methods, and liver function risks, and provides suggestions for modification. Model B modifies the prescription based on the suggestions from Model C, and finally integrates the diagnostic conclusion, candidate prescriptions, and safety tips into a combined output.
[0175] For example, a prescription generated independently by Model B contains licorice, but the patient is allergic to licorice. During collaboration, Model A transmits the allergy information to Model B, Model C performs a safety review again, and finally combines the outputs to remove licorice and supplement it with liver function monitoring and physician review requirements.
[0176] After collaboration, the system generates a final output, which is: "Based on the comprehensive assessment, the patient has spleen and stomach deficiency and internal dampness obstruction. The treatment principle is to strengthen the spleen and replenish qi, harmonize the stomach and resolve dampness. It is recommended to use Xiangsha Liujunzi Decoction with modifications, and to appropriately control the types and dosages of drugs according to the patient's liver function. Aconite is not used in the prescription, and it is recommended to recheck liver function during the medication period."
[0177] During training, the system evaluates the performance of each model independently and the overall performance of multiple models working together. If the collaborative result is better than the result of any single model working alone, the collaboration is considered effective. The system will then adjust the models accordingly, enabling them to gradually learn how to transmit effective information, divide tasks appropriately, and correct their output based on feedback from other models.
[0178] For example, during training, Model A, Model B, and Model C are each allowed to independently process the same case, and their outputs are evaluated using the same reward function, for example, based on the following aspects: whether the diagnosis is accurate, whether the treatment method and prescription are reasonable, whether allergies and medication risks are identified, and whether the output is complete.
[0179] For example, when each model processes the case independently, assuming a maximum score of 100, Model A independently outputs 69 points, Model B independently outputs 55 points, and Model C independently outputs 59 points. The combined output of the three models working together is 94 points. This illustrates that collaboration is not merely a simple combination of the models' answers, but rather a process of differentiation, prescription, safety review, and feedback modification to achieve a more accurate, complete, and safe result.
[0180] In this embodiment, the selection of the cooperation gain, i.e. the first cooperation gain value in the above embodiment, mainly depends on the requirements of the application scenario for cooperation effectiveness. Specifically, the ordinary cooperation gain or the optimal cooperation gain can be selected.
[0181] Specifically, ordinary collaborative gain compares the combined output to the average reward of each individual model. Collaboration is considered to have generated a gain as long as the collaborative result is better than the overall average of the individual models. This method is relatively lenient and suitable for the early stages of training to encourage collaborative behavior in models. Optimal collaborative gain compares the combined output to the best-performing individual model. Collaboration is considered truly effective only when the collaborative result exceeds that of the strongest individual model. Optimal collaborative gain has stricter requirements, preventing situations where other models are merely benefiting from the combined effect, or where the actual contribution of the combined effect is solely from the strongest model.
[0182] In the multi-agent scenario of the TCM hospital in this embodiment, the optimal collaboration gain is prioritized. That is, the highest score of 69 points in the single model is taken as the independent capability benchmark, then the collaboration gain is 94-69=25 points. This shows that the result after the three models collaborate is still 25 points higher than the strongest single model, proving that information transmission, security review, and prescription correction generate practical collaborative value.
[0183] In this embodiment, if the capabilities of each model differ significantly and collaboration has not yet been established in the early stages of training, a normal collaboration gain can be used to provide a smoother training signal. Once collaboration has stabilized, the optimal collaboration gain can be used for rigorous evaluation. The specific method used can be preset according to the task stage and collaboration requirements.
[0184] It should be noted that the method of this disclosure embodiment can be executed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method of this disclosure embodiment, and the multiple devices will interact with each other to complete the method described.
[0185] It should be noted that the above description describes some embodiments of this disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in a different order than that shown in the above embodiments and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0186] Based on the same inventive concept, another embodiment of this disclosure proposes a multi-agent model training device, such as... Figure 2 As shown, it specifically includes:
[0187] The data acquisition module 301 is configured to acquire text data, input the text data into multiple sub-models, process it through each of the multiple sub-models, and obtain multiple sets of outputs. Each set of outputs includes multiple output results, including independent outputs corresponding to each sub-model and combined outputs between multiple sub-models.
[0188] The weight determination module 302 is configured to determine the target cooperative gain corresponding to each output result and the result type of each output result, and determine the target weight corresponding to each output result based on the result type.
[0189] The optimization function determination module 303 is configured to obtain the model parameters corresponding to each sub-model, and determine the objective optimization function corresponding to the multi-agent model based on all model parameters, all objective weights and all objective cooperative gains.
[0190] The model training module 304 is configured to optimize all model parameters based on the objective optimization function until the preset training completion conditions are met, thereby obtaining a trained multi-agent model.
[0191] In some embodiments, the weight determination module 302 is specifically configured as follows:
[0192] For each output result:
[0193] For each sub-model, determine the first independent advantage value corresponding to each independent output in the sub-model;
[0194] For each combination output, determine the first combination advantage value corresponding to each combination output;
[0195] Based on the first independent advantage value and the first combined advantage value, the target cooperative gain corresponding to the output result is determined.
[0196] In some embodiments, the weight determination module 302 is specifically configured as follows:
[0197] For each sub-model:
[0198] Obtain a preset reward function, and determine the independent reward value corresponding to each independent output based on the preset reward function;
[0199] Calculate all independent reward values and determine the first mean and first standard deviation corresponding to all independent reward values;
[0200] For each independent output, a first independent advantage value is determined based on the independent reward value, the first mean, and the first standard deviation.
[0201] In some embodiments, the weight determination module 302 is specifically configured as follows:
[0202] For each combination, output:
[0203] Obtain a preset reward function, and determine the corresponding combination reward value for each combination output based on the preset reward function;
[0204] Calculate the total combination reward values and determine the second mean and second standard deviation of the total combination reward values;
[0205] For each combined output, a first combined advantage value is determined based on the combined reward value, the second mean, and the second standard deviation.
[0206] In some embodiments, the weight determination module 302 is specifically configured as follows:
[0207] For each set of outputs:
[0208] Obtain a preset reward function, and determine the independent reward value corresponding to each independent output and the combined reward value corresponding to the combined output based on the preset reward function;
[0209] The first collaborative advantage value is determined based on all the individual reward values and the combined reward values.
[0210] The first independent advantage value, the first combined advantage value, and the first cooperative advantage value are weighted to obtain the target cooperative gain corresponding to the output result.
[0211] In some embodiments, the weight determination module 302 is specifically configured as follows:
[0212] For each set of outputs, a first collaborative gain value is determined based on all the independent reward values and the combined reward value;
[0213] Statistically analyze all first cooperative gain values and determine the third mean and third standard deviation corresponding to all first cooperative gain values;
[0214] For each output group, a first cooperative advantage value is determined based on the first cooperative gain value, the third mean, and the third standard deviation.
[0215] In some embodiments, the weight determination module 302 is specifically configured as follows:
[0216] The fourth mean is obtained by averaging all independent reward values.
[0217] The first collaborative gain value is obtained by subtracting the combined reward value and the fourth mean value.
[0218] In some embodiments, the weight determination module 302 is specifically configured as follows:
[0219] Iterate through all independent reward values and take the maximum value among them as the target independent reward value;
[0220] The first collaborative gain value is obtained by subtracting the combined reward value from the target independent reward value.
[0221] In some embodiments, the weight determination module 302 is specifically configured as follows:
[0222] In response to the result type being independent, the target weight corresponding to the output result is determined as the first weight; or,
[0223] In response to the result type being a combination type, the target weight corresponding to the output result is determined to be a second weight, wherein the second weight is less than the first weight.
[0224] For ease of description, the above apparatus is described in terms of its functions, divided into various modules. Of course, in implementing this disclosure, the functions of each module can be implemented in one or more software and / or hardware.
[0225] The apparatus of the above embodiments is used to implement the corresponding multi-agent model training method in any of the following embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0226] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the multi-agent model training method described in any of the above embodiments.
[0227] Figure 3This embodiment illustrates a more specific hardware structure of an electronic device. The device may include a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, memory 1020, input / output interface 1030, and communication interface 1040 are interconnected internally via the bus 1050.
[0228] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0229] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.
[0230] The input / output interface 1030 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components within the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.
[0231] The communication interface 1040 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0232] Bus 1050 includes a pathway for transmitting information between various components of the device, such as processor 1010, memory 1020, input / output interface 1030, and communication interface 1040.
[0233] It should be noted that although the above-described device only shows the processor 1010, memory 1020, input / output interface 1030, communication interface 1040, and bus 1050, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all the components shown in the figures.
[0234] The electronic devices described above are used to implement the corresponding multi-agent model training methods in any of the foregoing embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0235] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this disclosure also provides a non-transitory computer-readable storage medium that stores computer instructions for causing the computer to execute the multi-agent model training method as described in any of the above embodiments.
[0236] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0237] The computer instructions stored in the storage medium of the above embodiments are used to cause the computer to execute the multi-agent model training method as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0238] It is understood that before using the technical solutions of the various embodiments in this disclosure, users will be informed of the type, scope of use, and usage scenarios of the personal information involved in an appropriate manner, and user authorization will be obtained.
[0239] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose, based on the prompt message, whether to provide personal information to the software or hardware such as electronic devices, applications, servers, or storage media performing the operations of this disclosed technical solution.
[0240] As an optional but not limited implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0241] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0242] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of this disclosure (including the claims) is limited to these examples; within the framework of this disclosure, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the embodiments of this disclosure as described above, which are not provided in detail for the sake of brevity.
[0243] Additionally, to simplify the description and discussion, and to avoid obscuring the embodiments of this disclosure, the provided drawings may or may not show well-known power / ground connections to integrated circuit (IC) chips and other components. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the embodiments of this disclosure, and this also takes into account the fact that the details of implementation of these block diagram apparatuses are highly dependent on the platform on which the embodiments of this disclosure will be implemented (i.e., these details should be fully understood by those skilled in the art). While specific details (e.g., circuits) have been set forth to describe exemplary embodiments of this disclosure, it will be apparent to those skilled in the art that the embodiments of this disclosure can be implemented without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0244] Although this disclosure has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.
[0245] This disclosure is intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for training a multi-agent model, characterized in that, The multi-agent model includes multiple sub-models, including: The text data is acquired and input into multiple sub-models. Each sub-model processes the text data to obtain multiple sets of outputs. Each set of outputs includes multiple output results, including independent outputs corresponding to each sub-model and combined outputs between multiple sub-models. Determine the target cooperative gain for each output result and the result type for each output result, and determine the target weight for each output result based on the result type; Obtain the model parameters corresponding to each sub-model, and determine the objective optimization function corresponding to the multi-agent model based on all model parameters, all objective weights, and all objective cooperative gains. The parameters of all models are optimized based on the objective optimization function until the preset training completion conditions are met, resulting in a trained multi-agent model.
2. The method according to claim 1, characterized in that, Determining the target cooperative gain for each output result includes: For each sub-model, determine the first independent advantage value corresponding to each independent output in the sub-model; For each combination output, determine the first combination advantage value corresponding to each combination output; Based on the first independent advantage value and the first combined advantage value, the target cooperative gain corresponding to the output result is determined.
3. The method according to claim 2, characterized in that, The step of determining the first independent dominance value corresponding to each independent output in each sub-model includes: For each sub-model: Obtain a preset reward function, and determine the independent reward value corresponding to each independent output based on the preset reward function; Calculate all independent reward values and determine the first mean and first standard deviation corresponding to all independent reward values; For each independent output, a first independent advantage value is determined based on the independent reward value, the first mean, and the first standard deviation.
4. The method according to claim 2, characterized in that, The step of determining the first combined advantage value corresponding to each combined output includes: For each combination, output: Obtain a preset reward function, and determine the corresponding combination reward value for each combination output based on the preset reward function; Calculate the total combination reward values and determine the second mean and second standard deviation of the total combination reward values; For each combined output, a first combined advantage value is determined based on the combined reward value, the second mean, and the second standard deviation.
5. The method according to claim 2, characterized in that, The step of determining the target cooperative gain corresponding to the output result based on the first independent dominance value and the first combined dominance value includes: For each set of outputs: Obtain a preset reward function, and determine the independent reward value corresponding to each independent output and the combined reward value corresponding to the combined output based on the preset reward function; The first collaborative advantage value is determined based on all the individual reward values and the combined reward values. The first independent advantage value, the first combined advantage value, and the first cooperative advantage value are weighted to obtain the target cooperative gain corresponding to the output result.
6. The method according to claim 5, characterized in that, The step of determining the first collaborative advantage value based on all the individual reward values and the combined reward value includes: For each set of outputs, a first cooperative gain value is determined based on all the independent reward values and the combined reward values. Statistically analyze all first cooperative gain values and determine the third mean and third standard deviation corresponding to all first cooperative gain values; For each output group, a first cooperative advantage value is determined based on the first cooperative gain value, the third mean, and the third standard deviation.
7. The method according to claim 6, characterized in that, The step of determining the first collaborative gain value based on all the independent reward values and the combined reward value includes: The fourth mean is obtained by averaging all independent reward values. The first collaborative gain value is obtained by subtracting the combined reward value and the fourth mean value.
8. The method according to claim 6, characterized in that, The step of determining the first collaborative gain value based on all the independent reward values and the combined reward value includes: Iterate through all independent reward values and take the maximum value among them as the target independent reward value; The first collaborative gain value is obtained by subtracting the combined reward value from the target independent reward value.
9. The method according to claim 1, characterized in that, The step of determining the target weight corresponding to each output result based on the result type includes: In response to the result type being independent, the target weight corresponding to the output result is determined as the first weight; or, In response to the result type being a combination type, the target weight corresponding to the output result is determined to be a second weight, wherein the second weight is less than the first weight.
10. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method as described in any one of claims 1 to 9.
