Multi-target neural architecture search method and system based on gradient similarity hypernetwork

Through the hypernet method based on gradient similarity and PCGrad projection method, the high consumption of computing resource and gradient conflict problems of multi-objective optimization in neural architecture search are solved, efficient resource utilization and performance improvement are achieved, and an efficient and flexible Neural network architecture design scheme.

CN119180305AActive Publication Date: 2024-12-24NANJING UNIV OF INFORMATION SCI & TECH

Patent Information

Application Number
CN202411700143.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-26
Publication Date
2024-12-24
Estimated Expiration
2044-11-26

AI Technical Summary

Technical Problem

The existing neural architecture search methods consume high computing resources in multi-objective optimization, and traditional random sampling and gradient conflict processing are unstable, making it difficult to improve resource utilization efficiency and performance.

Method used

Using a hypernet method based on gradient similarity, the sampling probability and gradient conflict processing of subnets are optimized through gradient norm importance sampling and PCGrad projection method, a multi-objective neural architecture search system is constructed, and the hypernet sharing weight and NSGA-III are used. The algorithm realizes efficient resource utilization and multi-objective balanced optimization.

Benefits of technology

It significantly reduces the computational cost and time of neural architecture search, improves resource utilization and overall performance, achieves the optimization of performance balanced under multiple goals, and enhances the adaptability and practicality of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119180305A_ABST
    Figure CN119180305A_ABST
Patent Text Reader

Abstract

The invention provides a multi-target neural architecture search method and system based on a gradient similarity hypernet, and the method comprises the steps: constructing a hypernet, and generating a shared weight through training; in the training process, a gradient norm importance sampling strategy is adopted, the sampling probability of paths and data is dynamically optimized, and architecture and data which have great influence on weight updating are preferentially selected, so that the efficiency is improved. For gradient conflicts in multi-objective optimization, a PCGrad projection method is introduced, gradient similarity dynamic dominant direction selection and gradient projection are calculated, conflicts are reduced, and the optimization process is stabilized. After super-network training, population inheritance sharing weight is initialized, performance is obtained on a target data set, non-dominated sorting and optimization are carried out through an evolutionary algorithm, and it is ensured that balanced performance is achieved on the targets of precision, floating point calculation times, parameter quantity and the like. According to the method, on the premise of ensuring multi-target balance optimization, the calculation cost is effectively reduced, and the efficiency and the performance of neural network architecture search are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of automated machine learning, and in particular to a multi-objective neural architecture search method and system based on a gradient similarity supernet. Background Art

[0002] Neural networks have achieved breakthroughs in many fields (such as computer vision, natural language processing, healthcare, and autonomous driving), and have become a core tool for promoting the development of cutting-edge intelligent technologies. Its architectural design directly determines the advantages and disadvantages of the model in terms of feature extraction, representation, and generalization capabilities. Therefore, a reasonable network structure is crucial. Traditional neural network design often relies on expert experience and repeated trials, which is not only time-consuming and labor-intensive, but also difficult to adapt to rapidly changing application requirements. To this end, automated neural architecture search (NAS) came into being, providing a new way to optimize the structure of neural networks from an algorithmic perspective, allowing the model to automatically adapt to different tasks, and improving the efficiency and performance of architectural design. NAS technology reduces dependence on expert knowledge and opens up a new path for building more accurate and adaptable deep learning models, thereby promoting the in-depth development of intelligent applications in various fields.

[0003] Although NAS has shown great application potential in optimization and automated design, its high cost of computing resources has become a major obstacle to further promotion. NAS usually requires complete training and evaluation on a large number of candidate architectures. Especially in scenarios with large-scale data sets and complex network structures, this evaluation process requires a lot of computing resources and time. As the search space increases, the search complexity and computing resource requirements of NAS increase exponentially, which poses a huge challenge to practical applications. To address these problems, researchers have proposed methods such as proxy models, pruning, and weight sharing to reduce the overhead of candidate architecture evaluation. However, these methods do not completely solve the high cost problem of NAS. Especially when the demand for multi-objective optimization increases, the resource consumption of NAS becomes more and more obvious, becoming a bottleneck limiting its application.

