Particle swarm neural architecture search method and system based on ternary comparison agent assistance

Through the ternary comparison agent-assisted particle swarm neural architecture search method, the particle swarm algorithm and graph neural network are used to perform dual comparisons, which solves the high cost and inaccurate evaluation problems in neural network architecture search, and realizes efficient and accurate architectural search .

CN119204082AActive Publication Date: 2024-12-27NANJING UNIV OF INFORMATION SCI & TECH

Patent Information

Application Number
CN202411682871.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2024-12-27
Estimated Expiration
2044-11-22

AI Technical Summary

Technical Problem

The existing neural network architecture search methods have huge architectural search costs, especially because the training of proxy models requires a large amount of real performance data and inaccurate evaluation, which leads to high-performance architectures being misjudged as low performance, affecting the search direction.

Method used

The particle swarm neural architecture search method is used based on ternary comparison agent assistance. By initializing particle swarm, the architecture performance is truly evaluated, the triple sample is formed, the agent model is trained, and the particle swarm algorithm and graph neural network are used for double comparison and relaxation operations. , optimize the proxy model to suit different search stages.

Benefits of technology

It significantly improves the efficiency and accuracy of neural network architecture search, reduces the time cost of real evaluation, ensures that excellent architecture is effectively retained in the architecture pool, and improves the prediction accuracy of the proxy model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119204082A_ABST
    Figure CN119204082A_ABST
Patent Text Reader

Abstract

The invention provides a particle swarm neural architecture search method and system based on ternary comparison agent assistance, and the method employs a graph neural network to effectively extract the operation information and topological structure of a network architecture, and carries out the evolution search of a particle swarm. In order to solve the problem of high architecture evaluation cost in the current neural network structure search field, the invention provides a triple-based dual comparison agent model. By constructing a training data set in a triple form, the method can realize data enhancement, and compared with a traditional method, the number of training samples is remarkably increased, and the problem that the training samples of the proxy model are insufficient in the traditional method is effectively solved. In addition, the advantages and disadvantages of the two architectures are judged through a dual comparison mechanism, and the method can more effectively ensure that the excellent architectures are reserved in the architecture pool. Therefore, the proxy model can replace a real evaluation process to a greater extent, so that the time cost of architecture evaluation is remarkably reduced.
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 particle swarm neural architecture search method and system based on ternary comparison agent assistance. Background Art

[0002] Deep learning has played a key role in the field of machine learning. It has achieved success in many aspects of computer vision, including but not limited to image classification, object detection, boundary detection, semantic segmentation, and pose estimation. These achievements are mainly attributed to deep neural networks, which have automated feature engineering. The structure of a deep neural network is usually tailored for a specific task, and its associated weights are acquired through a learning process. In order to achieve the best performance on the target task, both the network structure and weights must be optimal. However, designing an effective deep neural network architecture is a complex process that requires in-depth knowledge of both deep learning and the specific problem, and requires a long time to adjust a large number of hyperparameters. These network architectures designed for specific tasks often do not work well in other application areas. For example, a network architecture designed for image classification may perform poorly on the object detection task. In addition, network architectures need to be designed for different deployment environments under limited computing resources (such as latency, memory, number of floating-point operations, etc.). Manually designing network architectures is inefficient and cannot explore all possible options.

[0003] Based on the problem of inefficiency in manually designed network architectures, neural network architecture search has begun to attract widespread attention. As a method of automated machine learning, neural network architecture search focuses on automatically searching for neural network structures that are effective for specific tasks on a given dataset. Although neural network architecture search has shown great potential in the automated design of neural networks, the huge cost of architecture search has become the biggest obstacle to its development. Evaluating the performance of candidate architectures is the biggest factor affecting the search cost, because the evaluation of each candidate architecture requires the complete training and verification of the network structure. Early researchers adopted low-fidelity estimation methods such as early stopping, reducing the resolution of input images, using subsets of the full training set, and reducing the number of network channels, but they may lead to inaccurate evaluation of candidate networks, especially for complex and large network architectures; later, weight inheritance methods were proposed to allow network architectures to skip the weight training process, but such methods are highly dependent on the design of supernets, have additional optimization overhead, have limited search spaces, and are not suitable for search spaces for specific or complex operations. Therefore, neural network architecture search based on agent-assisted methods has become a suitable choice. It uses agent models to predict the performance of neural networks, thereby reducing the time overhead of the true evaluation of neural network performance.

[0004] The method of using proxy models as performance predictors for neural network architecture search usually has the following common problems: the training of proxy models requires a large amount of training data, which is an expensive resource because each data requires the real performance of the neural network architecture; the prediction accuracy of the proxy model cannot be absolutely accurate, so there is a situation where a high-performance architecture is predicted as a low-performance architecture, which often affects the search direction of the model. Therefore, it is very necessary to propose a particle swarm neural architecture search method based on ternary comparison proxy assistance. Summary of the invention

[0005] Purpose of the invention: The technical problem to be solved by the present invention is to provide a particle swarm neural architecture search method and system based on ternary comparison agent assistance in view of the shortcomings of the prior art. The method comprises the following steps:

