Business data processing method and device

By preprocessing the data matrix and matching it with the weight matrix, the resource consumption and error problems of computing devices when performing the activation data and weight data internal product operations are solved, and the accuracy and matching of the calculation results are improved.

CN119149887APending Publication Date: 2024-12-17HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310711066.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-15
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

When the computing device performs the internal product operation of activation data and weight data, it consumes a large amount of computing resources. Due to the mismatch of the sorting of the data matrix and the weight matrix, errors are easily introduced and the accuracy of the calculation results are reduced.

Method used

By preprocessing the data matrix, converting it into an exponential form, and sorting and matching it with the weight matrix, reducing the consumption of computing resources during the model operation and reducing errors. The specific steps include obtaining the exponential average of the data matrix, sorting it to form the to-process matrix, and inputting it into the model to match the sort of the weight matrix, and performing an exponential alignment operation to reduce resource consumption of the inner product calculation.

Benefits of technology

It effectively reduces the consumption of computing resources during model calculation, improves the accuracy of calculation results, and reduces the error introduced due to sorting mismatch, making the processing results more in line with user expectations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149887A_ABST
    Figure CN119149887A_ABST
Patent Text Reader

Abstract

The invention discloses a business data processing method and device, and relates to the technical field of computers. And the computing device inputs the matrix (such as the first matrix) of the preprocessed data into the model to obtain a processing result of the service. Compared with the method that the computing device directly inputs the data matrix into the model to obtain the business processing result, the method has the advantages that the data matrix is preprocessed by the computing device, so that the data matrix does not need to be reprocessed in the process of obtaining the business processing result through model operation, and computing resources occupied in the process of obtaining the business processing result through model operation are reduced. As the sorting of each piece of index data in the matrix of the preprocessed data is matched with the sorting of the weight matrix of the model, a large amount of errors caused by mismatching of the data matrix and the sorting of the weight matrix can be effectively avoided, and the inaccuracy of the calculation result of the model is reduced; the accuracy of the service processing result obtained by the computing device by adopting the computing result is improved, and the matching degree with the expectation of the user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and device for processing business data. Background Art

[0002] Neural network models can realize data prediction and reasoning. When a computing device uses a neural network model to predict and reason data, a block floating point (BFP) can be used to calculate the inner product of activation data and weight data to improve the calculation efficiency of the inner product. When a computing device uses BFP to calculate the inner product of activation data and weight data, it is necessary to perform an alignment operation on the exponents of the activation data and weight data. The computing device performs an alignment operation on the exponents of the activation data and weight data, which consumes a lot of computing resources. Summary of the invention

[0003] The present application provides a method and apparatus for processing business data, which are used to solve the problem that a computing device consumes a large amount of computing resources when performing inner product operations on activation data and weight data.

[0004] In a first aspect, the present application provides a method for processing business data. The method is executed by a computing device, and includes: the computing device obtains data required for the business and a model for executing the business. The parameters of the model include a weight matrix for processing the data. The computing device preprocesses the matrix of the data to obtain a first matrix to be processed. The first matrix includes: indexed data after sorting the data, and the indexed data includes a decimal part and an exponential part. The computing device inputs the first matrix into the model and outputs the processing result of the business. Among them, the order of each element in the weight matrix matches the order of each indexed data in the first matrix.

[0005] In the present application, the computing device inputs the matrix of preprocessed data (such as the first matrix) into the model to obtain the processing result of the business. Compared with the computing device directly inputting the matrix of data into the model to obtain the processing result of the business, the computing device in the present application preprocesses the matrix of data, so that the process of the model running to obtain the processing result of the business does not need to process the matrix of data again, reducing the computing resources occupied in the process of the model operation to obtain the processing result of the business. And because the order of each indexed data in the matrix of preprocessed data matches the order of the weight matrix of the model, it can effectively avoid introducing a large number of errors due to the mismatch between the order of the matrix of data and the weight matrix, reduce the inaccuracy of the calculation result of the model, improve the accuracy of the processing result of the business obtained by the computing device using the calculation result, and improve the matching degree with the user's expectations.

[0006] In a possible implementation, the matrix of data includes multiple computing units, each computing unit includes multiple exponential data. The computing device preprocesses the matrix of data to obtain a first matrix to be processed, including: the computing device obtains the exponential average value of the multiple exponential data included in each computing unit. The computing device sorts the multiple exponential average values ​​of the multiple computing units to obtain the first matrix.

