A model-independent meta-learning method, device, equipment and storage medium

By generating copies of the meta-model for inner and outer loop training, and combining gradient clipping and loss dropout strategies, the problems of gradient explosion, overfitting, and inconsistent learning rates in meta-learning are solved, thus improving training performance.

CN118428454BActive Publication Date: 2026-07-03WUHAN UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WUHAN UNIV
Filing Date
2024-04-23
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

In the meta-learning process, there are problems such as gradient explosion and gradient vanishing, overfitting and noise sensitivity, and inconsistent learning rate control, which lead to poor training results.

Method used

By generating a copy of the meta-model, an inner loop is trained to determine the weighted average loss and gradient. After the outer loop is trained, the learning rate is updated. By combining gradient pruning and loss discarding strategies, the learning rate of the inner and outer loops decays synchronously.

Benefits of technology

It improves the training effect of meta-learning methods, solves the problems of gradient explosion, overfitting and inconsistent learning rates, and achieves a more stable training process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118428454B_ABST
    Figure CN118428454B_ABST
Patent Text Reader

Abstract

This invention provides a model-independent meta-learning method, apparatus, device, and storage medium. The model-independent meta-learning method includes: Step S1: acquiring sample data and a meta-model; Step S2: generating several meta-model replicas based on the meta-model, performing inner loop training on each meta-model replica using the sample data and a preset training task, and determining the weighted average loss and weighted average gradient of each meta-model replica; Step S3: determining the task loss average and gradient average based on the weighted average loss and weighted average gradient of all meta-model replicas, and performing outer loop training on the meta-model based on the gradient average. This invention effectively improves the performance of model-independent meta-learning methods and solves the problem of poor training results in existing related technologies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of meta-learning technology, and in particular to a model-independent meta-learning method, apparatus, device, and storage medium. Background Technology

[0002] With the development of deep learning technology, especially in the field of meta-learning, effectively extracting general knowledge from multiple related tasks and quickly adapting to new tasks has become a key challenge. Meta-learning aims to learn a generalized learning strategy from a large number of different "few-shot" tasks, so as to quickly achieve good performance when faced with unseen new tasks. However, in the process of meta-learning, models often face a series of problems:

[0003] Gradient explosion and gradient vanishing problems: In multi-layer neural networks, the dynamic range of gradients across different layers can become extremely large, leading to training instability or even divergence. In meta-learning scenarios, the parameters of multi-layer neural networks need to be shared during cross-task training, which further increases the dynamic range of gradients. Existing weighted averaging methods alleviate this problem to some extent, but the effect is not significant.

[0004] Overfitting and noise sensitivity: Meta-learning is often used in few-shot learning. When dealing with tasks with a small number of samples, over-reliance on individual samples can lead to model overfitting. Existing methods using weighted averaging or dynamic learning rates can alleviate this problem, but the results are not ideal.

[0005] Inconsistent learning rate control: Traditional learning rate settings may help the model converge quickly in the early stages of training, but they are prone to getting stuck in local optima or oscillations in the later stages. Therefore, a learning rate decay strategy is particularly important. This means dynamically adjusting the learning rate based on the global optimization state during task training, allowing the model to explore quickly with a larger learning rate in the initial stage, and then approach the optimal solution with finer steps in later stages. However, in meta-learning scenarios, due to the implicit influence between the learning rates of the inner and outer loops in model-independent meta-learning methods, existing learning rate decay strategies do not take this implicit relationship into account. Instead, they apply different learning rate decay strategies to the outer and inner loops respectively. This inconsistency in the learning step size between the inner and outer loops may cause the outer loop meta-model to deviate from the overall optimal direction.

[0006] There is currently no good solution to the problem of poor training results in existing related technologies. Summary of the Invention

[0007] This invention provides a model-independent meta-learning method, apparatus, device, and storage medium to address the shortcomings of poor training results in existing technologies and improve the performance of model-independent meta-learning methods.

[0008] In a first aspect, the present invention provides a model-independent meta-learning method, comprising:

[0009] Step S1: Obtain sample data and meta-model;

[0010] Step S2: Generate several meta-model replicas based on the meta-model, and perform inner loop training on each meta-model replica using the sample data and a preset training task to determine the weighted average loss and weighted average gradient of each meta-model replica.