[0006] Step 1: Initialize a particle population in the search space. Each particle represents a neural network architecture. Use the particle swarm algorithm to evolve G generations and truly evaluate all architecture individuals in the population to obtain true performance, and record all the truly evaluated architecture performance data.

[0007] Step 2: Make the architectures that have been actually evaluated into triple samples. A triple sample contains three architectures. Label the performance difference between the two combinations in each triple according to the actual performance difference. This serves as the training data set for the proxy model, and the proxy model is trained.

[0008] Step 3: Continue to generate architecture individuals through the update formula of the particle swarm algorithm, and use the proxy model to double compare the current architecture with the local optimal architecture of the current particle and take relaxation operations to obtain the relationship between the current architecture and the local optimal architecture of the current particle. When the local optimal architecture is replaced, the current architecture and the global optimal architecture of the particle swarm are put into the proxy model for double comparison, and relaxation operations are taken to determine whether to replace the global optimal architecture.

[0009] Step 4: Whenever a local optimal architecture is replaced, the actual performance of the updated local optimal architecture is evaluated, and the updated local optimal architecture is added to the architecture pool. When the number of different architectures in the architecture pool reaches the set threshold, the proxy model is updated using the latest architecture performance data to optimize the model's performance to adapt to different search stages.

[0010] Step 5: Repeat steps 3 to 4 until the stopping condition is met and output the global optimal architecture.

[0011] In step 1, initialize a particle population , N i represents the i-th neural network architecture, n is the number of particles in the population; and randomly initialized The position and velocity, N i The position is represented by , For the The particle in Position on the dimension; The speed is , For the The particle in Speed ​​in dimension;

[0012] In step 1, It is the entity of the particle swarm in the particle swarm algorithm. Finally, the state update formula in the particle swarm algorithm is used to update the position and speed of each particle. The speed of each particle determines the direction of particle architecture evolution, and the position is the architecture representation of the particle. Generation, here set 2≤G≤3, in this evolutionary generation G, the calculation of the fitness value of each particle is equivalent to the real evaluation of the network architecture represented by each particle. In this process, the performance indicators of each architecture on the task dataset are evaluated and saved in the architecture pool. Where N is the total number of architecture-performance pairs in the architecture pool Archive, (Arch i ,y i ) represents an architecture-performance pair, Arch i is the i-th architecture in the record, y i is the performance corresponding to the i-th architecture. The task dataset refers to a set of data designed specifically for evaluating and training neural network architectures. This dataset is used to test and measure the performance of neural network architectures when processing specific tasks. For example, if the task is image recognition, the dataset may contain various labeled images for training and evaluating neural networks to recognize objects in images. Common image recognition task datasets include CIFAR-10, ImageNet, COCO, etc. The reason why the initial evolutionary number G is set to 2≤G≤3 is that when G is too large, it means that the number of architectures that need to be truly evaluated will increase, and the true evaluation of the architecture is an expensive operation, which goes against the original intention of using agent-assisted optimization; when G is too small, it will result in too little data being provided to the agent model for training, which is likely to lead to insufficient training of the agent model, the inability of the learned features to fit the entire search space well, and the risk of overfitting of the agent model training.

[0013] In step 2, you first need to pool the architecture The architecture with performance indicators is rearranged to obtain a list of triple samples, which is not only conducive to the training of the proxy model, but also solves the biggest bottleneck problem of using proxy-assisted methods to replace the real evaluation process: the training of the proxy model requires a large amount of training data, which is an expensive resource because each data requires the real performance of the neural network architecture. 3 The triplet training data set is N, where N is the number of architectures in the architecture pool Archive. After obtaining sufficient labeled training data samples, supervised training is performed on the proxy model. Step 2 specifically includes:

[0014] Step 2.1, create a triplet training data set:

[0015] For the architecture pool Archive, the number of combinations without duplication is N. 3 The triplet training dataset of , the corresponding triple label is , in order to ensure that similar triples will not be generated, the above satisfy ;

[0016] Step 2.2, design the structure of the proxy model:

[0017] The model structure design of the proxy model directly determines the degree to which it can fully extract information from the input data, so it is very necessary to design a model structure that conforms to the application scenario. Graph neural networks can process graph structured data and naturally capture the connection relationship and topological structure between nodes, which is very useful for understanding the characteristics of neural network architecture.

[0018] The proxy model includes an architecture feature extractor and a performance difference predictor, and the architecture feature extractor and the performance difference predictor are coupled to each other to jointly train and complete the tasks of architecture feature extraction and performance difference prediction;

[0019] The architecture feature extractor includes a graph convolution layer, and the architecture feature extractor extracts the architecture features of the neural network based on the transmission and aggregation of information between nodes to obtain an architecture representation;

[0020] The performance difference predictor comprises a fully connected layer, and the performance difference predictor completes the performance difference prediction of a pair of input neural network architectures based on the learning of the architecture representation;

[0021] In the graph convolution layer, the node information is a feature vector unique to each node. The information transfer operation between nodes is called the aggregation operation. The aggregation operation formula is:

[0022] ,

