Data processing method, data processing device, system, equipment and medium

By determining the sparse threshold of the input data and selecting the corresponding relationship in the large model, only important network parameters are loaded to the end device, which solves the problem of high storage and bandwidth requirements when deploying large models, achieving reduction in data volume and improvement in processing accuracy. Take into consideration.

CN118227339BActive Publication Date: 2024-09-17LYNXI TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410637906.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-22
Publication Date
2024-09-17
Estimated Expiration
2044-05-22

AI Technical Summary

Technical Problem

When large models are deployed on end devices, due to the large amount of network parameter data, the demand for storage space and transmission bandwidth during operation is high. Existing technologies such as model quantization, model pruning and low-rank decomposition have shortcomings in adaptive compression. It is difficult to effectively reduce bandwidth and computing bottlenecks.

Method used

By determining the sparse threshold of the input data of the target network layer, and based on the sparse threshold and the corresponding relationship between the input data and network parameters, the target network parameters are selected from the network parameters of the target network layer, and only important parameters are loaded to the target device for data processing. .

Benefits of technology

It effectively reduces the amount of target network parameter data that needs to be loaded to the target device, reduces storage and bandwidth requirements, takes into account the processing accuracy of the preset model, and achieves adaptive compression of network parameters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118227339B
    Figure CN118227339B
Patent Text Reader

Abstract

The present disclosure provides a data processing method, a data processing device, a system, a device and a medium, and belongs to the field of computer technology. The data processing method includes: for a target network layer of a preset model, determining a sparse threshold of input data of the target network layer, the sparse threshold being greater than the absolute value of the minimum value in the input data; selecting target network parameters from the network parameters of the target network layer according to the sparse threshold and the correspondence between the input data and the network parameters of the target network layer; loading the target network parameters into a target device, so that the target device processes based on the target network parameters and the input data to obtain output data of the target network layer. According to the embodiments of the present disclosure, the storage and bandwidth requirements for the target device can be reduced, while also taking into account the processing accuracy of the preset model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a data processing method, a data processing device, a data processing system, an electronic device, and a computer-readable storage medium. Background Art

[0002] Large models (LM) may have a huge number of parameters exceeding 100 billion, which brings huge challenges to the deployment and application of large models. In addition, as users' demands for privacy and timeliness increase, it has become necessary to deploy large models locally on mobile phones, laptops and other end devices, which puts higher requirements on reducing the storage space of large models and the transmission bandwidth during operation. Summary of the invention

[0003] The present disclosure provides a data processing method, a data processing device, a data processing system, an electronic device, and a computer-readable storage medium.

[0004] In a first aspect, the present disclosure provides a data processing method, which includes: for a target network layer of a preset model, determining a sparse threshold of input data of the target network layer, the sparse threshold being greater than an absolute value of a minimum value in the input data; selecting target network parameters from the network parameters of the target network layer according to the sparse threshold and a correspondence between the input data and the network parameters of the target network layer; loading the target network parameters into a target device for the target device to process based on the target network parameters and the input data to obtain output data of the target network layer.

[0005] In a second aspect, the present disclosure provides a data processing device, which includes: a determination module, used to determine, for a target network layer of a preset model, a sparse threshold of input data of the target network layer, wherein the sparse threshold is greater than the absolute value of the minimum value in the input data; a selection module, used to select target network parameters from the network parameters of the target network layer according to the sparse threshold and the correspondence between the input data and the network parameters of the target network layer; and a loading module, used to load the target network parameters to a target device, so that the target device processes the target network parameters and the input data to obtain output data of the target network layer.

[0006] In a third aspect, the present disclosure provides a data processing system, which includes: a data processing device and a target device; the data processing device is used to implement a data processing method as described in any one of the embodiments of the present disclosure; the target device is used to process the target network parameters of the target network layer of the preset model loaded by the data processing device and the input data of the target network layer to obtain the output data of the target network layer.

[0007] In a fourth aspect, the present application provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, and one or more of the computer programs are executed by the at least one processor so that the at least one processor can execute the data processing method described in any one of the embodiments of the present disclosure.

[0008] In a fifth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor / processing core, implements the data processing method described in any one of the embodiments of the present disclosure.

[0009] The embodiments provided by the present disclosure take into account that when a model is deployed on a terminal device such as a chip, if the data volume of the network parameters of the model is too large, the storage and bandwidth requirements of the chip are relatively large. Based on this, in the embodiments of the present disclosure, for the target network layer of the preset model, a sparse threshold of the input data of the target network layer is determined, and the sparse threshold is greater than the absolute value of the minimum value in the input data; according to the sparse threshold and the corresponding relationship between the input data and the network parameters of the target network layer, the target network parameters are selected from the network parameters of the target network layer; the target network parameters are loaded into the target device for the target device to process based on the target network parameters and the input data to obtain the output data of the target network layer. Among them, compared with directly using zero values ​​to perform sparse processing on input data, by determining a sparse threshold and performing subsequent processing on the input data based on the sparse threshold, the sparsity of the input data can be further improved. Moreover, since there is a certain correspondence between the input data and the network parameters of the target network layer, corresponding operations will be performed between the input data and the network parameters with the corresponding relationship, and the network parameters corresponding to the sparse data in the input data do not need to participate in the corresponding operations. Therefore, the improvement of the sparsity of the input data can effectively reduce the amount of data of the target network parameters that need to be loaded into the target device, thereby reducing the storage and bandwidth requirements for the target device, while also taking into account the processing accuracy of the preset model.

[0010] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the present disclosure and do not constitute a limitation of the present disclosure. The above and other features and advantages will become more apparent to those skilled in the art by describing detailed example embodiments with reference to the accompanying drawings, which are shown as follows.

[0012] Figure 1 A flowchart of a data processing method provided in an embodiment of the present disclosure.

[0013] Figure 2a A schematic diagram of a data processing method for input data and a target network layer provided for related technology.

[0014] Figure 2b A schematic diagram of a data processing method for input data and a target network layer provided in an embodiment of the present disclosure.

[0015] Figure 3 A flowchart of a data processing method provided in Embodiment 1 of the present disclosure.

[0016] Figure 4 A flowchart of a data processing method provided in Embodiment 2 of the present disclosure.

[0017] Figure 5 A block diagram of a data processing device provided in an embodiment of the present disclosure.

[0018] Figure 6 A block diagram of a data processing system provided in an embodiment of the present disclosure.

