A dynamic selection method and system for parameter exchange in deep learning

By dynamically comparing and selecting the parameter exchange method in deep learning, the problem that the parameter exchange method in the existing technology cannot be applied to all scenarios and is time-consuming is solved, the adaptive parameter exchange of the deep learning framework is realized, and the performance and efficiency are improved.

CN113033818BActive Publication Date: 2024-09-13YI TAI FEI LIU INFORMATION TECH LLC
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202110305835.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-25
Publication Date
2024-09-13
Estimated Expiration
2041-03-25

AI Technical Summary

Technical Problem

The existing parameter exchange method in deep learning cannot be applied to all scenarios at the same time, is highly time-consuming, relies on user experience and manual configuration, and affects model performance.

Method used

By reading the number of devices and data volume in the configuration file, run the complete deep learning network and record the time, compare the time differences of different parameter exchange methods, dynamically select the best exchange method, and put it into the global settings to make the depth The learning framework adaptively selects the parameter exchange method.

Benefits of technology

The deep learning framework is implemented to automatically judge and select a more efficient parameter exchange method, improving deep learning performance and reducing manual configuration and time-consuming.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113033818B
    Figure CN113033818B
Patent Text Reader

Abstract

The present invention provides a method and system for dynamically selecting a parameter exchange mode in deep learning, by exchanging parameters after each iteration, that is, reading the data of an iteration, exchanging data after calculation, and recording the time consumed for calculation and parameter exchange; and exchanging parameters after each layer of calculation is completed, that is, reading the data of an iteration of a deep learning network, exchanging data after each layer of calculation is completed, and recording the total time consumed for calculation and parameter exchange; comparing the time of parameter exchange, and dynamically selecting the parameter exchange mode of deep learning according to the comparison result. The present invention can enable the deep learning framework to judge which parameter exchange mode is faster by itself, achieve the effect of self-adaptation, and thus exert the best performance in the deep learning process. The present invention can automatically adopt a more efficient parameter exchange mode to achieve the effect of improving deep learning performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and system for dynamically selecting a parameter exchange mode in deep learning. Background Art

[0002] Deep learning is essentially to build a machine learning architecture model with multiple hidden layers, and obtain a large amount of representative feature information through training with large-scale data. Because the data used for training is huge, the deep learning framework must support multi-device and multi-host parallel computing mode. During the training process, parameters need to be exchanged between multiple devices and multiple hosts so that the calculation results can be shared and convergence can be achieved as soon as possible. However, due to differences in machine learning architecture models, exchanged parameter sizes, network conditions, etc., the current parameter exchange method cannot be applied to all scenarios at the same time. In addition, the parameter exchange method of the current machine learning model is generally configured before training, and the user decides which method to configure based on experience. Therefore, the current parameter exchange method cannot make the machine learning model optimal. If the user wants to choose the best parameter exchange method, he needs to manually modify the configuration, train separately, manually record the time information for comparison, and then modify the configuration for training; but this part of the work is not only time-consuming, but also depends on the user's experience and ability. Summary of the invention

[0003] In view of the shortcomings of the prior art described above, an object of the present invention is to provide a method and system for dynamically selecting a parameter exchange method in deep learning, so as to solve the problem that the parameter exchange method in the prior art in the deep learning process cannot be applied to all scenarios at the same time and is time-consuming.

[0004] To achieve the above-mentioned and other related purposes, the present invention provides a method for dynamically selecting a parameter exchange mode in deep learning, comprising the following steps:

[0005] Read the number of devices and amount of data that can be used from the configuration file for deep learning;

[0006] Acquire data of a certain size, run a complete deep learning network according to the data of the certain size, exchange parameters of the deep learning network after the entire deep learning network is run, and record the time used to complete a complete deep learning network and the time of parameter exchange, which are recorded as the first calculation time and the first parameter exchange time;

[0007] Running a complete deep learning network according to the data of the data volume, exchanging parameters once after each layer of the deep learning network is run, and recording the time used for calculation and the total time of parameter exchange, which are recorded as the second calculation time and the second parameter exchange time;

