Evolution-based model merging method, question answering method, and electronic device

By introducing an individual evolution model to optimize the search for merging coefficients, the problem of poor merging model performance caused by fixed operators is solved, and a more efficient and stable model fusion effect is achieved.

CN122287801APending Publication Date: 2026-06-26PENG CHENG LAB
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
PENG CHENG LAB
Filing Date
2026-05-13
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing technologies suffer from poor model merging performance and difficulty in finding the optimal merging coefficients due to the lack of self-adjustment capability of fixed operators during the model merging process.

Method used

By employing individual evolutionary models such as conditional generative adversarial networks or variational autoencoders, merging coefficients are adaptively generated, and the search space is optimized through evolutionary iteration to find the globally optimal merging model.

Benefits of technology

It improves the search efficiency and stability of the merged model, ensuring that the final merged model performs well in multiple application areas and achieves better model fusion results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122287801A_ABST
    Figure CN122287801A_ABST
Patent Text Reader

Abstract

This invention relates to the field of artificial intelligence technology and discloses an evolution-based model merging method, question-answering method, and electronic device. The method includes: generating initial individuals composed of merging coefficients corresponding to each initial model using a preset encoding strategy; merging multiple initial models using the initial individuals to obtain an initial merged model corresponding to the initial individuals and a fitness value corresponding to the initial merged model; constructing an initial history set using the initial individuals and their corresponding fitness values; iterating the initial individuals using an individual evolution model to update the initial history set, obtaining a global history set; and merging multiple initial models using the individual with the highest fitness value in the global history set to obtain a target merged model. By implementing the method of this application, it can be ensured that the final target merging coefficients are globally optimal, thereby resulting in a better merging effect for the final target merged model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, specifically to an evolution-based model merging method, a question-answering method, and an electronic device. Background Technology

[0002] With the development of large-scale artificial intelligence models such as large language models, the number of model parameters has increased dramatically. Fine-tuning all parameters to adapt to the needs of specific tasks has become increasingly impractical in terms of computational resources and data costs. Against this backdrop, model fusion technology has emerged. It aims to directly merge multiple initial models, fine-tuned for different tasks or data, into a single model without introducing additional training costs. This achieves knowledge transfer and capability combination, representing a highly promising, scalable, and sustainable model capability enhancement mechanism.

[0003] However, in the process of finding merging coefficients, related technologies often use predefined fixed operators such as random mutation and uniform crossover to traverse an unstructured search space. Since fixed operators do not have the ability to actively learn from historical trajectories and self-adjust, the search behavior has significant randomness and blindness, making it difficult to find the optimal merging coefficients, and thus resulting in poor overall performance of the merging model. Summary of the Invention

[0004] This invention provides an evolution-based model merging method, question-answering method, and electronic device to address the problem of poor overall performance of merged models obtained in related technologies.

[0005] In a first aspect, the present invention provides an evolution-based model merging method, comprising: generating initial individuals composed of merging coefficients corresponding to each initial model using a preset encoding strategy, wherein multiple initial models are trained based on the same base model and each initial model performs tasks in different application domains; merging multiple initial models using the initial individuals to obtain an initial merged model corresponding to the initial individuals and a fitness value corresponding to the initial merged model; constructing an initial history set using the initial individuals and their corresponding fitness values; iterating the initial individuals using an individual evolution model to update the initial history set to obtain a global history set; and merging multiple initial models using the individual with the highest fitness value in the global history set to obtain a target merged model, wherein the target merged model is used to perform tasks in multiple application domains.

[0006] Secondly, the present invention provides a question-answering method, which includes: receiving a question text to be answered; and processing the question text to be answered using a target merging model to obtain the target answer corresponding to the question text to be answered.

[0007] Thirdly, the present invention provides an electronic device comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the evolution-based model merging method of the first aspect or the question-and-answer method of the second aspect.

[0008] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to execute the evolution-based model merging method of the first aspect or the question-and-answer method of the second aspect.

[0009] Fifthly, the present invention provides a computer program product, including computer instructions for causing a computer to execute the evolution-based model merging method of the first aspect or the question-and-answer method of the second aspect.

[0010] The evolutionary model merging method provided in this embodiment iterates through an individual evolutionary model on initial individuals. This allows for evolutionary updates of the initial individuals and their corresponding fitness values, resulting in a final global history set. By merging the initial models using the individual with the highest fitness value from the global history set, a target merged model can be obtained. This target merged model can handle tasks in the application domains corresponding to each initial model. Compared to related technologies that iterate through initial individuals using fixed operators, this application transforms the original random and blind exploration process into a directed and guided intelligent sampling process using an individual evolutionary model. This improves search efficiency and stability under limited evaluation budgets, ensuring that the final target merging coefficients are globally optimal, thus resulting in a better merging effect for the final target merged model. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the specific embodiments or related technologies of the present invention, the drawings used in the description of the specific embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0012] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of the present invention; Figure 2 This is a schematic diagram of the first process of the evolution-based model merging method provided in the embodiments of the present invention; Figure 3 This is a schematic diagram of the second process of the evolution-based model merging method provided in the embodiments of the present invention; Figure 4 This is a flowchart illustrating the question-and-answer method provided according to an embodiment of the present invention; Figure 5 This is a schematic diagram of the training process of a dual generator according to an embodiment of the present invention; Figure 6 This is a schematic diagram illustrating the search for the optimal merging coefficient according to an embodiment of the present invention; Figure 7 This is a structural block diagram of an evolution-based model merging device provided according to an embodiment of the present invention; Figure 8 This is a structural block diagram of a question-and-answer device provided according to an embodiment of the present invention; Figure 9 This is a schematic diagram of the hardware structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation

[0013] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0014] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in the present invention and their authorization should be obtained in accordance with relevant laws and regulations through appropriate means.

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

[0016] With the development of large-scale artificial intelligence models such as large language models, the number of model parameters has increased dramatically. Fine-tuning all parameters to adapt to the needs of specific tasks has become increasingly impractical in terms of computational resources and data costs. Against this backdrop, model fusion technology has emerged. It aims to directly merge multiple initial models, fine-tuned for different tasks or data, into a single model without introducing additional training costs. This achieves knowledge transfer and capability combination, representing a highly promising, scalable, and sustainable model capability enhancement mechanism.

[0017] The development of model fusion has evolved from heuristic design to optimization search. Early methods relied heavily on manually designed heuristics, such as linear averaging or spherical interpolation of weights from different models, or scaling and sparsification schemes to mitigate interference between parameters. However, these methods are typically task-independent and cannot adaptively adjust the fusion strategy based on the validation objective.

[0018] To overcome this limitation, recent years have seen a shift towards optimization- or search-based model fusion frameworks. Among these, evolutionary model fusion has emerged as a practical alternative, utilizing a population-based, gradient-free search strategy and demonstrating competitive performance on various tasks. For example, a typical evolutionary model fusion method typically involves: initializing a population containing multiple candidate merge models; evaluating the performance (fitness value) of each candidate merge model on a validation set; selecting elite individuals from the initial population based on the performance of the candidate merge models; applying random mutation and / or crossover operations to the elite individuals to generate new candidate merge models; and repeating this evolutionary cycle. This process essentially involves a random search in a high-dimensional model parameter space or fusion coefficient space, and its search efficiency is highly dependent on the design of the mutation operator and the effectiveness of the random perturbation.