[0023] in, is the activation function; is the adjacency matrix of a graph with self-loops; It is the degree matrix of all nodes. The degree matrix is ​​a matrix in graph theory, which describes the degree of each node in the graph. The degree indicates the number of edges connected to a node. is a degree matrix containing self-loops, is the trainable weight matrix of the feature extractor of the l-th layer architecture; represents the node feature vector of the l-th layer architectural feature extractor, and , Represents the input of the entire architecture feature extractor It is the initial node feature vector X. The node feature information extracted by the graph convolution layer is then integrated through a global pooling layer to obtain the representation of the architecture diagram in the latent space.

[0024] Next, the architecture representation will be input into the performance difference predictor to predict the performance difference between the two architectures;

[0025] Step 2.3, design a loss function to guide the training process of the proxy model:

[0026] Designing a loss function for the proxy model is crucial because it is directly related to the goal and effect of model training. A specifically designed loss function can ensure that the direction of model learning is closely aligned with the task requirements, thereby optimizing the model's performance on a specific task.

[0027] The loss function of the designed proxy model is expressed as:

[0028] ,

[0029] ,

[0030] ,

[0031] in, is the cross entropy loss function, is the batch size of the input data, is the performance difference predicted by the surrogate model, It is The actual performance of each architecture is poor; is the designed symbolic loss function, where the function is a hinge function with a lower limit of 0, and the function is a sign function; and is an adaptive weight coefficient that controls the importance between two different loss functions; the total loss function is used Guide the training of the surrogate model until convergence.

[0032] The design of the sign loss function is mainly to ensure that the proxy model can ensure the correctness of the sign of the performance difference when making double comparisons, which corresponds to the relaxation operation; The cross entropy loss function is designed to ensure that the comparison between poor performance can still maintain high accuracy when the second comparison of the anchor architecture is introduced. The high requirements of this loss on the model can enable the model to obtain better prediction accuracy by relaxing the operation in the prediction stage. and The two adaptive weight coefficients are designed to ensure that the cross entropy loss and the sign loss are unbalanced in magnitude, helping to update the model gradient more stably.

[0033] In step 3, the particle swarm algorithm is used as the neural network architecture search strategy because it is an evolutionary computation method that can effectively cope with global optimization challenges and is insensitive to local optimality. It is very suitable for dealing with the architecture design problems of deep learning models, which are usually non-differentiable and non-convex. The particle swarm algorithm has shown great potential in dealing with complex optimization problems due to its simple implementation and fast convergence, and has gradually surpassed the traditional genetic algorithm. In the context of neural network architecture search, some parameters, such as the number of filters in the convolutional layer, have a wide linear adjustable range. These parameters are called ordinals. The particle swarm algorithm can intuitively handle these ordinal parameters through a smooth parameter update mechanism and effectively search for optimal values ​​in a large range.

[0034] Step 3 specifically includes:

[0035] Step 3.1, update the state of particles in the population through the update formula of the particle swarm algorithm;

[0036] Step 3.2, using the proxy model to predict the performance difference between the newly generated architecture and the local optimal architecture, as well as the performance difference between the newly generated architecture and the global optimal architecture;

[0037] Step 3.3, based on the double comparison and relaxation operation, determine whether a real evaluation of the newly generated architecture is required;

[0038] Step 3.4, based on the results of the true evaluation of the newly generated architecture, further determine whether it is necessary to replace the local optimal architecture and the global optimal architecture.

[0039] In step 3.1, the update formula of the particle swarm algorithm is:

[0040] ,

[0041] ,

[0042] in, is the inertia factor; Indicates the number of current iterations; , is the acceleration factor; , A random number between 0 and 1; For the Daidi The particle in The speed of the dimension, For the Daidi The particle in Position on dimension; pbest id It is The particle in The location of the individual extreme point of dimension, gbest d It is the position of all extreme points of the entire population in the dth dimension.

[0043] In step 3.2, traverse all individuals in the current population, for any individual N i , N i and N i The corresponding local optimal architecture One-hot encoding is performed respectively, and the resulting encoding structures are ,Will Directly connected to form the proxy model input , input the proxy model ip Send it to the proxy model to get the predicted value output of the performance difference between the corresponding newly generated architecture and the local optimal architecture ip ; The global optimal architecture gbest of the current iteration i Perform one-hot encoding, and the resulting encoding is ,Will Directly connected to form the proxy model input , input the proxy model ig Send it to the proxy model to get the predicted value output of the performance difference between the corresponding newly generated architecture and the global optimal architecture ig ; Get pbest directly from the architecture pool Archive i The real performance ip With gbest i The real performance ig , and get the actual performance difference y ipg =y ip -y ig;Finally, according to output ip 、output ig ,y ipg To directly determine whether the current particle individual needs to replace the local optimal architecture with the global optimal architecture.