[0007] In another possible implementation, the computing device obtains the exponential average value of the multiple exponential data included in each computing unit, including: the computing device sums the exponents of the multiple exponential data included in each computing unit to obtain the exponential sum of each computing unit. The computing device obtains the exponential average value of each computing unit based on the exponential sum of each computing unit and the number of exponential data included in each computing unit.

[0008] In another possible implementation, before the computing device outputs the processing result of the service, the computing device preprocesses the weight matrix to obtain a second matrix. The order of each element in the second matrix matches the order of each indexed data in the first matrix.

[0009] In another possible implementation, the computing device preprocesses the weight matrix to obtain the second matrix, including: the computing device sorts the weight matrix by row to obtain a first sorting result, and the computing device sorts the first sorting result by column to obtain the second matrix.

[0010] In another possible implementation, after obtaining the second matrix, the computing device performs an exponent alignment operation on the first matrix at a first granularity to obtain a third matrix, and the computing device performs an exponent alignment operation on the second matrix at the first granularity to obtain a fourth matrix. The first granularity is used to indicate: the number of elements on which the exponent alignment operation is performed.

[0011] In another possible implementation, the first granularity includes: at least one of a first type of granularity or a second type of granularity. The first type of granularity indicates: a preset granularity. The second type of granularity indicates: a granularity customized by a user as required.

[0012] In a second aspect, the present application provides a device for processing business data, which includes modules for executing the method described in the first aspect or any possible design of the first aspect.

[0013] In a third aspect, the present application provides a processor. The processor includes: a control circuit and an interface circuit. The interface circuit is used to: receive data from other devices outside the processor and transmit it to the control circuit, or send data from the control circuit to other devices outside the processor. The control circuit is used to execute the operating steps of the method in the first aspect or any possible design of the first aspect through a logic circuit or execution code instructions.

[0014] In a fourth aspect, the present application provides a computing device. The computing device includes: a memory and at least one processor described in the third aspect. The memory is used to store computer instructions, and when the processor executes the computer instructions, the computing device executes the operation steps of the method described in the first aspect or any possible implementation of the first aspect.

[0015] In a fifth aspect, the present application provides a computer-readable storage medium. The computer-readable storage medium includes: computer software instructions; when the computer software instructions are executed in a computing device, the computing device executes the operation steps of the method described in the first aspect or any possible implementation of the first aspect.

[0016] In a sixth aspect, the present application provides a computer program product. When the computer program product is executed on a computing device, the computing device is caused to execute the operation steps of the method described in the first aspect or any possible implementation of the first aspect.

[0017] The beneficial effects of the second to sixth aspects above can refer to the description of the first aspect or any implementation of the first aspect, and will not be repeated here. Based on the implementations provided by the above aspects, this application can also be further combined to provide more implementations. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 A schematic diagram of a neural network structure;

[0019] Figure 2 A schematic diagram of the architecture of an artificial intelligence system provided for this application;

[0020] Figure 3 A schematic diagram of the structure of an AI chip provided in this application;

[0021] Figure 4 A flowchart of a method for processing business data provided by this application;

[0022] Figure 5 A schematic diagram of calculating the first index sum provided for this application;

[0023] Figure 6A schematic diagram of calculating the second index and provided in this application;

[0024] Figure 7 A schematic diagram of the sorting of the matrix of the first type of data provided in this application;

[0025] Figure 8 A schematic diagram of the sorting of the matrix of the second type of data provided in this application;

[0026] Fig. 9 A flowchart of another method for processing business data provided by this application;

[0027] Fig.10 A schematic diagram of the sorting of a weight matrix provided for this application;

[0028] Fig.11 A schematic diagram of an index alignment operation provided in this application;

[0029] Fig.12 A schematic diagram of the flow chart of the internal calculation of a model provided in this application;

[0030] Fig.13 A schematic diagram of another flow chart of internal calculation of a model provided for this application;

[0031] Fig.14 A schematic diagram of a method for processing business data;

[0032] Fig.15 A schematic diagram of the structure of a business data processing device provided in this application. DETAILED DESCRIPTION

[0033] The terms used in the implementation method of this application are only used to explain the specific embodiments of this application, and are not intended to limit this application. The following is a brief introduction to some concepts that may be involved in this application.

[0034] (1) Neural Network

[0035] A neural network can be composed of neurons, and a neuron can be a s The output of this operation unit satisfies the following formula (1).

[0036]

[0037] Where, s = 1, 2, ... n, n is a natural number greater than 1, W s For x sThe weight of the neuron is , and b is the bias of the neuron. f is the activation function of the neuron, which is used to introduce nonlinear characteristics into the neural network and convert the input signal in the neuron into the output signal. The output signal of the activation function can be used as the input of the next layer. A neural network is a network formed by connecting multiple single neurons mentioned above. The weight represents the strength of the connection between different neurons and determines the influence of the input on the output.