[0004] In this context, one-time training based on supernets has gradually become a resource-efficient solution. Supernets cover all candidate subnets in one training, so that each subnet can share weights, avoiding the waste of resources from scratch training. However, there are still some key problems in the supernet training process. First, the sampling strategy of the subnet directly affects the training effect, and traditional random sampling may cause instability in the training process; second, the optimization directions of different subnets may conflict with each other, especially in multi-objective optimization tasks, where gradient conflicts between different objectives often make it difficult to find a performance-balanced architecture. In addition, the existing supernet architectures are mostly based on a single performance indicator, and fail to fully consider the needs of multi-objective balanced optimization. Therefore, in response to the above challenges, the present invention proposes a multi-objective neural architecture search method based on gradient similarity. By optimizing the sampling strategy and improving the gradient conflict handling mechanism, multi-objective balanced optimization is achieved, thereby greatly improving the resource utilization efficiency and overall performance of neural architecture search. Summary of the invention

[0005] Purpose of the invention: The technical problem to be solved by the present invention is to provide a multi-objective neural architecture search method and system based on gradient similarity supernet in view of the shortcomings of the prior art. The method comprises the following steps:

[0006] Step 1: Build a supernet containing two or more subnets, and generate weights shared by all subnets by training the supernet; during the supernet training process, calculate the total gradient of each subnet on the optimization target;

[0007] Step 2: Get the gradient norm of each subnetwork, adopt the importance sampling strategy of the gradient norm, and dynamically adjust the sampling probability of the subnetwork according to the size of the gradient norm;

[0008] Step 3: PCGrad (Projected Conflicting Gradient) projection method is used to deal with the gradient conflict problem between different subnetworks in the multi-objective optimization process. By calculating the gradient similarity between different subnetworks, in the case of gradient conflict, the subnetwork gradient with a smaller gradient norm is projected to the orthogonal direction of the larger gradient, and finally the weighted average is performed to obtain the final gradient update direction;

[0009] Step 4: Initialize a population. Each architecture in the population inherits the shared weights directly from the supernet and is trained on the target dataset to obtain performance on the target.

[0010] Step 5: Use the non-dominated sorting genetic algorithm NSGA-III (Non-dominated Sorting Genetic Algorithm III) to perform non-dominated sorting on the sampled architectures, select the top N architectures from the architectures in the Pareto frontier, and form the next generation of parents;

[0011] Step 6: Repeat steps 4 to 5 until the predetermined stop condition is met, and output the Pareto frontier architecture with the best performance in each objective balance. Then select the architecture with the best performance, inherit the weights from the supernet and train it separately.

[0012] In step 1, a supernet containing multiple subnets is first constructed, and weights that can be shared by all subnets are generated by training the supernet. During the supernet training process, the gradients on each subnet target and the total gradient on multiple targets are calculated. The reason for building a supernet is that when evaluating the performance of the architecture, it is not necessary to train from scratch on the target dataset. The performance can be obtained directly by inheriting the supernet weights and training, which can greatly reduce training time and resource consumption;

[0013] Step 1 specifically includes:

[0014] Step 1.1, design the loss function of the subnet:

[0015] During the training process of the supernet S, the following objectives are defined: accuracy Accuray, floating point calculation times FLOPs, and parameter quantity Params; for each subnet, the following multi-objective loss function L is designed:

[0016]

[0017] Among them, K is the number of optimization targets, is the loss function of the kth objective, is the weight of the kth objective, which is used to balance the contribution of each objective to the total gradient.

[0018] Step 1.2, calculate the gradient of each subnet target and the total gradient of multiple targets:

[0019] For the subnet sampled during the supernet training process, forward propagation is performed to calculate the multi-objective loss function L, and then the gradient of the subnet on each objective is calculated separately through back propagation:

[0020]

[0021] in, represents the gradient of the subnet on the kth target, It is the loss function The gradient of

[0022] The gradient on each target is weighted and summed according to the weighted method in the loss function to obtain the total gradient of the subnetwork on multiple targets:

[0023]

[0024] in, is the total gradient of multi-objective optimization. It reflects the comprehensive contribution of the subnetwork to all optimization objectives.

[0025] Step 1.1 specifically includes:

[0026] Step 1.1.1, define the weight adjustment index: In the multi-objective optimization process, set each objective The current loss value is ,definition is the relative training speed of the kth target at time step t-1, and the formula is:

[0027]

[0028] in, It is expressed as a time step, and its value range is ,in Indicates the maximum number of iterations for supernet training; is the loss value at the previous time step; by comparing the loss changes between the current and previous time steps, the learning speed of the current target can be reflected.

[0029] Step 1.1.2, Dynamic adjustment of weights: Calculate the kth target at time step The weight of time:

[0030]

[0031] Where K represents the total number of targets, is the relative training speed of the ith target at time step t-1, T is the temperature coefficient, and exp is the natural exponential function. T is used to adjust the relative difference in weights between targets. When T is small, the weight difference is large, and when T is large, the weights of each target tend to be more uniform. Through this formula, targets with larger weights are usually those that converged slower in the previous time step to ensure that each target can learn at a similar speed. The dynamically adjusted weights can ensure that in the multi-objective optimization process, the focus on different targets is constantly adjusted as the training progresses, giving priority to targets that converge slower or are more important, thereby improving the overall optimization effect and stability.