[0044] In step 3.3, through output ip 、output ig ,y ipg Calculated , , where sign1 is the difference sign obtained by relaxing the performance difference between the newly generated architecture of the current particle and the local optimal architecture of the current particle. If the sign is positive, it means that the performance of the newly generated architecture of the current particle is higher than that of the local optimal architecture of the current particle. If the sign is negative, it means that the performance of the newly generated architecture of the current particle is lower than that of the local optimal architecture of the current particle. Sign2 takes the current global optimal architecture as the anchor point and uses the known real performance difference y ipg , thereby indirectly comparing the performance of the newly generated architecture of the current particle with the performance of the local optimal architecture of the current particle. Sign2 is also a difference sign. If the sign is positive, it means that the performance of the newly generated architecture of the current particle is higher than the performance of the local optimal architecture of the current particle. If the sign is negative, it means that the performance of the newly generated architecture of the current particle is lower than the performance of the local optimal architecture of the current particle. The sign obtained based on the double comparison of sign1 and sign2 is used to make a true judgment, that is, as long as one of sign1 and sign2 is positive, the newly generated architecture of the current particle is truly evaluated to obtain its true performance. Finally, it is judged whether it is necessary to update the local optimal architecture of the current particle and the global optimal architecture of the current population.

[0045] In step 3.4, when the real evaluation performance y of the newly generated architecture i Greater than the actual evaluation performance of the local optimal architecture of the particle corresponding to the newly generated architecture obtained from the architecture pool Archive When N i Replace the local optimal architecture pbest of the particle corresponding to the newly generated architecture i When y i Greater than the performance y of obtaining the true evaluation of the global optimal architecture in the architecture pool Archive gbest , then use N i Replaces the global optimal architecture gbest.

[0046] In step 4, when the newly generated architecture is truly evaluated, the performance y of the true evaluation is obtained. i After that, the architecture performance is compared The deduplicated data is stored in the architecture pool Archive. When the architecture performance in the architecture pool Archive is i ,y i ) reaches the threshold T (T is usually 60), then repeat step 3 and use the architecture performance pair (Arch i ,y i ) is made into a triplet training data set, so as to retrain the proxy model to ensure the prediction accuracy of the proxy model.

[0047] In step 4, when the local optimal architecture is replaced, a real evaluation of the new architecture is performed, which can not only accumulate the real performance indicators of excellent architectures, but also ensure the correctness of the evolutionary direction of the evolutionary algorithm. The accumulation of real performance indicators of excellent architectures is mainly used for retraining of proxy models. The proxy model that will be retrained during the architecture search process is called an online proxy model. The online proxy model can update parameters according to the latest data, which can more accurately reflect the current search status and trends, while the offline proxy model is usually built based on historical data and may not be able to reflect the latest changes in time; the online proxy model provides higher flexibility and can add new data points or adjust the model structure as needed during the search process, while the offline proxy model usually has all the parameters and structures determined before the search begins. Therefore, it is very necessary to update the proxy model during the architecture search process.

[0048] In step 5, after the particle swarm iterates to the target generation, it will Use the task dataset for retraining and use it as the optimal architecture finally searched by the algorithm.

[0049] The present invention also provides a particle swarm neural architecture search system based on ternary comparison agent assistance, comprising:

[0050] Evolution module based on particle swarm algorithm: used to generate new neural network architectures and promote the iteration of particle swarms;

[0051] Architecture feature extraction module based on graph neural network: used to extract the topological structure information and operation information of the network architecture, thereby generating a code that can fully describe the network structure information;

[0052] Triplet-based proxy model training module: used to generate training data samples for proxy models. Triplet-based data enhancement allows the proxy model to learn richer features.

[0053] Neural network architecture performance difference prediction module based on double comparison and relaxation operation: Use the prediction results of the proxy model to replace the real evaluation, thereby reducing the time cost of architecture evaluation.

[0054] The present invention proposes an innovative triple-based dual comparison proxy model to address the high cost problem faced by architecture evaluation in the current field of neural network structure search. This method achieves effective data enhancement by constructing a training data set in the form of triples. Compared with traditional methods, it significantly increases the number of training samples and fundamentally solves the problem of lack of training samples for proxy models. By implementing a dual comparison mechanism, the model can more accurately evaluate the pros and cons between two architectures, ensuring that excellent architectures are effectively retained in the architecture pool. This mechanism not only improves the accuracy of the evaluation, but also greatly reduces the dependence on the real evaluation process, enabling the proxy model to replace the traditional evaluation method to a greater extent, thereby significantly shortening the time cost required for architecture evaluation.

[0055] The beneficial effects of the present invention are as follows: the present invention proposes an innovative particle swarm optimization algorithm combined with ternary comparison agent assistance for searching neural network architectures, which significantly improves the search efficiency and accuracy with the help of a ternary comparison agent model. In this method, the neural network architecture is modeled as a directed acyclic graph, and a graph neural network is used as a feature extractor. Through the information propagation mechanism of the graph neural network, the method can comprehensively capture and integrate the topological structure and operation information of the network architecture, and convert this information into feature encodings that can accurately reflect the performance of the architecture. These encodings are then input into a performance difference predictor to predict the performance of the architecture. The close combination of the encoder and the predictor ensures the consistency and accuracy between the feature representation and the performance prediction. In order to generate training samples for the agent model, the present invention adopts a triple strategy, which not only reduces the cost but also ensures sufficient sample supply, thereby improving the quality and efficiency of model training. In addition, the present invention combines the particle swarm algorithm with a dual comparison prediction mechanism, and uses the prediction results of the agent model to evaluate the fitness of the particles, as well as the comparison results with the local optimal architecture. This combination not only enhances the applicability of evolutionary algorithms in neural architecture search, but also further improves the accuracy of prediction by introducing relaxation operations when the agent model predicts performance differences. In general, the present invention provides an efficient solution to the key problem of neural network architecture evaluation and promotes the advancement of neural network architecture search technology. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 The figure is a flow chart of the method of the present invention.