[0038] Figure 1 Schematic diagram of a neural network structure. The neural network 100 includes X processing layers, where X is an integer greater than or equal to 3. The first layer of the neural network 100 is the input layer 110, which is responsible for receiving input signals. The last layer of the neural network 100 is the output layer 130, which is responsible for outputting the processing results of the neural network. The other layers except the first and last layers are intermediate layers 140, which together constitute the hidden layer 120. Each intermediate layer 140 in the hidden layer 120 can both receive input signals and output signals. The hidden layer 120 is responsible for processing input signals. Each layer represents a logical level of signal processing. Through multiple layers, the data signal can be processed by multiple levels of logic.

[0039] In order to make the description of the following embodiments clear and concise, a brief introduction to the related technology is first given.

[0040] Figure 2 A schematic diagram of the architecture of an artificial intelligence system provided for this application, such as Figure 2 As shown, the artificial intelligence (AI) system 200 includes: a computing device 210 and a client device 220. A user can input business data to be processed into the computing device 210 through the client device 220. The business data to be processed may include, but is not limited to, text data, audio data, image data, video data, multimodal data, etc. The client device 220 may be a terminal device, including but not limited to a personal computer, a server, a mobile phone, a tablet computer, or a smart car.

[0041] The computing device 210 may include: a processor 211, a memory 212, and an input / output (I / O) interface 213. The I / O interface 213 is used to communicate with a device located outside the computing device 210. For example, the client device 220 inputs the business data to be processed and the AI ​​task to the computing device 210 through the I / O interface 213. After the computing device 210 processes the input business data to be processed, it sends the output result of the processing of the business data to be processed to the client device 220 through the I / O interface 213. AI tasks may include, but are not limited to, text prediction and reasoning, image prediction and reasoning, audio prediction and reasoning, video prediction and reasoning, multimodal prediction and reasoning, or computing tasks based on neural network models. For example, AI tasks include matrix operation tasks in text prediction and reasoning processes.

[0042] The processor 211 is the computing core and control core of the computing device 210. The processor 211 can be a central processing unit (CPU) or other specific integrated circuits. The processor 211 can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 211 can include one or more processor cores. An operating system and other software programs are installed in the processor 211, so that the processor 211 can access the memory 212 and various peripheral component interconnect express (PCIe) devices. In actual applications, in some possible situations, the computing device 210 may also include multiple processors 211.

[0043] The processor 211 can be connected to the memory 212 via a double data rate (DDR) bus or other types of buses. The memory 212 is the main memory of the computing device 210. The memory 212 is usually used to store various running software in the operating system, input data received from the client device 220, and output results to be sent to the client device 220 in the future. In order to improve the access speed of the processor 211, the memory 212 needs to have the advantage of fast access speed, such as dynamic random access memory (DRAM) can be used as the memory 212. In addition to DRAM, the memory 212 can also be other random access memories, such as static random access memory (SRAM). In addition, the memory 212 can also be a read-only memory (ROM). As for ROM, for example, it can be a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), etc. This embodiment does not limit the number and type of the memory 212.

[0044] Optionally, in order to store data persistently, the AI ​​system 200 may further include: a data storage system 214, which may be located outside the computing device 210 (e.g., Figure 1 As shown), the data storage system 214 exchanges data with the computing device 210 through the network. Optionally, the data storage system 214 may also be located inside the computing device 210, such as the data storage system 214 exchanges data with the processor 211 through the PCIe bus 215, in which case the data storage system 214 is represented by a hard disk.

[0045] For example, Figure 2 The processing 211 can be done by Figure 3 The AI ​​chip shown is used to implement it. Figure 3 A schematic diagram of the structure of an AI chip provided in this application, such as Figure 3 As shown, the AI ​​chip 300 may include: an AI core 310 , an AI CPU 320 , a system buffer 330 , a DDR memory 340 , and an I / O device 350 .

[0046] The AI ​​CPU 320 is used to accept AI tasks and call the AI ​​core 310 to execute the tasks. In some possible scenarios, the AI ​​chip 300 may include one or more AI cores 310. In the case where the AI ​​chip 300 includes multiple AI cores 310, the AI ​​CPU 320 is also used to undertake the task of scheduling. The AI ​​CPU 320 can be implemented by an ARM processor. In this case, the AI ​​CPU has the advantages of small size, low power consumption, and simple and flexible addressing. Of course, in some embodiments, the AI ​​CPU 320 can also be implemented by other processors.