[0019] Figure 7 A block diagram of an electronic device provided in accordance with a first embodiment of the present disclosure.

[0020] Figure 8 A block diagram of an electronic device provided in Embodiment 2 of the present disclosure. DETAILED DESCRIPTION

[0021] In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0022] In the absence of conflict, the various embodiments of the present disclosure and the various features therein may be combined with each other.

[0023] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.

[0024] The terms used herein are only used to describe specific embodiments and are not intended to limit the present disclosure. As used herein, the singular forms "a" and "the" are also intended to include plural forms, unless the context clearly indicates otherwise. It will also be understood that when the terms "including" and / or "made of" are used in this specification, the presence of the features, wholes, steps, operations, elements and / or components is specified, but the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof is not excluded. "Connected" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect.

[0025] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted as having an idealized or overly formal meaning unless explicitly defined as such herein.

[0026] Large models (for example, GPT-3 (Generative Pre-trained Transformer-3), GLM (General Language Model) and other large language models (LLM)) have a huge number of network parameters exceeding 100 billion, which brings huge challenges to model deployment and application. In addition, with the increasing demand for privacy protection and timeliness, users may need to deploy large models locally on the end device, which requires further reducing the storage space of LM and the transmission bandwidth during operation.

[0027] In related technologies, the above problems are usually solved by parameter compression, which mainly involves technical means such as model quantization, model pruning, and low-rank decomposition. Among them, model quantization refers to reducing the amplitude representation accuracy of model parameters, such as compressing the 16-bit floating point number (fp16) representation of the parameter into an 8-bit integer (int8) or a 4-bit integer (int4) or a lower bit width representation. Compared with the model performance of fp16, int4 precision quantization did not bring about a significant decline. Model pruning refers to discarding unimportant parameters in the model parameters to achieve parameter sparsity. Low-rank decomposition refers to using the low-rank characteristics of the parameter matrix to discard some of the singular values ​​and singular vectors with less influence, decomposing the large parameter matrix into the product of small parameter matrices, thereby reducing the parameter storage amount.

[0028] Although the relevant technology has effectively reduced the total storage volume of the model, it is still difficult to deploy it on the end device. In addition, in the model inference stage, the bandwidth to computation ratio of large models is large, so parameter transmission is one of the main bottlenecks that limit the overall inference speed of the model. However, the above methods mostly use static weight quantization or loading methods, which do not effectively take into account the different importance of different rows (columns) of parameters under different inputs, making it difficult to adaptively compress the model parameters according to the input.

[0029] In view of this, embodiments of the present disclosure provide a data processing method, a data processing device, a data processing system, an electronic device, and a computer-readable storage medium.

[0030] In the disclosed embodiment, for the target network layer of the preset model, the sparse threshold of the input data of the target network layer is determined; according to the sparse threshold and the correspondence between the input data and the network parameters of the target network layer, the target network parameters are selected from the network parameters of the target network layer; the target network parameters are loaded into the target device so that the target device processes based on the target network parameters and the input data to obtain the output data of the target network layer. Compared with directly using zero value to perform sparse processing on the input data, by determining the sparse threshold and performing subsequent processing on the input data based on the sparse threshold, the sparsity of the input data can be further improved, and since there is a certain correspondence between the input data and the network parameters of the target network layer, the input data and the network parameters with the corresponding relationship will perform corresponding operations, and the network parameters corresponding to the sparse data in the input data do not need to participate in the corresponding operations. Therefore, the improvement of the sparsity of the input data can effectively reduce the amount of data of the target network parameters that need to be loaded into the target device, thereby reducing the storage and bandwidth requirements for the target device, while also taking into account the processing accuracy of the preset model.

[0031] A first aspect of an embodiment of the present disclosure provides a data processing method.

[0032] Figure 1 A flowchart of a data processing method provided by an embodiment of the present disclosure. Figure 1 , the data processing method may include the following steps.

[0033] Step S11, for a target network layer of a preset model, determining a sparse threshold of input data of the target network layer, wherein the sparse threshold is greater than an absolute value of a minimum value in the input data.

[0034] Step S12, selecting target network parameters from the network parameters of the target network layer according to the sparse threshold and the corresponding relationship between the input data and the network parameters of the target network layer.

[0035] Step S13, loading the target network parameters into the target device, so that the target device processes based on the target network parameters and the input data to obtain output data of the target network layer.

[0036] When processing data using a preset model, if all network parameters of the target network layer of the preset model are loaded into the target device, high requirements will be placed on the storage and bandwidth of the target device. Some target devices with limited performance (e.g., end devices) may not be able to carry large-scale preset models, thereby limiting the application of the preset model. Based on this, in the embodiment of the present disclosure, a sparse threshold of the input data is determined for the input data of the target network layer, so as to adaptively improve the sparsity of the input data through the sparse threshold, and since there is a corresponding relationship between the input data and the network parameters of the target network layer, the increase in the sparsity of the input data will affect the calculation of the corresponding network parameters, and the network parameters corresponding to the sparse input data will not affect (or have a small impact on) the final calculation result. Therefore, the sparse threshold and the corresponding relationship can be used to select a part of the full network parameters of the target network layer as the target network parameters, and only load the target network parameters into the target device, so that the target device can be processed based on the target network parameters and the input data.

[0037] Through this processing method, on the one hand, the amount of data of the target network parameters that need to be loaded into the target device can be reduced, and the storage and bandwidth requirements for the target device are reduced, so that some target devices that originally cannot carry the preset model can deploy and run the preset model; on the other hand, the sparse threshold is the sparse threshold of the input data, not a static threshold set in advance. That is to say, for different input data, the determined sparse threshold may be different. In this way, adaptive compression processing of network parameters can be achieved; on the third hand, since the loaded target network parameters are selected based on the sparse threshold and the corresponding relationship, this part of the target network parameters belongs to the network parameters that have a greater impact on the calculation results. Therefore, using the target network parameters can obtain relatively accurate processing results, while taking into account the processing accuracy of the preset model.