[0057] Figure 2 This is a diagram of the proxy model structure of the present invention.

[0058] Figure 3 This is a structural diagram of the search space of the present invention.

[0059] Figure 4This is a double comparison prediction error diagram of the surrogate model of the present invention. DETAILED DESCRIPTION

[0060] 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.

[0061] like Figure 1 As shown, in a specific embodiment of the present invention, a novel neural architecture search method is proposed, which utilizes a ternary comparison agent to enhance the particle swarm optimization algorithm. Figure 1 The complete flow chart of this method is shown, starting from the initialization stage of the population until the output of the final result. The method of this embodiment is evaluated on the standard dataset NAS-Bench-201 in the field of neural architecture search as an example. Next, the execution steps and key details of the ternary comparison agent assisted particle swarm neural architecture search method proposed in the present invention will be described in detail. The method of the present invention specifically includes the following steps:

[0062] Step 1: Initialize a particle population P with N=30 particles and an empty architecture pool Archive. Evaluate the architectures represented by all particles in P on the task dataset and obtain their true performance values. Add all initialized architectures to the architecture pool Archive in the form of architecture performance pairs. ,in, represents the i-th architecture, Represents the performance value corresponding to the i-th architecture, and N is the total logarithm of architecture-performance pairs in Archive. Then evolve the population P for G generations, 2≤G≤3, and evaluate each newly generated architecture, and also add the record to Archive. The reason why the initial evolutionary number G is set to 2≤G≤3 is that if the value of G is too high, the number of architectures that need to be actually evaluated will increase, which will lead to an increase in the evaluation cost, which violates the original intention of using proxy models to assist optimization to reduce costs. On the contrary, if the value of G is too low, the number of neural network architectures with true accuracy obtained is insufficient, which means that the proxy model receives insufficient training data, which may lead to insufficient model training and inability to accurately capture the characteristics of the entire search space, thereby increasing the risk of overfitting of the proxy model.

[0063] Step 2: Rearrange the architectures with performance indicators in the architecture pool Archive to obtain a triple sample list. The architecture pool Archive stores the architecture performance pairs that have been deduplicated. , deduplication is to ensure that the proxy model is not trained with duplicate data, otherwise it will increase the risk of overfitting the model. Making training samples of triple lists solves the biggest bottleneck problem of using proxy-assisted methods to replace the real evaluation process: the training of proxy models requires a large amount of training data, which is an expensive resource in itself, because each data requires the real performance of the neural network architecture. Because the combination of triple samples can obtain an order of magnitude of N 3 The reason why the proxy model in the present invention can use data in the form of triples as training data is because of its unique prediction index, performance difference. The elements that need to be compared in the particle swarm algorithm are the current particle, the local optimal architecture of the current particle, and the global optimal architecture, and these three just correspond to the three architectures in a single triple, so the proxy model based on the training data in the form of triples can be integrated into the particle swarm algorithm with a high degree of fit. After obtaining sufficient labeled training data samples, the proxy model is supervised.

[0064] Step 2.1: Divide the architecture in Archive into training data samples in the form of triplets. Single triplet , the corresponding triple label is , in order to ensure that similar triples will not be generated, the above i, j, k are strictly required to satisfy ; ,Triple list is the batch data set for training the proxy model, and size is the number of samples. The three architectures in Triple are all encapsulated using the Data class in the torch_geometric library. list It is a list of graphic data converted by the to_data_list method in the torch_geometric library.

[0065] Step 2.2: Build Figure 2 The proxy model shown in the figure consists of an architecture feature extractor and a performance predictor. The architecture feature extractor is a three-layer graph convolution layer plus a global maximum pooling layer, and the performance difference predictor is a three-layer fully connected layer. The feature extractor and the performance predictor are coupled, so the training of the two parts of the model can be guided simultaneously by a single loss function, which also helps to better transfer information between the two models.

[0066] Step 2.3: Using Triple list As a surrogate model, the supervised training dataset is used As the loss function to guide the directional training of the proxy model, L1 is the cross entropy loss function, and L2 is the designed symbolic loss function. and It is an adaptive weight coefficient that controls the importance between two different loss functions. The design of the sign loss function L2 is mainly to ensure that the proxy model can ensure the correctness of the sign of the performance difference when making double comparisons, which corresponds to the relaxation operation; the design of the cross entropy loss function L1 is mainly to ensure that the comparison between the performance differences can still ensure high accuracy when the second comparison of the anchor architecture is introduced. The high requirements of this loss on the model can enable the model to obtain better prediction accuracy in the relaxation operation of the prediction stage; and The two adaptive weight coefficients are designed to ensure that the cross entropy loss and the sign loss are unbalanced in magnitude, helping to update the model gradient more stably.