[0011] Step S3: Based on the weighted average loss and weighted average gradient of all the meta-model replicas, determine the average task loss and average gradient, and perform outer loop training on the meta-model according to the average gradient.

[0012] Step S4: Based on the current outer loop training round, update the outer loop learning rate of the meta-model and update the inner loop learning rate of the meta-model;

[0013] Step S5: Repeat steps S2 to S4 until the number of rounds of the outer loop training reaches the preset number of outer loops, and determine the target meta-model.

[0014] According to a model-independent meta-learning method provided by the present invention, before the meta-model generates several meta-model copies, the method includes: initializing the model parameters of the meta-model.

[0015] According to the model-independent meta-learning method provided by the present invention, the sample data includes a support set and a query set;

[0016] In step S2, for each copy of the meta-model, the inner loop training includes the following execution steps:

[0017] Step S2.1: Train the meta-model replica using the support set to determine the query set loss and model gradient of the trained meta-model replica on the current query set;

[0018] Step S2.2: Determine whether the loss of the query set exceeds a preset loss threshold. If the determination is yes, and the number of gradient pruning operations of the meta-model replica has not reached the maximum number of pruning operations in a single training session, then perform gradient pruning on the meta-model replica. Otherwise, discard the meta-model replica due to loss and proceed to step S2.4.

[0019] Step S2.3: Record the query set loss and model gradient of the metamodel replica on the current query set, and clear the model gradient of the current metamodel replica;

[0020] Step S2.4: Repeat steps S2.1 to S2.3 until the number of rounds of inner loop training of the meta-model reaches the preset number of inner loops, and determine the weighted average loss and weighted average gradient of the meta-model replica based on the query set loss and model gradient of all records.

[0021] According to a model-independent meta-learning method provided by the present invention, in step S2.2, gradient pruning is performed on the meta-model copy, including:

[0022] Adjust the model parameters of the metamodel replica to the level before the current training of the metamodel replica, retrain the metamodel replica, and determine the query set loss and model gradient of the metamodel replica on the current query set.

[0023] The model gradient of the meta-model copy is updated according to a preset decay factor.

[0024] According to a model-independent meta-learning method provided by the present invention, in step S3, the average task loss and the average gradient are determined based on the weighted average loss and the weighted average gradient of all the meta-model replicas, including:

[0025] Calculate the average of the weighted average loss of all the meta-model replicas, and use it as the average task loss of the meta-model replicas;

[0026] Calculate the weighted average gradient of all the metamodel replicas, and use it as the average gradient of the metamodel replicas.

[0027] According to a model-independent meta-learning method provided by the present invention, in step S4, the outer loop learning rate of the meta-model is updated based on the current outer loop training epoch, including:

[0028] The current outer loop learning rate of the meta-model is determined based on the current outer loop training rounds, the preset initial outer loop learning rate, and the preset number of outer loops.

[0029] According to a model-independent meta-learning method provided by the present invention, in step S4, updating the inner loop learning rate of the meta-model includes:

[0030] The decay ratio is determined based on the current outer loop learning rate of the meta-model and the preset initial outer loop learning rate;

[0031] The inner loop learning rate of the meta-model is determined based on the attenuation ratio and the preset initial inner loop learning rate.

[0032] Secondly, the present invention also provides a model-independent meta-learning device, comprising:

[0033] The acquisition module is used to acquire sample data and the meta-model.

[0034] The inner loop module is used to generate several meta-model replicas based on the meta-model, perform inner loop training on each meta-model replica using the sample data and a preset training task, and determine the weighted average loss and weighted average gradient of each meta-model replica.

[0035] The outer loop module is used to determine the average task loss and average gradient based on the weighted average loss and weighted average gradient of all the meta-model copies, and to perform outer loop training on the meta-model based on the average gradient.

[0036] An update module is used to update the outer loop learning rate of the meta-model and the inner loop learning rate of the meta-model based on the current outer loop training round.

[0037] Thirdly, the present invention 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 model-independent meta-learning method as described in the first aspect above.

[0038] Fourthly, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the model-independent meta-learning method as described in the first aspect above.

[0039] Fifthly, the present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the model-independent meta-learning method as described in the first aspect above.