[0019] However, using predefined fixed operators such as random mutation and uniform crossover to traverse the unstructured search space is problematic. Since fixed operators lack the ability to actively learn from historical trajectories and self-adjust, the search behavior exhibits significant randomness and blindness, making it difficult to find the optimal merging coefficients, thus resulting in a poor overall performance of the merged model.

[0020] In view of this, this application models the merging coefficient search as a learnable generative distributed sampling problem, and introduces a trainable individual evolution model, such as a conditional generative adversarial network or a variational autoencoder, to replace the fixed mutation operator. This individual evolution model can adaptively generate new candidate merging coefficients with high potential based on real-time feedback. In this way, the originally random and blind exploration process can be transformed into a directional and guided intelligent sampling, which significantly improves the search efficiency and stability under a limited evaluation budget, ensures that the final target merging coefficient can be globally optimal, and thus makes the merging effect of the final target merging model better.

[0021] As an optional application scenario of this invention, such as Figure 1 As shown, the question-and-answer system may include at least one electronic device and at least one server. Figure 1The system, as exemplarily shown, includes a computer 101, a mobile terminal 102, and a server 103, with the computer 101, mobile terminal 102, and other electronic devices connected to the server 103 via a network 110. The computer 101 can be used to execute the evolution-based model merging method of this application, and the mobile terminal 102 can be used to execute the question-answering method of this application.

[0022] Specifically, electronic devices can be smartphones, tablets, laptops, PDAs, desktop computers, game consoles, smart TVs, smart wearable devices, in-vehicle terminals, VR (Virtual Reality) devices, AR (Augmented Reality) devices, etc. Server 103 can be a standalone physical server, a server cluster, a distributed system, or a cloud server providing cloud services. Network 110 can be a wired or wireless network, examples of which include, but are not limited to, the Internet, corporate intranets, local area networks, wide area networks, mobile communication networks, and combinations thereof.

[0023] As a specific example, the evolution-based model merging process proposed in this application can be formally modeled as follows. The base model parameters of the base model can be expressed as... , Used to represent the number of model parameters, and The initial model parameters of an initial model can be expressed as: , This represents the initial model parameters for the i-th initial model, and each initial model is tested on tasks or datasets in different application domains. This is achieved through fine-tuning of instructions or efficient fine-tuning of parameters. This is used to represent the specific knowledge or capability offset of the i-th initial model relative to the base model, hence the i-th The task vector of an initial model can be represented as... Task vector The i-th initial model was captured to adapt to the i-th The direction of parameter changes resulting from each task. The goal of model merging is to find a merging coefficient. This allows for the linear combination of these task vectors according to the merging coefficients and their addition back to the base model, resulting in a merged model that achieves excellent performance across multiple tasks. The parameterized form of the merged model can be represented as... Given a validation set containing multiple task samples. and an evaluation function The fitness value of the objective merging model can be expressed as the average accuracy across multiple tasks, normalized loss, or human evaluation score. The optimization objective is to find the optimal merging coefficient. To record the search process, all evaluated merging coefficients and their corresponding fitness values ​​can be stored in the history set. , Used to indicate the total number of evolutionary cycles.

[0024] According to an embodiment of the present invention, an evolution-based model merging method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0025] This embodiment provides an evolution-based model merging method that can be used in computers. Figure 2 This is a flowchart of an evolution-based model merging method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps: Step S201: Using a preset encoding strategy, an initial individual is generated, which is composed of the merging coefficients corresponding to each initial model. Multiple initial models are trained based on the same base model, and each initial model performs tasks in different application domains.

[0026] The preset encoding strategy here can be a pre-defined strategy used to generate initial individuals. An initial individual can represent the merging coefficients of all initial models during model merging. For example, if there are three initial models—a first initial model, a second initial model, and a third initial model—an initial individual can be represented as [0.3, 0.3, 0.4]. This initial individual yields a merging coefficient of 0.3 for the first initial model, 0.3 for the second initial model, and 0.4 for the third initial model.

[0027] In addition, to ensure the stability and interpretability of the merged model obtained through merging, in one scenario, the merging coefficients can be adjusted. (i.e., an initial individual) constraints are imposed. As a concrete example, nonnegativity constraints and normalization constraints can be used, i.e. and Constraints are applied to the merging coefficients.

[0028] Here, multiple initial models are obtained by fine-tuning instructions or parameters based on the same base model, but different initial models perform tasks in different application domains. Following the previous example, the first initial model can be used to perform tasks in the medical field, the second initial model can perform tasks in the education field, and the third initial model can perform tasks in the financial field. This application does not specifically limit the application domain corresponding to the initial models; it only needs to ensure that multiple initial models are all obtained by fine-tuning instructions from the same base model.

[0029] Step S202: Use the initial individuals to merge multiple initial models to obtain the initial merged model corresponding to the initial individuals and the fitness value corresponding to the initial merged model.

[0030] This can be achieved by merging multiple initial models using the merging coefficients represented by the initial individuals, resulting in an initial merged model corresponding to each initial individual. Furthermore, the resulting initial merged model can perform tasks in the application domains corresponding to each initial model. Following the previous example, the resulting initial merged model can perform tasks in the medical, educational, and financial fields.

[0031] As a concrete example, the task vector corresponding to the i-th initial model can be represented as: N represents the total number of initial models. The pooling coefficient is represented by the initial individuals. The initial merged model can be represented as follows: A linear combination of the task vectors corresponding to all initial models is then added back to the base model. .

[0032] After obtaining the initial merge model, it can be used on the validation set. The fitness value of the initial merging model is obtained by using performance metrics such as the average accuracy of the initial merging model on multiple tasks, normalized loss, or human evaluation score. This fitness value is the fitness value of the initial individual corresponding to the initial merging model.

[0033] Step S203: Construct an initial history set using the initial individuals and their corresponding fitness values.

[0034] Here, a key-value pair approach can be used, adding the initial individual as the key and its corresponding fitness value as the value to an empty set to obtain the initial history set. Subsequently, this initial history set can be continuously updated to store individuals from all evolutionary rounds and their corresponding fitness values. Furthermore, the updated set allows for quick searching of the individual with the highest fitness value.

[0035] Step S204: Use the individual evolution model to iterate the evolution of the initial individuals to update the initial history set and obtain the global history set.

[0036] The individual evolution model here can have fewer network layers, and at each evolutionary round, the individual evolution model can be continuously updated using the historical set corresponding to the current evolutionary round.

[0037] As a concrete example, an initial individual can be input into an individual evolution model to obtain an evolved individual corresponding to the initial individual. Then, the evolved individual and its corresponding fitness value can be added to the initial history set. This allows for continuous updating of the initial history set, resulting in a final global history set. Accordingly, this global history set can be the final history set obtained after a pre-defined number of evolutionary rounds, storing individuals from all evolutionary rounds and their corresponding fitness values.

[0038] It should be understood that the process of obtaining the evolutionary merging model corresponding to the evolutionary individual and the fitness value corresponding to the evolutionary merging model using the evolutionary individual can be referred to the process of obtaining the initial merging model and the fitness value corresponding to the initial merging model using the initial individual as shown above.

[0039] As a concrete example, the global history set can be represented as , Used to indicate the total number of evolutionary cycles.