[0038] In summary, in the embodiments of the present disclosure, taking into account that when a model is deployed on a terminal device such as a chip, if the data volume of the network parameters of the model is too large, the storage and bandwidth requirements of the chip are relatively large. Based on this, in the embodiments of the present disclosure, for the target network layer of the preset model, the sparse threshold of the input data of the target network layer is determined; according to the sparse threshold and the correspondence between the input data and the network parameters of the target network layer, the target network parameters are selected from the network parameters of the target network layer; the target network parameters are loaded into the target device for the target device to process based on the target network parameters and the input data to obtain the output data of the target network layer. Among them, compared with directly using zero values ​​to perform sparse processing on input data, by determining a sparse threshold and performing subsequent processing on the input data based on the sparse threshold, the sparsity of the input data can be further improved. Moreover, since there is a certain correspondence between the input data and the network parameters of the target network layer, corresponding operations will be performed between the input data and the network parameters with the corresponding relationship, and the network parameters corresponding to the sparse data in the input data do not need to participate in the corresponding operations. Therefore, the improvement of the sparsity of the input data can effectively reduce the amount of data of the target network parameters that need to be loaded into the target device, thereby reducing the storage and bandwidth requirements for the target device, while also taking into account the processing accuracy of the preset model.

[0039] The data processing method of the embodiment of the present disclosure is described below.

[0040] In some optional implementations, the preset model is a model that can perform preset tasks, which may include a text processing model, an audio processing model, etc., which is not limited in this embodiment of the present disclosure.

[0041] In some optional implementations, the preset model includes a large model for performing preset tasks. Among them, the large model refers to a machine learning model with large-scale parameters and complex computing structure. The large model is usually built from a deep neural network and has billions or even hundreds of billions of parameters. The large model learns complex patterns and features by training massive data, has a stronger generalization ability, and can make accurate predictions for unseen data. Therefore, the large model has strong expressive power and predictive performance, and can handle more complex tasks and data. In an embodiment of the present application, the large model can be applied to fields such as natural language processing, computer vision, speech recognition, and recommendation systems, and can be used to perform preset tasks such as text processing tasks, audio processing tasks, and image processing tasks.

[0042] In some optional implementations, the preset model may include a large language model. The large language model can be obtained by training a deep learning model with massive text data, which can not only generate natural language text, but also deeply understand the meaning of the text and process various natural language tasks, such as text summarization, question answering, translation, etc.

[0043] In some optional implementations, the target network layer is a network layer in a preset model, which can implement a corresponding processing function (eg, a feature extraction function). Furthermore, the preset model may include one or more target network layers.

[0044] Exemplarily, the preset model is a text processing model, and the target network layer includes a self-attention (Self-Attetion) network layer, a feed-forward network (FFN) layer, etc. in the text processing model.

[0045] It should be noted that the above preset model and its target network layer are only examples, and the embodiments of the present disclosure are not limited to this.

[0046] In some optional implementations, the input data of the target network layer refers to the data input to the target network layer. If the target network layer is the first network layer of the preset model, its input data is the initial data input to the preset model; if the target network layer is an intermediate network layer (e.g., a hidden layer) of the preset model, its input data is some intermediate data (e.g., a hidden layer vector, an activation vector, etc.).

[0047] In some optional implementations, the network parameters of the target network layer include at least one of a weight parameter, a bias parameter, and the like.

[0048] In some optional implementations, the network parameters may include at least one of a self-attention weight parameter and a multi-layer perceptron weight parameter. The self-attention weight parameter is a weight parameter of a self-attention network layer, and the multi-layer perceptron weight parameter is a weight parameter of a multi-layer perceptron network (MLP) layer, which is a special case of a feedforward neural network.

[0049] It should be noted that the above network parameters are merely examples, and the embodiments of the present disclosure do not limit this.

[0050] Furthermore, after the input data is input into the target network layer, the target network layer needs to perform certain data processing (e.g., convolution operation) on the input data to obtain the corresponding processing result. Among them, the network parameters of the target network layer are actually involved in the data processing of the input data, and there is a certain correspondence between the input data and the network parameters of the target network layer, based on which operations such as multiplication and addition can be performed between the input data and the network parameters.

[0051] For example, the input data is a 1×4 row vector I=[1,2,0,2], and the network parameters of the target network layer are a 4×5 matrix W=[1,1,2,3,3; 2,2,3,1,5; 1,1,3,0,0; 2,2,1,1,1]. After the input data is input into the target network layer, I×W needs to be calculated to obtain the corresponding output data. When calculating I×W, the elements of each column in I and W are multiplied and added to obtain five multiplication and addition values. These five multiplication and addition values ​​constitute a 1×5 row vector Y, which is the output data of the target network layer.

[0052] Furthermore, since I performs multiplication and addition operations on the elements in each column of W, the corresponding relationship between the input data and the network parameters can be determined. For example, the element in W that performs multiplication operations on the "0" element in I is the element in the third row, that is, [1,1,3,0,0] in W performs multiplication operations on "0", so it can be determined that there is a corresponding relationship between "0" in I and [1,1,3,0,0] in W.

[0053] In some optional implementations, the sparse threshold of the input data is a threshold for performing sparse processing on the input data, and the sparse threshold is greater than the absolute value of the minimum value in the input data, so that the sparsity of the input data determined based on the sparse threshold is definitely greater than zero (that is, at least one data in the input data will be sparse). In other words, through the sparse threshold, the input data can be screened, important information can be screened out, and irrelevant information can be discarded, thereby achieving sparseness of the input data.

[0054] The sparse threshold of the input data can be determined according to the corresponding sparse requirements. For example, if the sparse requirement is high, a sparse threshold with a larger value can be set to improve the sparse level. If the sparse requirement is low, a sparse threshold with a smaller value can be set to meet various processing requirements.

[0055] It should be noted that the sparse threshold in the embodiment of the present disclosure is not a pre-set fixed value, but can be updated according to actual needs (for example, the requirement for parameter compression degree), or change with the change of the input data itself, so as to achieve an adaptive sparse processing effect.

[0056] Exemplarily, if the input data are all greater than or equal to zero, the sparse threshold of the input data can be determined to be thr1 (thr1≥0), and the data in the input data that is less than the sparse threshold thr1 can be regarded as data that can be sparsed, and the data that is greater than or equal to the sparse threshold thr1 is considered to be relatively important information that needs to be retained.

[0057] Exemplarily, if the input data includes both data greater than or equal to zero and data less than zero, the sparse threshold of the input data can be determined to be thr2 (thr2≥0), and data whose absolute value is less than the sparse threshold thr2 is regarded as data that can be sparsed, and data whose absolute value is greater than or equal to the sparse threshold thr2 is regarded as relatively important information that needs to be retained.