[0040] The model-independent meta-learning method provided by this invention adjusts and updates the model parameters of the meta-model by synthesizing the model parameters obtained after training all meta-model copies, enabling the meta-model to achieve better results in performing the aforementioned training tasks. Furthermore, this invention addresses the gradient explosion problem in the inner loop through gradient pruning, the insufficient loss and gradient loss problems in the inner loop through loss discarding, and the inconsistent learning rate control between the inner and outer loops through synchronous learning rate decay. These combined strategies improve the performance of the model-independent meta-learning method and solve the problem of poor training results in existing related technologies. Attached Figure Description

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

[0042] Figure 1 This is a flowchart of the model-independent meta-learning method in this invention;

[0043] Figure 2 This is a flowchart of a model-independent meta-learning method in one embodiment of the present invention;

[0044] Figure 3 This is a flowchart of gradient pruning of the meta-model copy in this invention;

[0045] Figure 4 This is a flowchart of the loss-discarding process for meta-model copies in this invention;

[0046] Figure 5 This is a schematic diagram of the loss curve of the meta-model obtained without using this method for training;

[0047] Figure 6 This is a schematic diagram of the loss curve of the target meta-model obtained by training using this method;

[0048] Figure 7 This is a structural block diagram of the model-independent meta-learning device in this invention;

[0049] Figure 8 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

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

[0051] This invention provides a model-independent meta-learning method, such as... Figure 1 As shown, Figure 1 This is a flowchart of the model-independent meta-learning method in this invention, which includes:

[0052] Step S1: Obtain sample data and meta-model.

[0053] Step S2: Generate several meta-model replicas based on the meta-model, and perform inner loop training on each meta-model replica using sample data and a preset training task to determine the weighted average loss and weighted average gradient of each meta-model replica.

[0054] Step S3: Based on the weighted average loss and weighted average gradient of all meta-model replicas, determine the average task loss and average gradient, and perform outer loop training on the meta-model according to the average gradient.

[0055] Step S4: Based on the current outer loop training round, update the outer loop learning rate of the meta-model and update the inner loop learning rate of the meta-model.

[0056] Step S5: Repeat steps S2 to S4 until the number of outer loop training rounds reaches the preset number of outer loops, and determine the target meta-model.

[0057] This method is a model-independent meta-learning approach, therefore applicable to most models in practical applications, and the category of meta-model is not specifically limited here. For example, meta-models include convolutional neural networks for image classification and recurrent neural networks for text classification; correspondingly, sample data include character image classification datasets with known categories and demand classification datasets with known categories. For the meta-model to be trained, sample data for training the meta-model is first obtained. Then, several meta-model copies are generated based on the meta-model. Generally, the model parameters of the meta-model copies are the same as the original meta-model. Furthermore, a corresponding training task is assigned to each meta-model copy. Therefore, by adjusting and updating the model parameters of the meta-model based on the combined model parameters obtained after training all meta-model copies, the meta-model can achieve better results in performing the various training tasks described above.

[0058] Specifically, firstly, each meta-model replica is trained through several rounds of inner loop training using sample data. Each round yields a loss value and gradient value for that meta-model replica. Based on the training results of all rounds, the weighted average loss and weighted average gradient for that meta-model replica can be determined. The weights for the weighted average loss and weighted average gradient can be determined as needed, such as using an exponential moving average weighted algorithm or an arithmetic average method. The weighted average loss characterizes the difference between the meta-model replica before and after this training, while the weighted average gradient characterizes the adjustment trend of the model parameters during this training. Then, based on the weighted average loss and weighted average gradient of all meta-model replicas, the average task loss and average gradient are determined. Since the average gradient is obtained by integrating all training tasks, training the meta-model based on the average gradient effectively improves its learning performance across all training tasks. Finally, based on the current training round of the meta-model, the outer loop learning rate and inner loop learning rate are updated to avoid inconsistencies in the adjustment of the inner and outer loop learning rates. Repeat the above steps to train the meta-model in the outer loop until the pre-set number of outer loop iterations is reached. Then, use the final meta-model as the target meta-model. This process improves the training performance of the meta-model across all training tasks, avoids inconsistencies in inner and outer learning rate adjustments, and solves the problem of poor training performance in existing related technologies.