[0040] Step S205: Using the individual with the highest fitness value in the global history set, multiple initial models are merged to obtain the target merged model, which is used to perform tasks in multiple application domains.

[0041] It should be understood that the process of obtaining the target merging model by using the individual with the highest fitness value in the global history set can be referred to as the process of obtaining the initial merging model by using the initial individual shown above.

[0042] As shown earlier, the target merging model, after merging, can perform tasks in the application domains corresponding to the initial models. For example, the target merging model performs tasks in the medical, educational, and financial fields. Furthermore, the performance of the target merging model can outperform both the initial merging model and the evolutionary merging model described earlier.

[0043] Furthermore, in this application, the initial model is updated in each evolutionary round. For example, in the first evolutionary round, individuals with the highest fitness values, matching the number of initial models, are selected through evolutionary updates. These individuals are then used to merge the initial models, resulting in a merged model. This merged model can then be used as the initial model for the next evolutionary round. Through multiple evolutionary rounds, the final target merged model can be obtained. This application breaks away from the limitations of traditional fixed initial models and proposes a co-evolutionary framework that allows the initial model to be synchronized with and dynamically optimized along with the merging coefficient search strategy. By introducing new initial models or adjusting existing ones, the search space is continuously expanded and optimized, thereby systematically breaking through the performance limitations set by the initial models and ultimately finding a fusion model architecture with superior performance.

[0044] The evolutionary model merging method provided in this embodiment iterates through an individual evolutionary model on initial individuals. This allows for evolutionary updates of the initial individuals and their corresponding fitness values, resulting in a final global history set. By merging the initial models using the individual with the highest fitness value from the global history set, a target merged model can be obtained. This target merged model can handle tasks in the application domains corresponding to each initial model. Compared to related technologies that iterate through initial individuals using fixed operators, this application transforms the original random and blind exploration process into a directed and guided intelligent sampling process using an individual evolutionary model. This improves search efficiency and stability under limited evaluation budgets, ensuring that the final target merging coefficients are globally optimal, thus resulting in a better merging effect for the final target merged model.

[0045] This embodiment provides an evolution-based model merging method that can be used in computers. Figure 3 This is a flowchart of an evolution-based model merging method according to an embodiment of the present invention, such as... Figure 3 As shown, the process includes the following steps: Step S301: Using a preset encoding strategy, an initial individual is generated, which is composed of the merging coefficients corresponding to each initial model. Multiple initial models are trained based on the same base model, and each initial model performs tasks in different application domains.

[0046] As a specific example, preset encoding strategies may include average merging strategy, model one-hot strategy, and random sampling strategy.

[0047] Specifically, step S301 includes: Step S3011: Generate the first initial individual using the average merging strategy.

[0048] The average merging strategy here can be a strategy where the merging coefficients of each initial model have the same value, and the sum of the merging coefficients of all initial models is 1, that is, the strategy where each initial model equally shares the overall merging coefficient. As a specific example, if the number of initial models is 3, then by using the average merging strategy, we can obtain a first initial individual with a merging coefficient of 0.333 and a quantity of 1 for each initial model. This initial individual can be represented as [0.333, 0.333, 0.333].

[0049] Step S3012: Generate the second initial individual using the model's one-heat strategy.

[0050] The one-hot model strategy here can be a strategy where only one initial model has a merging coefficient of 1, and the merging coefficients of the remaining initial models are 0. As a specific example, if the number of initial models is 3, the one-hot model strategy can yield second initial individuals such as [1,0,0], [0,10], and [0,0,1]. It should be understood that the number of second initial individuals obtained through the one-hot model strategy is the same as the number of initial models.

[0051] Step S3013: Generate a third initial individual using a random sampling strategy.

[0052] The random sampling strategy here can be to randomly generate corresponding merging coefficients for each initial model within a preset range of coefficient values, while satisfying the non-negativity constraint and normalization constraint conditions shown above, thereby obtaining the third initial individual.

[0053] As shown above, the average merging strategy can yield a first initial individual of 1, and the one-hot model strategy can yield a second initial individual of the same number as the initial model. For example, if the number of initial models is N, the one-hot model strategy can yield a second initial individual of N. If the number of initial individuals is set to P=2N, then the random sampling strategy can generate a third initial individual of PN-1.

[0054] Step S3014: Using the merging results of the first initial individual, the second initial individual, and the third initial individual, the initial individual is obtained.

[0055] Here, the first initial individual, the second initial individual, and the third initial individual can be merged together to obtain an initial individual with a population size of P.

[0056] The initial individuals are generated by using an average merging strategy, a model one-hot strategy, and a random sampling strategy. This ensures that the initial population composed of the initial individuals has sufficient diversity. When iterating and evolving the initial individuals, a global search can be carried out based on the rich initial solution space, which improves the efficiency of iterative optimization and the quality of the final optimal individuals. This, in turn, ensures that the obtained target merging model has better overall performance in multiple domain tasks.

[0057] Step S302: Use the initial individuals to merge multiple initial models to obtain the initial merged model corresponding to the initial individuals and the fitness value corresponding to the initial merged model.

[0058] Specifically, step S302 includes: Step S3021: Obtain the base model parameters corresponding to the base model, and the initial model parameters corresponding to each initial model.

[0059] The base model parameters can be the model parameters corresponding to the base model, specifically through... This is represented. The initial model parameters can be the model parameters corresponding to the initial model, specifically through... To express.

[0060] As a concrete example, the base model parameters can be... and initial model parameters The base model parameters and initial model parameters are pre-stored in a database, and the computer can access the database to obtain them. Regarding the initial model parameters... Please refer to the previous text for details, which will not be repeated here.

[0061] Step S3022: Use the difference between each initial model parameter and the base model parameter to obtain the model parameter offset of each initial model.

[0062] The difference between the initial model parameters and the base model parameters corresponding to the initial model can be seen as the direction of parameter changes in the initial model to adapt to the task of its corresponding application domain. As a specific example, the difference between the initial model parameters and the base model parameters corresponding to the i-th initial model can be seen as the direction of parameter changes in the initial model parameters corresponding to the i-th initial model to adapt to the task of the i-th application domain.

[0063] For example, the difference between the initial model parameters corresponding to the i-th initial model and the base model parameters can be expressed as: .

[0064] Step S3023: Using the merging coefficients represented by the initial individuals, the model parameter offsets of all initial models are weighted and merged to obtain the parameter fusion offset.

[0065] Here, the merging coefficients represented by the initial individuals can be used to linearly combine all the model parameter offsets to obtain the parameter fusion offset. As a concrete example, the parameter fusion offset can be expressed as... Where N is the total number of initial models. Used to represent the merging coefficient corresponding to the i-th initial model in the initial individuals.

[0066] Step S3024: The parameter fusion offset is superimposed on the base model parameters to obtain the merged parameters.

[0067] Here, the base model parameters and the parameter fusion offset can be directly added together to obtain the merged parameters. As a specific example, the merged parameters can be represented as follows: ,in, Used to represent an initial individual.

[0068] Step S3025: Based on the model structure of the base model, construct the initial merge model using the merge parameters.

[0069] Here, the merging parameters can be assigned to the base model to obtain an initial merged model formed by the fusion of multiple initial models.

[0070] Step S3026: Use the performance metrics of the initial merge model on the validation set to obtain the fitness value corresponding to the initial merge model.