[0058] Exemplarily, if the input data includes both data greater than or equal to zero and data less than zero, it can be determined that the sparse thresholds of the input data include thr3 (thr3≥0) and thr4 (thr4<0), and the data in the input data whose values ​​are within the value range of (thr4, thr3) are regarded as data that can be sparsely distributed, and the remaining data are regarded as relatively important information that needs to be retained, wherein the sizes of thr3 and |thr4│ can be different.

[0059] In other words, through the sparse threshold, the input data can be divided into first data greater than or equal to the sparse threshold and second data less than the sparse threshold. Among them, since the value of the first data is relatively large, its importance to the network parameters corresponding to the first data is also relatively large, so the part of the network parameters corresponding to the first data needs to be retained and will not be compressed; correspondingly, since the value of the second data is relatively small, its importance to the network parameters corresponding to the second data is also relatively small, so this part of the network parameters can be compressed.

[0060] That is to say, after determining the sparse threshold of the input data, the target network parameters that need to be retained can be selected from the network parameters of the target network layer based on the correspondence between the input data and the network parameters of the target network layer, and the remaining network parameters can be compressed.

[0061] In some optional implementations, target network parameters are selected from the network parameters of the target network layer based on a sparse threshold and a correspondence between the input data and the network parameters of the target network layer, including: filtering out target data having a value greater than or equal to the sparse threshold from the input data; and selecting network parameters having a correspondence with the target data as the target network parameters.

[0062] Exemplarily, the input data is a 1×4 row vector I=[i1,i2,i3,i4]=[1,2,0,2], and its corresponding sparse threshold T is determined to be 1. The network parameters of the target network layer are a 4×5 matrix W=[1,1,2,3,3; 2,2,3,1,5; 1,1,3,0,0; 2,2,1,1,1], and I×W data operations are performed between the two to obtain the corresponding output data. It can be seen that i1 in I is multiplied by the first row element [1,1,2,3,3] in W, i2 in I is multiplied by the second row element [2,2,3,1,5] in W, i3 in I is multiplied by the third row element [1,1,3,0,0] in W, and i4 in I is multiplied by the fourth row element [2,2,1,1,1] in W.

[0063] Since i1=T, i2>T, i3<T, i4>T, i1 and i3 in I are data that can be sparsified, and i2 and i4 are target data. Based on this, it can be determined that the target network parameters include: [2,2,3,1,5; 2,2,1,1,1].

[0064] In some optional implementations, after determining the target network parameters, the target network parameters can be loaded into the target device. For the target device, it can use the target network parameters and input data to perform corresponding processing to obtain output data of the target network layer. Among them, the target device refers to a processor with certain data storage and data processing capabilities, which can be a chip, a single-core processor, or a multi-core processor, which is not limited in the embodiments of the present disclosure.

[0065] Figure 2a A schematic diagram of a data processing method for input data and target network layer provided for related technologies. Figure 2a, the input data is a 1×4 row vector I=[i1,i2,i3,i4]=[1,2,0,2], and the network parameters of the target network layer are a 4×5 matrix W=[1,1,2,3,3; 2,2,3,1,5; 1,1,3,0,0; 2,2,1,1,1], and I×W data operations are performed between the two.

[0066] like Figure 2a As shown, if the above data processing is performed based on the relevant technology, the complete W needs to be loaded into the target device, and I×W is calculated based on the computing resources of the target device to obtain the output data O=[9,9,10,7,15].

[0067] Figure 2b A schematic diagram of a data processing method for input data and a target network layer provided by an embodiment of the present disclosure. Figure 2b As shown, in the data processing method based on the embodiment of the present disclosure, the input data is a 1×4 row vector I=[i1,i2,i3,i4]=[1,2,0,2], and its corresponding sparse threshold T is determined to be 2, and the network parameters of the target network layer are a 4×5 matrix W=[1,1,2,3,3; 2,2,3,1,5; 1,1,3,0,0; 2,2,1,1,1], and I×W data operations are performed between the two. Since the sparse threshold T is 2, i1 and i3 whose values ​​are less than T belong to data that can be sparsed. According to the correspondence between the input data and the network parameters, it is only necessary to load the network parameters that have a corresponding relationship with i2 and i4 to the target device, that is, it is only necessary to load the elements of the 2nd and 4th rows of W to the target device. For the target device, it only needs to calculate [2,2]×[2,2,3,1,5; 2,2,1,1,1] to obtain the output data O'=[8,8,8,4,12].

[0068] By comparison Figure 2a and Figure 2b It can be seen that although the amount of network parameter data loaded into the target device is reduced, the output data O' of the target device regarding the target network layer has a high similarity with the output data O loaded with the full amount of network parameters. Therefore, the output data obtained based on the target network parameters can meet subsequent data processing requirements.

[0069] It can be seen that when data processing is performed based on the embodiment of the present disclosure, only some of the more important target network parameters can be loaded to the target device, based on which the amount of data that needs to be loaded to the target device can be reduced, thereby reducing the bandwidth pressure on the target device. In addition, since the amount of loaded data is reduced, the amount of data calculation of the target device is also reduced accordingly, so the inference speed of the target device can be improved.

[0070] In some optional implementations, determining the sparse threshold of the input data of the target network layer includes: determining the quantile value of the input data; determining the sparse threshold value according to the quantile value. Among them, the quantile value (Quantile) can also be called the quantile point, which is a statistical concept, which can be used to divide a set of data according to size and determine the percentage of data contained in each division. The distribution and central tendency of the data can be analyzed by the quantile value, and the relative value position of the data point in the entire data set can be understood. Common quantile values ​​include median values ​​(50% quantile values), quartile values ​​(such as 25% quantile values, 75% quantile values) and percentile values ​​(quantile values ​​of any percentage), etc., and the embodiments of the present disclosure are not limited to this.

[0071] For example, the 25% percentile value indicates the target data in the target sorting position after sorting a set of data from small to large, so that 25% of the data in the input data is less than or equal to the target data, and the target data corresponds to the 25% percentile value. If the input data is a 1×8 row vector R=[5,1,3,6,5,7,9,2], after sorting the elements in the input data, we can get the sequence: 1, 2, 3, 5, 5, 6, 7, 9. Among them, the data in the second position is 2, and the number of data less than or equal to 2 in the sequence is two, and the total number is 8, so the value "2" corresponds to the 25% percentile value. It can be seen that the 25% percentile value of the input data is 2, and the 25% percentile value is used as the sparse threshold of the input data, so that the sparse threshold of the input data can be determined to be 2.