[0059] To better leverage the basic framework of the meta-model for training and learning, some embodiments include initializing the model parameters of the meta-model before generating several copies based on the meta-model. These model parameters include the inner loop learning rate `in_lr` and the outer loop learning rate `out_lr`. Furthermore, while initializing the model parameters, relevant parameters during training can be set or initialized, such as the maximum number of gradient clipping iterations (`clip_num`), the gradient decay factor (`clip_p`), the dropout rate (`loss_drop_p`), the number of iterations in the inner loop (`M`), and the number of iterations in the outer loop (`N`).

[0060] In some embodiments, the sample data includes a support set and a query set. For example... Figure 2 As shown, Figure 2This is a flowchart of a model-independent meta-learning method in one embodiment of the present invention. In step S2, for each meta-model replica, the inner loop training includes the following steps: Step S2.1: Train the meta-model replica using the support set to determine the query set loss and model gradient of the trained meta-model replica on the current query set. Step S2.2: Determine whether the query set loss exceeds a preset loss threshold. If yes, and the gradient pruning count of the meta-model replica has not reached the maximum pruning count in a single training iteration, then perform gradient pruning on the meta-model replica; otherwise, discard the loss of the meta-model replica and proceed to step S2.4. Step S2.3: Record the query set loss and model gradient of the meta-model replica on the current query set, and clear the model gradient of the current meta-model replica. Step S2.4: Repeat steps S2.1 to S2.3 until the number of inner loop training iterations for the meta-model reaches the preset number of inner loop iterations, and determine the weighted average loss and weighted average gradient of the meta-model replica based on all recorded query set losses and model gradients.

[0061] For example, regarding the character image classification dataset mentioned above, suppose there is a character image classification dataset containing 500 categories, with 60 samples per category. The dataset is divided into 300 classification tasks, with five categories per task, five support sets per category, and 15 query sets per category. 250 of these classification task datasets are used as training tasks, and 50 are used as testing tasks. Each task contains five categories and a total of 100 images. Similarly, regarding the demand classification dataset mentioned above, suppose there is a demand classification dataset containing 20 categories, with 200 samples per category. The dataset is divided into 20 classification task datasets, with 10 categories per task, five support sets per category, and 15 query sets per category. 15 of these datasets are used as training tasks, and 5 are used as testing tasks.

[0062] Specifically, such as Figure 3 As shown, Figure 3 This is a flowchart of gradient pruning for the metamodel replica in this invention. Step S2.2, pruning the metamodel replica includes: adjusting the model parameters of the metamodel replica to the level before the current training iteration; retraining the metamodel replica using gradient descent; and determining the query set loss and model gradient of the metamodel replica on the current query set. The model gradient of the metamodel replica is then updated according to a preset decay factor. For example, the preset decay factor is clip_p. Assuming the current model gradient of the metamodel replica is G, the new model gradient is G*clip_p.

[0063] For loss discard operations, such as Figure 4 As shown, Figure 4This is a flowchart of the loss discarding process for the meta-model replica in this invention. When the query set loss does not exceed the preset loss threshold in step S2.2, or the gradient pruning number of the meta-model replica has reached the maximum number of prunings in a single training session, the loss of the meta-model replica is discarded. That is, the query set loss and model gradient obtained in this round of training do not need to be recorded, and the process jumps directly to step S2.4.

[0064] In some embodiments, in step S3, determining the average task loss and average gradient based on the weighted average loss and weighted average gradient of all meta-model replicas includes: calculating the average of the weighted average loss of all meta-model replicas as the average task loss of the meta-model replicas; and calculating the weighted average gradient of all meta-model replicas as the average gradient of the meta-model replicas.

[0065] For example, the formula for calculating the average task loss is as follows:

[0066]

[0067] avg = sum / n

[0068] Where sum represents the summation result, specifically the summation of the weighted average loss over all meta-model replicas, loss i represents the weighted average loss obtained in the i-th round of inner loop training, n represents the number of inner loop rounds, and avg represents the average result, specifically referring to the average task loss of the meta-model replica.

[0069] Similarly, the formula for calculating the gradient mean is as follows:

[0070]

[0071] avg = sum / n

[0072] Where `sum` represents the summation result, specifically referring to the summation of the weighted average gradients over all metamodel replicas, and `gradient` represents the summation result. i represents the weighted average gradient obtained in the i-th round of inner loop training, n represents the number of inner loop rounds, and avg represents the average result, specifically referring to the average gradient of the meta-model replica.