[0071] The validation set here This could be a unified multi-task evaluation dataset, containing representative task samples from different application domains corresponding to each initial model, along with their corresponding evaluation criteria. A validation set would then be used. It can comprehensively reflect the model's overall performance in multiple scenarios.

[0072] For example, this can be achieved through an evaluation function. This is used to evaluate the performance metrics of the initial merge model on the validation set, thereby obtaining the fitness value corresponding to the initial merge model. As a specific example, the fitness value corresponding to the initial merge model can be expressed as: .

[0073] Alternatively, multi-task accuracy averaging can be used. To evaluate the performance metrics of the initial merge model on the validation set, the fitness value corresponding to the initial merge model is obtained, where, The total number of tasks on the validation set. This is used to represent the prediction accuracy of the initial merging model on the s-th task.

[0074] Alternatively, a weighted composite score can be used. To evaluate the performance metrics of the initial merge model on the validation set, the fitness value corresponding to the initial merge model is obtained, where, Let be the weight corresponding to the s-th task. This is used to represent the performance score of the initial merging model on the s-th task.

[0075] Alternatively, it can be achieved through loss-based metrics. To evaluate the performance metrics of the initial merge model on the validation set, the fitness value corresponding to the initial merge model is obtained, where, This is used to represent the minimum loss of the initial merging model on the s-th task. Maximizing this negative loss metric is equivalent to minimizing the average loss of the model across all tasks.

[0076] By weighting and merging the parameter offsets of each initial model relative to the base model, the computational complexity and storage overhead of the model merging process can be reduced. Furthermore, by controlling the weighting of the differentiated knowledge increments of each initial model using the merging coefficients represented by the initial individuals, knowledge conflicts and capability cancellation problems caused by simple parameter averaging are avoided, achieving balanced transfer and combination of domain-specific knowledge. Using the actual performance indicators of the initial merged model on a multi-task validation set as fitness values ​​can guide the evolutionary iteration process towards convergence towards the optimal comprehensive performance across multiple domains, ensuring that the final merged model exhibits excellent performance on all target tasks.

[0077] Step S303: Construct the initial history set using the initial individuals and their corresponding fitness values. See details below. Figure 2 Step S203 of the illustrated embodiment will not be described again here.

[0078] Step S304: Use the individual evolution model to iterate the evolution of the initial individuals to update the initial history set and obtain the global history set.

[0079] Specifically, step S304 includes: Step S3041: Update the initial individual evolution model using the initial history set to obtain the individual evolution model.

[0080] The initial individual evolutionary model here can be a model that has not been updated using the initial history set. Updating the initial individual evolutionary model using the initial history set enables the evolutionary iteration process to have historical memory capabilities. It can avoid redundant calculations and invalid searches based on previously explored individuals and fitness information, thereby improving evolutionary efficiency and convergence stability, and ultimately outputting evolved individuals with better fitness more quickly.

[0081] Furthermore, it should be understood that after obtaining the initial history set, the inner loop step of the model merging algorithm in this application is entered. In the inner loop, the initial individual evolutionary model is first updated using the initial history set to obtain an individual evolutionary model; then, the initial individuals are updated using the individual evolutionary model to obtain evolved individuals and their corresponding fitness values. These evolved individuals and their corresponding fitness values ​​are then added to the initial history set to obtain a candidate history set. Next, it can be determined whether the end condition of the inner loop is met. If it is, the iteration stops, and the candidate history set is used as the current history set. Conversely, if the end condition is not met, the P individuals with the highest fitness values ​​from the candidate history set are selected as the initial individuals for the next iteration, the candidate history set is used as the initial history set for the next iteration, and the individual evolutionary model obtained from the current iteration is used as the initial individual evolutionary model for the next iteration. This process returns to the aforementioned step of updating the initial individual evolutionary model until the end condition of the inner loop is met, and then the candidate history set corresponding to the last evolutionary round is used as the current history set.

[0082] In some optional implementations, step S3041 above includes: Step a1: Select the second-highest number of individuals with the highest fitness value in the initial history set as the winning individuals, and construct the winning set corresponding to the winning individuals.

[0083] Step a2: Select the second-lowest number of individuals with the lowest fitness value in the initial history set as the weakest individuals, and construct the weakest set corresponding to the weakest individuals.

[0084] Step a3: Using the comparison between the winning set and the losing set, update the initial individual evolution model to obtain the individual evolution model.

[0085] Here, a fixed-ratio method can be used to construct the winning and losing sets. For example, for the initial history set... All individuals are sorted in descending order according to their corresponding fitness values, and a certain proportion is set. The ones that appear first in the sorting list Each individual (also referred to as a sample) is included in the winning set. , sort the later Individuals are categorized into the disadvantaged set. In some cases, The range of values ​​can be As a specific example, .

[0086] Here, based on the distribution of fitness values ​​in the initial historical set, quantiles such as the upper quartile and lower quartile can be dynamically selected as the splitting threshold to construct the winning set and the losing set.

[0087] Here, an absolute or relative gap threshold can also be set, and individuals above the gap threshold are considered winners, while those below the gap threshold are considered losers.

[0088] Here, we can use the winning set and the losing set to pair up to obtain multiple individual pairs (one individual pair corresponds to one winning individual and one losing individual), and then update the initial individual evolution model through multiple individual pairs to obtain the individual evolution model.

[0089] By constructing a winning set using the individuals with the best fitness from the initial historical set and a losing set using the individuals with the worst fitness, and updating the initial individual evolution model using the comparison between the winning and losing sets, the initial individual evolution model can clearly learn the characteristic patterns of high-quality individuals and the ineffective features of low-quality individuals. This significantly improves the accuracy of the evolution direction and the iteration efficiency, avoids invalid searches, and enables subsequently generated individuals to approach the optimal merging coefficient more quickly. Ultimately, this allows the target merging model to have more balanced and superior performance in multiple domain tasks.

[0090] The initial individual evolution model includes an initial forward generator and an initial backward generator. The initial forward generator maps inferior individuals to their corresponding, higher-performing winning regions. The initial backward generator maps superior individuals to inferior regions. As a concrete example, the initial forward generator... It can be a multilayer perceptron, with an initial inverse generator. It can be a multilayer perceptron that is symmetrical to the structure of the initial forward generator.

[0091] like Figure 5 As shown, the initial forward generator It can include five fully connected layers, and the output dimensions of these five fully connected layers can be 128, 256, 256, 256, and 128 dimensions, respectively. Correspondingly, the initial inverse generator... It can also include 5 fully connected layers, and the output dimensions of these 5 fully connected layers can be 128, 256, 256, 256 and 128 respectively.

[0092] Specifically, both the initial forward generator and the initial backward generator can be fully connected networks comprising an input layer, several hidden layers, and an output layer. Following the output layer of the initial forward generator and the initial backward generator is... The function ensures that the generated merging coefficients are consistent. and This approach can be applied to scenarios that require probabilistic interpretation or stable weighting.

[0093] Of course, it can also be used in the output layers of the initial forward generator and the initial backward generator. The function restricts each merging coefficient to the interval [-1, 1], which can be applied to a wider space where positive and negative contributions need to be explored (i.e., task vector addition and subtraction).