[0032] In step 2, we first need to obtain the gradient norm of each subnet, and then dynamically adjust the sampling probability of the subnet according to the size of the calculated gradient norm. Ensure that the training focuses on the paths and data samples that have a greater impact on weight updates to improve the efficiency and effectiveness of supernet training. Step 2 specifically includes:

[0033] Step 2.1, calculate the gradient norm of the subnetwork:

[0034] For the subnets sampled during supernet training, calculate the total gradient The gradient norm of :

[0035]

[0036] in is the total gradient of the ith subnetwork on multiple targets, is the gradient norm of the ith subnetwork, is the total gradient vector of the ith subnetwork The jth component of The size of the gradient norm reflects the influence of the subnet on the weight update of the entire supernet. Subnets with larger gradient norms indicate that their update direction is more important for the multi-objective optimization task, so these subnets will be given priority in the sampling process.

[0037] Step 2.2, calculate the probability of subnet sampling:

[0038] Assume the gradient norm of each subnetwork i is , then the sampling probability is Proportional to:

[0039]

[0040] Where M represents the number of single sampling subnetworks, is the probability of the ith subnet being sampled. This dynamically adjusted sampling probability can ensure that the training process focuses on those paths and data samples that contribute more to weight updates, thereby improving the efficiency and effectiveness of supernet training.

[0041] In step 3, most of the existing evolutionary neural architecture searches use a crossover method based on the adjacency matrix. First, the adjacency matrix is ​​flattened into a one-dimensional vector, and the node operations are one-hot encoded and connected into a one-dimensional vector. Then, the two one-dimensional vectors are concatenated as a representation of an architecture.

[0042] Step 3 specifically includes:

[0043] Step 3.1, Detect gradient conflicts: During supernet training, different subnets may generate conflicting gradients on multi-objective optimization tasks. To solve this gradient conflict problem, we first need to detect whether there is a gradient conflict between subnets. and , and define their total gradients on multiple objectives as and , by calculating the cosine similarity of the gradient , determine whether there is a gradient conflict between them:

[0044]

[0045] in, The value of is between -1 and 1. If the cosine similarity <0, it indicates that there is a gradient conflict between the two subnetworks;

[0046] Step 3.2: When gradient conflicts are detected between subnetworks, the PCGrad projection method is used to handle the conflicts; the main idea is to project the gradient of the subnetwork with a smaller gradient norm. Project to the subnetwork gradient with larger gradient norm in orthogonal directions to minimize conflicts.

[0047] Step 3.3: Weight update and training iteration: Update the shared weights of the supernet according to the total gradient G on the multi-objectives calculated in each round. This update process follows the conventional gradient descent method, but because the gradient of each subnet has undergone conflict resolution during the update process, the weight update is more stable and can better balance the multiple objectives.

[0048] Step 3.2 includes:

[0049] Step 3.2.1, select the dominant gradient: When a gradient conflict is detected between subnetworks, compare the gradient norms of the two conflicting subnetworks. If > , then select As the dominant gradient, As the gradient to be projected;

[0050] Step 3.2.2, Gradient Projection: Calculate the gradient to be projected In the dominant gradient The projection component on the gradient Project to In the orthogonal direction:

[0051]

[0052] in, For gradient Gradient after projection;

[0053] Step 3.2.3, perform weighted averaging on the projected gradients:

[0054]

[0055] in, It represents the direction of gradient update during supernet training.

[0056] For subnetworks with similar gradients, When , weighted averaging of gradients is performed, which enables similar subnetworks to share gradient information and obtain a more comprehensive gradient optimization direction.

[0057] For the subnet with gradient conflict, that is, When , the weighted average of the gradient is also performed to prevent a certain gradient from completely dominating the training direction of the supernet, thereby avoiding the supernet from going in the wrong direction at the beginning of training.

[0058] The PCGrad projection method is used to handle gradient conflicts between subnetworks, which not only effectively reduces the gradient instability caused by multi-objective optimization, but also achieves a better balance between different tasks by dynamically selecting the dominant gradient and projection strategy. At the same time, this method can prevent the optimization from being invalid due to the offset of gradients, thereby improving the overall training efficiency and effect of the supernet.

[0059] Step 4 includes:

[0060] Initialize a population , the size is , each individual represents an architecture; each individual in the population is represented as an architecture , ; Architecture The structure and operation type of are obtained by randomly sampling the architecture from the supernet; the construction process of each architecture includes randomly selecting the parameters of each layer from the supernet, such as the number of channels, convolution kernel size, network depth, etc.

[0061] After the parent population is initialized, crossover mutation is performed on the parent population to obtain N new architectures. , merge the parent population with the newly generated architecture to obtain the population ;right Each architecture in , inheriting the shared weights from the supernet S , and in the training dataset Fine-tune on the , and get the performance of each architecture on multiple targets, specifically expressed as:

[0062]

[0063] Among them, the elite population library What is initially stored in is the structure of the parent population; It represents the performance of the i-th architecture on multiple targets, which is specifically expressed as:

[0064]

[0065] in Represents the i-th architecture Classification accuracy on the training dataset; Represents the i-th architecture The number of floating point calculations; Represents the i-th architecture The number of parameters.

[0066] In step 5, the most recently evaluated architecture is merged with the existing architecture in the current population. The merged population contains a variety of possible architectures, providing a rich set of candidate solutions for the next environment selection. Step 5 specifically includes:

[0067] Step 5.1, for the merged population Perform NSGA-III non-dominated sorting on the architecture in:

[0068] Non-dominated sorting divides architecture individuals into two or more levels, where the first level is non-dominated architectures, meaning that the architectures are not completely dominated by other individuals on all targets; the second level contains architectures that are only dominated by the first level, and so on; the results of non-dominated sorting are used to stratify the entire population, with high-level architectures taking priority in the next generation:

[0069]

[0070] Among them, the objective function vector Represented as the i-th architecture Performance on different optimization objectives;

[0071] Step 5.2, select reference point: After completing the non-dominated sorting, NSGA-III uses a pre-defined reference point to guide the selection of individuals. For each architecture ,calculate The Euclidean distance between each reference point will be Assign to nearest reference point;

[0072] Step 5.3, select and generate the next generation of individuals: through the association of non-dominated sorting and reference points, starting from the optimal non-dominated level, i.e. the first level, select individuals layer by layer until N individuals are filled; the selected N individuals serve as the next generation parent population ,Will Deposit into elite population library in; from Subpopulations are generated after tournament selection, crossover and mutation operations .

[0073] In step 6, continue to repeat steps 4 to 5 for the new parent population until the set number of generations is reached, and the elite population library is finally updated. The selected architectures that perform well on multiple objectives are included in the elite population library. Select the architecture with the best performance and inherit weights from the supernet for separate training.

[0074] The present invention also provides a multi-objective neural architecture search system based on a gradient similarity supernet, comprising:

[0075] Supernet-based shared weight inheritance module: used to inherit shared weights from the supernet, ensuring that the architecture does not have to be trained from scratch on the target dataset, but can be directly fine-tuned by inheriting the supernet weights, greatly reducing training time and resource consumption;

[0076] Gradient norm-based importance sampling module: During supernet training, the gradient norm-based importance sampling module is used to calculate the gradient norms of each subnet and perform importance sampling based on these norms. This sampling strategy ensures that subnets that contribute more to the supernet weight update are preferentially selected for training, thereby improving training efficiency and performance;

[0077] Projection module based on gradient similarity: The PCGrad projection method is used to solve the gradient conflict problem between different subnetworks in the multi-objective optimization process; by calculating the gradient similarity between subnetworks and handling conflicting gradients, stable and efficient weight updates are ensured in multi-objective optimization.

[0078] The present invention effectively improves the resource utilization and search efficiency of multi-objective neural architecture search by introducing a supernet method based on gradient similarity. With the help of the supernet shared weight mechanism, each architecture can directly inherit the supernet weight without having to start training from scratch, which greatly reduces the computational consumption and accelerates the architecture optimization process. In terms of subnet sampling, the importance sampling strategy of the gradient norm is adopted to focus the sampling on the paths and data that have a greater impact on the optimization, further improving the training efficiency. In addition, the present invention proposes a gradient conflict processing method based on the PCGrad projection method, which dynamically selects and projects the dominant direction through gradient similarity analysis, effectively alleviates the gradient conflict problem in multi-objective optimization, and maintains the stability of the optimization process. Compared with the previous neural architecture search method that only focuses on a single performance indicator, the present invention can achieve balanced optimization under multiple objectives such as accuracy, computational amount, and parameter amount. Through the multi-objective non-dominated sorting algorithm NSGA-III, the present invention realizes effective exploration on multiple performance objectives and promotes new progress in the field of multi-objective neural architecture search. Compared with the existing methods, the present invention has better resource efficiency and comprehensive performance.