[0072] Exemplarily, the sparse threshold of the input data can be determined by the following formula:

[0073] T=quantile(│[R]│,q)

[0074] Where T represents the sparse threshold, [R] represents the input data, │ │ represents the absolute value operation, q represents the quantile parameter (for example, q is 25% to determine the 25% quantile), and quantile() represents the function that determines the q quantile of the input data [R].

[0075] It should be noted that when the sparse threshold of the input data is determined based on the quantile value, the corresponding quantile value will be different for different input data values, and the sparse threshold will also change accordingly, which is equivalent to realizing an adaptive threshold determination method. In other words, the sparse threshold determined based on the quantile value can be adaptively changed with different input data to ensure the rationality of the sparse threshold.

[0076] It should also be noted that when determining the sparse threshold of the target network layer based on the percentile value of the input data, if the input data is the same, the determined sparse threshold is the same even for different target network layers.

[0077] In some optional implementations, determining the sparse threshold of the input data of the target network layer includes: determining the compression ratio of the target network layer according to an evaluation function of a preset model, where the evaluation function is a function of a preset evaluation data set, a preset model, model parameters of the preset model, and the compression ratio of the target network layer; and determining the sparse threshold of the input data according to the compression ratio. The compression ratio of the target network layer is a ratio for compressing the network parameters of the target network layer, which can be understood as a pruning ratio of the target network layer.

[0078] Among them, the evaluation function can be used to evaluate the performance of the preset model (for example, accuracy, etc.), and the preset evaluation dataset can be selected from large language model evaluation benchmark datasets such as ceval (a comprehensive Chinese basic model evaluation suite) and cmmlu (a suite for evaluating Chinese multimodal learning and comprehension capabilities).

[0079] Exemplarily, based on a preset evaluation data set, a preset model, model parameters of the preset model, and a compression ratio of a target network layer, an evaluation function of the preset model is constructed as follows:

[0080]

[0081] Where i is the serial number of the target network layer, qi represents the compression ratio of the i-th target network layer, D represents the preset evaluation data set, x represents the sample data in D, f( ) represents the preset model, θ represents the model parameters of the preset model, P[ ] represents the evaluation function, argmax represents the function for solving the maximum value, and E represents the expected value.

[0082] For example, solving {qi} means solving the statistical mean E of the evaluation function on the sample set x. x~D The maximum value of .

[0083] The above formula can be solved by optimization methods such as genetic algorithm, particle swarm algorithm, etc., which is not limited in the embodiments of the present disclosure.

[0084] In some optional implementations, after the compression ratio is determined, it is only clear to what extent the network parameters of the target network layer are compressed, but it is not clear which network parameters need to be compressed. Furthermore, among the many network parameters of the target network layer, there are some parameters that have a greater impact on the input data, and there are other parameters that have a smaller impact on the input data. In order to alleviate or reduce the impact of parameter compression on the processing results as much as possible, the parameters that have a greater impact on the input data can be retained, and the network parameters that have a smaller impact on the input data can be compressed.

[0085] In some optional implementations, if a certain data in the input data has a larger value, the importance of the network parameter calculated corresponding to the input data is also correspondingly higher. Conversely, if a certain data in the input data has a smaller value, the importance of the network parameter calculated corresponding to the input data is also correspondingly smaller. It can be seen that the numerical value of the input data is associated with the importance of the corresponding network parameter. Therefore, the part of the data with a larger value can be selected from the input data according to the compression ratio to determine the network parameter to be compressed. Among them, the sparse threshold can be used as a benchmark for dividing the value size of the input data, that is, if a certain data in the input data is greater than or equal to the sparse threshold, it is determined that the data has a greater impact on the corresponding network parameter, so the corresponding network parameter is retained. If a certain data in the input data is less than the sparse threshold, it is determined that the data has a smaller impact on the corresponding network parameter, and the corresponding network parameter can be compressed.

[0086] In some optional implementations, a sparse threshold of input data is determined based on a compression ratio, including: dividing the input data into first input sub-data and second input sub-data based on the compression ratio, so that the ratio of the number of first input sub-data to the number of second input sub-data is the compression ratio, and the first input sub-data are all less than or equal to the second input sub-data; and determining the sparse threshold of the input data based on the minimum value of the second input sub-data or the maximum value of the first input sub-data.

[0087] Exemplarily, if the compression ratio is 40%, 40% of the network parameters of the target network layer need to be compressed (or pruned). Based on this, the sparse threshold of the input data can be determined so that the input data can be divided into first data greater than or equal to the sparse threshold and second data less than the sparse threshold based on the sparse threshold, and the network parameters corresponding to the first data are used as target network parameters, and the network parameters corresponding to the second data are determined at the same time, and these network parameters are used as network parameters that can be compressed.

[0088] It should be noted that in the related art, "0" is usually directly used as the sparse threshold of the input data, that is, if a certain data in the input data is 0, then the data can be sparse, and other data except 0 cannot be sparse. Since the number of 0s in the input data is usually small, if the input data is sparse based on 0 as the sparse threshold, the degree of sparsity is limited and may not meet the processing requirements. Based on this, the embodiment of the present disclosure proposes a sparse threshold, which performs a greater degree of sparse processing on the input data, and the specific value of the sparse threshold can also be adjusted according to the needs to achieve different degrees of sparse processing.

[0089] It should also be noted that in the embodiments of the present disclosure, the sparse threshold of the input data can achieve "sparseness" of the network parameters of the target network layer. This is because there is a corresponding relationship between the input data and the network parameters of the target network layer. If some data in the input data is less than the sparse threshold, the network parameters that have a corresponding relationship with the data can be sparse. This part of the network parameters that can be sparse does not need to participate in subsequent data processing, and therefore does not need to be loaded into the target device. In this way, the amount of data of the target network parameters that need to be loaded into the target device can be effectively reduced, reducing the storage and bandwidth requirements for the target device.

[0090] In some optional implementations, the network parameters of the target network layer correspond to multiple parameter types; accordingly, determining the sparse threshold of the input data of the target network layer includes: determining the sparse threshold of the input data for each parameter type of the network parameters. That is, if the target network layer includes network parameters of multiple parameter types, the sparse threshold of the input data corresponding to each parameter type of the network parameters can be determined.

[0091] Exemplarily, the network parameters of the target network layer i include the self-attention weight parameter W1 and the feedforward neural network weight parameter W2. Based on this, the evaluation function of the preset model can be constructed according to the preset evaluation data set, the preset model, the model parameters of the preset model, and the compression ratio of the target network layer as shown below:

[0092]

[0093] Among them, i is the serial number of the target network layer, q i1 represents the compression ratio of the i-th target network layer regarding the self-attention weight parameter W1, q i2represents the compression ratio of the i-th target network layer with respect to the feedforward neural network weight parameter W2, D represents the preset evaluation data set, x is the sample data in D, f( ) represents the preset model, θ represents the model parameter of the preset model, P[ ] represents the evaluation function, argmax represents the function for solving the maximum value, and E represents the expected value. Solving the above equations by optimization methods such as genetic algorithm and particle swarm algorithm can obtain q i1 and q i2 .

[0094] If the input data is I, then when q is obtained i1 and q i2 After that, the compression ratio q i1 , the input data I is divided into the first input sub-data I11 and the second input sub-data I12, so that the ratio of the number of the first input sub-data I11 to the number of the second input sub-data I12 is the compression ratio q i1 , and the first input sub-data are all less than or equal to the second input sub-data, and the sparse threshold T1 of the input data is determined according to the minimum value of the second input sub-data I12 or the maximum value of the first input sub-data I11; similarly, the sparse threshold T1 of the input data can be determined according to the compression ratio q i2 , the input data I is divided into the first input sub-data I21 and the second input sub-data I22, so that the ratio of the number of the first input sub-data I21 to the number of the second input sub-data I22 is the compression ratio q i2 , and the first input sub-data are all less than or equal to the second input sub-data, and the sparse threshold T2 of the input data is determined according to the minimum value of the second input sub-data I22 or the maximum value of the first input sub-data I21.

[0095] Furthermore, first target data having a value greater than or equal to the sparse threshold T1 is filtered out from the input data I, and a network parameter having a corresponding relationship with the first target data is selected as a target network parameter corresponding to the self-attention weight parameter W1, and the target network parameter is loaded into a target device, which performs processing based on the target network parameter and the input data to obtain output data of the target network layer regarding the self-attention weight parameter W1.

[0096] Similarly, second target data having a value greater than or equal to the sparse threshold T2 can be screened out from the input data I, and a network parameter having a corresponding relationship with the second target data is selected as the target network parameter corresponding to the feedforward neural network weight parameter W2, and the target network parameter is loaded into the target device, which performs processing based on the target network parameter and the input data to obtain the output data of the target network layer regarding the feedforward neural network weight parameter W2.

[0097] It should be noted that this processing method takes into account the different ways and / or purposes of computing network parameters of different parameter types and input data. Based on this, corresponding compression ratios can be determined for network parameters of different parameter types. Based on this, sparse thresholds of different parameter types can be determined for input data, thereby obtaining a more reasonable and accurate network parameter compression method and reducing the impact on output results.

[0098] In some optional implementations, the network parameters of the target network layer include at least one of a vector, a matrix and a tensor, and the input data includes a vector; accordingly, a network parameter having a corresponding relationship with the target data is selected as the target network parameter, including: when the network parameter is a vector, according to the corresponding relationship, the vector element in the network parameter that is multiplied with the target data is determined as the target network parameter; when the network parameter is a matrix, according to the corresponding relationship, the matrix row element in the network parameter that is multiplied with the target data is determined as the target network parameter; when the network parameter is a tensor, according to the corresponding relationship, multiple matrix row elements in the network parameter that are multiplied with the target data are determined as the target network parameter.

[0099] Exemplarily, if the input data of the target network layer is a row vector, and the network parameters of the target network layer are column vectors, the two vectors are multiplied, and each element in the row vector corresponds to the corresponding element of the column vector, and the multiplication operation is performed between the two. If some elements in the row vector are target data, the corresponding elements in the column vector belong to the target network parameters, and these target network parameters will be loaded into the target device for subsequent data processing.

[0100] Exemplarily, if the input data of the target network layer is a row vector, and the network parameters of the target network layer are matrices, the row vector and the matrix are multiplied, and each element in the row vector corresponds to a row element in the matrix, and the two are multiplied. If some elements in the row vector are target data, the corresponding matrix row elements in the matrix belong to the target network parameters, and these target network parameters will be loaded into the target device for subsequent data processing.

[0101] Exemplarily, if the input data of the target network layer is a row vector, and the network parameters of the target network layer are three-dimensional tensors (the third dimension is the channel dimension, the three-dimensional tensor corresponds to multiple channels, and each channel corresponds to a matrix), the row vector and the tensor are multiplied. For each channel, each element in the row vector corresponds to a row element in the matrix of the channel, and the two are multiplied. If some elements in the row vector are target data, the matrix row elements corresponding to these target data in the matrix corresponding to each channel belong to the target network parameters. For the entire tensor, there are multiple matrix row elements that belong to the target network parameters. This part of the target network parameters will be loaded into the target device for subsequent data processing.

[0102] Figure 3 This is a flow chart of a data processing method provided in the first embodiment of the present disclosure. Figure 3 , the data processing method may include the following steps.

[0103] Step S31, obtaining input data of the target network layer of the preset model.

[0104] Step S32, determining the percentile value of the input data.

[0105] Step S33, determining the sparse threshold of the input data according to the quantile value.

[0106] Step S34, filtering out target data whose value is greater than or equal to the sparse threshold from the input data.

[0107] Step S35 , with respect to the network parameters of the target network layer, select the network parameters that have a corresponding relationship with the target data as the target network parameters of the target network layer.

[0108] Step S36, loading the target network parameters into the target device.

[0109] Step S37: The target device processes based on the target network parameters and the input data to obtain output data of the target network layer.

[0110] Figure 4 This is a flow chart of a data processing method provided in the second embodiment of the present disclosure. Figure 4 , the data processing method may include the following steps.

[0111] Step S41, constructing an evaluation function of the preset model based on the preset evaluation data set, the preset model, the model parameters of the preset model and the compression ratio of the target network layer.

[0112] The compression ratio refers to the ratio of compressing the network parameters of the target network layer.

[0113] Step S42, solving the evaluation function by a preset optimization algorithm to obtain the compression ratio of the target network layer.

[0114] Step S43, when the input data of the target network layer is obtained, the input data is divided into first input sub-data and second input sub-data according to the compression ratio.

[0115] The ratio of the number of the first input sub-data to the number of the second input sub-data is the compression ratio, and the first input sub-data are all smaller than or equal to the second input sub-data.