[0008] The first calculation time is compared with the second calculation time, and the first parameter exchange time is compared with the second parameter exchange time, and a parameter exchange method for deep learning is dynamically selected according to the comparison result.

[0009] Optionally, the method further includes obtaining a comparison result between the first parameter exchange time and the second parameter exchange time;

[0010] Obtaining a difference between the first parameter exchange time and the second parameter exchange time according to the comparison result;

[0011] If the ratio of the difference to the first parameter exchange time is higher than a preset threshold, it is not suitable to adopt a parameter exchange method in which the parameters are exchanged once after each layer of the deep learning network is completed; otherwise, it is suitable to adopt a parameter exchange method in which the parameters are exchanged once after each layer of the deep learning network is completed.

[0012] Optionally, the determined parameter exchange method is obtained and placed in the global settings, so that the deep learning network in subsequent training can adaptively select the parameter exchange method.

[0013] The present invention also provides a dynamic selection system for parameter exchange mode in deep learning, including:

[0014] A first acquisition module is used to read the number of available devices and the amount of data from a configuration file; the configuration file is used in deep learning;

[0015] The second acquisition module is used to obtain data of a certain size;

[0016] A first parameter exchange module is used to run a complete deep learning network according to the data of the data volume, and exchange parameters of the deep learning network after the entire deep learning network is run;

[0017] A first recording module is used to record the time taken by the first parameter module to complete a complete deep learning network and the time for parameter exchange, and record it as a first calculation time and a first parameter exchange time;

[0018] A second parameter exchange module is used to run a complete deep learning network according to the data of the data volume, and exchange parameters after each layer of the deep learning network is run;

[0019] A second parameter exchange module, used to record the time used for calculation and the total time of parameter exchange, and record them as the second calculation time and the second parameter exchange time;

[0020] A dynamic selection module is used to compare the first calculation time with the second calculation time, and to compare the first parameter exchange time with the second parameter exchange time, and to dynamically select a parameter exchange method for deep learning according to the comparison result.

[0021] Optionally, the method further includes obtaining a comparison result between the first parameter exchange time and the second parameter exchange time;

[0022] Obtaining a difference between the first parameter exchange time and the second parameter exchange time according to the comparison result;

[0023] If the ratio of the difference to the first parameter exchange time is higher than a preset threshold, it is not suitable to adopt a parameter exchange method in which the parameters are exchanged once after each layer of the deep learning network is completed; otherwise, it is suitable to adopt a parameter exchange method in which the parameters are exchanged once after each layer of the deep learning network is completed.

[0024] Optionally, the determined parameter exchange method is obtained and placed in the global settings, so that the deep learning network in subsequent training can adaptively select the parameter exchange method.

[0025] As described above, the present invention provides a method and system for dynamically selecting a parameter exchange mode in deep learning, which has the following beneficial effects:

[0026] By reading the number of devices and data volume that can be used from the configuration file for deep learning; then obtaining data of a data volume size, running a complete deep learning network according to the data of the data volume size, and exchanging the parameters of the deep learning network after the entire deep learning network is completed, recording the time used to complete a complete deep learning network and the time of parameter exchange, recorded as the first calculation time and the first parameter exchange time; and running a complete deep learning network according to the data of the data volume size, and exchanging parameters once after each layer of the deep learning network is completed, and recording the time used for calculation and the total time of parameter exchange, recorded as the second calculation time and the second parameter exchange time; then comparing the first calculation time with the second calculation time, and comparing the first parameter exchange time with the second parameter exchange time, and dynamically selecting the parameter exchange method of deep learning according to the comparison result. The present invention can enable the deep learning framework to judge which parameter exchange method is faster by itself, achieve the effect of self-adaptation, and thus exert the best performance in the deep learning process. The present invention can automatically adopt a more efficient parameter exchange method to achieve the effect of improving deep learning performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1A schematic diagram of a flow chart of a method for dynamically selecting a parameter exchange mode in deep learning provided by an embodiment;

