Sample data cache method, system, computer device, and storage medium
The sample data caching method addresses the inefficiencies in deep neural network training by prioritizing important data samples, reducing IO operations and improving training speed and accuracy.
Patent Information
- Application Number
- JP2023566481
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2023-08-16
- Filing Date
- 2023-09-25
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2043-09-25
AI Technical Summary
The training efficiency of deep neural networks is hindered by high IO resource consumption, particularly in distributed training scenarios, due to redundant data loading and preprocessing operations, which have not been adequately addressed by current research.
A sample data caching method that optimizes data processing by identifying and caching important data samples based on their resource consumption and importance, using importance sampling to prioritize hard-to-learn samples, thereby reducing redundant IO operations.
The method improves training efficiency by minimizing redundant data loading and preprocessing, shortening overall training time and enhancing accuracy through optimized data caching.
Smart Images

Figure 0007805373000004 
Figure 0007805373000005 
Figure 0007805373000006
Abstract
Description
[Technical Field]
[0001] The present invention relates to the field of deep neural networks, and in particular to a sample data cache method, system, computer device and storage medium. [Background technology]
[0002] Deep Neural Networks (DNN) is a framework for deep learning. A deep neural network model is composed of multiple layers of computational units, with the output of one layer serving as the input for the next. Training a DNN model involves a forward propagation method, in which information related to input data is passed through all model layers in order to generate a prediction. For example, in image recognition applications, image pixel information is passed through each model layer to predict the image content. To generate a prediction, deep learning (DL) defines a cost / loss function based on the forward propagation output and real labels.
[0003] When training deep neural networks, large datasets are typically used because they represent diverse real-world scenarios. Current research focuses on optimizing the model itself, such as quantification, pruning, and distillation, or on communication layers such as NVlink, Infiniband, and the repeated upgrades of accelerator cards, which provide better-performing hardware such as GPUs (Graphics Processing Units) and TPUs (Tensor Processing Units). However, little research has been done to address bottlenecks in the data stream processing process. The IO (Input / Output) capabilities of storage resources have not kept pace with improvements in computing performance. Especially in some distributed training scenarios, IO resource consumption accounts for more than 85% of the total training time.
[0004] The DNN training process requires multiple iterations for large amounts of data, and each iteration is called an epoch. In each epoch, all data items need to be processed, and they are processed only once, with the data being read from disk into internal memory in mini-batches. During the training process, the IO process loads the data into a queue, where it is preprocessed by the Central Processing Unit (CPU). After data processing is complete, the data is released from internal memory, and the same data items must be read from disk into internal memory again in the next epoch. This increases the number of redundant IO and preprocessing operations, thereby reducing the training efficiency of deep neural networks. Summary of the Invention [Problem to be solved by the invention]
[0005] According to various embodiments of the present invention, sample data caching methods, systems, computer devices, computer readable storage media and computer program products are provided. [Means for solving the problem]
[0006] In a first aspect, the present invention provides a sample data caching method, the method comprising: Obtaining a list of sample data for training; if the decoded sample data set in the cache area does not contain decoded sample data that matches the first sample data in the sample data list, identifying alternative decoded sample data from the decoded sample data set; If the importance of the first sample data and the importance of the alternative decoded sample data satisfy a predetermined condition and the resource consumption of the decoding of the first sample data is greater than the resource consumption of the decoding of the alternative decoded sample data, decoding the first sample data to obtain corresponding target decoded sample data; and updating the decoded sample data set in the cache area based on the target decoded sample data.
[0007] In one embodiment, when the decoding sample data set in the cache area does not contain decoding sample data that matches the first sample data in the sample data list, the step of identifying alternative decoding sample data from the decoding sample data set includes: if the decoded sample data set in the cache area does not contain decoded sample data that matches the first sample data in the sample data list, obtaining the importance of each decoded sample data set in the decoded sample data set; and identifying the least significant decoded sample as the replacement decoded sample data.
[0008] In one embodiment thereof, before obtaining the training sample data list, the method further comprises: obtaining a decoding sample dataset; Identifying the importance of each sample data in the decoded sample data set, identifying a target data sample set from the decoded sample data set, and caching the target data sample set in a cache area.
[0009] In one embodiment, the decoded sample data set includes a plurality of batches of sample data, and the step of identifying the importance of each sample data in the sample data set includes: Identifying an entropy loss value of a single second sample data in each batch sample data; The method includes a step of ranking a single second sample data in each batch sample data based on the entropy loss value to obtain an importance of the single second sample data, wherein the importance represents the degree of influence of the second sample data on the accuracy of the deep neural network.
[0010] In one embodiment thereof, the step of ranking the single second sample data in each batch of sample data based on the entropy loss value to obtain the importance of the single second sample data comprises: Identifying reference sample data from each batch sample data as a reference, and obtaining an entropy loss value of the reference sample data; and a step of ranking the single second sample data in each batch sample data by determining whether the entropy loss value of the single second sample data in each batch sample data is greater than the entropy loss value of the reference sample data, thereby obtaining the importance of the single second sample data.
[0011] In one embodiment, the method further includes a step of not updating the decoded sample data set in the cache area if the importance of the first sample data and the importance of the alternative decoded sample data meet a predetermined condition and the resource consumption of decoding the first sample data is less than the resource consumption of decoding the alternative decoded sample data.
[0012] In a second aspect, the present invention further provides a sample data cache system, the system including a data layer, the data layer including a sample list acquisition module, an alternative decoding sample identification module, a target decoding sample identification module, and a cache update module.
[0013] A sample list acquisition module is for acquiring a sample data list for training.
[0014] an alternative decoding sample identification module for identifying alternative decoding sample data from the decoding sample data set when the decoding sample data set in the cache area does not contain decoding sample data that matches the first sample data in the sample data list;
[0015] A target decoded sample identification module is configured to decode the first sample data to obtain corresponding target decoded sample data when the importance of the first sample data and the importance of the alternative decoded sample data meet a predetermined condition and the resource consumption of decoding the first sample data is greater than the resource consumption of decoding the alternative decoded sample data.
[0016] a cache update module for updating the decoded sample data set in the cache area based on the target decoded sample data;
[0017] In a third aspect, the present invention further provides a computer device, the computer device including a memory and a processor, the memory storing a computer program, the processor executing the computer program performing the following: Obtaining a list of sample data for training; if the decoded sample data set in the cache area does not contain decoded sample data that matches the first sample data in the sample data list, identifying alternative decoded sample data from the decoded sample data set; If the importance of the first sample data and the importance of the alternative decoded sample data satisfy a predetermined condition and the resource consumption of the decoding of the first sample data is greater than the resource consumption of the decoding of the alternative decoded sample data, decoding the first sample data to obtain corresponding target decoded sample data; and updating the decoded sample data set in the cache area based on the target decoded sample data.
[0018] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, the computer program being configured to, when executed by a processor, perform the following: Obtaining a list of sample data for training; if the decoded sample data set in the cache area does not contain decoded sample data that matches the first sample data in the sample data list, identifying alternative decoded sample data from the decoded sample data set; If the importance of the first sample data and the importance of the alternative decoded sample data satisfy a predetermined condition and the resource consumption of the decoding of the first sample data is greater than the resource consumption of the decoding of the alternative decoded sample data, decoding the first sample data to obtain corresponding target decoded sample data; and updating the decoded sample data set in the cache area based on the target decoded sample data.
[0019] In a fifth aspect, the present invention further provides a computer program product, the computer program product comprising a computer program which, when executed by a processor, Obtaining a list of sample data for training; if the decoded sample data set in the cache area does not contain decoded sample data that matches the first sample data in the sample data list, identifying alternative decoded sample data from the decoded sample data set; If the importance of the first sample data and the importance of the alternative decoded sample data satisfy a predetermined condition and the resource consumption of the decoding of the first sample data is greater than the resource consumption of the decoding of the alternative decoded sample data, decoding the first sample data to obtain corresponding target decoded sample data; and updating the decoded sample data set in the cache area based on the target decoded sample data.
[0020] The details of one or more embodiments of the invention are set forth in the drawings and description below. Other features, objects, and advantages of the invention will become apparent from the description, drawings, and claims. [Brief explanation of the drawings]
[0021] In order to more clearly describe the embodiments of the present invention or the technical solutions of the prior art, the following briefly introduces drawings necessary for describing the embodiments or the prior art. The drawings described below are only embodiments of the present invention, and it is obvious to those skilled in the art that other drawings can be obtained based on the disclosed drawings without any creative work.
[0022] [Figure 1] FIG. 1 is a diagram illustrating resource consumption for each link in the training process in some embodiments. [Figure 2] FIG. 2 is a diagram illustrating an application environment for a sample data caching method in some embodiments. [Figure 3] FIG. 3 is a flow diagram of a sample data caching method according to some embodiments. [Figure 4] FIG. 4 is a flow diagram of a method for determining the importance of sample data in some embodiments. [Figure 5] FIG. 5 is a flow diagram of a sample data caching method according to some embodiments. [Figure 6] FIG. 6 is an architectural block diagram of a sample data cache system according to some embodiments. [Figure 7] FIG. 7 is a diagram illustrating the internal structure of a computer device in some embodiments. DETAILED DESCRIPTION OF THE INVENTION
[0023] The following clearly and completely describes the technical solutions of the embodiments of the present invention with reference to the drawings of the embodiments of the present invention. The described embodiments are only some of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without any creative work fall within the protection scope of the present invention.
[0024] Deep neural networks are a branch of deep learning and are widely applied in computational vision, natural language processing, robotics, autonomous driving, biomedicine, and other fields. Training a DNN model involves the forward propagation method, in which information related to input data is passed through all model layers in order to generate a prediction. For example, in image recognition applications, image pixel information is passed through each model layer to predict the image content. To generate a prediction, DL defines a cost / loss function based on the forward propagation output and real labels. The DL process aims to minimize the cost function and improve the prediction by increasing or decreasing the weights of the model's intermediate layer outputs. This step is called backpropagation. The DL process uses gradient descent optimization to adjust the DL model parameters from the outermost layer and backtrack to the input layer. Gradient descent optimization adjusts the parameters in the opposite direction of the gradient. DL training using SGD (Stochastic Gradient Descent) ensures that all training samples are equally represented by simply using random sampling or shuffling to generate random sequences at the end of each training cycle. Shuffle means that for a given dataset, the sequence of examples is randomly shuffled to avoid the model learning the sequence mode of the data.
[0025] The deep neural network training process can be divided into four parts: original data loading, data decoding, data augmentation, GPU calculation, and gradient update. Resource consumption exists in the deep neural network training process. As shown in Figure 1, in some embodiments, a schematic diagram of the resource consumption of each link in the training process includes IO resource consumption, decoding resource consumption, graphics processing means resource consumption, and graphics conversion resource consumption.
[0026] However, the training speed of deep neural networks plays a relatively important role in the deep neural network training process. To improve the training efficiency of deep neural networks, original data caching is used to reduce IO resource consumption and improve data processing performance. However, currently, improving training efficiency by caching original data cannot meet actual needs. Therefore, to address the problem of low training efficiency of deep neural networks, a sample data caching method is proposed.
[0027] The sample data caching method provided in the embodiment of the present invention may be applied to the application environment shown in Figure 2. The server includes a control layer 202 and a data layer 204. The control layer 202 calculates the importance of sample data, drives model training, and sends data requests for deep neural network training. The data layer 204 includes a first priority queue (PQ) and a second priority queue (GC) for tracking currently cached decoded sample data and recording all accessed sample data. The data layer 202 responds to a deep neural network training data request sent by the control layer 204, obtains a training sample data list, and if the decoded sample data set in the cache area does not contain decoded sample data that matches the first sample data in the sample data list, identifies alternative decoded sample data from the decoded sample data set. If the importance of the first sample data and the importance of the alternative decoded sample data meet a predetermined condition and the resource consumption of decoding the first sample data is greater than the resource consumption of decoding the alternative decoded sample data, decodes the first sample data to obtain corresponding target decoded sample data, and updates the decoded sample data set in the cache area based on the target decoded sample data. Furthermore, the sample data caching method in this embodiment of the present invention is a cache optimization method using importance sampling, and the access method of importance sampling, i.e., the access frequency of sample data, is different. Importance sampling can be understood as a process of searching for training samples that are more important than other samples, i.e., have the greatest contribution to the loss function. In other words, in the deep learning training process, different data have different impacts on the accuracy of the model, and hard-to-learn sample data are usually more important, so increasing the frequency of access to important samples in the training process can accelerate the convergence speed of the model. Hard-to-learn sample data can also be sample data that is difficult for a machine learning model to learn and classify. It should be understood that the control layer and the data layer may exist simultaneously on both the terminal side and the server side, and can be specified according to the specific system framework and application scenario. The control layer and the data layer may exist on the terminal side and the server side, respectively. For example, in some conventional client / server systems, the data layer is usually located on the server side, and the control layer is located on the client side of the terminal side. For example, the control layer exists on the terminal side, and the data layer exists on the server side. The control layer calculates the value of sample data, drives deep neural network training, and sends data requests for deep neural network training. The data layer tracks the currently cached decoded sample data and records all accessed sample data.
[0028] In one embodiment, as shown in FIG. 3, a sample data caching method is provided, which is illustrated by taking the application environment shown in FIG. 1 as an example, and includes the following steps:
[0029] In step 302, a sample data list for training is obtained.
[0030] The sample data list includes at least one training sample data mark, and each sample data mark has corresponding sample data.
[0031] Specifically, before training a deep neural network, an original sample data set for training is acquired, and after decoding the original sample data set, a decoded sample data set is obtained and stored on disk. According to predetermined cache conditions, a target decoded sample data set is acquired from the decoded sample data set on disk and stored in a cache area. The decoded sample data cached in the cache area is the decoded sample data, i.e., the tensor data after decoding the original sample data is cached, and the decoded data can be reused to shorten the overall training time. When training a deep neural network, the control layer sends a data request for deep neural network training to the data layer, and the data layer responds to the data request to acquire a sample data list required for training from the control layer. The cache is searched for decoded sample data that matches the first sample data in the sample data list. The original sample data may be an image.
[0032] In step 304, if the decoded sample data set in the cache area does not contain the decoded sample data that matches the first sample data in the sample data list, substitute decoded sample data is identified from the decoded sample data set.
[0033] The alternative decoded sample data may be identified based on the importance of each decoded sample data in the decoded sample data set in the cache area. Depending on the needs of various scenarios, the importance may be a predetermined range of importance or a set importance threshold. The importance of the decoded sample data may be expressed by the access frequency of the data, e.g., the higher the importance of the data, the higher the corresponding access frequency.
[0034] In step 306, if the importance of the first sample data and the importance of the alternative decoded sample data meet a predetermined condition and the resource consumption of decoding the first sample data is greater than the resource consumption of decoding the alternative decoded sample data, the first sample data is decoded to obtain the corresponding target decoded sample data.
[0035] The predetermined condition may be that the importance of the first sample data is equal to the importance of the alternative decoded sample data, or that the difference between the importance of the first sample data and the importance of the alternative decoded sample data is within a predetermined threshold range. In this embodiment, the predetermined condition is described as the importance of the first sample data being equal to the importance of the alternative decoded sample data. As can be understood, if the resource consumption of decoding the first sample data is greater than the resource consumption of decoding the alternative decoded sample data, the first sample data may be the sample that provides the greatest benefit. The sample that provides the greatest benefit may be the sample in the training dataset that is most difficult for the machine learning model to process and requires more training iterations. The number of first sample data may be one or two, and the number of first samples is not limited here. The method for determining the decoding resource consumption may be determined by methods in related art, and will not be described again here.
[0036] The importance of sample data and the resource consumption of decoding may be recorded by components in the data layer 202. The components of the data layer include a metadata manager and a distributed memory key-value storage server. The metadata manager uses two heap-based priority queues: a primary priority queue (PQ) and a secondary priority queue (GC, Garbage Collection). The PQ is used to track currently cached decoded sample data, and the GC records all accessed sample data. The PQ and GC record sample IDs and original data.<is,af,at> The mapping relationship is stored, where is is the importance of the sample, af is the access frequency, and at is the resource consumption of decoding. The cache sequence of the first priority queue PQ is determined according to the priority of the elements in the queue, rather than first-in, first-out (FIFO), and the priority in this embodiment is determined based on the importance of the sample data and the priority of the resource consumption of decoding. For example, if 10% of the sample data have the same access frequency and importance, the sample data with the highest cache decoding consumption will be preferentially selected and cached.
[0037] In step 308, the decoded sample data set in the cache area is updated based on the target decoded sample data.
[0038] In one epoch (also referred to as a training cycle or iteration), one data sample can be accessed in multiple small batches (also referred to as a batch size), and each decoded sample data in the cache area changes with each training iteration. A method for updating the decoded sample data set in the cache area includes deleting the replacement decoded sample data from the decoded sample data set in the cache area and adding the target decoded sample data to the decoded sample data set in the cache area.
[0039] Specifically, when the cache area is full, the system acquires a sample data list. If the decoded sample data set in the cache area does not contain decoded sample data that matches the first sample data in the sample data list, it detects the importance of the first sample data and the alternative decoded sample data and the decoding resource consumption. If the importance of the first sample data is equal to the importance of the alternative decoded sample data and the decoding resource consumption of the first sample data is greater than the decoding resource consumption of the alternative decoded sample data, it acquires the first sample data from the disk, and decodes the acquired first sample data to acquire the corresponding target decoded sample data. The system deletes the alternative decoded sample data from the decoded sample data set in the cache area, adds the target decoded sample data to the decoded sample data set in the cache area, and records the original data of the target decoded sample data in a priority queue.
[0040] As can be understood, during training of deep neural networks, the training sample data set is typically divided into multiple batches, each containing a fixed number of sample data. In one training cycle, the model traverses the entire training data set and updates the parameters of each batch until training is complete. In this embodiment, the sample data cache for one training cycle is taken as an example. In multiple training cycles, the sample data cache step is repeated, and training is repeated using sample data that is difficult to learn, thereby providing a good cache hit rate and improving training accuracy.
[0041] In the above sample data caching method, in response to a data request for deep neural network training, a sample data list for training is obtained. If there is no decoded sample data matching the first sample data in the sample data list in the decoded sample data set in the cache area, alternative decoded sample data is identified from the decoded sample data set, and the importance and decoding resource consumption of the alternative decoded sample data and the first sample data are compared. If the importance of the first sample data and the importance of the alternative decoded sample data meet a predetermined condition and the decoding resource consumption of the first sample data is greater than the decoding resource consumption of the alternative decoded sample data, The decoded sample data set in the cache area is updated based on the target decoded sample data of the first sample data. When training the deep neural network, the decoded sample data in the cache area is optimized by taking into account two different granularities: the importance of the sample data and the resource consumption of decoding. The decoded sample data in the cache area can be cached to maximize its benefits. There is no need to newly load the same data items from the disk into the internal memory. More decoded sample data that meets the specified conditions of importance can be stored in the cache, reducing a lot of redundant IO. The resource consumption of the data decoding itself is taken into account, shortening the overall training time and further improving training efficiency.
[0042] In one embodiment, as shown in FIG. 4, a method for identifying sample data importance is provided, which includes the following steps.
[0043] Step 402: Obtain a decoded sample data set, where the decoded sample data set includes a plurality of batch sample data.
[0044] Step 404: Identifying an entropy loss value of a single second sample data in each batch sample data.
[0045] Step 406: Ranking a single second sample data in each batch sample data based on the entropy loss value to obtain the importance of the single second sample data, which represents the degree of influence of the second sample data on the accuracy of the deep neural network.
[0046] The control layer calculates the importance of each sample, which is the entropy loss value, at the sample level granularity. In other words, the importance of each sample data is calculated based on the sample-level loss information, i.e., the entropy loss value of a single sample in a small batch, and the entropy loss value can be understood as the categorical cross-entropy of the sample data. The categorical cross-entropy of each sample data indicates that the model can predict the uncertainty of the sample category label, and measuring the uncertainty can identify the importance of the sample data. The categorical cross-entropy can be calculated as follows: JPEG0007805373000001.jpg22170
[0047] Ti represents the hot-encoded real label of sample category i, and Si represents the softmax probability of sample category i in the small batch. The calculation method of Si is as follows: JPEG0007805373000002.jpg19170
[0048] ri represents the original probability that a sample belongs to category i, and rj represents the original probability that a sample belongs to category j, with the denominator being the standardized term. As can be seen, the softmax normalization method can effectively identify the change in the magnitude of the original probability and assign a corresponding weight to it, ensuring that a positive exponent is obtained. The entropy loss value by sample can identify the most important sample for deep neural network training.
[0049] Furthermore, because softmax is continuously differentiable, it is possible to calculate the derivative of each weight of the DNN model with respect to the cost function. Using the above method, the entropy loss for all samples is identified and the average entropy loss is calculated. A higher entropy loss value for a sample means that the model generates multiple predictions for that sample, but only one of them is accurate, making it difficult for the model to generate a single accurate prediction for that sample. Correspondingly, a lower entropy loss value for a sample means that the model can generate a unique, highly accurate prediction for that sample. Therefore, a lower entropy loss value for a sample indicates that it will have little effect on improving the model's accuracy in the following period, while a higher entropy loss value indicates the opposite situation.
[0050] In other words, although calculating the entropy loss value of each sample provides a simple method for quantifying the importance of different samples, it is difficult to account for the different contributions of different samples to model accuracy between small batches. Therefore, the importance of each secondary sample data in each batch of sample data is determined by ranking the secondary sample data based on the entropy loss value. The importance determination method includes identifying reference sample data from each batch of sample data and obtaining the entropy loss value of the reference sample data. The entropy loss value of each secondary sample data in each batch of sample data is then determined by determining whether the entropy loss value of the secondary sample data in each batch of sample data is greater than the entropy loss value of the reference sample data, thereby ranking the secondary sample data in each batch of sample data and determining the importance of the secondary sample data.
[0051] The reference sample data may be determined according to actual needs. For example, the first sample data in each batch of sample data may be selected as the reference sample data.
[0052] The importance of the sample data may be determined based on a logarithmic ranking algorithm, and the specific method is as follows: JPEG0007805373000003.jpg19170
[0053] In one small batch containing B samples, the ranking importance of the ith sample data is represented as ranki. li and lk represent the entropy loss, or entropy loss value, of the ith and kth sample data, respectively. b0 is a bias term to fix the ranking range on a logarithmic scale. I is the identity function, which returns 1 if the condition li>lk is true, and 0 otherwise. For each k item in batch B, each sample data may be placed in an appropriate ranking.
[0054] For example, two small batches B1 and B2 contain sample data <4, 5, 6> and <7, 8, 9>. The sample data in B1 has an entropy score of <0.3, 0.5, 0.4>, while the sample data in B2 has an entropy loss value of <0.6, 1.2, 0.8>. Because these entropy loss values are original values, comparing the importance of samples across small batches is not inaccurate. For example, when ranking all samples in two small batches using a priority queue cache, sample data 5 in B1 is ranked in the bottom half of the total, making sample data 5 the most important sample data in B1. Ranking these sample data by entropy loss value gives the rankings for B1 and B2, which means that sample data 5 and 8 are the most important sample data in B1 and B2, respectively. This leads to the conclusion that the top x% of important data in a small batch is necessarily the top x% of the entire dataset.
[0055] The above method for identifying the importance of sample data calculates the entropy loss value of a single sample data in each batch of sample data, and then identifies the importance of each sample data to the model accuracy of different samples in the corresponding batch of sample data based on the entropy loss value of the single sample data, allowing training on sample data that is difficult to learn, providing a good cache hit rate, and ensuring improved training accuracy.
[0056] In one embodiment, as shown in FIG. 5, a sample data caching method is provided, which is illustrated by taking the application environment shown in FIG. 1 as an example, and includes the following steps:
[0057] Step 502: Obtain a decoding sample data set.
[0058] In step 504, the importance of each sample data in the decoded sample data set is determined, and a target data sample set is determined from the decoded sample data set, and the target data sample set is cached in a cache area.
[0059] The number of target data sample sets may be specified based on the size of the cache area, or may be specified based on the importance of each sample data and the size of the cache area, and is not limited to these.
[0060] Step 506: Obtain a sample data list for training.
[0061] In step 508, if the decoded sample data set in the cache area does not contain the decoded sample data that matches the first sample data in the sample data list, the importance of each decoded sample data set in the decoded sample data set is obtained.
[0062] In step 510, the least significant decoded sample is identified as the alternative decoded sample data.
[0063] In step 512, if the importance of the first sample data and the importance of the alternative decoded sample data meet a predetermined condition and the resource consumption of decoding the first sample data is greater than the resource consumption of decoding the alternative decoded sample data, the first sample data is decoded to obtain the corresponding target decoded sample data.
[0064] In step 514, the decoded sample data set in the cache area is updated based on the target decoded sample data.
[0065] Optionally, in one embodiment, if the importance of the first sample data and the importance of the alternative decoded sample data meet a predetermined condition and the resource consumption of decoding the first sample data is less than the resource consumption of decoding the alternative decoded sample data, the decoded sample data set in the cache area is not updated.
[0066] Optionally, in one embodiment, the above sample data caching method is implemented using PyTorch 1.7. PyTorch includes three main components: dataset, sampler, and data loader. The dataset class provides a dataset access method and exposes a get_item interface for obtaining sample data at a specified index and its target label. The sampler provides a subset of the dataset to the training process and adopts random placement. The data loader uses the information provided by the sampler to load samples in small batches with the help of a working process. In the system, a new class, IsDataset, is implemented by inheriting the PyTorch dataset class. This class has the function of combining samples and their corresponding class labels so that the data loader can easily obtain sample data for training from remote storage. This class contains the main logic for the cache data item filtering strategy.
[0067] The IsDataSet class introduces the data layer logic through methods get_item and len. The len method returns the total length of the IsDataSet, and the get_item method obtains the index associated with a data sample, allowing the client layer to find the importance and decoding resource consumption of each sample at the granularity. The get_item method is connected to a memory pool cache, i.e., a cache area, and is based on a priority queue cache strategy. It performs the following detection: if the decoded sample data set in the cache area does not contain decoded sample data that matches the first sample data in the sample data list, it identifies alternative decoded sample data from the decoded sample data set. If the importance of the first sample data and the importance of the alternative decoded sample data meet a predetermined condition and the decoding resource consumption of the first sample data is greater than the decoding resource consumption of the alternative decoded sample data, it decodes the first sample data to obtain the corresponding target decoded sample data, and updates the decoded sample data set in the cache area based on the target decoded sample data.
[0068] The above sample data caching method responds to a data request for deep neural network training, obtains a sample data list for training, and if the decoded sample data set in the cache area does not contain decoded sample data that matches the first sample data in the sample data list, identifies alternative decoded sample data from the decoded sample data set, and compares the importance and decoding resource consumption of the alternative decoded sample data with the first sample data. If the importance of the first sample data and the importance of the alternative decoded sample data meet a predetermined condition and the decoding resource consumption of the first sample data is greater than the decoding resource consumption of the alternative decoded sample data, the decoded sample data set in the cache area is updated based on the target decoded sample data of the first sample data. During training, the decoded sample data in the cache area is optimized by taking into account both the importance of the sample data and the decoding resource consumption, eliminating the need to newly load the same data items from the disk to the built-in memory, thereby reducing a lot of redundant IO and taking into account the resource consumption of the data decoding itself, thereby shortening the overall training time and further improving training efficiency. In other words, by combining the data stream processing characteristics of deep learning training and cache optimization methods, costs can be reduced while training speed is improved.
[0069] It should be understood that although the steps in the flowcharts according to the above embodiments are shown in the order indicated by the arrows, these steps are not necessarily executed in the sequence indicated by the arrows. Unless otherwise explicitly stated herein, the execution sequence of these steps is not strictly limited, and these steps may be executed in other sequences. Furthermore, at least some of the steps in the flowcharts according to the above embodiments may include multiple steps or stages, and these steps or stages do not necessarily have to be executed at the same time but may be executed at different times. The execution sequence of these steps or stages does not necessarily have to be executed sequentially, but may be executed sequentially or alternately with other steps or at least some of the steps or stages in other steps.
[0070] According to the same inventive concept, an embodiment of the present invention further provides a sample data cache system for implementing the above-described sample data cache method. Since the implementation solution for solving the problem provided by this system is similar to the implementation solution described in the above method, the specific limitations of one or more sample data cache system embodiments provided below may refer to the limitations of the sample data cache method described above, and will not be redundantly described here.
[0071] In one embodiment, as shown in FIG. 6 , a sample data cache system 600 is provided, which includes a data layer 204, which includes a sample list acquisition module 602, an alternative decoding sample identification module 604, a target decoding sample identification module 606, and a cache update module 608.
[0072] A sample list acquisition module 602 is for acquiring a sample data list for training.
[0073] An alternative decoding sample identification module 604 is for identifying alternative decoding sample data from the decoding sample data set when there is no decoding sample data in the decoding sample data set in the cache area that matches the first sample data in the sample data list.
[0074] The target decoded sample identification module 606 is configured to decode the first sample data to obtain the corresponding target decoded sample data when the importance of the first sample data and the importance of the alternative decoded sample data meet a predetermined condition and the resource consumption of the decoding of the first sample data is greater than the resource consumption of the decoding of the alternative decoded sample data.
[0075] A cache update module 608 is for updating the decoded sample data set in the cache area based on the target decoded sample data.
[0076] The sample data cache system responds to a data request for deep neural network training and obtains a sample data list for training. If the decoded sample data set in the cache area does not contain decoded sample data that matches the first sample data in the sample data list, it identifies alternative decoded sample data from the decoded sample data set and compares the importance and decoding resource consumption of the alternative decoded sample data with the first sample data. If the importance of the first sample data and the importance of the alternative decoded sample data meet a predetermined condition and the decoding resource consumption of the first sample data is greater than the decoding resource consumption of the alternative decoded sample data, it updates the decoded sample data set in the cache area based on the target decoded sample data of the first sample data. During training, the decoded sample data in the cache area is optimized by taking into account both the importance of the sample data and the decoding resource consumption. This eliminates the need to reload the same data items from the disk to the built-in memory, reducing a lot of redundant IO. It also takes into account the resource consumption of the data decoding itself, shortening the overall training time and improving training efficiency.
[0077] In another embodiment, a sample data cache system is provided, which includes a data layer including a sample list acquisition module 602, an alternative decoding sample identification module 604, a target decoding sample identification module 606, and a cache update module 608, as well as an importance identification module and a cache module.
[0078] The alternative decoding sample identification module 604 is also for obtaining the importance of each decoding sample data in the decoding sample data set when there is no decoding sample data in the decoding sample data set in the cache area that matches the first sample data in the sample data list.
[0079] The least significant decoded sample is identified as the alternate decoded sample data.
[0080] an importance determination module for obtaining the decoded sample data set and determining the importance of each sample data in the sample data set;
[0081] A cache module for identifying a data sample set of interest from the sample data set and caching the data sample set of interest in a cache area.
[0082] In one embodiment, the importance determination module is also for determining an entropy loss value of a single second sample data of each batch sample data.
[0083] The single second sample data in each batch of sample data is ranked based on the entropy loss value to obtain the importance of the single second sample data, which represents the degree of influence of the sample data on the accuracy of the deep neural network.
[0084] In one embodiment, the importance identification module is also for identifying reference sample data as a reference from each batch sample data, and obtaining an entropy loss value of the reference sample data.
[0085] By determining whether the entropy loss value of a single second sample data in each batch sample data is greater than the entropy loss value of the reference sample data, the single second sample data in each batch sample data is ranked to obtain the importance of the single second sample data.
[0086] In one embodiment, the cache update module 608 is also configured to not update the decoded sample data set in the cache area if the importance of the first sample data and the importance of the alternative decoded sample data meet a predetermined condition and the resource consumption of decoding the first sample data is less than the resource consumption of decoding the alternative decoded sample data.
[0087] Each module in the sample data cache system may be realized in whole or in part by software, hardware, or a combination thereof. Each module may be integrated into a processor in a computer device in a hardware form, or may be independent, or may be stored in a memory in a computer device in a software form, so that the processor can call each module to perform a corresponding operation.
[0088] In one embodiment, a computer device 700 is provided, which may be a server and whose internal structure may be as shown in FIG. 7 . The computer device 700 includes a processor 701, a memory 702, an input / output interface 703 (abbreviated as Input / Output, I / O), and a communication interface 704. The processor 701, the memory 702, and the input / output interface 703 are connected via a system bus 705, and the communication interface 704 is connected to the system bus 705 via the input / output interface 703. The processor 701 of the computer device 700 provides calculation and control capabilities. The memory 702 of the computer device 700 includes a non-volatile storage medium 7021 and an internal memory 7022. The non-volatile storage medium 7021 stores an operating system, computer programs, and databases. The internal memory 7022 provides an environment for the operating system and computer programs to run on the non-volatile storage medium 7021. The computer device 700 has a database for storing sample data. The computer device 700 has an input / output interface 703 for exchanging information between the processor 701 and external devices. The computer device 700 has a communication interface 704 for connecting to and communicating with external terminals via a network. The computer program, when executed by the processor 701, implements a sample data caching method.
[0089] Those skilled in the art will understand that the structure shown in FIG. 7 is merely a block diagram of a partial structure related to the solution of the present invention, and does not constitute a limitation on the computer device 700 to which the solution of the present invention is applied, and that the specific computer device 700 may include more or fewer components than those shown in the figure, or may combine certain components, or have a different component arrangement.
[0090] In one embodiment, there is further provided a computing device 700 including a memory 702 in which a computer program is stored, and a processor 701 that, when executing the computer program, implements the steps in each of the method embodiments described above.
[0091] In one embodiment, a computer readable storage medium is provided having stored thereon a computer program that, when executed by the processor 701, implements the steps in each of the method embodiments described above.
[0092] In one embodiment, a computer program product is provided that includes a computer program that, when executed by the processor 701, implements the steps in each of the method embodiments described above.
[0093] In addition, all user information (including, but not limited to, user device information, user personal information, etc.) and data (including, but not limited to, data for analysis, data for storage, data for display, etc.) related to the present invention are information and data approved by the user or fully approved by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions.
[0094] Those skilled in the art will understand that all or part of the steps in the above-described method embodiments can be accomplished by instructing relevant hardware using a computer program. The computer program may be stored in a non-volatile computer-readable storage medium, and when executed, the computer program may include the steps of the above-described method embodiments. Any reference to memory 702, a database, or other media used in the embodiments provided herein may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM®), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache, etc. For illustrative purposes and not limitation, RAM may be in multiple forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database according to each embodiment provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a distributed database using a blockchain. The processor 701 according to each embodiment provided herein may be, but is not limited to, a general-purpose processor, a central processor, a graphics processor, a digital signal processor, programmable logic, data processing logic using quantum computing, etc.
[0095] The technical features of the above embodiments can be combined in any desired manner, and for the sake of brevity, not all possible combinations of the technical features in the above embodiments will be described. However, as long as there is no contradiction in the combination of these technical features, any combination should be considered to be within the scope of the present specification.
[0096] The above examples only show some embodiments of the present invention, and although the description is specific and detailed, it should not be understood as limiting the patent scope of the application. It should be noted that those skilled in the art can make further modifications and improvements without departing from the concept of the present invention, all of which fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined based on the appended claims.
[0097] This invention claims priority from a Chinese patent application filed on August 16, 2023, bearing application number 202311029639.8 and entitled "Sample data caching method, system, computer device and storage medium," the entire contents of which are incorporated herein by reference.
Claims
1. 1. A sample data caching method, comprising: Obtaining a list of sample data for training; identifying alternative decoded sample data from the decoded sample data set in the cache area when the decoded sample data corresponding to the first sample data in the sample data list does not exist in the decoded sample data set in the cache area; If the importance of the first sample data and the importance of the alternative decoded sample data satisfy a predetermined condition and the resource consumption of the decoding of the first sample data is greater than the resource consumption of the decoding of the alternative decoded sample data, decoding the first sample data to obtain the corresponding target decoded sample data; updating the decoded sample data set in the cache area based on the target decoded sample data. A sample data caching method comprising:
2. When the decoded sample data set in the cache area does not contain decoded sample data corresponding to the first sample data in the sample data list, the step of identifying alternative decoded sample data from the decoded sample data set includes: if the decoded sample data set in the cache area does not contain decoded sample data corresponding to the first sample data in the sample data list, obtaining the importance of each decoded sample data set in the decoded sample data set; and identifying the least significant decoded sample as replacement decoded sample data.
2. The method of claim 1 .
3. Before obtaining the training sample data list, the method further comprises: obtaining a decoding sample dataset; identifying the importance of each sample data in the decoded sample data set, identifying a target data sample set from the decoded sample data set, and caching the target data sample set in a cache area.
2. The method of claim 1 .
4. The decoding sample data set includes a plurality of batches of sample data, and the step of identifying the importance of each sample data in the sample data set includes: Identifying an entropy loss value of a single second sample data in each batch sample data; and a step of ranking the single second sample data in each batch sample data based on the entropy loss value to obtain an importance of the single second sample data, the importance representing a degree of influence of the second sample data on the accuracy of the deep neural network.
4. The method of claim 3.
5. The step of ranking the single second sample data in each batch sample data based on the entropy loss value to obtain the importance of the single second sample data includes: Identifying reference sample data from each batch sample data as a reference, and obtaining an entropy loss value of the reference sample data; and determining whether the entropy loss value of the single second sample data in each of the batch sample data is greater than the entropy loss value of the reference sample data, thereby ranking the single second sample data in each of the batch sample data to obtain the importance of the single second sample data.
5. The method of claim 4.
6. The method further includes not updating the decoded sample data set in the cache area if the importance of the first sample data and the importance of the alternative decoded sample data satisfy a predetermined condition and the resource consumption of the decoding of the first sample data is smaller than the resource consumption of the decoding of the alternative decoded sample data.
2. The method of claim 1 .
7. 1. A sample data cache system, the system including a data layer, the data layer comprising: a sample list acquisition module for acquiring a sample data list for training; an alternative decoding sample identifying module for identifying alternative decoding sample data from the decoding sample data set in the cache area when the decoding sample data corresponding to the first sample data in the sample data list does not exist in the decoding sample data set in the cache area; a target decoded sample identifying module for decoding the first sample data to obtain corresponding target decoded sample data when the importance of the first sample data and the importance of the alternative decoded sample data satisfy a predetermined condition and the resource consumption of the decoding of the first sample data is greater than the resource consumption of the decoding of the alternative decoded sample data; a cache update module for updating the decoded sample data set in the cache area based on the target decoded sample data. A sample data cache system comprising:
8. A computer device comprising a memory in which a computer program is stored and a processor, the processor implementing the steps of the method according to any one of claims 1 to 6 when executing the computer program.
1. A computer device characterized by:
9. A computer-readable storage medium having stored thereon a computer program, the computer program implementing the steps of the method according to any one of claims 1 to 6 when executed by a processor. A computer-readable storage medium comprising:
Citation Information
Patent Citations
Block level cache prefetching optimization method and system based on deep learning
CN110245094A
Federal learning method and related device
CN116050544A
In-memory Decoding Cache and Its Management Scheme for Accelerating Deep Learning Batching Process
KR1020220142059A