[0116] Step S44: determining a sparse threshold of the input data according to the minimum value of the second input sub-data or the maximum value of the first input sub-data.

[0117] Step S45, filtering out target data whose value is greater than or equal to the sparse threshold from the input data.

[0118] Step S46, selecting a network parameter corresponding to the target data as a target network parameter.

[0119] Step S47, loading the target network parameters into the target device.

[0120] Step S48: The target device processes based on the target network parameters and the input data to obtain output data of the target network layer.

[0121] It can be understood that the above-mentioned embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, the present disclosure will not repeat them. Those skilled in the art can understand that in the above-mentioned method of the specific implementation method, the specific execution order of each step and the setting of the functional module should be determined by its function and possible internal logic.

[0122] A second aspect of an embodiment of the present disclosure provides a data processing device.

[0123] Figure 5 A block diagram of a data processing device provided by an embodiment of the present disclosure. Figure 5 , the data processing device 500 may include the following modules.

[0124] The determination module 510 is used to determine a sparse threshold of input data of a target network layer for a preset model, where the sparse threshold is greater than an absolute value of a minimum value in the input data.

[0125] The selection module 520 is used to select target network parameters from the network parameters of the target network layer according to the sparse threshold and the corresponding relationship between the input data and the network parameters of the target network layer.

[0126] The loading module 530 is used to load the target network parameters into the target device, so that the target device processes the target network parameters and the input data to obtain the output data of the target network layer.

[0127] In the embodiments of the present disclosure, taking into account that when a model is deployed on a terminal device such as a chip, if the data volume of the network parameters of the model is too large, the storage and bandwidth requirements of the chip are relatively large. Based on this, in the embodiments of the present disclosure, for the target network layer of the preset model, a sparse threshold of the input data of the target network layer is determined by a determination module, and the sparse threshold is greater than the absolute value of the minimum value in the input data; a selection module is used to select target network parameters from the network parameters of the target network layer according to the sparse threshold and the correspondence between the input data and the network parameters of the target network layer; and a loading module is used to load the target network parameters to the target device, so that the target device processes the target network parameters and the input data to obtain output data of the target network layer. Among them, compared with directly using zero values ​​to perform sparse processing on input data, by determining a sparse threshold and performing subsequent processing on the input data based on the sparse threshold, the sparsity of the input data can be further improved. Moreover, since there is a certain correspondence between the input data and the network parameters of the target network layer, corresponding operations will be performed between the input data and the network parameters with the corresponding relationship, and the network parameters corresponding to the sparse data in the input data do not need to participate in the corresponding operations. Therefore, the improvement of the sparsity of the input data can effectively reduce the amount of data of the target network parameters that need to be loaded into the target device, thereby reducing the storage and bandwidth requirements for the target device, while also taking into account the processing accuracy of the preset model.

[0128] A third aspect of an embodiment of the present disclosure provides a data processing system.

[0129] Figure 6 A block diagram of a data processing system provided by an embodiment of the present disclosure. Figure 6 , the data processing system 600 may include: a data processing device 610 and a target device 620 .

[0130] The data processing device 610 is used to implement any data processing method of the embodiments of the present disclosure.

[0131] The target device 620 is used to process the target network parameters of the target network layer of the preset model loaded by the data processing device and the input data of the target network layer to obtain the output data of the target network layer.

[0132] In some optional implementations, the data processing device 610 determines the sparse threshold of the input data of the target network layer for the preset model, the sparse threshold is greater than the absolute value of the minimum value in the input data; selects the target network parameters from the network parameters of the target network layer according to the sparse threshold and the correspondence between the input data and the network parameters of the target network layer; and loads the target network parameters to the target device. The target device 620 receives the target network parameters and processes based on the target network parameters and the input data to obtain the output data of the target network layer.

[0133] In the embodiments of the present disclosure, taking into account that when a model is deployed on a terminal device such as a chip, if the data volume of the network parameters of the model is too large, the storage and bandwidth requirements of the chip are relatively large. Based on this, in the embodiments of the present disclosure, a data processing device is used to determine the sparse threshold of the input data of the target network layer for the target network layer of a preset model; based on the sparse threshold and the correspondence between the input data and the network parameters of the target network layer, the target network parameters are selected from the network parameters of the target network layer; the target network parameters are loaded into the target device; the target device processes the target network parameters of the target network layer loaded by the data processing device and the input data of the target network layer to obtain the output data of the target network layer. Among them, compared with directly using zero values ​​to perform sparse processing on input data, by determining a sparse threshold and performing subsequent processing on the input data based on the sparse threshold, the sparsity of the input data can be further improved. Moreover, since there is a certain correspondence between the input data and the network parameters of the target network layer, corresponding operations will be performed between the input data and the network parameters with the corresponding relationship, and the network parameters corresponding to the sparse data in the input data do not need to participate in the corresponding operations. Therefore, the improvement of the sparsity of the input data can effectively reduce the amount of data of the target network parameters that need to be loaded into the target device, thereby reducing the storage and bandwidth requirements for the target device, while also taking into account the processing accuracy of the preset model.

[0134] In addition, the present disclosure also provides an electronic device and a computer-readable storage medium.

[0135] Figure 7 A block diagram of an electronic device provided in accordance with a first embodiment of the present disclosure.

[0136] Reference Figure 7An embodiment of the present disclosure provides an electronic device, which includes: at least one processor 701; at least one memory 702, and one or more I / O interfaces 703, connected between the processor 701 and the memory 702; wherein the memory 702 stores one or more computer programs that can be executed by the at least one processor 701, and the one or more computer programs are executed by the at least one processor 701 so that the at least one processor 701 can execute the data processing method described in any one of the embodiments of the present disclosure.

[0137] Figure 8 A block diagram of an electronic device provided in Embodiment 2 of the present disclosure.

[0138] Reference Figure 8 An embodiment of the present disclosure provides an electronic device, which includes multiple processing cores 801 and an on-chip network 802, wherein the multiple processing cores 801 are connected to the on-chip network 802, and the on-chip network 802 is used to exchange data between the multiple processing cores and external data.

[0139] Among them, one or more instructions are stored in one or more processing cores 801, and the one or more instructions are executed by one or more processing cores 801, so that one or more processing cores 801 can execute the data processing method described in any one of the embodiments of the present disclosure.