[0073] In some embodiments, in step S4, the outer loop learning rate of the meta-model is updated based on the current outer loop training round, including: determining the current outer loop learning rate of the meta-model based on the current outer loop training round, the preset initial outer loop learning rate, and the preset number of outer loops.

[0074] For example, the cosine annealing algorithm can be used to update the outer loop learning rate of the meta-model. Let the current outer loop iteration be epoch, then the formula for calculating the current outer loop learning rate is as follows:

[0075]

[0076] Among them, out_lr epoch+1 `out_lr` is the current outer loop learning rate, `out_lr` is the preset initial outer loop learning rate, `epoch` is the current outer loop training epoch, and `N` is the number of outer loop iterations.

[0077] After calculating the current outer loop learning rate, the inner loop learning rate can be updated using a learning rate synchronization decay strategy to ensure that the inner loop learning rate remains consistent with the outer loop learning rate. Therefore, in some embodiments, updating the inner loop learning rate of the metamodel in step S4 includes: determining a decay ratio based on the current outer loop learning rate of the metamodel and a preset initial outer loop learning rate; and determining the inner loop learning rate of the metamodel based on the decay ratio and the preset initial inner loop learning rate.

[0078] For example, the decay ratio is first determined based on the current outer loop learning rate of the meta-model and the preset initial outer loop learning rate, using the following formula:

[0079]

[0080] Where p represents the attenuation ratio, out_lr epoch This represents the current outer loop learning rate, where out_lr is the preset initial outer loop learning rate.

[0081] Then, the product of the decay ratio and the preset initial inner loop learning rate is used as the new inner loop learning rate of the meta-model, as shown in the following formula:

[0082] in_lr epoch+1 =in_lr*p

[0083] Among them, in_lr epoch+1 This represents the new inner loop learning rate of the metamodel, where in_lr represents the preset initial inner loop learning rate.

[0084] In summary, this invention addresses the gradient explosion problem in the inner loop through a gradient pruning strategy, the undersized loss and gradient loss problems in the inner loop through a loss discarding strategy, and the inconsistent learning rate control between the inner and outer loops through a synchronous learning rate decay strategy. By combining these strategies, the performance of the model-independent meta-learning method is improved.

[0085] To verify the effectiveness of this method, a comparison was made between the meta-model obtained without training using this method and the target meta-model obtained using this method. The loss curves of the two models are shown below. Figure 5 and Figure 6 As shown, where, Figure 5 This is a schematic diagram of the loss curve of the meta-model obtained without using this method for training. Figure 6 This diagram illustrates the loss curve of the target meta-model trained using this method. In the figure, the horizontal axis represents the number of training epochs, the vertical axis represents the loss, curves A1 and A2 represent the training loss curves of the meta-model and the target meta-model, respectively, and curves B1 and B2 represent the validation loss curves of the meta-model and the target meta-model, respectively. As shown in the figure, although the loss values ​​of both training methods generally decrease with increasing training epochs, the training and validation losses of the meta-model trained without this method fluctuate significantly. Therefore, the learning performance of the meta-model trained without this method is not stable enough. In contrast, the training and validation losses of the target meta-model trained using this method remain almost consistent. Therefore, the learning performance of the target meta-model trained using this method is more stable, and the model-independent meta-learning method proposed in this invention has superior performance.

[0086] The model-independent meta-learning apparatus provided by the present invention is described below. The model-independent meta-learning apparatus described below can be referred to in correspondence with the model-independent meta-learning method described above.

[0087] This invention provides a model-independent meta-learning device, such as... Figure 7 As shown, Figure 7 This is a structural block diagram of the model-independent meta-learning device of the present invention, which includes:

[0088] Acquisition module 701 is used to acquire sample data and meta-model;

[0089] The inner loop module 702 is used to generate several meta-model replicas based on the meta-model, and to perform inner loop training on each meta-model replica using sample data and a preset training task to determine the weighted average loss and weighted average gradient of each meta-model replica.

[0090] The outer loop module 703 is used to determine the average task loss and average gradient based on the weighted average loss and weighted average gradient of all meta-model copies, and to perform outer loop training on the meta-model based on the average gradient.

[0091] Update module 704 is used to update the outer loop learning rate of the metamodel and the inner loop learning rate of the metamodel based on the current outer loop training epoch.