[0047] The AI ​​core 310 is used to provide the neural network model involved in the AI ​​task and perform corresponding operations. The AI ​​core 310 includes a load / store unit (LSU), a cube computing unit, a scalar computing unit, a vector computing unit and a buffer. Among them, the LSU is used to load the data to be processed and store the processed data. It can also be used for the read and write management of the internal data in the AI ​​core 310 between different buffers, and to complete some format conversion operations. The cube computing unit is used to provide the core computing power of matrix multiplication. The scalar computing unit is a single instruction single data (SISD) processor. This type of processor only processes one piece of data (usually an integer or floating point number) at the same time. The vector computing unit, also known as an array processor, is a processor that can directly operate a set of arrays or vectors for calculation. The number of buffers may be one or more. For example, the buffer mainly refers to the L1 buffer. The buffer is used to temporarily store some data that the AI ​​core 310 needs to use repeatedly to reduce reading and writing from the bus. In addition, the implementation of certain data format conversion functions also requires the source data to be located in the buffer.

[0048] The system buffer 330 mainly refers to the L2 buffer or L2 cache, which is used to temporarily store input data, intermediate results or final results passing through the AI ​​chip 300.

[0049] DDR memory 340 is an off-chip memory, which can also be replaced by high bandwidth memory (HBM) or other off-chip memory. DDR memory 340 is located between AI chip 300 and external memory, overcoming the access speed limitation when computing resources share memory reading and writing.

[0050] The I / O devices 350 included in the AI ​​chip 300 are mainly some peripherals, such as a network interface card.

[0051] For example, when the AI ​​CPU 320 loads the data (such as a matrix) to be processed by the AI ​​task into the DDR memory 340, the LSU in the AI ​​core 310 reads (loads) the data from the DDR memory 340 and sends it to one or more computing units for calculation. When the processing result is obtained, the LSU loads (stores) the processing result into the DDR memory 340, and the network interface card sends the prediction and inference results to the computing device.

[0052] The above describes the AI ​​system provided by the present application in conjunction with the accompanying drawings. Figure 4 Describe the method for processing business data provided by this application. Figure 4 A flowchart of a method for processing business data provided by this application, such as Figure 4 As shown, this method can be Figure 2 The described computing device executes the method including the following steps S410 to S430.

[0053] Step S410: The computing device obtains data required for the business and a model for executing the business.

[0054] The data required for the service may include, but not limited to: text data, image data, audio data, video data and multimodal data, etc. The model for executing the service may include, but not limited to: deep neural network (DNN) model, convolutional neural network (CNN) model, recurrent neural network (RNN) model, multi-layer feedforward neural network (BP) model, radial basis function (RBF) model, Hopfield network (HN) model, etc. The parameters of the model include the weight matrix for processing the data.

[0055] Step S420: The computing device pre-processes the matrix of the data to obtain a first matrix to be processed.

[0056] The matrix of data can be obtained by converting the data required by the business. For example, when the data required by the business is text data, the computing device can use a word embedding (word2, vec) model, a transformer-based bidirectional encoding (BERT) model, (embeddings from language models, ELMo), a global word vector (globalvectors, GloVe) model, etc. to convert the data required by the business into a matrix of data. For the specific process of the computing device converting the data required for the business into a matrix of data, please refer to the general technology, which will not be repeated here. The data type of the elements contained in the matrix of data can be a single-precision floating point type (float) or a double-precision floating point type (double). This application does not limit the data type of the elements contained in the matrix of data, and the user can set it as needed. The first matrix includes exponential data after sorting the data contained in the matrix of data, and the exponential data includes a decimal part and an exponential part. The first matrix can be stored in Figure 2 The L2 cache described.

[0057] In one possible scenario, the matrix of data includes a plurality of computing units, and each of the plurality of computing units includes a plurality of indexed data. The following specifically describes a process of obtaining a first matrix by preprocessing the matrix of data by a computing device, and the process includes the following steps ① and ②.

[0058] Step 1: The computing device obtains the exponential average value of multiple indexed data contained in each computing unit.

[0059] The computing device may calculate the exponential average value of each computing unit using any of the following possible examples.

[0060] In a first possible example, the computing device directly sums the exponents of the multiple exponential data contained in each computing unit to obtain the exponential sum of each computing unit. The computing unit obtains the exponential average value of each computing unit based on the exponential sum of each computing unit and the number of exponential data contained in each computing unit.