[0094] Of course, it can also be used in some coefficient layers of the initial forward generator and the initial backward generator. Functions, partially used Functions are implemented to accommodate the different merging requirements of different parts of the model, such as the attention layer and the feedforward layer.

[0095] Additionally, the number of hidden layers and neurons can be adjusted based on the initial model size N. For example, for For medium-sized applications, 3-5 hidden layers can be used, with each layer containing [number of neurons]. arrive Between. Meanwhile, for large-scale initial model merging ( (This is quite significant), and a self-attention layer can be introduced into the initial forward generator and the initial backward generator to better model the correlation between different merging coefficients. Moreover, the initial forward generator and the initial backward generator can also receive the average fitness of the current population, the historical best fitness, etc., as conditional inputs to achieve more adaptive generation.

[0096] Alternatively, the individual evolution model can also be a variational autoencoder, a regularized flow model, a diffusion model, or an adversarial generative network, or it can employ a single generator and maintain diversity through regularization.

[0097] In some alternative implementations, step a3 above includes: Step a31 involves pairing the winning and losing sets to obtain multiple pairs of individuals.

[0098] Step a32: For each pair of individuals, input the winning individual in the pair into the initial reverse generator, and input the poorly fitting individuals output by the initial reverse generator into the initial forward generator to obtain the restored fit winning individual output by the initial forward generator.

[0099] Step a33: Input the inferior individuals in the individual pair into the initial forward generator, and input the best-fit individuals output by the initial forward generator into the initial backward generator to obtain the restored inferior individuals output by the initial backward generator.

[0100] Step a34: Calculate the loss value by using the difference between the best and worst fit individuals corresponding to the individual pairs.

[0101] Step a35: Using the loss values ​​corresponding to all individual pairs, adjust the model parameters of the initial forward generator and the initial backward generator to obtain the individual evolution model.

[0102] In the actual update process, an online pairing strategy can be adopted to independently select from the winning set. and disadvantage set A batch of individuals was randomly collected and randomly paired. This can be used to obtain multiple pairs of individuals. As a concrete example, the Cartesian product of the winning and losing sets can be performed to obtain multiple pairs of individuals.

[0103] Here, the winning individual from the pair can be input into the initial backward generator, which maps the winning individual to the inferior region, resulting in the poorly fitted individual output by the initial backward generator. Then, the poorly fitted individual can be input into the initial forward generator, which remaps the poorly fitted individual back to the winning region, thus obtaining the restored winning individual. The process from the inferior individual to the restored poorly fitted individual is similar to the above process and will not be repeated.

[0104] By constructing individual pairs that include winning and losing individuals, the initial individual evolution model is updated, enabling it to accurately learn and distinguish between effective optimization directions and ineffective perturbations. This allows for the extraction of richer relative gradient information from sparse absolute scores, thereby greatly improving the information utilization rate of single evaluation feedback and guiding the initial forward generator in the initial individual evolution model to evolve more accurately toward the winning region (i.e., the high-performance region).

[0105] In some alternative implementations, step a34 above includes: Step b1: Construct the first loss value by restoring the difference between the winning individual and the winning individual in the individual pair.

[0106] Step b2: Construct a second loss value by restoring the difference between the inferior individual and the inferior individual in the individual pair.

[0107] Step b3: Construct a cycle-consistent loss value using the fusion result between the first loss value and the second loss value.

[0108] Step b4: Obtain the centroid corresponding to the winning set.

[0109] Step b5: Construct a guiding loss value by utilizing the difference between the centroid and the best-fitting individual.

[0110] Step b6: Construct a loss value using the fusion result between the cycle consistency loss value and the bootstrapping loss value.

[0111] As a concrete example, the cycle consistency loss can be expressed as: + [ ] in, Used to represent the cycle consistency loss value The L2 norm squared of a vector is used to represent the sum of the squares of the vector's elements. Used to indicate a disadvantaged individual. Used to represent the winning individual. Used to represent the inferior set Used to represent the winning set Used to represent the best-fitting individual. Used to represent individuals with poor fit in restoration. Used to represent individuals with poor fit. Used to represent the best fit of the restored individuals.

[0112] As a concrete example, the centroid corresponding to the winning set can be represented as ,in, This is used to denote the centroid of the winning set. Accordingly, the guiding loss value can be expressed as...

[0113] in, Used to represent the guiding loss value. Used to represent the best fit individual.

[0114] As a concrete example, the cycle consistency loss and the bootstrapping loss can be weighted and fused to obtain the final loss value. For instance, the loss value can be represented as... ,in, Weighting coefficients used to represent the cycle consistency loss value Weighting coefficients used to represent the guided loss value. Furthermore, through... and It can be used to balance the cycle consistency loss value and the bootstrapping loss value.

[0115] Cyclic consistency loss ensures that the bidirectional mapping between the initial forward generator and the initial backward generator is reversible and structure-preserving, preventing the initial forward and backward generators from collapsing or producing meaningless outputs. Furthermore, guiding loss not only explicitly guides the initial forward generator towards the winning region but also tends to generate more stable evolved individuals closer to the center of that winning region.

[0116] like Figure 5The diagram illustrates the specific process of updating the initial individual evolutionary model. First, the initial history set... All individuals are sorted in descending order according to their corresponding fitness values, and a certain proportion is set. The ones that appear first in the sorting list Individuals (i.e.) to ) included in the winning set , sort the later Individuals (i.e.) to ) Included in the disadvantage set At the same time, through the winning collection and disadvantage set Multiple individual pairs are obtained by performing a Cartesian product. The weakest individual in each pair is input into the initial forward generator to obtain the best-fitting individual output by the initial forward generator. Then, the best-fitting individual is input into the initial backward generator to obtain the refitted weakest individual. The second loss value is constructed by the difference between the refitted weakest individual and the weakest individual. Similarly, the first loss value is constructed in the manner described above. Finally, a cycle consistency loss value is constructed using the first and second loss values, and a guiding loss value is constructed using the difference between the centroid of the winning set and the refitted best-fitting individual. Subsequently, a weighted fusion result of the cycle consistency loss value and the guiding loss value is constructed to obtain the final loss value. Finally, the model parameters of the initial forward generator and the initial backward generator are adjusted using the loss values ​​corresponding to all individual pairs to obtain the forward generator and the backward generator, i.e., the individual evolution model.

[0117] Step S3042: Use the individual evolution model to update the initial individuals to update the initial history set and obtain the current history set.

[0118] Here, the initial individual can be updated using an individual evolution model to obtain an evolved individual. Then, the evolved individuals can be used to merge the initial model to obtain an evolutionary merge model and its corresponding fitness value. Finally, the evolved individuals and their corresponding fitness values ​​can be added to the initial history set to obtain the current history set.

[0119] As a concrete example, the forward generator in an individual evolution model can be used to update the initial individual to obtain the evolved individual corresponding to the initial individual. Meanwhile, to maintain population diversity and avoid getting trapped in local optima, a small amount of random Gaussian noise can be added to the evolutionary individuals output by the forward generator. ,and As the final evolved individual.

[0120] In some alternative implementations, step S3042 includes: Step c1: Use the individual evolution model to update the initial individual to obtain the evolved individual corresponding to the initial individual.

[0121] Step c2: Merge multiple initial models using the evolved individuals to obtain the evolutionary merged model corresponding to the evolved individuals and the fitness value corresponding to the evolutionary merged model.