[0092] In use, this device first acquires sample data for training the meta-model through the acquisition module 701. Then, it creates several meta-model copies through the inner loop module 702. Generally, the model parameters of the meta-model copies are the same as the original meta-model. Furthermore, a corresponding training task is assigned to each meta-model copy. Therefore, by adjusting and updating the model parameters of the original meta-model based on the combined model parameters obtained after training all meta-model copies, the original meta-model can achieve better results in performing the aforementioned training tasks.

[0093] Specifically, firstly, the inner loop module 702 uses sample data to perform several rounds of inner loop training on each meta-model copy. Each round of training yields a loss value and gradient value for that meta-model copy. Based on the training results of all rounds, the weighted average loss and weighted average gradient for that meta-model copy can be determined. The weights for the weighted average loss and weighted average gradient can be determined as needed, such as using an exponential moving average weighted algorithm or an arithmetic average method. The weighted average loss characterizes the difference between the meta-model copy before and after this training, while the weighted average gradient characterizes the adjustment trend of the model parameters during this training. Then, the outer loop module 703 determines the average task loss and average gradient based on the weighted average loss and weighted average gradient of all meta-model copies. Since the average gradient is obtained by integrating all training tasks, training the meta-model based on the average gradient can effectively improve the meta-model's learning performance across all training tasks. Finally, the update module 704 updates the outer loop learning rate and inner loop learning rate of the meta-model according to the current training epochs, avoiding inconsistencies in the adjustment of the inner and outer learning rates. The above steps are repeated to train the meta-model in the outer loop until a pre-set number of outer loop iterations is reached, after which the final meta-model is used as the target meta-model. This device improves the training performance of the meta-model across all training tasks, avoids inconsistencies in the adjustment of the inner and outer learning rates, and solves the problem of poor training performance in existing related technologies.

[0094] Figure 8 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 8 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830, and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other via the communication bus 840. The processor 810 can call logical instructions in the memory 830 to execute a model-independent meta-learning method, which includes:

[0095] Step S1: Obtain sample data and meta-model;

[0096] Step S2: Generate several meta-model replicas based on the meta-model, and perform inner loop training on each meta-model replica using sample data and a preset training task to determine the weighted average loss and weighted average gradient of each meta-model replica.

[0097] Step S3: Based on the weighted average loss and weighted average gradient of all meta-model replicas, determine the average task loss and average gradient, and perform outer loop training on the meta-model according to the average gradient.

[0098] Step S4: Based on the current outer loop training round, update the outer loop learning rate of the meta-model and update the inner loop learning rate of the meta-model;

[0099] Step S5: Repeat steps S2 to S4 until the number of outer loop training rounds reaches the preset number of outer loops, and determine the target meta-model.

[0100] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0101] On the other hand, the present invention also provides a computer program product, the computer program product including a computer program, the computer program being able to be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer is able to execute the model-independent meta-learning method provided by the above methods, the method including: step S1: acquiring sample data and meta-model;

[0102] Step S2: Generate several meta-model replicas based on the meta-model, and perform inner loop training on each meta-model replica using sample data and a preset training task to determine the weighted average loss and weighted average gradient of each meta-model replica.

[0103] Step S3: Based on the weighted average loss and weighted average gradient of all meta-model replicas, determine the average task loss and average gradient, and perform outer loop training on the meta-model according to the average gradient.

[0104] Step S4: Based on the current outer loop training round, update the outer loop learning rate of the meta-model and update the inner loop learning rate of the meta-model;

[0105] Step S5: Repeat steps S2 to S4 until the number of outer loop training rounds reaches the preset number of outer loops, and determine the target meta-model.

[0106] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the model-independent meta-learning method provided by the above methods, the method comprising: step S1: acquiring sample data and a meta-model;

[0107] Step S2: Generate several meta-model replicas based on the meta-model, and perform inner loop training on each meta-model replica using sample data and a preset training task to determine the weighted average loss and weighted average gradient of each meta-model replica.

[0108] Step S3: Based on the weighted average loss and weighted average gradient of all meta-model replicas, determine the average task loss and average gradient, and perform outer loop training on the meta-model according to the average gradient.

[0109] Step S4: Based on the current outer loop training round, update the outer loop learning rate of the meta-model and update the inner loop learning rate of the meta-model;

[0110] Step S5: Repeat steps S2 to S4 until the number of outer loop training rounds reaches the preset number of outer loops, and determine the target meta-model.