[0079] The beneficial effects of the present invention are as follows: the present invention constructs a supernet and adopts a shared weight mechanism during the supernet training process, so that subsequent architectures do not need to be trained from scratch. The design of shared weights enables each architecture to directly inherit the adapted parameters from the supernet, greatly reducing the computing resources and time cost required for repeated training, and effectively improving the efficiency of architecture search. At the same time, in the supernet training process, an importance sampling strategy based on the gradient norm is introduced. The sampling probability of the subnet is dynamically adjusted, and those architectures and data that have a greater impact on weight updates are given priority. This strategy ensures that resources and computational workloads are concentrated on subnets that contribute significantly to the final performance, avoids the instability caused by random sampling, and improves the convergence speed of the training effect. In addition, when dealing with multi-objective optimization, the present invention uses the PCGrad projection method to solve the problem of gradient conflicts between subnets. Gradient similarity is calculated to achieve gradient projection and conflict resolution. In the environment selection part, the NSGA-III algorithm is used to achieve non-dominated sorting and optimization during the search process. This algorithm not only supports multi-objective sorting, but also balances multiple optimization objectives such as accuracy, number of floating-point calculations, and number of parameters through a non-dominated sorting mechanism, ensuring that the optimal architecture with balanced performance and reasonable resource utilization can be found under different task requirements, thereby further improving the practicality and adaptability of the system. The multi-objective neural architecture search system of the present invention significantly reduces the computational cost while ensuring the search effect, and has significantly improved the balance of multi-objective optimization, providing an efficient and flexible solution for neural network architecture design. BRIEF DESCRIPTION OF THE DRAWINGS

[0080] Figure 1 It is a framework diagram of the method of the present invention.

[0081] Figure 2 This is a diagram describing the supernet training of the present invention.

[0082] Figure 3 This is a gradient projection description diagram of the present invention.

[0083] Figure 4 A flow chart for updating the population of the present invention.

[0084] Figure 5 This is a curve chart of the model training accuracy of the present invention. DETAILED DESCRIPTION

[0085] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments, and the above and / or other advantages of the present invention will become more clear.

[0086] In the embodiment of the present invention, the CIFAR-10 dataset is used. In order to ensure the fairness of the experiment and the reliability of the results, the dataset is divided into two parts: a supernet training dataset: used to train the supernet to obtain shared weights; a population performance evaluation dataset: used to evaluate the performance of each architecture in the population and determine the optimal architecture during the evolution process. The image data comes from the real world and contains 60,000 color images of size 32x32. There are 10 categories, namely airplanes, cars, birds, cats, deer, dogs, frogs, horses, ships and trucks, and each category has 6,000 pictures. 50,000 of them are used for supernet training and 10,000 are used for population evaluation. Figure 1 The whole algorithm framework diagram is shown below. The implementation process and details of the multi-objective neural architecture search method based on gradient similarity supernet proposed in the embodiment of the present invention will be introduced in detail. The method of this embodiment specifically includes the following steps:

[0087] Step 1: Supernet construction and training. The supernet constructed in the present invention includes multiple subnets, each of which has an adjustable number of convolutional layers and parameters, where the number of convolutional layers is set to 3 to 5 layers, and the convolution kernel sizes are 3×3, 5×5, and 7×7. The number of channels of the convolutional layer is set to 16, 32, and 64, respectively, to meet different computing requirements. The subnet design also includes a pooling layer for feature dimensionality reduction; the last layer is a fully connected layer for classification. During the training of the supernet, a batch size of 64, a training round number of 100, an optimizer of Adam, and an initial learning rate of 0.001 are used.

[0088] Step 1.1: Calculate the loss of the subnet. In the supernet training process, the dynamic weight adjustment method is used. The current loss value is , in order to measure the training speed of each objective and the need for weight adjustment, define is the relative training speed of target k at time step t-1, and its formula is as follows:

[0089]

[0090] in, It is expressed as a time step, and its value range is ,in Indicates the maximum number of iterations of supernet training is 100; is the loss value at the previous time step. By comparing the loss changes between the current and previous time steps, the learning speed of the current target can be reflected.

[0091] According to the training speed indicator , calculate the kth target at time step The weight adjustment formula is as follows:

[0092]

[0093] Among them, K represents the total number of targets, which is set to 4; T is the temperature coefficient, which is initially set to 0.1. This dynamic weight adjustment method makes the training process focus on targets with slower convergence, thereby ensuring balanced optimization of multiple targets.