[0122] Step c3 updates the evolutionary individuals and their corresponding fitness values ​​to the initial history set, thus obtaining the candidate history set.

[0123] Step c4: Use the candidate history set as the initial history set for the next iteration, the individual evolution model as the initial individual evolution model for the next iteration, and the third-ranked candidate individual with the highest fitness in the candidate history set as the initial individual for the next iteration. Then return to the step of updating the initial individual evolution model using the initial history set to obtain the individual evolution model and continue updating the candidate history set until the inner loop stops, and obtain the current history set.

[0124] Since the initial history set consists of initial individuals and their corresponding fitness values, it can include P initial individuals. After updating the initial individuals using an individual evolution model, P evolved individuals are obtained. Then, after updating the initial history set with the evolved individuals and their corresponding fitness values, the resulting candidate history set can include 2P individuals. At this point, the third-ranked candidate individual with the highest fitness can be selected from the candidate history set as the initial individual for the next iteration, where the third-ranked individual can be P.

[0125] Within the inner loop, an early stop mechanism can be configured. For example, if continuous... The improvement in optimal fitness of each generation was less than the threshold. If the condition is met, the inner loop can be terminated. Otherwise, iteration can continue until the required number of iterations for the inner loop is met, at which point the inner loop can be terminated.

[0126] By generating evolved individuals through an individual evolution model, updating the evolved individuals and their corresponding fitness values ​​to the initial history set, and continuing this closed-loop process of iteration, we can continuously learn the optimal merging coefficient rules from historical high-performing individuals, constantly eliminating low-quality individuals and retaining high-performance individuals, so that the merging coefficient gradually converges towards the optimal direction for multiple tasks. At the same time, by iteratively updating the history set and updating the individual evolution model, we can improve search efficiency, avoid redundant calculations, and prevent premature convergence, ultimately obtaining a target merging model with stronger adaptability and better comprehensive performance across multiple domains.

[0127] Step S3043: Using the first number of individuals with the highest fitness value in the current historical set, merge multiple initial models to obtain a first number of candidate merged models. The first number is the same as the number of initial models. Please refer to the previous text for details.

[0128] Step S3044: The first number of candidate merging models are used as the initial models for the next iteration, and the process of generating initial individuals composed of the merging coefficients corresponding to each initial model using a preset encoding strategy is continued to update the current historical set until the outer loop stops, thus obtaining the global historical set.

[0129] In each search iteration, not only are the merging coefficients optimized, but representative and high-performing candidate merging models are also identified and extracted from the current high-performance fusion models. These candidate models are then used to dynamically replace the initial model. Simultaneously, the parameters of the individual evolutionary models are updated to adapt to the new initial model. This approach allows the capabilities of the initial model and the search strategy to evolve together, continuously expanding and optimizing the search space. This systematically breaks through the performance limitations of the initial model set and discovers superior fusion architectures.

[0130] In addition, in some cases, a new initial model can be introduced together with the candidate merging model as the initial model for the next iteration, and the process of generating initial individuals composed of the merging coefficients corresponding to each initial model using a preset encoding strategy can continue to update the current history set until the outer loop stops and the global history set is obtained.

[0131] As a specific example, the outer loop stopping condition can be that the current evolution round of the outer loop has reached the preset number of outer loop iterations, or that the current computational cost has exceeded the total computational budget.

[0132] Step S305: Using the individual with the highest fitness value in the global history set, multiple initial models are merged to obtain the target merged model. The target merged model is used to perform tasks in multiple application domains. For details, please refer to [link to details]. Figure 2 Step S205 of the illustrated embodiment will not be described again here.

[0133] The evolutionary model merging method provided in this embodiment significantly improves search efficiency and reduces the number of evaluations by replacing fixed random perturbations with generative learning of high-performance merging coefficient distributions. Furthermore, by employing a dual-generator approach and cycle consistency constraints, combined with preference learning for both winning and losing individuals, it can stably learn and maintain diversity under sparse feedback, enhancing merging stability and robustness. In multiple rounds of evolution, candidate merging models dynamically replace the initial model from the previous evolutionary round, allowing the initial model's capabilities and search strategy to co-evolve, improving generalization performance and breaking through the performance ceiling of a fixed initial model. Under the same computational budget, higher merging model performance and better cross-task generalization are achieved.

[0134] This embodiment provides a question-and-answer method that can be used on a computer or a mobile terminal. Figure 4 This is a flowchart of a question-and-answer method according to an embodiment of the present invention, such as... Figure 4 As shown, the process includes the following steps: Step S401: Receive the text of the question to be answered.

[0135] As a specific example, the target merging model obtained in this application can provide a user interface, through which a user can input the text of the question to be answered into a computer or mobile terminal. The computer or mobile terminal can then respond to the user's input and receive the text of the question to be answered. Here, the text of the question to be answered can be the question text corresponding to the application domain of each initial model.

[0136] Step S402: Using the target merging model, process the text of the question to be answered to obtain the target answer corresponding to the text of the question to be answered.

[0137] Because the target merging model integrates the domain-specific knowledge and processing capabilities of each initial model through evolution-optimized merging coefficients, it can simultaneously meet the reasoning needs of multiple domain tasks. Therefore, by using this target merging model to process the input question text, it can automatically adapt to the domain to which the text belongs and perform accurate reasoning, ultimately outputting accurate, reliable, and target answers that meet the business needs of multiple scenarios.

[0138] As a concrete example, the initial models are defined as a first initial model, a second initial model, and a third initial model. The first initial model can be used to perform tasks in the medical field, the second initial model can be used to perform tasks in the education field, and the third initial model can be used to perform tasks in the financial field. The resulting target merging model can then simultaneously handle tasks in the medical, educational, and financial fields. Correspondingly, the question text to be answered can be a question text from any application domain within the medical, educational, and financial fields. The target merging model can process the question text to obtain the target answer corresponding to the question text.

[0139] The question-answering method provided in this embodiment receives the text of the question to be answered and processes it using a target merging model that integrates capabilities from multiple domains. It can achieve unified, efficient and accurate responses to questions from multiple domains without having to deploy multiple models separately for different domains. This reduces system deployment and maintenance costs while improving the versatility and response efficiency of question-answering processing.

[0140] As a specific application embodiment of the present invention, such as Figure 6 The diagram illustrates the specific process for finding the optimal merging coefficients.