[0067] Step 3: If Figure 1 As shown in the figure, the state update formula of the particle swarm algorithm is used to update the state of the particles, and then the population is selected for the environment. The process of environment selection requires comparing the performance of the newly generated architecture of each particle in this generation with the local optimal architecture corresponding to each particle.

[0068] Step 3.1: The reason why the particle swarm algorithm is suitable for the architecture search of neural networks is that it is an evolutionary algorithm that is good at finding the global optimal architecture, rather than just staying at the local optimum. This algorithm is particularly effective for complex, nonlinear problems in deep learning that are difficult to solve with traditional methods. Compared with traditional genetic algorithms, the particle swarm algorithm is simpler and can find solutions faster. In addition, the three most important elements in the particle swarm algorithm are the current particle state, the local optimal architecture of the current particle, and the global optimal architecture. These three elements are combined with the ternary comparison of the present invention, which greatly improves the fit between the search strategy and the evaluation strategy in the neural architecture search.

[0069] Step 3.2: Use the proxy model to predict the performance difference between the newly generated architecture and the local optimal architecture and the performance difference between the newly generated architecture and the global optimal architecture. Traverse all particles in the current population, for any particle N i , N i and pbest i The corresponding network architectures are one-hot encoded, and the resulting encoding structures are , directly connect the two to form the proxy model input , the proxy model is input Send it to the proxy model to get the predicted value of the performance difference between the corresponding newly generated architecture and the local optimal architecture ; gbest i The corresponding network architectures are one-hot encoded respectively, and the resulting encoding is ,Will Direct connection constitutes the proxy model input , the proxy model is input Send it to the proxy model to get the predicted value of the performance difference between the corresponding newly generated architecture and the global optimal architecture ; From the schema pool Get pbest directly i With gbest i Real performance and , and get the actual performance difference between the two ; Finally, according to The three are used to directly determine whether the current particle individual needs to replace the local optimal architecture with the global optimal architecture.

[0070] Step 3.3: The three calculations can be obtained , ,in It is the sign of the difference between the performance difference between the newly generated architecture of the current particle and the local optimal architecture of the current particle after relaxation operation. If the sign is positive, it means that the performance of the newly generated architecture of the current particle is higher than the performance of the local optimal architecture of the current particle. If the sign is negative, it means that the performance of the newly generated architecture of the current particle is lower than the performance of the local optimal architecture of the current particle. and The difference is that it uses the current global optimal architecture as an anchor point and uses known real information , thereby indirectly comparing the performance of the newly generated architecture of the current particle with the performance of the local optimal architecture of the current particle; based on the above and The double comparison of the symbol obtained is used to make a true judgment, that is, and As long as there is a positive sign in the equation, the newly generated architecture of the current particle is truly evaluated to obtain its true performance. Finally, it is determined whether it is necessary to update the local optimal architecture of the current particle and the global optimal architecture of the current population.

[0071] Step 3.4: When the performance of the newly generated architecture is evaluated Larger than the architecture pool The performance of the actual evaluation of the local optimal architecture of the particle obtained in When N i Alternative to pbest i ;when Greater than the performance of obtaining the true evaluation of the global optimal architecture in the architecture pool Archive , then use N iReplaces the global optimal architecture gbest.

[0072] Step 4: When a local optimal architecture is replaced, the architecture should be truly evaluated. If it is not truly evaluated, the online proxy model will degenerate into an offline proxy model, because no new labeled architecture will be generated during the algorithm operation, which will result in the proxy model having no new training data samples, which will lead to deviations in proxy model predictions. Because the offline proxy model cannot adapt well to every stage of the search process, it is necessary to evaluate a good architecture during the search process. The true evaluation of the architecture is to put the task data set into the current architecture for training, and finally obtain the architecture's true performance indicators under the target task through testing.

[0073] Step 5: After the particle swarm iterates to the target generation, it will calculate the current global optimal architecture The task dataset is retrained and used as the optimal architecture finally searched by the algorithm.

[0074] like Figure 3 As shown in Figure 1, NAS-Bench-201 defines a neural architecture search framework, where each architecture consists of a fixed skeleton and a series of stacked search units. This process can be seen as searching for the optimal cell configuration. In this framework, each cell is a densely connected directed acyclic network, such as Figure 3 As shown in the bottom part of . In this graph, nodes represent aggregations of feature maps, while edges represent operations that transform feature maps from one node to another. The size of the search space depends on the number of nodes in the directed acyclic graph and the size of the set of operations to choose from. In NAS-Bench-201, in order to construct the operation set, this method selected 4 nodes and 5 typical operations, resulting in a search space containing 15,625 different architectures. For each architecture, multiple trainings were performed on three different datasets to ensure the reliability and diversity of the results. The training process of each architecture is recorded in detail for each training iteration, including training logs and performance indicators. These indicators include but are not limited to training accuracy, test accuracy, training loss, and test loss. In addition, the number of parameters and floating-point operations performed for each architecture are also recorded in detail for easy analysis and comparison.

