Testing method to evaluate the impact of CPU multithreading environment on deep learning model training differences
By configuring environments with different CPU thread numbers in the virtual machine and fixing the seeds of the random number generator, we evaluate the difference of the deep learning model in the CPU multi-thread environment, solving the problem of inconsistent results of the deep learning model under the same conditions, and achieving An effective assessment of the impact of CPU multi-threaded environments on model training.
Patent Information
- Application Number
- CN202210017296.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-07
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-01-07
AI Technical Summary
Deep learning models produce different results when run multiple times under the same conditions, leading to uncertainty, which is mainly caused by uncertainty at the software and hardware levels. Especially in a CPU multi-threaded environment, it is difficult to evaluate its impact on model training. .
By using virtual machine software on the computing platform to build virtual machines with different CPU thread numbers, configure the deep learning model running environment, fix the seed of the random number generator, and train the model multiple times under different CPU thread number environments to analyze the training differences. To evaluate the impact of the CPU multi-threaded environment on model training.
Effectively evaluate and understand the impact of uncertainty in the CPU multi-thread environment on deep learning model training to ensure the reliability and consistency of the model in different CPU thread environments.
Smart Images

Figure CN114519002B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of deep learning model reliability testing in software engineering, and specifically relates to a testing method for evaluating the impact of a CPU multi-threaded environment on deep learning model training differences. Background Art
[0002] Deep learning is widely used in various fields such as computer vision, natural language processing, and virtual assistants. Reliable deep learning systems are essential, especially for safety-critical applications such as autonomous driving and medical diagnosis.
[0003] For the sake of reproducibility and stability, we usually expect that deep learning models should be deterministic in multiple training runs under the same conditions, that is, the same implementation framework and hardware platform, using the same data, experimental settings, and neural network models. We define this deterministic behavior as follows: given the same experimental conditions at the software and hardware levels, multiple repeated training can generate the same model and obtain the same evaluation results.
[0004] However, deep learning systems are usually non-deterministic, that is, multiple runs under the same conditions will produce different models and thus obtain different evaluation results. This is due to the uncertainty introduced by both software and hardware. At the software level, model training settings (such as weight initialization, shuffled batch sorting) and implementation frameworks (such as TensorFlow, Keras, PyTorch) are two major influencing factors. For example, training settings in user code and some operations of deep learning frameworks usually rely on random number generators (such as Python random and Numpy random).
[0005] In addition to software-level factors, the hardware environment also introduces uncertainty, such as the GPU or CPU platform used to train the deep learning system. The uncertainty introduced at the hardware level is mainly due to parallel computing. In order to evaluate the impact of uncertainty introduced at the CPU level, the present invention proposes a test method for evaluating the impact of CPU multi-threaded environment on the difference in deep learning model training. Summary of the invention
[0006] Purpose of the invention: The present invention proposes a test method for evaluating the impact of a CPU multi-threaded environment on the difference in deep learning model training, which helps to understand the impact of uncertainty in training deep learning models in a CPU multi-threaded environment.
[0007] Technical solution: The present invention proposes a test method for evaluating the impact of CPU multi-threading environment on deep learning model training differences, which specifically includes the following steps:
[0008] (1) Use virtual machine software on the computing platform to create virtual machines with different numbers of CPU threads as the test environment;
[0009] (2) configuring a deep learning model operating environment for the virtual machine created in step (1);
[0010] (3) Running the deep learning model under the same conditions for multiple training in the virtual machine whose environment has been configured in step (2);
[0011] (4) Using the training data obtained in step (3), analyze the training differences of the deep learning model under different CPU thread numbers.
[0012] Furthermore, the step (1) comprises the following steps:
[0013] (11) Using virtual machine software to create virtual machines with the same memory and hard disk storage size but different numbers of CPU threads;
[0014] (12) Install the operating system in the created virtual machine.
[0015] Furthermore, step (2) comprises the following steps:
[0016] (21) Install the dependent software required for deep learning model training and operation in the virtual machine operating system;
[0017] (22) The seed of the random number generator that the deep learning model training and operation rely on software is fixed.
[0018] Furthermore, the multiple training of the deep learning model in step (3) includes:
[0019] Default same training with model selection: This same training does not set a fixed seed for the random number generator of the deep learning model training software, uses the default model selection method, and then runs multiple model trainings with the same training and test data in virtual machines with different CPU thread numbers;
[0020] Fixed seed identical training with model selection: This identical training sets a fixed seed for the random number generator of the deep learning model training software, uses the default model selection method, and then runs multiple model trainings using the same training and test data in virtual machines with different CPU thread numbers;
[0021] Fixed seed identical training without model selection: This identical training sets a fixed seed for the random number generator of the deep learning model training run software, but does not use any model selection method, and then runs multiple model trainings using the same training and test data in virtual machines with different numbers of CPU threads.
[0022] Furthermore, the implementation process of step (4) is as follows:
[0023] Performing the same training multiple times in the same CPU thread number environment will produce multiple models. The training results obtained in different CPU thread number environments are compared by statistical methods to evaluate the impact of the CPU multi-thread environment on the training differences of deep learning models.
[0024] Beneficial effects: The beneficial effects of the present invention: The present invention can effectively evaluate the uncertainty impact of the CPU multi-threaded environment on the training differences of deep learning models. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 is a flow chart of the present invention;
[0026] Figure 2 Diagram of the test framework for evaluating the impact of CPU multi-threading environment on deep learning model training differences. DETAILED DESCRIPTION
[0027] The present invention is further described in detail below in conjunction with the accompanying drawings.
[0028] like Figure 1 , Figure 2 As shown, the present invention proposes a test method for evaluating the impact of CPU multi-threading environment on deep learning model training differences, and its specific implementation steps are as follows:
[0029] Take the training difference of the open source virtual voice assistant model HONK in a CPU multi-threaded environment as an example. HONK is a convolutional neural network model (CNN) for keyword localization re-implemented in PyTorch.
[0030] Step 1: Use virtual machine software on the computing platform to create virtual machines with different numbers of CPU threads as a test environment.
[0031] First, use virtual machine software to create virtual machines with the same memory and hard disk storage size, but different numbers of CPU threads.
[0032] For example, on a computing platform with an Intel i9-9900K CPU and Windows 10 as the main operating system, the virtual machine software VirtualBox is used to create virtual machines with 1 thread, 2 threads, 6 threads, and 12 threads respectively. These virtual machines all have 24 GB of memory and 500 GB of hard disk space.
[0033] Next, install the operating system in the created virtual machine.
[0034] For example, the guest operating system of the virtual machine is Linux (Ubuntu 18.04).
[0035] Step 2: Configure the deep learning model operating environment for the virtual machine created in step 1;
[0036] First, install the dependent software required for deep learning model training and operation in the virtual machine operating system. For example, install the dependent software required for running the HONK model: python, pytorch, numpy, flask, etc.
[0037] Secondly, set the seed of the random number generator of the software that the deep learning model training depends on to a fixed value. For example, set the seed (SEED) of torch.manual_seed(SEED) in PyTorch, random.seed(SEED) in Python, and np.random.seed(SEED) in Numpy to 1.
[0038] Step 3: Run the deep learning model training under the same conditions multiple times in the virtual machine where the environment has been configured in step 2.
[0039] The following three types of training are performed on the deep learning model:
[0040] (1) Default identical training with model selection: This identical training does not set a fixed setting for the seed of the random number generator of the software that the deep learning model training runs on, uses the default model selection method, and then runs multiple model trainings using the same training and test data in virtual machines with different numbers of CPU threads.
[0041] (2) Fixed seed identical training with model selection: This identical training sets a fixed seed for the random number generator of the software that the deep learning model training runs on, uses the default model selection method, and then runs multiple model training runs using the same training and test data in virtual machines with different numbers of CPU threads.
[0042] (3) Fixed seed identical training without model selection: This identical training sets a fixed seed for the random number generator of the software that runs the deep learning model training, but does not use any model selection method. The model training is then run multiple times using the same training and test data in virtual machines with different numbers of CPU threads.
[0043] Step 4: Use the training data obtained in step 3 to analyze the training differences of the deep learning model under different CPU thread numbers.
[0044] Performing the same training multiple times in the same CPU thread number environment will produce multiple models. The training results obtained in different CPU thread number environments are compared by statistical methods to evaluate the impact of the CPU multi-thread environment on the training differences of deep learning models.
[0045] For example, run the deep learning model training n times in a 1-thread virtual machine, and get the accuracy (or training time) of n models, which is called experimental group s1; similarly, run the deep learning model training n times in a 12-thread virtual machine, and get the test accuracy (or training time) of n models, which is called experimental group s2. In the test HONK model, n is set to 30. When comparing the two experimental groups s1 and s2, the null hypothesis is that the accuracies of experimental groups s1 and s2 have similar distributions. If the obtained p-value is less than the given significance level α=0.05, the null hypothesis can be rejected with 95% confidence, and the alternative hypothesis can be inferred to be true, that is, the accuracies (or training times) of experimental groups s1 and s2 are statistically significantly different.
[0046] The above content is a detailed description of a test method for evaluating the impact of a CPU multi-threaded environment on the training difference of a deep learning model according to the present invention, but it is obvious that the specific implementation form of the present invention is not limited thereto. For those skilled in the art, various obvious changes made to it without departing from the spirit of the present invention and the scope of the claims are within the scope of protection of the present invention.
Claims
1. A test method for evaluating the impact of CPU multi-threading environment on deep learning model training differences, characterized in that: The following steps are involved: (1) Use virtual machine software on the computing platform to create virtual machines with different numbers of CPU threads as the test environment; (2) Configure the deep learning model operating environment for the virtual machine created in step (1); (3) Run the deep learning model under the same conditions for multiple training in the virtual machine whose environment has been configured in step (2); (4) Using the training data obtained in step (3), analyze the training differences of deep learning models in environments with different numbers of CPU threads; The implementation process of step (1) includes the following steps: (11) Use virtual machine software to create virtual machines with the same memory and hard disk storage size but different numbers of CPU threads; (12) Install the operating system in the created virtual machine; Step (2) includes the following steps: (21) Install the dependent software required for deep learning model training and operation in the virtual machine operating system; (22) Setting a fixed seed for the random number generator used by the software used to train the deep learning model; The multiple training of the deep learning model in step (3) includes: Default same training with model selection: This same training does not set a fixed seed for the random number generator of the deep learning model training software, uses the default model selection method, and then runs multiple model trainings with the same training and test data in virtual machines with different CPU thread numbers; Fixed seed identical training with model selection: This identical training sets a fixed seed for the random number generator of the deep learning model training software, uses the default model selection method, and then runs multiple model trainings using the same training and test data in virtual machines with different CPU thread numbers; Fixed seed identical training without model selection: This identical training sets a fixed seed for the random number generator of the deep learning model training run software, but does not use any model selection method, and then runs multiple model trainings using the same training and test data in virtual machines with different CPU thread numbers; The implementation process of step (4) is as follows: Performing the same training multiple times in the same CPU thread number environment will produce multiple models. The training results obtained in different CPU thread number environments are compared by statistical methods to evaluate the impact of the CPU multi-thread environment on the training differences of deep learning models.