[0141] Step S1, for the first wheel( (For the initial round), calculate the task vector corresponding to each initial model. .

[0142] Step S2: Generate the initial population using the average merging strategy, the model one-hot strategy, and the random sampling strategy. This is to ensure a broad exploration of the coefficient space.

[0143] Step S3, for the p-th initial individual According to the formula The initial merged model was obtained and validated on the validation set. The fitness of the initial merging model is evaluated above. All Constructing the initial history set .

[0144] Step S4, using the initial history set The twin generator (i.e., the initial individual evolutionary model) is trained, and the trained forward generator is used to update the initial individual evolutionarily to obtain the evolved individual. and in the verification set The evolutionary merging model corresponding to the evolved individuals is evaluated to obtain the evolutionary merging model corresponding to the evolutionary merging model. Then, and Update to the initial history set , thus obtaining the candidate history set And thus from the candidate historical set The P individuals with the highest fitness values ​​are selected as the initial individuals for the next evolutionary round, and the candidate history set is... The candidate history set is used as the initial history set for the next iteration, and the dual generator (i.e., individual evolution model) trained in the current round is used as the initial individual evolution model for the next iteration. The candidate history set is updated in this way until the inner loop stopping condition is met, and the current history set is obtained.

[0145] Step S5, when the first After the inner loop of a cycle ends, the initial model is updated. Specifically, this involves updating the historical set accumulated in the current cycle. Among them, the one with the highest fitness (i.e., the optimal one) is selected. Combination coefficient Utilize the one with the highest fitness Combine the merging coefficients and the initial model of the current round to synthesize N new merged models, which will serve as the initial models for the next round. Simultaneously, based on the new initial model, the task vector for the next round of search is recalculated. .

[0146] Step S6, update r to r+1, and use the updated initial model. and the corresponding task vector As input, the population is reinitialized, and the process returns to step S3 to begin a new round of inner loop search. When the preset... The algorithm terminates after an external iteration or when a global termination condition is met (such as exceeding the total computational budget). Finally, the merging coefficient with the highest fitness (i.e., the final best solution) is selected from the accumulated global history set across all iterations. and its corresponding merging model As output.

[0147] This embodiment also provides an evolution-based model merging apparatus for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0148] This embodiment provides an evolution-based model merging device, such as... Figure 7 As shown, it includes: The generation module 701 is used to generate initial individuals composed of the merging coefficients corresponding to each initial model using a preset encoding strategy. Multiple initial models are trained based on the same base model, and each initial model performs tasks in different application domains.

[0149] The first merging module 702 is used to merge multiple initial models using the initial individuals to obtain the initial merged model corresponding to the initial individuals and the fitness value corresponding to the initial merged model.

[0150] Module 703 is used to construct an initial history set using the initial individuals and their corresponding fitness values.

[0151] Evolutionary iteration module 704 is used to perform evolutionary iteration on the initial individuals using the individual evolution model in order to update the initial history set and obtain the global history set.

[0152] The second merging module 705 is used to merge multiple initial models using the individual with the highest fitness value in the global history set to obtain a target merged model, which is used to perform tasks in multiple application domains.

[0153] In some optional implementations, the evolution iteration module 704 is further configured to update the initial individual evolution model using the initial history set to obtain an individual evolution model; update the initial individuals using the individual evolution model to update the initial history set to obtain the current history set; merge multiple initial models using the first number of candidate individuals with the highest fitness values ​​in the current history set to obtain a first number of candidate merged models, the first number being the same as the number of initial models; use the first number of candidate merged models as the initial models for the next iteration, and continue to execute the step of generating initial individuals composed of the merging coefficients corresponding to each initial model using a preset encoding strategy to continue updating the current history set until the outer loop stopping condition is reached to obtain the global history set.

[0154] In some optional implementations, the evolution iteration module 704 is further configured to select the second number of individuals with the highest fitness value in the initial history set as the winning individuals and construct the winning set corresponding to the winning individuals; select the second number of individuals with the lowest fitness value in the initial history set as the losing individuals and construct the losing set corresponding to the losing individuals; and update the initial individual evolution model using the comparison relationship between the winning set and the losing set to obtain the individual evolution model.

[0155] In some optional implementations, the initial individual evolution model includes an initial forward generator and an initial backward generator; the initial forward generator is used to map inferior individuals to superior regions; the initial backward generator is used to map superior individuals to inferior regions; the evolution iteration module 704 is also used to pair the superior and inferior sets to obtain multiple individual pairs; for each individual pair, the superior individual in the individual pair is input to the initial backward generator, and the fitted inferior individual output by the initial backward generator is input to the initial forward generator to obtain the restored fitted superior individual output by the initial forward generator; the inferior individual in the individual pair is input to the initial forward generator, and the fitted superior individual output by the initial forward generator is input to the initial backward generator to obtain the restored fitted inferior individual output by the initial backward generator; the loss value is obtained by using the difference between the restored fitted superior individual and the restored fitted inferior individual corresponding to the individual pair; the model parameters of the initial forward generator and the initial backward generator are adjusted using the loss values ​​corresponding to all individual pairs to obtain the individual evolution model.

[0156] In some optional implementations, the evolutionary iteration module 704 is further configured to construct a first loss value by utilizing the difference between the winning individual in the refit and the winning individual in the individual pair; construct a second loss value by utilizing the difference between the losing individual in the refit and the losing individual in the individual pair; construct a cycle consistency loss value by utilizing the fusion result between the first loss value and the second loss value; obtain the centroid corresponding to the winning set; construct a guiding loss value by utilizing the difference between the centroid and the winning individual in the refit; and construct a loss value by utilizing the fusion result between the cycle consistency loss value and the guiding loss value.

[0157] In some optional implementations, the evolution iteration module 704 is further configured to: update the initial individual using the individual evolution model to obtain the evolved individual corresponding to the initial individual; merge multiple initial models using the evolved individual to obtain the evolution merge model corresponding to the evolved individual and the fitness value corresponding to the evolution merge model; update the evolved individual and the fitness value corresponding to the evolved individual to the initial history set to obtain the candidate history set; use the candidate history set as the initial history set for the next iteration, use the individual evolution model as the initial individual evolution model for the next iteration, and use the third-highest fitness candidate individual in the candidate history set as the initial individual for the next iteration, and return to the step of updating the initial individual evolution model using the initial history set to obtain the individual evolution model to continue updating the candidate history set until the inner loop stopping condition is met to obtain the current history set.

[0158] In some optional implementations, the preset encoding strategy includes an average merging strategy, a model one-hot strategy, and a random sampling strategy; the generation module 701 is further configured to generate a first initial individual using the average merging strategy; generate a second initial individual using the model one-hot strategy; generate a third initial individual using the random sampling strategy; and obtain an initial individual using the merging results of the first initial individual, the second initial individual, and the third initial individual.

[0159] In some optional implementations, the first merging module 702 is further configured to obtain the base model parameters corresponding to the base model and the initial model parameters corresponding to each initial model; obtain the model parameter offset of each initial model by using the difference between each initial model parameter and the base model parameter; perform weighted merging of the model parameter offsets of all initial models by using the merging coefficient represented by the initial individuals to obtain the parameter fusion offset; superimpose the parameter fusion offset onto the base model parameters to obtain the merged parameters; construct an initial merged model based on the model structure of the base model using the merged parameters; and obtain the fitness value corresponding to the initial merged model by using the performance index of the initial merged model on the validation set.

[0160] The evolution-based model merging apparatus provided in this embodiment of the invention can execute the evolution-based model merging method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the various modules and units described above are the same as in the corresponding embodiments described above, and will not be repeated here.

[0161] This embodiment also provides a question-and-answer device, such as... Figure 8 As shown, it includes: The receiving module 801 is used to receive the text of the question to be answered.

[0162] The processing module 802 is used to process the text of the question to be answered using the target merging model to obtain the target answer corresponding to the text of the question to be answered.

[0163] The question-answering device provided in this embodiment of the invention can execute the question-answering method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the various modules and units described above are the same as in the corresponding embodiments described above, and will not be repeated here.

[0164] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.