[0075] like Figure 4As shown in the figure, a proxy model based on double comparison is used to conduct an experiment on the prediction error rate of the proxy model on NAS-Bench-201 space using 70% of all 15625 different architectures. The experiment is to train the proxy model for 100 iterations, test the proxy model after each iteration of training, and then record the prediction error rate of each proxy model test. The proxy model has converged when it has been trained to 50 generations, and the prediction error rate can be guaranteed to be stable below 0.02 when it has been trained to 80 generations. The experiment proves that the prediction error rate of the proxy model after double comparison of the poor performance of the architecture can be guaranteed.

[0076] The present invention provides a particle swarm neural architecture search method and system based on ternary comparison agent assistance. 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, without departing from the principle of the present invention, several improvements and modifications can be made, and 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 particle swarm neural architecture search method based on ternary comparison agent assistance, characterized in that: The following steps are involved: Step 1: Initialize a particle population in the search space. Each particle represents a neural network architecture. Use the particle swarm algorithm to evolve G generations and truly evaluate all architecture individuals in the population to obtain true performance, and record all the truly evaluated architecture performance data. Step 2: Make the architectures that have been actually evaluated into triple samples, and label the performance difference of each pair of combinations in each triple according to the actual performance difference, so as to serve as the training data set of the proxy model, and train the proxy model; Step 3: Continue to generate architecture individuals through the update formula of the particle swarm algorithm, and use the proxy model to double compare the current architecture with the local optimal architecture of the current particle and take relaxation operations to obtain the relationship between the current architecture and the local optimal architecture of the current particle. When the local optimal architecture is replaced, the current architecture and the global optimal architecture of the particle swarm are put into the proxy model for double comparison, and relaxation operations are taken to determine whether to replace the global optimal architecture. Step 4: Whenever a local optimal architecture is replaced, the actual performance of the updated local optimal architecture is evaluated and added to the architecture pool. When the number of different architectures in the architecture pool reaches the set threshold, the proxy model is updated using the latest architecture performance data to optimize the model's performance to adapt to different search stages. Step 5: Repeat steps 3 to 4 until the stopping condition is met and output the global optimal architecture.

2. The method according to claim 1, characterized in that In step 1, initialize a particle population , N i represents the i-th neural network architecture, n is the number of particles in the population; and randomly initialized The position and velocity, N i The position is represented by , is the position of the ith particle in the dth dimension; N i The speed is , is the speed of the ith particle in the dth dimension; then evolve for G generations, evaluate the performance indicators of each architecture on the task dataset, and save them in the architecture pool Where N is the total number of architecture-performance pairs in the architecture pool Archive, (Arch i ,y i ) represents an architecture-performance pair, Arch i is the i-th architecture in the record, y i is the performance corresponding to the i-th architecture.

3. The method according to claim 2, characterized in that Step 2 includes: Step 2.1, create a triplet training data set: For the architecture pool Archive, the number of combinations without duplication is N. 3 The triplet training dataset of , the corresponding triple label is , where i, j, k satisfy i≠j, k>j; Step 2.2, design the structure of the proxy model: The proxy model includes an architecture feature extractor and a performance difference predictor, and the architecture feature extractor and the performance difference predictor are coupled to each other to jointly train and complete the tasks of architecture feature extraction and performance difference prediction; The architecture feature extractor includes a graph convolution layer, and the architecture feature extractor extracts the architecture features of the neural network based on the transmission and aggregation of information between nodes to obtain an architecture representation; The performance difference predictor includes a fully connected layer, and the performance difference predictor completes the performance difference prediction of a pair of input neural network architectures based on the learning of the architecture representation; In the graph convolution layer, the node information is a feature vector unique to each node. The information transfer operation between nodes is called the aggregation operation. The aggregation operation formula is: , in, is the activation function; is the adjacency matrix of the graph with self-loops; D is the degree matrix of all nodes; is a degree matrix containing self-loops, is the trainable weight matrix of the feature extractor of the l-th layer architecture; represents the node feature vector of the l-th layer architectural feature extractor, and , Represents the input of the entire architecture feature extractor It is the initial node feature vector X. The node feature information extracted by the graph convolution layer is then integrated through a global pooling layer to obtain the representation of the architecture diagram in the latent space. Next, the architecture representation will be input into the performance difference predictor to predict the performance difference between the two architectures; Step 2.3, design a loss function to guide the training process of the proxy model: The loss function of the designed proxy model is expressed as: , , , Among them, L1 is the cross entropy loss function, m is the batch size of the input data, and predict i is the performance difference predicted by the surrogate model, target i is the actual performance difference corresponding to the i-th architecture; L2 is the designed symbolic loss function, function is a hinge function with a lower limit of 0, is a sign function; and is the adaptive weight coefficient; the total loss function L is used to guide the training of the proxy model until convergence.

4. The method according to claim 1, characterized in that Step 3 includes: Step 3.1, update the state of particles in the population through the update formula of the particle swarm algorithm; Step 3.2, using the proxy model to predict the performance difference between the newly generated architecture and the local optimal architecture, as well as the performance difference between the newly generated architecture and the global optimal architecture; Step 3.3, based on the double comparison and relaxation operation, determine whether a real evaluation of the newly generated architecture is required; Step 3.4, based on the results of the true evaluation of the newly generated architecture, further determine whether it is necessary to replace the local optimal architecture and the global optimal architecture.