[0094] Step 1.2: Figure 2 As shown in Figure 1, the subnet sampled during the supernet training process is forward propagated to calculate the multi-objective loss function L, and then the gradient of the subnet on each target is calculated by back propagation. , and weighted sum the gradient on each target according to the weighted method in the loss function to obtain the total gradient of the subnet on multiple targets . And calculate its total gradient The gradient norm of . Gradient norm The calculation formula is as follows:

[0095]

[0096] in is the total gradient of the ith subnetwork on multiple targets, is the gradient norm of the ith subnetwork, is the total gradient vector of subnet i The jth component of , K represents the dimension of the gradient vector (i.e. the total number of optimization targets).

[0097] Step 2: For the subnets sampled during the supernet training process, a probabilistic sampling strategy is used to select subnets for training based on the importance of the subnet gradient norm. As the importance indicator of its sampling, let the gradient norm of each subnetwork i be , then its sampling probability and Proportional to:

[0098]

[0099] Where M indicates that the number of single sampling subnetworks is set to 16. is the probability of subnet i being sampled. The subnet with the highest probability is used to update the weight of the supernet. The specific process is as follows Figure 3 shown.

[0100] Step 3: If Figure 3 As shown in Figure 1, several situations in which the gradients of the multi-objective optimization task may occur when the supernet weights are updated during supernet training are described. At the same time, gradient projection is performed for conflicting gradients.

[0101] Step 3.1: First, we need to detect whether there is a gradient conflict between subnetworks. For two different subnetworks and , defining their total gradient on multiple objectives and . By calculating the cosine similarity of the gradients, we can determine whether there is a conflict between them:

[0102]

[0103] in, The value of is between -1 and 1. If the cosine similarity <0, it indicates that there is a gradient conflict between the two subnetworks.

[0104] Step 3.2: If Figure 3 As shown in "Gradient Conflict" in . When a gradient conflict is detected between subnetworks, the gradient norms of the two conflicting subnetworks are compared. Assume > , then select As the dominant gradient, As the gradient to be projected. Calculate the gradient to be projected In the dominant gradient The projection component on the gradient Project to In the orthogonal direction:

[0105]

[0106] And perform weighted averaging on the projected gradients:

[0107]

[0108] in, It represents the direction of gradient update during supernet training.

[0109] Step 3.3: According to the total gradient of multiple targets calculated in each round , the shared weights of the supernet are updated. This update process follows the conventional gradient descent method.

[0110] Step 4: Figure 4 As shown, initialize a population , the size is , set to 50. Each individual represents an architecture. Each individual in the population is represented as an architecture , After the parent population is initialized, crossover mutation is performed on the parent population to obtain New Architecture , merging the parent population with the newly generated architecture .right Each architecture in Individual from Supernet Inherit shared weights , and the performance of each architecture on multiple targets is obtained, which is specifically expressed as:

[0111]

[0112] Among them, the elite population library What is initially stored in is the structure of the parent population; Expressed as The performance of each architecture on multiple targets, specifically:

[0113]

[0114] Represents the i-th architecture Classification accuracy on the training dataset; Represents the i-th architecture The number of floating point calculations; Represents the i-th architecture The number of parameters.

[0115] Step 5: Use the NSGA-III multi-objective evolutionary algorithm to perform non-dominated sorting on the merged architectures. Select the top N architectures from the non-dominated sorted architectures to form the next generation of parents.

[0116] Step 5.1, merge to get The architectures in NSGA-III are sorted by non-dominated sorting. Non-dominated sorting divides the architecture individuals into multiple levels. The first level is non-dominated architectures, which means that they are not completely dominated by other individuals on all goals. The second level contains architectures that are only dominated by the first level, and so on. The results of non-dominated sorting are used to stratify the entire population, and high-level architectures are given priority to enter the next generation.

[0117]

[0118] Among them, the objective function vector Represented as the i-th architecture Performance on different optimization objectives.

[0119] Step 5.2, after completing the non-dominated sorting, in order to ensure the diversity of the population, NSGA-III uses a pre-defined reference point to guide the selection of individuals. , calculate the Euclidean distance between it and each reference point. Each individual is assigned to the reference point closest to it.

[0120] Step 5.3, through the association of non-dominated sorting and reference points, starting from the optimal non-dominated level (i.e. non-dominated level 1), select individuals layer by layer until N individuals (set to 50) are filled. The selected N individuals serve as the parent population of the next generation. , and Deposit into elite population library In. From Subpopulations are generated after tournament selection, crossover and mutation operations .