[0140] In some embodiments, the electronic device may be a brain-like chip, and since the brain-like chip can use vectorized computing and needs to load the weight information and other parameters of the neural network model through an external memory such as a double data rate (DDR) synchronous dynamic random access memory, the batch processing in the disclosed embodiment has a higher computing efficiency.

[0141] The present disclosure also provides a computer-readable storage medium on which a computer program is stored, wherein the computer program implements the data processing method described in any one of the embodiments of the present disclosure when executed by a processor / processing core. The computer-readable storage medium may be a volatile or non-volatile computer-readable storage medium.

[0142] The embodiments of the present disclosure also provide a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the data processing method described in any one of the embodiments of the present disclosure.

[0143] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable storage medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a transient medium).

[0144] As is known to those of ordinary skill in the art, the term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable program instructions, data structures, program modules or other data. Computer storage media include, but are not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technology, portable compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, as is known to those of ordinary skill in the art, communication media typically contain computer readable program instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0145] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.

[0146] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect through the Internet). In some embodiments, by using the state information of the computer-readable program instructions to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit may execute the computer-readable program instructions, thereby implementing various aspects of the present disclosure.

[0147] The computer program product described herein may be implemented in hardware, software, or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK), etc.

[0148] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of boxes in the flowchart and / or block diagram can be implemented by computer-readable program instructions.

[0149] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0150] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0151] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.

[0152] Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for limiting purposes. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly noted, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, those skilled in the art will appreciate that various changes in form and detail may be made without departing from the scope of the present disclosure as set forth in the appended claims.

Claims

1. A data processing method, characterized in that: include: For a target network layer of a preset model, determining a sparse threshold of input data of the target network layer, wherein the sparse threshold is greater than an absolute value of a minimum value in the input data, wherein the preset model is used to perform at least one of a text processing task, an audio processing task, and an image processing task; Selecting a target network parameter from the network parameters of the target network layer according to the sparse threshold and the corresponding relationship between the input data and the network parameters of the target network layer; Loading the target network parameters to a target device, so that the target device processes the target network parameters and the input data to obtain output data of the target network layer; The determining a sparse threshold of input data of the target network layer includes: Determining the compression ratio of the target network layer according to an evaluation function of the preset model, wherein the evaluation function is a function of a preset evaluation data set, the preset model, model parameters of the preset model, and the compression ratio of the target network layer; Determining a sparse threshold of the input data according to the compression ratio; Determining the sparse threshold of the input data according to the compression ratio includes: According to the compression ratio, the input data is divided into first input sub-data and second input sub-data, so that the ratio of the number of the first input sub-data to the number of the second input sub-data is the compression ratio, and the first input sub-data are all smaller than or equal to the second input sub-data; A sparse threshold of the input data is determined according to a minimum value of the second input sub-data or a maximum value of the first input sub-data.

2. The method according to claim 1, characterized in that The determining a sparse threshold of input data of the target network layer includes: Determining a quantile value of the input data; The sparse threshold is determined according to the quantile value.

3. The method according to claim 1, characterized in that: The network parameters of the target network layer correspond to multiple parameter types; The determining a sparse threshold of input data of the target network layer includes: For each network parameter type, a sparse threshold of the input data is determined respectively.

4. The method according to claim 1, characterized in that: The selecting target network parameters from the network parameters of the target network layer according to the sparse threshold and the corresponding relationship between the input data and the network parameters of the target network layer includes: Filtering target data whose value is greater than or equal to the sparse threshold from the input data; A network parameter having a corresponding relationship with the target data is selected as the target network parameter.

5. The method according to claim 4, characterized in that The network parameter of the target network layer includes at least one of a vector, a matrix and a tensor, and the input data includes a vector; The selecting a network parameter having a corresponding relationship with the target data as the target network parameter includes: In the case where the network parameter is a vector, according to the corresponding relationship, the vector element in the network parameter that is multiplied by the target data is determined as the target network parameter; In the case where the network parameter is a matrix, according to the corresponding relationship, the matrix row elements in the network parameter that are multiplied with the target data are determined as the target network parameters; In the case where the network parameter is a tensor, based on the corresponding relationship, a plurality of matrix row elements in the network parameter that are multiplied with the target data are determined as the target network parameter.

6. The method according to any one of claims 1 to 5, characterized in that: The preset model includes a large model for performing a preset task.

7. A data processing device, characterized in that: include: A determination module, for determining a sparse threshold of input data of a target network layer of a preset model, wherein the sparse threshold is greater than an absolute value of a minimum value in the input data, wherein the preset model is used to perform at least one of a text processing task, an audio processing task, and an image processing task; A selection module, configured to select a target network parameter from the network parameters of the target network layer according to the sparse threshold and a correspondence between the input data and the network parameters of the target network layer; A loading module, used for loading the target network parameters into a target device, so that the target device processes the target network parameters and the input data to obtain output data of the target network layer; The determining a sparse threshold of input data of the target network layer includes: Determining the compression ratio of the target network layer according to an evaluation function of the preset model, wherein the evaluation function is a function of a preset evaluation data set, the preset model, model parameters of the preset model, and the compression ratio of the target network layer; Determining a sparse threshold of the input data according to the compression ratio; Determining the sparse threshold of the input data according to the compression ratio includes: According to the compression ratio, the input data is divided into first input sub-data and second input sub-data, so that the ratio of the number of the first input sub-data to the number of the second input sub-data is the compression ratio, and the first input sub-data are all smaller than or equal to the second input sub-data; A sparse threshold of the input data is determined according to a minimum value of the second input sub-data or a maximum value of the first input sub-data.

8. A data processing system, characterized in that: include: Data processing devices and target equipment; The data processing device is used to implement the data processing method according to any one of claims 1 to 6; The target device is used to process the target network parameters of the target network layer of the preset model loaded by the data processing device and the input data of the target network layer to obtain the output data of the target network layer, wherein the preset model is used to perform at least one of a text processing task, an audio processing task, and an image processing task.

9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs executable by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the data processing method according to any one of claims 1 to 6.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the computer program implements the data processing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • In-memory computing architecture for realizing acceleration and acceleration method thereof

    CN111026700A

  • Neural network model training method, data processing method and related products

    CN111126600A

  • Method for selecting deep network parameter sparse threshold based on Gaussian distribution estimation

    CN111488981A

  • Hierarchical graph convolutional neural network model-based case source clue classification processing method

    CN114154022A

  • Neural network model optimization method, platform, equipment and storage medium

    CN116596054A