[0061] For example, Figure 5 The calculation diagram of the first index and provided in this application is as follows: Figure 5 As shown, the data matrix is ​​A, and A contains K computing units. Any of the K computing units contains m×n elements, and the indices of the m×n elements are i 1 to i m×n At this time, the index and x of the calculation unit can be calculated using formula (2), and the index average y of each calculation unit can be calculated using formula (3).

[0062]

[0063] y=x / (m*n) Formula (3)

[0064] Where x is the index and i of the calculation unit. j is the index of the jth element, m×n is the number of elements in the calculation unit, j is the element of the calculation unit, j=1 to m×n positive integer, y is the average value of the exponents of the calculation unit.

[0065] In a second possible example, the computing device performs a weighted summation of the exponentials of the multiple exponential data contained in each computing unit to obtain the exponential sum of each computing unit. The computing unit obtains the exponential average value of each computing unit based on the exponential sum of each computing unit and the number of exponential data contained in each computing unit.

[0066] For example, Figure 6 The calculation diagram of the second index and provided in this application is as follows: Figure 6 As shown, the data matrix is ​​A, and A contains K computing units. Any of the K computing units contains m×n elements, and the indices of the m×n elements are i 1 to i m×n At this time, the index and x of the calculation unit can be calculated using formula (4), and the index average y of the calculation unit can be obtained using formula (3) described above.

[0067]

[0068] Where x is the index and i of the calculation unit. j is the index of the jth element, m×n is the number of elements in the calculation unit, j is the element of the calculation unit, j=1 to m×n positive integer, a j is the weight of the jth element.

[0069] Step ②: The computing device sorts the multiple computing units based on the exponential average value of each computing unit to obtain a first matrix to be processed. The computing device may obtain the first matrix in any of the following possible examples.

[0070] In a first possible example, the computing device sorts the multiple computing units in order of increasing exponential average values ​​of each computing unit from small to large to obtain a first matrix.

[0071] For example, Figure 7 The schematic diagram of the sorting of the matrix of the first type of data provided in this application is as follows: Figure 7As shown, the data matrix is ​​A, and A contains K computing units. The K computing units of the computing device are sorted from small to large according to the exponential average value to obtain a first matrix. The exponential average values ​​of each computing unit in the K computing units contained in the first matrix are y i To k , where y i To k Increase successively.

[0072] In a second possible example, the computing device sorts the multiple computing units in descending order of the exponential average value of each computing unit to obtain a first matrix.

[0073] For example, Figure 8 A schematic diagram of the sorting of the matrix of the second data provided in this application, such as Figure 8 As shown, the data matrix is ​​A, and A contains K computing units. The K computing units of the computing device are sorted from large to small according to the exponential average value to obtain a first matrix. The exponential average values ​​of each computing unit in the K computing units contained in the first matrix are y i To k , where y i To k Decrease in sequence.

[0074] In a possible scenario, after the computing device obtains the first matrix, it may further perform step S420A to pre-process the weight matrix. Fig. 9 A flowchart of another method for processing business data provided by this application, such as Fig. 9 As shown, the convenience includes the following steps S420A.

[0075] Step S420A: The computing device preprocesses the weight matrix to obtain a second matrix.

[0076] The ordering of the elements in the second matrix matches the ordering of the indexed data in the first matrix.

[0077] In one possible scenario, Fig.10 A schematic diagram of the sorting of a weight matrix provided for this application, such as Fig.10 As shown, the computing device may first sort the weight matrix by row to obtain a first sorting result, and then sort the first sorting result by column to obtain a second matrix.

[0078] Exemplarily, the weight matrix includes a plurality of second computing units, and a size of each second computing unit in the plurality of second computing units matches a size of a computing unit included in the matrix of data.

[0079] First, the computing device calculates the exponential average value of each second computing unit, and sorts each second computing unit row by row in the same sorting method as the multiple computing units contained in the matrix of the data, to obtain a first sorting result. For example, when the multiple computing units contained in the matrix of the data are sorted in a decreasing manner from large to small according to the exponential average value, the computing device sorts the multiple second computing units contained in the weights in a decreasing manner from large to small, to obtain a first sorting result. For another example, when the multiple computing units contained in the matrix of the data are sorted in an increasing manner from small to large according to the exponential average value, the computing device sorts the multiple second computing units contained in the weights in an increasing manner from small to large, to obtain a first sorting result. Regarding the method of calculating the exponential average value, please refer to the relevant description above, which will not be repeated here.

[0080] Secondly, the computing device sorts the first sorting result column by column in the same sorting manner as the plurality of computing units included in the matrix of data to obtain a second matrix. For a detailed description of the sorting, please refer to the above related description, which will not be repeated here.