5. The method according to claim 4, characterized in that In step 3.1, the update formula of the particle swarm algorithm is: , , in, is the inertia factor; k represents the number of current iterations; c1 and c2 are acceleration coefficients; rand1 and rand2 are random numbers between 0 and 1; is the velocity of the i-th particle of the k-th generation in the d-th dimension, is the position of the i-th particle of the k-th generation in the d-th dimension; pbest id is the position of the individual extreme point of the ith particle in the dth dimension, gbest d It is the position of all extreme points of the entire population in the dth dimension.

6. The method according to claim 4, characterized in that In step 3.2, traverse all individuals in the current population, for any individual N i , N i and N i The corresponding local optimal architecture One-hot encoding is performed respectively, and the resulting encoding structures are ,Will Directly connected to form the proxy model input , input the proxy model ip Send it to the proxy model to get the predicted value output of the performance difference between the corresponding newly generated architecture and the local optimal architecture ip ; The global optimal architecture gbest of the current iteration i Perform one-hot encoding, and the resulting encoding is ,Will Directly connected to form the proxy model input , input the proxy model ig Send it to the proxy model to get the predicted value output of the performance difference between the corresponding newly generated architecture and the global optimal architecture ig ; Get pbest directly from the architecture pool Archive i The real performance ip With gbest i The real performance ig , and get the actual performance difference y ipg =y ip -y ig ;Finally, according to output ip 、output ig ,y ipg To directly determine whether the current particle individual needs to replace the local optimal architecture with the global optimal architecture.

7. The method according to claim 6, characterized in that In step 3.3, through output ip 、output ig ,y ipg Calculated , , where sign1 is the difference sign obtained by relaxing the performance difference between the newly generated architecture of the current particle and the local optimal architecture of the current particle. If the sign is positive, it means that the performance of the newly generated architecture of the current particle is higher than that of the local optimal architecture of the current particle. If the sign is negative, it means that the performance of the newly generated architecture of the current particle is lower than that of the local optimal architecture of the current particle. Sign2 takes the current global optimal architecture as the anchor point and uses the known real performance difference y ipg , thereby indirectly comparing the performance of the newly generated architecture of the current particle with the performance of the local optimal architecture of the current particle. Sign2 is also a difference sign. If the sign is positive, it means that the performance of the newly generated architecture of the current particle is higher than the performance of the local optimal architecture of the current particle. If the sign is negative, it means that the performance of the newly generated architecture of the current particle is lower than the performance of the local optimal architecture of the current particle. The sign obtained based on the double comparison of sign1 and sign2 is used to make a true judgment, that is, as long as one of sign1 and sign2 is positive, the newly generated architecture of the current particle is truly evaluated to obtain its true performance. Finally, it is judged whether it is necessary to update the local optimal architecture of the current particle and the global optimal architecture of the current population.

8. The method according to claim 7, characterized in that In step 3.4, when the real evaluation performance y of the newly generated architecture i Greater than the actual evaluation performance of the local optimal architecture of the particle corresponding to the newly generated architecture obtained from the architecture pool Archive When N i Replace the local optimal architecture pbest of the particle corresponding to the newly generated architecture i When y i Greater than the performance y of obtaining the true evaluation of the global optimal architecture in the architecture pool Archive gbest , then use N i Replaces the global optimal architecture gbest.

9. The method according to claim 7, characterized in that: In step 4, when the newly generated architecture is truly evaluated, the performance y of the true evaluation is obtained. i After that, the architecture performance is The deduplicated data is stored in the architecture pool Archive. When the architecture performance in the architecture pool Archive is i ,y i ) reaches the threshold T, then repeat step 3 and use the architecture performance pair (Arch i ,y i ) is made into a triplet training data set, so as to retrain the proxy model to ensure the prediction accuracy of the proxy model.

10. The particle swarm neural architecture search based on ternary comparison agent assisted by the method according to any one of claims 1 to 9, characterized in that: include: Evolution module based on particle swarm algorithm: used to generate new neural network architectures and promote the iteration of particle swarms; Architecture feature extraction module based on graph neural network: used to extract the topological structure information and operation information of the network architecture, thereby generating a code that can fully describe the network structure information; Triplet-based proxy model training module: used to generate training data samples for proxy models. Triplet-based data enhancement allows the proxy model to learn richer features. Neural network architecture performance difference prediction module based on double comparison and relaxation operation: Use the prediction results of the proxy model to replace the real evaluation, thereby reducing the time cost of architecture evaluation.

Citation Information

Patent Citations

  • Intelligent identification method for same-opening welding seam image

    CN117237592A

  • Automated Construction of Neural Network Architecture with Bayesian Graph Exploration

    US20220004875A1

  • Automated variational inference using stochastic models with irregular beliefs

    WO2023249068A1

Cited By

  • Evolutionary neural architecture searching method and system based on similarity agent assistance

    CN119623515A