[0028] Figure 2 A schematic flow chart of a method for dynamically selecting a parameter exchange mode in deep learning provided by another embodiment;

[0029] Figure 3 A schematic diagram of the hardware structure of a system for dynamically selecting a parameter exchange method in deep learning provided by an embodiment. DETAILED DESCRIPTION

[0030] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0031] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0032] See also Figure 1 The present invention provides a method for dynamically selecting a parameter exchange mode in deep learning, comprising the following steps:

[0033] S100, reads the number of devices and the amount of data that can be used from the configuration file for deep learning;

[0034] S200, obtaining data of a data volume, running a complete deep learning network according to the data of the data volume, and exchanging parameters of the deep learning network after the entire deep learning network is run, recording the time used to complete a complete deep learning network and the time of parameter exchange, and recording it as a first calculation time and a first parameter exchange time;

[0035] S300, running a complete deep learning network according to the data of the data volume, exchanging parameters once after each layer of the deep learning network is run, and recording the time used for calculation and the total time of parameter exchange, which are recorded as the second calculation time and the second parameter exchange time;

[0036] S400: Compare the first calculation time with the second calculation time, and compare the first parameter exchange time with the second parameter exchange time, and dynamically select a deep learning parameter exchange method according to the comparison results.

[0037] This method enables the deep learning framework to determine which parameter exchange method is faster and achieve an adaptive effect, thereby achieving the best performance in the deep learning process. This method can automatically adopt a more efficient parameter exchange method to achieve the effect of improving deep learning performance.

[0038] In an exemplary embodiment, it also includes obtaining a comparison result between the first parameter exchange time and the second parameter exchange time; obtaining a difference between the first parameter exchange time and the second parameter exchange time according to the comparison result; if the ratio of the difference to the first parameter exchange time is higher than a preset threshold, it is not suitable to adopt a parameter exchange method in which the parameters are exchanged once after each layer of the deep learning network is run; otherwise, it is suitable to adopt a parameter exchange method in which the parameters are exchanged once after each layer of the deep learning network is run.

[0039] In an exemplary embodiment, the method further includes obtaining the determined parameter exchange method and placing the parameter exchange method in the global settings, so that the deep learning network in subsequent training can adaptively select the parameter exchange method.

[0040] like Figure 2 As shown, the embodiment of the present application provides a method for dynamically selecting a parameter exchange mode in deep learning, comprising the following steps:

[0041] Step 1: Exchange parameters after each iteration; that is, read the data of an iteration, exchange the data after the calculation is completed, and record the time consumed for calculation and parameter exchange.

[0042] Step 2: Exchange parameters after each layer of calculation is completed; that is, read the data of an iteration, exchange the data after each layer of calculation is completed, and record the total time spent on calculation and parameter exchange.

[0043] Step 3: Compare the time difference between step 1 and step 2; that is, compare the time of parameter exchange, so as to determine which parameter exchange method needs to be adopted.

[0044] Step 4: The formal training process adopts the parameter exchange method determined in step 3.

[0045] According to the above records, specifically:

[0046] Step a: Read the number of devices and data volume (batchsize) that can be used from the configuration file

[0047] Step b: Read a batch size of data, run a complete network, and exchange parameters after the run; and record the time used for calculation and the time for parameter exchange.

[0048] Step c: Read data of the same batch size, run a complete network, and exchange parameters after running each layer; record the time used for calculation and the total time for parameter exchange.

[0049] Step d: Compare the time results calculated in step a and step b. If the ratio of the parameter exchange time difference between step b and step c to the parameter exchange time of step b is higher than the preset threshold, it is not suitable to adopt the method of exchanging parameters in each layer, otherwise, it is suitable. In the embodiment of the present application, the preset threshold can be set according to the actual situation.

[0050] Step e: Determine the parameter exchange method based on the comparison result of step d, and put the exchange method into the global settings. This method will be used for each subsequent parameter exchange.