[0081] Step S430: The computing device inputs the first matrix into the model and outputs the processing result of the business.

[0082] The ordering of the elements in the weight matrix matches the ordering of the indexed data in the first matrix.

[0083] In one possible scenario, Fig.11 A schematic diagram of an index alignment operation provided in this application, such as Fig.11 As shown, the computing device performs an exponential alignment operation on multiple exponential data contained in the first matrix at a first granularity to obtain a third matrix. The computing device performs an exponential alignment operation on multiple elements contained in the second matrix at the first granularity to obtain a fourth matrix. The first granularity indicates the number of data on which the exponential alignment operation is performed. When the computing device performs an exponential alignment operation on the exponential data, it can be achieved by moving the decimal part corresponding to the exponential data. For the relevant content of exponential alignment, please refer to the description of the general technology, which will not be repeated here. Fig.12 A schematic diagram of the flow chart of the internal calculation of a model provided in this application, such as Fig.12 As shown, the model deployed on the computing device obtains the processing result of the business based on the third matrix and the fourth matrix.

[0084] In a possible scenario, the first granularity may include, but is not limited to, any one of the following possible examples.

[0085] In a first possible example, the first granularity indicates a preset granularity. In this case, the preset granularity may include multiple granularities, and the first granularity indicates any one of the multiple granularities.

[0086] In a second possible example, the first granularity indicates a granularity customized by the user as required.

[0087] In one possible scenario, when the element type included in the weight matrix is ​​an integer, the difference from the scenario described above is that the computing device directly performs an exponential alignment operation on multiple elements included in the weight matrix at the first granularity to obtain a fourth matrix. Fig.13 Another schematic diagram of the internal calculation process of the model provided for this application is as follows: Fig.13 As shown, the model deployed on the computing device performs an inner product operation on the third matrix and the fourth matrix to obtain an inner product result. The computing device obtains a processing result of the business based on the inner product result. For relevant information about the first granularity, please refer to the relevant description above, which will not be repeated here.

[0088] Compared with the computing device directly inputting the matrix of data into the model to obtain the processing result of the business, the computing device in this application first aligns the exponents of the activation data and the weight data, so that the process of the model operation to obtain the processing result of the business does not need to perform the exponent alignment operation, reducing the computing resources occupied by the model to perform the inner product operation, thereby reducing the power consumption of the computing device to obtain the processing result of the business. And when the exponents of the indexed data contained in the matrix of data differ greatly, the computing device directly performs the inner product operation on the matrix of data and the weight matrix, resulting in the introduction of a large number of rounding errors, such as Fig.14 As shown, Fig.14 It is a schematic diagram of a method for processing business data. In the present application, the computing device uses a matrix of preprocessed data (such as a first matrix) and a weight matrix to perform an inner product operation to obtain an inner product result. Since the order of each indexed data in the matrix of preprocessed data matches the order of each element in the weight matrix, the rounding error introduced when the computing device performs the inner product operation on the first matrix and the weight matrix can be reduced, and the accuracy of the inner product result calculated by the computing device can be improved, thereby improving the accuracy of the processing result obtained by the computing device processing the business data, so that the processing result is more in line with the user's expectations.

[0089] Combination of the above Figures 3 to 14 The processing method of the business data provided by this application is described below. Fig.15 Describe the business data processing device provided by this application. Fig.15 A schematic diagram of the structure of a business data processing device provided in this application, such as Fig.15 As shown, the processing device 1500 includes: a transceiver module 1510, a pre-processing module 1520 and an output module 1530.

[0090] The transceiver module 1510 is used to obtain the data required for the service and the model for executing the service. The parameters of the model include a weight matrix for processing the data. The preprocessing module 1520 is used to preprocess the matrix of the data to obtain a first matrix to be processed. The first matrix includes: indexed data after sorting the data. The indexed data includes: a decimal part and an exponential part. The output module 1530 is used to input the first matrix into the model and output the processing result of the service. The sorting of each element in the weight matrix matches the sorting of each indexed data in the first matrix.

[0091] In a possible scenario, the matrix of data includes multiple computing units, each computing unit includes multiple exponential data. The preprocessing module 1520 is specifically used to obtain the exponential average value of the multiple exponential data contained in each computing unit. And the preprocessing module 1520 is also specifically used to sort the multiple exponential average values ​​of the multiple computing units to obtain the first matrix.

[0092] In a possible scenario, the preprocessing module 1520 is specifically configured to sum the exponents of the multiple exponential data included in each computing unit to obtain the exponential sum of each computing unit. The preprocessing module 1520 is also specifically configured to obtain the exponential average value of each computing unit based on the exponential sum of each computing unit and the number of exponential data included in each computing unit.