[0121] Repeat steps 4 to 5 until the stopping condition is reached, and then output a set of architectures that perform well on multiple objectives. Finally, select the architecture with the highest performance in the elite population as the final optimal architecture. And select the best performing architecture from it, inherit the weights from the supernet for separate training. Figure 5 As shown, it is demonstrated that by The performance of the best architecture selected from the above after 100 independent training cycles on CIFAR-10. This model was selected as a candidate for high performance and low parameter size during the architecture search process. It has 3.8 MB of parameters and achieved a Top-1 accuracy of 97.52% (i.e., the highest accuracy) at the end of training. As can be seen from the figure, the accuracy of the model increased rapidly in the first 20 training cycles, showing good initial convergence ability, and continued to grow steadily during the subsequent training process, eventually tending to a high accuracy rate close to saturation.

[0122] The present invention provides a multi-objective neural architecture search method and system based on a gradient similarity supernet. There are many methods and ways to implement the technical solution. The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the protection scope of the present invention. All components not specified in this embodiment can be implemented by existing technologies.

Claims

1. A multi-objective neural architecture search method based on gradient similarity supernet, characterized in that: The following steps are involved: Step 1: Build a supernet containing two or more subnets, and generate weights shared by all subnets by training the supernet; during the supernet training process, calculate the total gradient of each subnet on the optimization target; Step 2: Get the gradient norm of each subnetwork, adopt the importance sampling strategy of the gradient norm, and dynamically adjust the sampling probability of the subnetwork according to the size of the gradient norm; Step 3: The PCGrad projection method is used to deal with the gradient conflict problem between different subnetworks in the multi-objective optimization process. The final gradient update direction is obtained by calculating the gradient similarity between different subnetworks and performing weighted average. Step 4: Initialize a population. Each architecture in the population inherits the shared weights directly from the supernet and is trained on the target dataset to obtain performance on the target. Step 5: Use the non-dominated sorting genetic algorithm NSGA-III to perform non-dominated sorting on the sampled architectures, select the top N architectures from the architectures in the Pareto frontier, and form the next generation of parents; Step 6: Repeat steps 4 to 5 until the predetermined stopping condition is met, output the Pareto frontier architecture with the best performance in each objective balance, and select the architecture with the best performance from it, inherit the weights from the supernet for separate training.

2. The method according to claim 1, characterized in that Step 1 includes: Step 1.1, design the loss function of the subnet: During the training process of the supernet S, the following objectives are defined: accuracy Accuray, floating point calculation times FLOPs, and parameter quantity Params; for each subnet, the following multi-objective loss function L is designed: , Among them, K is the number of optimization targets, is the loss function of the kth objective, is the weight of the kth target; Step 1.2, calculate the gradient of each subnet target and the total gradient of multiple targets: For the subnets sampled during the supernet training process, forward propagation is performed to calculate the multi-objective loss function L, and then the gradient of the subnet on each objective is calculated separately through back propagation: , in, represents the gradient of the subnet on the kth target, is the loss function The gradient of The gradient on each target is weighted and summed according to the weighted method in the loss function to obtain the total gradient of the subnetwork on multiple targets: , in, is the total gradient of the multi-objective optimization.

3. The method according to claim 2, characterized in that Step 1.1 specifically includes: Step 1.1.1, define the weight adjustment index: In the multi-objective optimization process, set each objective The current loss value is ,definition is the relative training speed of the kth target at time step t-1, and the formula is: , in, It is expressed as a time step, and its value range is ,in Indicates the maximum number of iterations for supernet training; is the loss value at the previous time step; Step 1.1.2, Dynamic adjustment of weights: Calculate the kth target at time step The weight of time: , Where K represents the total number of targets, is the relative training speed of the ith target at time step t-1, T is the temperature coefficient, and exp is the natural exponential function.

4. The method according to claim 3, characterized in that Step 2 includes: Step 2.1, calculate the gradient norm of the subnetwork: For the subnets sampled during supernet training, calculate the total gradient The gradient norm of : , in is the total gradient of the ith subnetwork on multiple targets, is the gradient norm of the ith subnetwork, is the total gradient vector of the ith subnetwork The jth component of Step 2.2, calculate the probability of subnet sampling: Assume the gradient norm of each subnetwork i is , then the sampling probability is Proportional to: , Where M represents the number of single sampling subnetworks, is the probability that the i-th subnet is sampled.

5. The method according to claim 4, characterized in that Step 3 includes: Step 3.1, Detect gradient conflicts: For two different subnetworks and , and define their total gradients on multiple objectives as and , by calculating the cosine similarity of the gradient , determine whether there is a gradient conflict between them: , Among them, if the cosine similarity <0, it indicates that there is a gradient conflict between the two subnetworks; Step 3.2: When gradient conflicts are detected between subnetworks, the PCGrad projection method is used to handle the conflicts; Step 3.3: Weight update and training iteration: Update the shared weights of the supernet according to the total gradient G on the multiple targets calculated in each round.