[0051] In summary, this method enables the deep learning framework to determine which parameter exchange method is faster and achieve an adaptive effect, thereby achieving the best performance in the deep learning process. This method can automatically adopt a more efficient parameter exchange method to achieve the effect of improving deep learning performance.

[0052] like Figure 3 As shown, the present invention also provides a dynamic selection system for parameter exchange mode in deep learning, including:

[0053] A first acquisition module M10 is used to read the number of available devices and the amount of data from a configuration file; the configuration file is used in deep learning;

[0054] The second acquisition module M20 is used to acquire data of a certain size;

[0055] A first parameter exchange module M30 is used to run a complete deep learning network according to the data of the data volume, and exchange parameters of the deep learning network after the entire deep learning network is run;

[0056] A first recording module M40 is used to record the time taken by the first parameter module to complete a complete deep learning network and the time for parameter exchange, and record it as a first calculation time and a first parameter exchange time;

[0057] A second parameter exchange module M50 is used to run a complete deep learning network according to the data of the data volume, and exchange parameters after each layer of the deep learning network is run;

[0058] The second parameter exchange module M60 is used to record the time used for calculation and the total time of parameter exchange, and record them as the second calculation time and the second parameter exchange time;

[0059] The dynamic selection module M70 is used to compare the first calculation time with the second calculation time, and to compare the first parameter exchange time with the second parameter exchange time, and to dynamically select a parameter exchange method for deep learning according to the comparison result.

[0060] This system enables the deep learning framework to determine which parameter exchange method is faster and achieve the effect of self-adaptation, so as to achieve the best performance in the deep learning process. This system can automatically adopt a more efficient parameter exchange method to achieve the effect of improving deep learning performance.

[0061] In an exemplary embodiment, it also includes obtaining a comparison result between the first parameter exchange time and the second parameter exchange time; obtaining a difference between the first parameter exchange time and the second parameter exchange time according to the comparison result; if the ratio of the difference to the first parameter exchange time is higher than a preset threshold, it is not suitable to adopt a parameter exchange method in which the parameters are exchanged once after each layer of the deep learning network is run; otherwise, it is suitable to adopt a parameter exchange method in which the parameters are exchanged once after each layer of the deep learning network is run.

[0062] In an exemplary embodiment, the method further includes obtaining the determined parameter exchange method and placing the parameter exchange method in the global settings, so that the deep learning network in subsequent training can adaptively select the parameter exchange method.

[0063] The embodiment of the present application provides a system for dynamically selecting a parameter exchange method in deep learning, including:

[0064] Step 1: Exchange parameters after each iteration; that is, read the data of an iteration, exchange the data after the calculation is completed, and record the time consumed for calculation and parameter exchange.

[0065] Step 2: Exchange parameters after each layer of calculation is completed; that is, read the data of an iteration, exchange the data after each layer of calculation is completed, and record the total time spent on calculation and parameter exchange.

[0066] Step 3: Compare the time difference between step 1 and step 2; that is, compare the time of parameter exchange, so as to determine which parameter exchange method needs to be adopted.

[0067] Step 4: The formal training process adopts the parameter exchange method determined in step 3.

[0068] According to the above records, specifically:

[0069] Step a: Read the number of devices and data volume (batchsize) that can be used from the configuration file

[0070] Step b: Read a batch size of data, run a complete network, and exchange parameters after the run; and record the time used for calculation and the time for parameter exchange.

[0071] Step c: Read data of the same batch size, run a complete network, and exchange parameters after running each layer; record the time used for calculation and the total time for parameter exchange.

[0072] Step d: Compare the time results calculated in step a and step b. If the ratio of the parameter exchange time difference between step b and step c to the parameter exchange time of step b is higher than the preset threshold, it is not suitable to adopt the method of exchanging parameters in each layer, otherwise, it is suitable. In the embodiment of the present application, the preset threshold can be set according to the actual situation.

[0073] Step e: Determine the parameter exchange method based on the comparison result of step d, and put the exchange method into the global settings. This method will be used for each subsequent parameter exchange.