[0093] In a possible scenario, the preprocessing module 1520 is further used to: preprocess the weight matrix to obtain a second matrix. The order of each element in the second matrix matches the order of each indexed data in the first matrix.

[0094] In a possible scenario, the preprocessing module 1520 is specifically configured to: sort the weight matrix by rows to obtain a first sorting result. And the preprocessing module 1520 is further specifically configured to sort the first sorting result by columns to obtain a second matrix.

[0095] In a possible scenario, the service data processing device may further include: an index alignment unit 1540. The index alignment unit 1540 is used to: perform an index alignment operation on the first matrix according to the first granularity to obtain a third matrix. And the index alignment unit 1540 performs an index alignment operation on the second matrix according to the first granularity to obtain a fourth matrix. The first granularity is used to indicate: the number of elements to perform the index alignment operation.

[0096] It should be understood that the service data processing device 1500 of the embodiment of the present application can be implemented by a CPU, an ASIC, or a programmable logic device (PLD), and the PLD can be a complex programmable logical device (CPLD), an FPGA, a generic array logic (GAL), or any combination thereof. When the service data processing device 1500 implements the service data processing method shown in any of the above-mentioned figures through software, the service data processing device 1500 and its various modules can also be software units.

[0097] A more detailed description of the above-mentioned business data processing device 1500 can be directly obtained by referring to the relevant description in the embodiment shown in the aforementioned drawings, and will not be repeated here.

[0098] For example, when the service data processing device 1500 is implemented by hardware, the hardware can be implemented by a processor, such as Figure 2 The processor 211 described above includes an interface circuit and a control circuit. The interface circuit is used to receive data from other devices outside the processor and transmit it to the control circuit, or to send data from the control circuit to other devices outside the processor.

[0099] The control circuit is used to implement any possible implementation method in the above embodiments through a logic circuit or executing code instructions. The beneficial effects can be found in the description of any aspect of the above embodiments, which will not be repeated here.

[0100] The present application also provides a computing device, which includes a processor and a memory; the processor and the memory can cooperate to implement the business data processing method provided in the above embodiment. As an optional implementation, in hardware implementation, the computing device can refer to a chip or chip system encapsulated with one or more processors.

[0101] For example, when a computing device is used to implement Figure 4 In the method shown in the figure, the processor included in the computing device executes the method steps and possible sub-steps described in S420. In an optional situation, the computing device may also include a communication interface, which can be used to perform Figure 4 S410 is shown.

[0102] For example, the communication interface is used to obtain data required for the service. The processor is used to pre-process the matrix of the data to obtain a first matrix, and output the processing result of the service according to the first matrix.

[0103] It is worth noting that computing devices can also perform Fig.15 The functions of the business data processing device 1500 shown are not described in detail here.

[0104] It is understood that the processor in the embodiments of the present application may be a CPU, NPU or GPU, or other general-purpose processors, DSP, ASIC, FPGA or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.

[0105] The method steps in the embodiments of the present application can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in random access memory (RAM), flash memory, ROM, PROM, EPROM, electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a network device or a terminal device. Of course, the processor and the storage medium can also be present in a network device or a terminal device as discrete components.

[0106] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is executed in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device or other programmable device. The computer program or instruction may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer program or instruction may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired or wireless means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium, for example, a floppy disk, a hard disk, a tape; it may also be an optical medium, for example, a digital video disc (DVD); it may also be a semiconductor medium, for example, a solid state drive (SSD).

[0107] In each embodiment of the present application, if there is no special explanation and logical conflict, the terms and / or descriptions between different embodiments are consistent and can be referenced to each other, and the technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationships. The various digital numbers involved in the embodiments of the present application are only used to distinguish for the convenience of description and are not used to limit the scope of the embodiments of the present application. The size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and inherent logic.

Claims

1. A method for processing business data, characterized in that: The method comprises: Acquire data required for a business and a model for executing the business, wherein parameters of the model include a weight matrix for processing the data; Preprocessing the matrix of the data to obtain a first matrix to be processed; the first matrix comprises: exponential data after sorting the data, the exponential data comprises a decimal part and an exponential part; The first matrix is ​​input into the model, and the processing result of the business is output; the order of each element in the weight matrix matches the order of each indexed data in the first matrix.