6. The method according to claim 5, characterized in that Step 3.2 includes: Step 3.2.1, select the dominant gradient: When a gradient conflict is detected between subnetworks, compare the gradient norms of the two conflicting subnetworks. If > , then select As the dominant gradient, As the gradient to be projected; Step 3.2.2, Gradient Projection: Calculate the gradient to be projected In the dominant gradient The projection component on the gradient Project to In the orthogonal direction: , in, For gradient Gradient after projection; Step 3.2.3, perform weighted averaging on the projected gradients: , in, It represents the direction of gradient update during supernet training.

7. The method according to claim 6, characterized in that Step 4 includes: Initialize a population , the size is , each individual represents an architecture; each individual in the population is represented as an architecture , ; Architecture The structure and operation type of the architecture are obtained by randomly sampling from the supernet; After the parent population is initialized, crossover mutation is performed on the parent population to obtain N new architectures. , merge the parent population with the newly generated architecture to obtain the population ;right Each architecture in , inheriting the shared weights from the supernet S , and in the training dataset Fine-tune on the , and get the performance of each architecture on multiple targets, specifically expressed as: , Among them, the elite population library What is initially stored in is the structure of the parent population; It represents the performance of the i-th architecture on multiple targets, which is specifically expressed as: , in Represents the i-th architecture Classification accuracy on the training dataset; Represents the i-th architecture The number of floating point calculations; Represents the i-th architecture The number of parameters.

8. The method according to claim 7, characterized in that Step 5 includes: Step 5.1, for the merged population Perform NSGA-III non-dominated sorting on the architecture in: Non-dominated sorting divides architecture individuals into two or more levels, where the first level is non-dominated architectures, meaning that the architectures are not completely dominated by other individuals on all targets; the second level contains architectures that are only dominated by the first level; the results of non-dominated sorting are used to stratify the entire population, with high-level architectures taking priority in the next generation: , Among them, the objective function vector Represented as the i-th architecture Performance on different optimization objectives; Step 5.2, select reference point: After completing the non-dominated sorting, NSGA-III uses a pre-defined reference point to guide the selection of individuals. For each architecture ,calculate The Euclidean distance between each reference point will be Assign to nearest reference point; Step 5.3, select and generate the next generation of individuals: through the association of non-dominated sorting and reference points, starting from the optimal non-dominated level, i.e. the first level, select individuals layer by layer until N individuals are filled; the selected N individuals serve as the next generation parent population ,Will Deposit into elite population library in; from Subpopulations are generated after tournament selection, crossover and mutation operations .

9. The method according to claim 8, characterized in that In step 6, steps 4 to 5 are repeated for the new parent population until the set number of generations is reached. The elite population library is finally updated. The selected architectures that perform well on multiple objectives are included in the elite population library. Select the architecture with the best performance and inherit weights from the supernet for separate training.

10. A multi-objective neural architecture search system based on gradient similarity supernet implemented by the method according to any one of claims 1 to 9, characterized in that: include: Supernet-based shared weight inheritance module: used to inherit shared weights from the supernet, ensuring that the architecture does not have to be trained from scratch on the target dataset, but can be directly fine-tuned by inheriting the supernet weights, greatly reducing training time and resource consumption; Gradient norm-based importance sampling module: During supernet training, the gradient norm-based importance sampling module is used to calculate the gradient norms of each subnet and perform importance sampling based on these norms; Projection module based on gradient similarity: The PCGrad projection method is used to solve the gradient conflict problem between different subnetworks in the multi-objective optimization process; by calculating the gradient similarity between subnetworks and handling conflicting gradients, stable and efficient weight updates are ensured in multi-objective optimization.

Citation Information

Patent Citations

  • Embedded target detection model generation method based on multi-target neural network search

    CN113283426A

  • Image classification method for neural network architecture search based on evolutionary strategy

    CN114373101A

  • Neural network searching method and device and readable storage medium

    CN116362294A

  • Learning gene inheritance method based on architecture search and self-knowledge distillation

    CN117195951A

  • Image recognition method and system based on multi-population alternate evolution neural structure search

    CN117611974A

Cited By

  • Lightweight potential diffusion model design method and system based on evolutionary neural architecture search

    CN119559286A

  • Generative adversarial network architecture searching method and system based on architecture distillation technology

    CN119886228A

  • Intelligent computing fusion network routing system and routing method thereof

    CN120614292A