[0165] The following is a detailed reference. Figure 9The diagram illustrates a structural schematic suitable for implementing an electronic device according to embodiments of the present invention. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 901, which can perform various appropriate actions and processes based on a program stored in read-only memory (ROM) 902 or a program loaded from memory 908 into random access memory (RAM) 903. RAM 903 also stores various programs and data required for the operation of the electronic device. The processor 901, ROM 902, and RAM 903 are interconnected via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0166] Typically, the following devices can be connected to I / O interface 905: input devices 906 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 907 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 908 including, for example, magnetic tapes, hard disks, etc.; and communication devices 909. Communication device 909 allows electronic devices to exchange data via wireless or wired communication with other devices. Although Figure 9 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.

[0167] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 909, or installed from a memory 908, or installed from a ROM 902. When the computer program is executed by the processor 901, it performs the functions defined in the evolution-based model merging method or question-answering method of the embodiments of the present invention.

[0168] Figure 9 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of the present invention.

[0169] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code originally stored on a remote storage medium or a non-transitory machine-readable storage medium and subsequently stored on a local storage medium after being downloaded via a network. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the evolution-based model merging method or question-and-answer method shown in the above embodiments is implemented.

[0170] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0171] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. An evolution-based model merging method, characterized in that, The method includes: Using a preset encoding strategy, an initial individual is generated, which is composed of the merging coefficients corresponding to each initial model. Multiple initial models are trained based on the same base model, and each initial model performs tasks in different application domains. The initial individuals are used to merge multiple initial models to obtain an initial merged model corresponding to the initial individuals and a fitness value corresponding to the initial merged model. An initial history set is constructed using the initial individual and its corresponding fitness value. The initial individuals are iterated through an individual evolution model to update the initial history set, thereby obtaining the global history set; Using the individual with the highest fitness value in the global history set, multiple initial models are merged to obtain a target merged model, which is used to perform tasks in multiple application domains.

2. The method according to claim 1, characterized in that, The process of using an individual evolutionary model to iterate the evolution of the initial individuals to update the initial history set and obtain a global history set includes: The initial individual evolution model is updated using the initial history set to obtain the individual evolution model; The initial individual is updated using the individual evolution model to update the initial history set, thus obtaining the current history set; Using the first number of candidate individuals with the highest fitness values ​​in the current historical set, multiple initial models are merged to obtain the first number of candidate merged models, where the first number is the same as the number of initial models; The first number of candidate merging models are used as the initial models for the next iteration, and the process of generating initial individuals composed of the merging coefficients corresponding to each initial model using a preset encoding strategy is continued to update the current history set until the outer loop stops, thus obtaining the global history set.

3. The method according to claim 2, characterized in that, The step of updating the initial individual evolution model using the initial history set to obtain the individual evolution model includes: The second-highest fitness value of individuals in the initial historical set is selected as the winning individual, and the winning set corresponding to the winning individual is constructed. The second number of individuals with the lowest fitness value in the initial history set are identified as the weakest individuals, and a weak set corresponding to the weakest individuals is constructed. The initial individual evolution model is updated by using the comparison relationship between the winning set and the losing set to obtain the individual evolution model.

4. The method according to claim 3, characterized in that, The initial individual evolution model includes an initial forward generator and an initial backward generator; the initial forward generator is used to map inferior individuals to superior regions; the initial backward generator is used to map superior individuals to inferior regions. The step of updating the initial individual evolution model by utilizing the comparison relationship between the winning set and the losing set to obtain the individual evolution model includes: The winning set and the losing set are paired to obtain multiple pairs of individuals. For each pair of individuals, the winning individual in the pair is input into the initial reverse generator, and the poorly fitting individual output by the initial reverse generator is input into the initial forward generator to obtain the restored fit winning individual output by the initial forward generator. The inferior individuals in the individual pair are input into the initial forward generator, and the well-fitting individuals output by the initial forward generator are input into the initial backward generator to obtain the restored inferior individuals output by the initial backward generator. The loss value is obtained by using the difference between the individual pair and the corresponding well-fitting and poorly-fitting individuals. By using the loss values ​​corresponding to all the individual pairs, the model parameters of the initial forward generator and the initial backward generator are adjusted to obtain the individual evolution model.

5. The method according to claim 4, characterized in that, The step of obtaining the loss value by utilizing the difference between the well-fitting and poor-fitting individuals corresponding to the individual pairs includes: A first loss value is constructed by utilizing the difference between the winning individual in the restored fit and the winning individual in the individual pair. A second loss value is constructed by utilizing the difference between the reconstructed and fitted inferior individuals and the inferior individuals in the individual pair; A cycle consistency loss value is constructed using the fusion result between the first loss value and the second loss value; Obtain the centroid corresponding to the winning set; A guiding loss value is constructed using the difference between the centroid and the best-fitting individual. The loss value is constructed using the fusion result between the cycle consistency loss value and the bootstrapping loss value.

6. The method according to claim 2, characterized in that, The step of using the individual evolution model to update the initial individual, thereby updating the initial history set and obtaining the current history set, includes: The initial individual is updated using the individual evolution model to obtain the evolved individual corresponding to the initial individual; The evolutionary individuals are used to merge multiple initial models to obtain the evolutionary merged model corresponding to the evolutionary individuals and the fitness value corresponding to the evolutionary merged model. The evolutionary individual and its corresponding fitness value are updated to the initial history set to obtain the candidate history set. The candidate history set is used as the initial history set for the next iteration, the individual evolution model is used as the initial individual evolution model for the next iteration, and the third-ranked candidate individual with the highest fitness in the candidate history set is used as the initial individual for the next iteration. The process then returns to the step of updating the initial individual evolution model using the initial history set to obtain the individual evolution model, and continues to update the candidate history set until the inner loop stops, thus obtaining the current history set.

7. The method according to any one of claims 1 to 6, characterized in that, The preset encoding strategies include average merging strategy, model one-hot strategy, and random sampling strategy; The step of generating an initial individual composed of the merging coefficients corresponding to each initial model using a preset encoding strategy includes: The first initial individual is generated using the average merging strategy described above; The second initial individual is generated using the model's one-heat strategy; The third initial individual is generated using the aforementioned random sampling strategy; The initial individual is obtained by merging the first initial individual, the second initial individual, and the third initial individual.

8. The method according to any one of claims 1 to 6, characterized in that, The step of merging multiple initial models using the initial individuals to obtain an initial merged model corresponding to the initial individuals and a fitness value corresponding to the initial merged model includes: Obtain the base model parameters corresponding to the base model, and the initial model parameters corresponding to each initial model; The model parameter offset of each initial model is obtained by using the difference between each initial model parameter and the base model parameter; Using the merging coefficients represented by the initial individuals, the model parameter offsets of all the initial models are weighted and merged to obtain the parameter fusion offset; The parameter fusion offset is superimposed on the base model parameters to obtain the merged parameters; Based on the model structure of the base model, the initial merge model is constructed using the merge parameters; The fitness value of the initial merging model is obtained by using the performance metrics of the initial merging model on the validation set.

9. A question-and-answer method, characterized in that, The method includes: Receive the text of the question to be answered; Using the target merging model described in any one of claims 1 to 8, the text of the question to be answered is processed to obtain the target answer corresponding to the text of the question to be answered.

10. An electronic device, characterized in that, include: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, the processor executing the computer instructions to perform the evolution-based model merging method of any one of claims 1 to 8, or the question-answering method of claim 9.