[0111] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0112] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0113] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A model-independent meta-learning method, characterized in that, include: Step S1: Obtain sample data and meta-models; the meta-models include convolutional neural networks for image classification and recurrent neural network models for text classification; Correspondingly, the sample data includes character image classification datasets with known categories and demand classification datasets with known categories; Step S2: Generate several meta-model replicas based on the meta-model, and perform inner loop training on each meta-model replica using the sample data and a preset training task to determine the weighted average loss and weighted average gradient of each meta-model replica. Step S3: Based on the weighted average loss and weighted average gradient of all the meta-model replicas, determine the average task loss and average gradient, and perform outer loop training on the meta-model according to the average gradient. Step S4: Based on the current outer loop training round, update the outer loop learning rate of the meta-model, and based on the outer loop learning rate of the original model, update the inner loop learning rate of the meta-model. Step S5: Repeat steps S2 to S4 until the number of rounds of the outer loop training reaches the preset number of outer loops, and determine the target meta-model; The sample data includes a support set and a query set; In step S2, for each copy of the meta-model, the inner loop training includes the following execution steps: Step S2.1: Train the meta-model replica using the support set to determine the query set loss and model gradient of the trained meta-model replica on the current query set; Step S2.2: Determine whether the loss of the query set exceeds a preset loss threshold. If the determination is yes, and the number of gradient pruning operations of the meta-model replica has not reached the maximum number of pruning operations in a single training session, then perform gradient pruning on the meta-model replica. Otherwise, discard the meta-model replica due to loss and proceed to step S2.

4. Step S2.3: Record the query set loss and model gradient of the metamodel replica on the current query set, and clear the model gradient of the current metamodel replica; Step S2.4: Repeat steps S2.1 to S2.3 until the number of rounds of inner loop training of the meta-model reaches the preset number of inner loops, and determine the weighted average loss and weighted average gradient of the meta-model replica based on the query set loss and model gradient of all records. In step S2.2, gradient pruning is performed on the meta-model copy, including: Adjust the model parameters of the metamodel replica to the level before the current training of the metamodel replica, retrain the metamodel replica, and determine the query set loss and model gradient of the metamodel replica on the current query set. The model gradient of the meta-model copy is updated according to a preset decay factor.

2. The model-independent meta-learning method according to claim 1, characterized in that, Before generating several copies of the metamodel based on the metamodel, the process includes: initializing the model parameters of the metamodel.

3. The model-independent meta-learning method according to claim 1, characterized in that, In step S3, based on the weighted average loss and weighted average gradient of all the meta-model replicas, the task loss average and gradient average are determined, including: Calculate the average of the weighted average loss of all the meta-model replicas, and use it as the average task loss of the meta-model replicas; Calculate the average of the weighted average gradients of all the metamodel replicas, and use it as the average gradient of the metamodel replicas.

4. The model-independent meta-learning method according to claim 1, characterized in that, In step S4, the outer loop learning rate of the meta-model is updated based on the current outer loop training epoch, including: The current outer loop learning rate of the meta-model is determined based on the current outer loop training rounds, the preset initial outer loop learning rate, and the preset number of outer loops.

5. The model-independent meta-learning method according to claim 1, characterized in that, In step S4, the inner loop learning rate of the meta-model is updated, including: The decay ratio is determined based on the current outer loop learning rate of the meta-model and the preset initial outer loop learning rate; The inner loop learning rate of the meta-model is determined based on the attenuation ratio and the preset initial inner loop learning rate.

6. A model-independent meta-learning device for implementing the model-independent meta-learning method according to any one of claims 1-5, characterized in that, include: The acquisition module is used to acquire sample data and the meta-model. The inner loop module is used to generate several meta-model replicas based on the meta-model, perform inner loop training on each meta-model replica using the sample data and a preset training task, and determine the weighted average loss and weighted average gradient of each meta-model replica. The outer loop module is used to determine the average task loss and average gradient based on the weighted average loss and weighted average gradient of all the meta-model copies, and to perform outer loop training on the meta-model based on the average gradient. An update module is used to update the outer loop learning rate of the meta-model and the inner loop learning rate of the meta-model based on the current outer loop training round.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the model-independent meta-learning method as described in any one of claims 1 to 5.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the model-independent meta-learning method as described in any one of claims 1 to 5.