[0074] In summary, this system can enable the deep learning framework to judge which parameter exchange method is faster and achieve the effect of self-adaptation, so as to achieve the best performance in the deep learning process. This system can automatically adopt a more efficient parameter exchange method to achieve the effect of improving deep learning performance.

[0075] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.

Claims

1. A method for dynamically selecting a parameter exchange mode in deep learning, characterized in that: Applied between multiple devices and multiple hosts, including the following steps: Read the number of devices and amount of data that can be used from the configuration file for deep learning; Acquire data of a certain size, run a complete deep learning network according to the data of the certain size, exchange parameters of the deep learning network after the entire deep learning network is run, and record the time used to complete a complete deep learning network and the time of parameter exchange, which are recorded as the first calculation time and the first parameter exchange time; Running a complete deep learning network according to the data of the data volume, exchanging parameters once after each layer of the deep learning network is run, and recording the time used for calculation and the total time of parameter exchange, which are recorded as the second calculation time and the second parameter exchange time; The first calculation time is compared with the second calculation time, and the first parameter exchange time is compared with the second parameter exchange time, and a parameter exchange method for deep learning is dynamically selected according to the comparison result.

2. The method for dynamically selecting a parameter exchange mode in deep learning according to claim 1, characterized in that: It also includes obtaining a comparison result of the first parameter exchange time and the second parameter exchange time; Obtaining a difference between the first parameter exchange time and the second parameter exchange time according to the comparison result; If the ratio of the difference to the first parameter exchange time is higher than a preset threshold, it is not suitable to adopt a parameter exchange method in which the parameters are exchanged once after each layer of the deep learning network is completed; otherwise, it is suitable to adopt a parameter exchange method in which the parameters are exchanged once after each layer of the deep learning network is completed.

3. The method for dynamically selecting a parameter exchange mode in deep learning according to claim 2, characterized in that: The determined parameter exchange method is obtained and placed in the global settings, so that the deep learning network in subsequent training can adaptively select the parameter exchange method.

4. A dynamic selection system for parameter exchange in deep learning, characterized in that: Applicable between multiple devices and multiple hosts, including: A first acquisition module is used to read the number of available devices and the amount of data from a configuration file; the configuration file is used in deep learning; The second acquisition module is used to obtain data of a certain size; A first parameter exchange module is used to run a complete deep learning network according to the data of the data volume, and exchange parameters of the deep learning network after the entire deep learning network is run; A first recording module is used to record the time taken by the first parameter module to complete a complete deep learning network and the time for parameter exchange, and record it as a first calculation time and a first parameter exchange time; A second parameter exchange module is used to run a complete deep learning network according to the data of the data volume, and exchange parameters after each layer of the deep learning network is run; A second parameter exchange module, used to record the time used for calculation and the total time of parameter exchange, and record them as the second calculation time and the second parameter exchange time; A dynamic selection module is used to compare the first calculation time with the second calculation time, and to compare the first parameter exchange time with the second parameter exchange time, and to dynamically select a parameter exchange method for deep learning according to the comparison result.

5. The system for dynamically selecting parameter exchange methods in deep learning according to claim 4, characterized in that: It also includes obtaining a comparison result of the first parameter exchange time and the second parameter exchange time; Obtaining a difference between the first parameter exchange time and the second parameter exchange time according to the comparison result; If the ratio of the difference to the first parameter exchange time is higher than a preset threshold, it is not suitable to adopt a parameter exchange method in which the parameters are exchanged once after each layer of the deep learning network is completed; otherwise, it is suitable to adopt a parameter exchange method in which the parameters are exchanged once after each layer of the deep learning network is completed.

6. The system for dynamically selecting parameter exchange methods in deep learning according to claim 5, characterized in that: The determined parameter exchange method is obtained and placed in the global settings, so that the deep learning network in subsequent training can adaptively select the parameter exchange method.

Citation Information

Patent Citations

  • Data-parallel-based deep learning parameter exchange method and system

    CN108304918A

  • Deployment method and device of deep learning network and terminal equipment

    CN111290762A

  • Method and apparatus for determining transmission policy

    WO2020172825A1