2. The method according to claim 1, characterized in that The matrix of data includes a plurality of calculation units, each calculation unit includes a plurality of indexed data, The preprocessing of the matrix of the data to obtain a first matrix to be processed includes: Obtaining an exponential average value of a plurality of exponential data contained in each of the calculation units; The multiple exponential average values ​​of the multiple computing units are sorted to obtain the first matrix.

3. The method according to claim 2, characterized in that The obtaining the exponential average value of the plurality of exponential data contained in each calculation unit comprises: summing the exponents of the plurality of exponential data contained in each computing unit to obtain the exponent sum of each computing unit; An index average value of each computing unit is obtained based on the index of each computing unit and the amount of indexed data contained in each computing unit.

4. The method according to any one of claims 1 to 3, characterized in that Before outputting the processing result of the business, the method further includes: The weight matrix is ​​preprocessed to obtain a second matrix, wherein the order of the elements in the second matrix matches the order of the indexed data in the first matrix.

5. The method according to claim 4, characterized in that The preprocessing of the weight matrix to obtain a second matrix includes: Sorting the weight matrix by rows to obtain a first sorting result; The first sorting results are sorted by columns to obtain the second matrix.

6. The method according to claim 4 or 5, characterized in that: After obtaining the second matrix, the method further includes: An exponential alignment operation is performed on the first matrix at a first granularity to obtain a third matrix, and an exponential alignment operation is performed on the second matrix at the first granularity to obtain a fourth matrix; the first granularity is used to indicate: the number of elements on which the exponential alignment operation is performed, and the third matrix and the fourth matrix are used to calculate the processing result of the business.

7. The method according to claim 6, characterized in that The first granularity includes: A first type of granularity, wherein the first type of granularity indicates a preset granularity; And / or, a second type of granularity, wherein the second type of granularity indicates a granularity customized by a user as required.

8. A device for processing business data, characterized in that: The processing device comprises: A transceiver module, used to obtain data required for a service and a model for executing the service, wherein the parameters of the model include a weight matrix for processing the data; A preprocessing module, used for preprocessing the matrix of the data to obtain a first matrix to be processed; the first matrix comprises: exponential data after the data is sorted, the exponential data comprises a decimal part and an exponential part; An output module is used to input the first matrix into the model and output the processing result of the business; the order of each element in the weight matrix matches the order of each indexed data in the first matrix.

9. The device according to claim 8, characterized in that The matrix of data includes a plurality of calculation units, each calculation unit includes a plurality of indexed data, The preprocessing module is specifically used to obtain the exponential average value of the multiple exponential data contained in each calculation unit; The preprocessing module is further specifically used to sort the multiple exponential average values ​​of the multiple computing units to obtain the first matrix.

10. The device according to claim 9, characterized in that The preprocessing module is specifically used to sum the exponents of the multiple exponential data contained in each computing unit to obtain the exponent sum of each computing unit; The preprocessing module is further specifically configured to obtain an average value of the exponent of each computing unit based on the exponent of each computing unit and the amount of indexed data contained in each computing unit.

11. The device according to any one of claims 8 to 10, characterized in that The preprocessing module is further used to preprocess the weight matrix to obtain a second matrix, and the order of each element in the second matrix matches the order of each indexed data in the first matrix.

12. The device according to claim 11, characterized in that The preprocessing module is specifically used to sort the weight matrix by rows to obtain a first sorting result; The preprocessing module is further specifically used to sort the first sorting results by columns to obtain the second matrix.

13. The device according to claim 11 or 12, characterized in that The device also includes an index alignment module, The exponent alignment module is used to perform an exponent alignment operation on the first matrix at a first granularity to obtain a third matrix, and to perform an exponent alignment operation on the second matrix at the first granularity to obtain a fourth matrix; the first granularity is used to indicate: the number of elements on which the exponent alignment operation is performed, and the third matrix and the fourth matrix are used to calculate the processing result of the business.

14. The device according to claim 13, characterized in that The first granularity includes: A first type of granularity, wherein the first type of granularity indicates a preset granularity; And / or, a second type of granularity, wherein the second type of granularity indicates a granularity customized by a user as required.

15. A processor, characterized in that: The processor includes a control circuit and an interface circuit; The interface circuit is used to: receive data from other devices outside the processor and transmit it to the control circuit, or send data from the control circuit to other devices outside the processor; The control circuit is used to implement the method according to any one of claims 1 to 7 through a logic circuit or executing code instructions.

16. A computing device, characterized in that: The computing device comprises a memory and at least one processor as claimed in claim 15; the memory is used to store a set of computer instructions.

17. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes: computer software instructions; When the computer software instructions are executed in a computing device, the computing device performs the method of any one of claims 1-7.