EP3704638A1 - Neural network representation - Google Patents
Neural network representationInfo
- Publication number
- EP3704638A1 EP3704638A1 EP17811855.0A EP17811855A EP3704638A1 EP 3704638 A1 EP3704638 A1 EP 3704638A1 EP 17811855 A EP17811855 A EP 17811855A EP 3704638 A1 EP3704638 A1 EP 3704638A1
- Authority
- EP
- European Patent Office
- Prior art keywords
- predetermined
- data field
- discrete weight
- weights
- matrix
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0464—Convolutional networks [CNN, ConvNet]
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0495—Quantised networks; Sparse networks; Compressed networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/09—Supervised learning
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/10—Interfaces, programming languages or software development kits, e.g. for simulating neural networks
Definitions
- the present application is concerned with an efficient neural network representation, its derivation and its processing such as its usage in performing a prediction using the neural network represented by such representation.
- a neural network is composed by a set of neurons that are connected in a particular arrangement.
- the connectivity of the neurons can be represented by a set of matrices or tensors.
- a common step is to quantize the matrix/tensor values (that is, each element of a matrix/tensor is allowed to only take values from a finite set of real values, instead of the entire R).
- neural networks become a tool which is more and more dedicated to be used in the field, i.e. , in handheld or mobile devices, where the computational power is limited and the energy consumption needs to be low owing to limited battery resources.
- the advantages resulting from decentralizing such neural networks may be huge.
- Decentralizing neural networks avoids, for instance, data gathered at decentralized sites to be send to a server for being subject to neural network based prediction with sending the prediction result back to the data origins.
- speech recognition e.g., speech recognition.
- Mobile phones offering speech recognition may perform the neural network based prediction themselves without having to send the audio data or intermediate descriptors obtained therefrom, to a server to obtain the recognized text back from the server, thereby saving transmission bandwidth as well as extending the applicability of the speech recognition functionality to occasions where the connectivity is intermediately interrupted.
- the present application is based on the finding that the usage of neural networks may be rendered more efficient by elevating neural network computation not only by trying to increase the number of weights of the neural network being set to zero, but also aiming at obtaining a representation of the neural network where the number of actually assumed discrete weight values of the weights of the neural network is controlled, or kept low, or, differently speaking, where the probability distribution of the actually assumed discrete weight values has a reduced entropy.
- This "aim" may be enforced with respect to a predetermined matrix or tensor of the neural network or a subsection thereof or, more generally, with respect to a portion of a predetermined matrix or tensor of the neural network with the portion comprising the whole predetermined matrix or tensor or a subsection thereof.
- the result of enforcing this aim is the fact that many neurons of the neural network share the same discrete weight value.
- the weights of matrices/tensors of the neural network representation describe the amplification or strength at which activations of neurons of the neural network are forwarded.
- this statement shall then nevertheless be applicable to neural network topologies other than layered feed forward — networks such as recursive neural networks, for instance. This statement shall apply for the remaining description.
- WS property a property which is briefly called the weight sharing property, in the following.
- Another insight underlying the present application is the fact that the property of a neural network representation to comprise weights which share the same discrete weight value mutually may be exploited so as to significantly reduce the task of executing the neural network prediction. For instance among the computational tasks to be performed when executing a neural network based prediction multiplications and summations turn out to be the most prominent ones with respect to the weights of the neural network. Among these two tasks, the multiplications are the most cumbersome ones so that reducing the number of multiplications having to be performed results in an increase of execution efficiency when executing the neural network prediction.
- Weights sharing the same discrete weight value enable to exploit the distributive law, for instance: the way a predetermined matrix or tensor of a neural network representation controls an amplification at which activations of neurons of the neural network are forwarded downstream, involves the computation of a dot product of the predetermined matrix or tensor and an array of activations, the dot product involving sums over component-wise products between weights of the predetermined matrix or tensor and activations of neurons of the array of activations.
- Weights sharing the same discrete weight value enable the application of the distributive law in that the summation over the dot products may be, as far as the partial sums over the products are concerned which relate to weights which share the same discrete weight value, turned into a product between this shared discrete weight value and the sum over the other factors, namely the corresponding activations.
- Another way of exploiting this kind of representation of the neural network weights is to perform a pre-computation of the occurring component-wise products involved in dot product followed by selectively inserting the pre-computed component-wise products into the individual sums involved in the dot product computation.
- an even further possibility of exploiting the just-outlined representation of the neural network weights is the possibility of decomposing the dot product into a weighted sum of binary matrices/tensors each weighted with one of the discrete weight values and having all zeros but the positions corresponding to the positions of the original weight sharing predetermined matrix or tensor where the latter has weights corresponding to the respective discrete weight value.
- optimization may be used in order to reduce a cardinality of a set of discrete activation values of activations for a predetermined set of neurons of the neural network and/or an entropy of a probability distributinon the set of discrete weight values.
- Reducing the domain of activations namely the set of discrete activation values onto which activations of neurons are to be quantized during prediction which when executing the neural network, with the set of discrete activation values being conveyed, for instance, within the representation of the neural network, enables, for instance, to increase the efficiency or reduce the complexity of the mathematical algorithms, namely multiplications and additions, to be performed during neural network based prediction.
- neural network representation derivation involves the use of an optimization scheme with an objective function which depends on a cardinality of the set of discrete activation values or on frequencies at which discrete activation values of the set of discrete activation values are assumed in a manner so that the cardinality and/or the entropy is reduced.
- Fig. 2 shows a schematic diagram illustrating a portion of the neural network described by a matrix according to Fig. 1 ;
- Fig. 3 shows a possible representation for the matrix example of Fig. 1 in accordance with an embodiment
- Fig. 4 shows a schematic diagram illustrating a representation for the matrix example of Fig. 1 using pointers for pointing to the positions of the discrete weight values
- Fig. 5 shows a schematic diagram illustrating a representation of the matrix example of Fig. 1 designed for a low data amount for the representation and lending itself from alleviating a dot product computation using the matrix example by matrix decomposition;
- Fig. 6 shows a schematic diagram illustrating another example for a representation of the matrix example of Fig. 1 designed for low storage amount and dot product computation alleviation by matrix decomposition;
- Fig. 7 shows a schematic diagram illustrating another example for a representation of the matrix example, designed for alleviating the dot product computation by exploiting the distributive law
- Fig. 8 shows a schematic diagram of another example for a representation of the matrix example, modified compared to the one of Fig. 7 with respect to the discrete weight value indication per row;
- Fig. 9 shows a schematic diagram illustrating an example for a representation of the matrix example, aiming at reducing the number of operational operations for the recipient of the representation and using the representation for performing prediction, and designed for alleviating the prediction by matrix decomposition;
- Fig. 10 shows a schematic diagram illustrating another example for a representation of a weight matrix designed for alleviating the prediction using matrix decomposition;
- Fig. 1 1 shows a schematic diagram illustrating an example for a representation aiming at alleviating the prediction process by allowing for a precomputation of component-wise products to be inserted as add-ends into the summations of a component-wise product prescribed by the dot product;
- Fig. 12 shows a schematic diagram illustrating a representation modified relative to Fig.
- Fig. 13 shows a schematic diagram of a further more hardware friendly implementation of a representation allowing to alleviate the prediction process by exploitation of the distributive law
- Fig. 14 shows a schematic diagram of another example for a representation allowing for alleviating the dot product computation by precomputation of component-wise products
- Fig. 15 shows another example for a representation allowing for alleviating the dot product computation by exploiting the distributive law
- Fig. 16 shows a schematic diagram of a representation modified compared to Fig. 15;
- Fig. 17 shows an encoder scheme suitable for generating a neural network such that it may be advantageously represented by representations discussed herein, thereby reducing resource requirements to model a neural network, wherein the scheme shows different transformation steps of a given neural network model until a compressed domain representation of it results, wherein procedures are - represented by boxes and take as input a neural network and output same with changed properties, and wherein types of input-output scenarios are numbered and depicted in this Figure.
- Fig. 18 shows a schematic block diagram of the encoder scheme of Fig. 17 in an expanded version
- Fig. 19 shows a schematic diagram illustrating possible tasks to be performed by a decoder which takes advantage of representations discussed in the present application
- Fig. 20 shows an example for a neural network, i.e. of its general construction and subdivision into layers and layer sets, here exemplarily designed as a neural network designed to receive an image as an input and output probability values or to discriminate images of different contents;
- Fig. 21 shows a pseudocode algorithm for performing the prediction using the neural network of Fig. 20;
- Fig. 22 shows an example for a pseudocode listing of an algorithm ought to advantageously compute the dot product on the basis of representations assisting in alleviating the computation via exploitation of the distributive law
- Fig. 23 shows a schematic flow diagram illustrating the steps performed by the algorithm of Fig. 22;
- Fig. 24 shows an exemplary pseudocode for an algorithm for performing a dot product advantageously by exploiting the distributive law by showing amendments compared to the example of Fig. 22;
- Fig. 25 shows a flow diagram illustrating steps performed by the algorithm of Fig. 24;
- Fig 26 shows a schematic diagram illustrating the dot product computation for the example of Fig. 1 ;
- Fig. 27 illustrates a decomposition of the computation of Fig. 26 in accordance with examples of the present application according to which the computation is alleviated by a precomputation of component-wise products;
- Fig. 28 shows a pseudocode of an algorithm ought to perform the dot product computation by alleviating same using the precomputation concept for component-wise products;
- - . . _ _ illustrates the concept of alleviating the dot product computation by matrix decomposition;
- a illustrates special characteristics of a convolutional matrix / tensor;
- b to 30e show a schematic diagram illustrating representations of a convolutional matrix / tensor example according to different embodiments reusing some concepts of the above representations;
- a shows and explains the advantages of treating the predetermined discrete weight values separately from an extra discrete weight value such as the most frequently assumed weight value in case of the extra discrete weight value being non-zero and how a recipient of the representation may recover the matrix or tensor represented by a representation according to embodiments of the present application by simple addition of an all one matrix times the extra discrete value when setting the discrete weight values to be represented as offsets relative to the extra discrete value;
- b shows an
- Fig. 38 shows a schematic block diagram of an apparatus for deriving a neural network representation in accordance with an embodiment of the present application.
- Fig. 39 shows a schematic block diagram of an apparatus for deriving a neural network- based representation by training from the scratch or quantizing a pre-trained neural network in terms of weights and/or activations.
- embodiments of the present application are concerned with weight sharing, while others are additionally or alternatively concerned with reducing the entropy or cardinality of discrete activation values.
- the following description starts with an introduction which motivates thoughts underlying these aspects of the present application.
- weight sharing property As already outlined above, this property is called weight sharing property or WS property in short during the following description.
- the weights of a layer are represented as single-precision floating-point matrices.
- the pre-activation values of the subsequent layer are calculated element-wise as
- pre-activation values are the result of the sums of products often discussed throughout this document, namely the sums involved in the dot product of a predetermined matrix or tensor, for instance, with an array of activations.
- the pre- activation values are then, within the neural network, the subject to a non-linear function, for instance, the output of which is then mapped onto the set of activation values which may correspond to the reduced set of discrete activation values with the aspect also mentioned above as being alternatively or additionally performed in addition to the exploitation of the weight sharing property.
- section 3 we will describe a set of new formats for representing weight matrices with shared weights. Each format will be designed such, that they are efficient with respect to a specific optimization objective. But, before we describe the new formats in more detail, we will give a short introduction into formats for storing sparse matrices in the next section for the sake of understanding. A brief note shoud be made as to the explicit mentioning of a matrix-vector prduct. Merely for sake of an easier undnerstanding, this case is further discussed below. In this case, the activations are described as to be an array or vector, a one-dimensional array. However, when doing prediction, one can take a set of inputs und bundle them into a matrix form and perform a forward pass on this matrix.
- the activations are matrices of higher dimension and not vectors.
- the subsequent description is readily applicable to the matrix-matrix product cases and shall not be understood as being limiting to these cases. A similar statement is true with respect to transferring the teaching to tensor notations.
- Sparse matrices are those which contain many zero elements. Since they appear very often in various scientific fields, a great amount of work has been put into deriving new representations (formats) that are more efficient with respect to different optimization objectives. Nevertheless, all formats have in common that they take advantage of the statistical property that there are many zeros present in the matrix.
- the coordinate format or COO in short, stores the information of a sparse matrix within three arrays: the weights-, row Index-, collndex-array.
- the weights-array contains the values of all non zero elements in the matrix, and rowlndex- and collndex-array their respective row/column positions.
- the ab matrix would be represented as follows
- This representation can ease storage requirements for large spare matrices by just storing the non zero elements and their respective positions. In addition, it allows for easy new matrix element insertion, which is advantageous when building new sparse matrices.
- the compressed sparse row format also represents the sparse matrix by using three arrays. It stores the non-zero values and column indices in row major order and adds a pointer, which indicates where a new row starts. Hence, the previous example would be stored as follows
- This format stores the non zero values and their corresponding column indices, but fixes the number of non zeros per row and pads with an additional symbol * empty spaces. Subsequently, it transposes the entries in order to allow for coalesced memory access.
- the above example would be represented as
- Matrix A depicted in Fig. 1 .
- Reference sign 10 is spent or assigned to matrix A.
- Matrix A will be used as a representative example throughout this document as an example for a "predetermined matrix” with respect to which, for instance, the weight sharing property is exploited or, as described in more detail below, enforced.
- “Enforcement” denotes the fact that the degree of weight sharing property may be increased at the time of training the neural network or quantizing a pre-learned neural network with putting specific emphasis on the increase in the weight sharing property.
- “Exploiting" the weight sharing property is done in the following two-fold, i.e. , at two occasions, namely by designing the representation/format accordingly, i.e.
- Fig. 2 depicts as to how the weights of matrix 10 define the neural network.
- the connections are illustrated in Fig. 2 using lines 20 merely with respect to one representative neuron 12, namely the left hand one.
- Matrix A controls the amplification or strength at which activations of neurons 16 are forwarded downstream to the respective neuron 12.
- Each row of matrix A is assigned to a certain neuron 12.
- the first row of weights is assigned to reference sign 22.
- the weights 24 of matrix 10 within this row 22 control the amplification of the activations along connections 20 as depicted in Fig. 2.
- Fig. 3 illustrates as to how a representation of the neural network could look like with respect to matrix A. It comprises, with respect to matrix A, a first data field 30 indicating the set 32 of discrete weight values assumed by any weight 24 within matrix A, i.e., the complete set of discrete weight values assumed by at least one weight 24 of matrix A.
- set 32 is usually composed of one discrete weight value 34 which may be treated separately because it is zero and/or it appeared most frequently among the weights 24 of matrix A on the one hand and the remaining set 36 of discrete weight values, often called the "set of predetermined discrete weight values ' ' in the following description.
- the format/representation comprises a second data field 40 which indicates for each predetermined discrete weight value of set 36, the positions of weights 24 in matrix A which assume the respective predetermined discrete weight value. According to the example of Fig. 3, this is done by indices 38 each pointing to the respective discrete weight value in set 32 and being associated with the corresponding weight 24 in matrix A by its position in data field 40.
- the indices 38 in data field 40 are ordered in a manner so as to be uniquely associated with weights 24 of matrix A which circumstance is achieved according to the example of Fig. 3 in that same are ordered in the same two- dimensional manner as the weights 24 in matrix A are, wherein indices 38 corresponding to discrete weight values of set 36 have indices of value other than indices 38 corresponding to weights 24 of value 34, thereby separating indices 38 corresponding to weights having a value within set 36.
- An alternative way for a representation is depicted in Fig. 4.
- the second data field 40 comprises, for each discrete weight value of set 32, a set of pointers indicated in square brackets in Fig.
- the pointers are addresses addressing the respective position with assigning addresses to weights 24 in matrix A one-dimensionally in a raster scan order from top to bottom with starting at zero for the upper-left weight 24 of matrix A.
- the pointers are indicated in Fig. 4, generally using reference sign 42.
- this characteristic is the fact that the representations discussed herein have an association mechanism which leads from the first data field 30 or, to be more precise, from the discrete weight values indicated therein, towards the position indication by way of the second data field 40. That is, the format or representation allows for the recipient of the representation/format to inspect the first data field 30 in order to obtain information on the discrete weight values within set 32 or 36, and then inspect the second data field 40 in order to obtain, for each discrete weight value indicated by the first data field the information on where in the corresponding matrix 10 weights 24 are positioned which assume the respective discrete weight value.
- the representations/formats presented herein thus, avoid any necessity to perform this sort of analysis, namely searching for weights sharing a certain discrete weight value, at the time of performing the neural network prediction.
- the indication of the discrete weight values within set 32 or set 36 may alternatively be split-up onto more than- one first data field 30 with one second data field 40 for each such first data field.
- such splitting-up onto several first data fields 30 may be performed on a per row basis, i.e., one first data field per row of matrix 10.
- Other examples may become clear from the following examples.
- wPtr may point directly to it's entries. But if / is stored in a sparse-like format, it is only required to point to the locations in the respective array where the change in a weight value can be uniquely identified. In the last example (storing / in csr-like format), wPtr could point either to locations in coll or in rowPtr.
- the representation 50 comprises the first data field 30 indicating the predetermined discrete weight values 36.
- the representation 50 comprises, additionally, the indication 52 of the extra discrete weight value, which is 0 in the present case, i.e., discrete weight value 34.
- representation 50 also comprises an indication 54 of the size of matrix 10, i.e., the number of rows 56 and the number of columns 58 indicated by N and M, respectively.
- the data field 40 associated with data field 30 indicates the positions of the weights assuming any of the discrete weight values 36 by way of column indices 60 which merely indicate the column index of each search position, wherein the association of the column index values within data set 40 and the columns of matrix 10 are indicated in Fig. 5 at 62.
- the column indices 60 are ordered in a list of column indices where the column indices are arranged along in the following order: the weight 24 in matrix 10 are traversed in an one-dimensional order, namely here in Fig. 5 exemplary in a raster scan order which leads, or traverses matrix 10, row-wise from top-left to bottom-right of matrix A. In particular, matrix 10 is traversed three times along this order.
- the column index of each weight 24 is entered into the list 64 of column indices whenever a weight 24 is encountered during this traversal or scan which corresponds to the first discrete weight value 36 indicated in the list 66 of discrete weight values 36 of data field 30, which is 4 in the present case.
- list 64 forms a sequence of column indices 60 which is sub-divided into subsequences or continuous runs 68 of column indices relating to column indices 60 of weights 24 being a) in the same row of column 10 and b) being of the same discrete weight value 36.
- the subsequences 68 are arranged in list 64, owing to the sequential traversal of the posi- tons of matrix A once per discrete weight value 36, according to their associated row index row with subsequences 68 concerning a certain discrete weight value 36 preceding subsequences 68 concerning a next discrete weight value 36 in list 66. For some pairs of row index row/ and discrete weight value w/ there is no subsequence in lists 64 owing to a lack of a weight 24 in the respective row of the respective discrete weight value 36.
- the representation 50 additionally comprises a list 70 of differentially coded pointers rowPfr which point to the position of subsequences 68 in list 64 not otherwise detectable or following a skipped subsequence.
- a recipient of representation 50 thus, would perform the differential decoding task 72 to detect the borders between consecutive subsequences 68 in list 64 and associate each subsequence 68 in list 64 to its respective pair of discrete weight value 36 and row index row/.
- representation 50 could be stored, or could like, as depicted in Fig. 6.
- column index list 64 of the second data field 40 is designed in a manner so that the column indices 60 are arranged in list 64 still according to the number of traversers corresponding to the number of discrete weight values 36, but whenever for a certain row of matrix A, no column index 60 is inserted into list 64 owing to the fact that the corresponding row does not comprise a weight 64 within that row which would comprise the discrete weight value corresponding to the current scan, an escape value 80 is inserted to list 64 instead of a corresponding index 60 in order to indicate this circumstance.
- a recipient of representation 50 is able to associate each subsequence 68 of column indices 60 within list 64 to their respective associated pair of discrete weight value 36 and row of matrix 10, namely by a) checking whether consecu- tive column indices 60 in list 64 are equal or decrease with this check being indicated using reference sign 82, or by detecting b) that a certain row has been skipped in the current scan or traversal for the current discrete weight value 36 by encountering an escape value 80.
- the above matrix A ( 10) would be represented by representation 50 or format 50 in the manner depicted in Fig. 7.
- the subsequences of column indices 60 in the column index list 64 comprised by the second data field 40 are collected differently.
- the column indices in list 64 are ordered in list 64 of Fig. 7 in accordance with a different order, namely according to an order according to which each row of matrix 10 as often as there are discrete weight values in set 36 as indicated by the first data field 30 within proceeding with the next row with the rows being traversed, for instance, from top to bottom.
- the number of subsequences 68 in Fig. 7 is, accordingly, the same as in the example of Fig.
- weight indices 90 in a weight index list 92 indicate for each subsequence 68 as to which discrete weight value the column indices 60 of the respective subsequent 68 relate to. That is, a weight index 90 at a certain rank in the order of list 92 indicates the weight which the corresponding subsequence 68 at the same rank within list 64 refers to, by indexing the corresponding weight 36 within the data field 30, namely within list 66.
- the i th weight index 90 indicates the weight that the column indices 60 of the i lh subsequence 68 relate to.
- Lists 66 and 92 together form an example of having one first data field 30 per row, in that certain portions, indicated using dashed lines in Fig. 7, point to those (sub)sets of discrete weight values in 66 which occur in a corresponding row.
- the second data field 40 comprises a sequences of pointers 94 each pointing to a starting position or starting rank of a corresponding subsequence 68 of list 64. That is, sequence 94 comprises pointers 96 pointing to the rank in list 64 where a corresponding subsequence 68 starts. Pointers 96 are ordered along the order of subsequences 68 within list 64, i.e., they monotonically increase. Further, second data field 40 comprises another pointer sequence 98, the pointers of which point to rank positions within pointer sequence 94 from which onwards within list 94 the pointers relate to a next row within matrix 10.
- the pointers 96 within list 94 is sub-divided into subsequences 100 each being related to a different row, and being ordered in row direction from top to bottom in matrix 10.
- the pointers 102 in list 98 point to the starting positions of the subsequences 100 within list 94 in row order.
- a recipient of representation 50 is able to locate, for each row of matrix 10, the weights 24 assuming any of the discrete weight values 36. That is, in case of Fig. 7, the second data field 40 is structured into portions 104, namely one for each discrete weight value 36 indicated by the first data field 30, and for each such portion 104, there is a set 106 of pointers present in the second data field 40 which points to this portion 104.
- the set 106 is structured in a manner so that the pointing to portions 104 is done in two stages: each portion 106 comprises a pointer 102 pointing to one or more pointers 96 which, in turn, point to the respective column indices 60 in list 64.
- the weight indication is done by providing each portion 104 with an index into list 66.
- Fig. 8 shows an alternative for the representation 50 depicted in Fig. 7 in that the indirect weight indication by way of weight index list 92 is replaced by a direct indication of the weights in a corresponding list 1 10 of weights 1 12.
- List 1 10 merely differs from the weight index list 92 of Fig. 7 in that the corresponding weight is entered at the corre- •—spending rank position directly
- this list 1 10 of weights is structured into one data field 30 per row and the second data field 40 comprises one portion 104 for each such first data field 30 along with one or more pointers 106 per portion 104.
- the recipient of representation 50 would use, per row, the one or more pointers 106 associated with a respective row also in order to access the corresponding discrete weight values for this row from list 1 10, namely by accessing the corresponding discrete weight values 1 12 at the corresponding rank positions, namely corresponding to the rank positions of the subsequences 68 within portion 104.
- the indication of discrete weight values within matrix A is structured into one data field 30 per row, namely, in the case of Fig. 8, one data field 30 indicating, row individually, the discrete weight values within the respective row directly, and in case of Fig. 7 indicating the discrete weight values within the respective row indirectly by way of indices indicating the respective discrete values out of a reference list 66.
- the CSWR format can be trivially modified to account for iterations over column indices instead of row indices. That is, instead of scanning the values row-wise we can scan them column-wise. Hence, the coll array would be changed into a row! array, containing the row indices of the respective weight values per column, and the rowPtr to a coiPtr indicating the change in column.
- CSWC instead of CSWR.
- CSWR/CSWC can serve as good candidate if we desire to iterate over the rows/columns of the matrices.
- the format is optimized for minimal number of operations required to perform a dot product per row/column.
- the representation 50 again, comprises the information 52 and 54 along with a first data field 30 indicating by way of list 66 the predetermined discrete weight values 36
- the second data field 40 comprises a column index list 64 listing, again the column indices 60 in the order as described above with respect to Fig. 5.
- the weight values may be given in data filed 30 and list 66, respectively, in a manner indicating the difference to the special discrete weight value 34.
- a row pointer of pointer list 70 is also comprised by the second data field 40 in case of Fig. 9, here, however, allowing for an easier access to the subsequences 68 of column indices 60 and list 64.
- the pointers in list 70 are construed in a manner so that pairs of consecutive pointers in list 70 point to begin of a corresponding subsequence 68, if present, and the column index immediately succeeding the subsequence. If the pointers of such a pair point to the same position within column index list 64, this denotes that the corresponding subsequence is missing.
- the pairs of pointers in list 70 are ordered in subsequences, mainly list 70 comprises pointers relating to a first discrete weight value of list 66 in a first subsequence 1 21 within subsequences of pointers concerning the following discrete weight values 36 of list 66 following.
- the pointer indexing of the column indices 60 within list 64 by way of the pointers 120 within list 70 are reset between the subsequences 120 to 0.
- Fig. 9 qualifies itself as a good candidate to decompose matrix 10 into a matrix decomposition, namely a weighted sum 123 of binary matrices 124 weighted with a factor 1 25, which corresponds to a discrete weight value or an offset of the discrete weight value to the specific weight value 34, and having ones at the corresponding positions, namely at positions where weights 24 in matrix 10 have the corresponding discrete weight value.
- Fig. 9 depicts the case where this matrix decomposition 123 also comprises an addend concerning the most frequently assumed discrete weight value 34, for example, formed by an all-ones matrix 127 times the value 34.
- a possible format could be an array-of-arrays-of-list like format, where the first array 66 comprised by the data field 36 contains the alphabet values, the second array 140 their respective column index positions where they appear at least once, here ordered in n column scans where n is the cardinality of set 36, thereby subdividing list 140 into three subsequences 142 one for each value 36 and the list lists the corresponding values that appear per row. Or, if we represent it by a set of arrays, 2 additional pointed arrays 50 and 160 would be needed that indicate start-end parts of each sequence of the previous entities. Hence, the above example would be stored in the manner depicted in Fig. 1 1.
- a recipient of representation 50 may obtain the set of discrete weight values, i.e., 36, from list 66 comprised by the first data field 30, while list 140 comprised by second data field 40 indicates, for each discrete weight value 36 within list 66 by way of a separate subsequence 142, the column indices of those columns where at least one weight 24 within matrix 10 is positioned which assumes the respective discrete weight value 36.
- list 66 and 140 are enough information for the recipient of representation 50 to perform the pre-computation of the multiplications: remember the column indices also address the inbound activations.
- a recipient pre-computes, for each discrete weight value 36, the products of this weight value and the activation corresponding to the column indices indicated in the subsequence 142 associated with the respective discrete weight value. Accordingly, the number of column indices in list 140 concurrently indicates the number of pre-calculated products. As just-mentioned, list 140 is subdivided into subsequences 142 which are concertinaed in the order with which the discrete weight values 36 are listed in list 66, and pointer list 170 indicates by pointers into list 140 as to where the subsequences 142 start and end. Additionally, a recipient of representation 50 is provided with information as to which pre-calculated product is to be added-up for each output value.
- each row corresponds to an output of the dot product, and is formed by a summation over the component wise products formed along a corresponding row.
- List 150 is a list of indices pointing to rank positions in list 140, ordered in a manner so that list 150 is sub-divided into subsequences of indices, each subsequence 152 corresponding to a certain row, where the subsequences 150 ordered in row order from top to bottom. Within each subsequence, the indices might be ordered in different manners.
- the indices are ordered by size.
- list 160 contains a pointer for each row in order to point the subsequences 152 within list 150.
- the recipient of representation 50 is able to locate, for each row, the subsequence 152 belonging to this row, and add-up the pre-calculated products indexed via the indices of that subsequence 152.
- a possible extension could be to store combinations of partial sums of w k xi which appear frequently and can be reused.
- a list pointing to the elements in the previous lists that indicates which elements of those need to be summed together per row (and corresponding pointer arrays).
- Thread divergence is present when all threads within a warp do not (or cannot) execute the same instructions at the same time. Typical causes are if-then-else statements or when threads have to wait for the results of other thread.
- CSR format does not provide this capability, which is the main cause of it's low efficiency when running on vector architectures.
- the representation 50 shown in Fig. 12 amends the representation depicted in Fig. 7 in that the lists of column indices 64 comprised by the second data field 40 and the list 92 of weight indices comprised by the first data field 30 are ordered differently: they are ordered according to a regular scan of the weight positions in matrix 10 which scan is controlled by two parameters 170, wConst, which indicates the maximum number of discrete weight indices per row of matrix 10, and parameter 172, row- Const, which indicates the maximum number of weights in a certain row which assume one of the maximum number 170 of discrete weight values in each individual row.
- the indices in list 92 are ordered according to a raster scan order according to which matrix 10 is scanned as often as indicated by parameter 170, i.e., as often as there are different discrete weight values of set 36 within any individual row of matrix 10.
- this parameter indicates two and accordingly, matrix 10 is scanned two times.
- list 92 as 10 rank positions.
- the first five indices in list 92 indicate a first discrete weight value in each row of matrix 10, such as in direction from top to bottom.
- the second five rank positions contain indices within list 92, which indicate any second discrete weight value of set 36 occurring in the respective line, if present, wherein an escape symbol 174 is placed at the respective rank value for the corresponding row if there is no such further discrete weight value. Accordingly, list 92 is structured into subsequences 176, namely as many as indicated by parameter 170 and each being as long as there are rows in matrix 10.
- the column indices 60 are ordered also in row order from top to bottom, wherein the number of scans is equal to the product of parameters 170 and 172: for each of the maximum number 170 of discrete weight values per row, a maximum occasion of the respective discrete weight value of 172 is expected, and accordingly, the rows of matrix 10 are scanned the number of parameter 172 times per the number of discrete weight values per row as indicated by parameter 170. Accordingly, the column indices 60 within list 64 are structured into subsequences 178, each as long as there are rows in matrix 10, and with parameter 170 times parameter 172 in number.
- the first subsequence 178 in list 64 indicates, along the row direction from top to bottom, the column indices for the first discrete weight value indicated in the first subsequence 176 of weight index list 92, the second subsequence 178 of indices of column indices indicates the column index of the second instantiation of this first discrete weight value, under the same manner, the third and fourth subsequences 178 indicate the column indices of the first and second occasion of the second discrete weight value indicated for each row by the second subsequence 176 of weight indices 90 in list 92. It is clear that the order among the indices in list 92 and 64 could also be defined differently.
- the structuring could be done in manner so that subsequences result which are as long as the number of discrete weight values, for instance, i.e., as long as indicated by parameter 170.
- the scan of the weight indices 92 could, accordingly, be such that the first run of indices 90 forms a subsequence 176 indicating the weight index for the discrete weight values within the first row, followed by the subsequences relating to the subsequent rows.
- column index list 64 could be structured into subsequences 178 of column indices 60 of a length corresponding to parameter 170, each subsequence 78 collecting the indices 60 corresponding to one certain row of matrix 10 and a certain discrete weight value as indicated for that row. Even alternatively, column index list 64 could be structured into subsequences 178 of column indices 60 of a length corresponding to parameter 172, so that each subsequence would collect the indices of weight within a certain row corresponding to the n th weight within the respective row assuming each of the maximum number 170 of discrete weight values. The next Fig. will present an example.
- This format would be to store just one max appearance value in order to reduce storage requirements and enhance structure in the distribution. But this variation is probably prompt to be inefficient when the distribution of number of appearance per row strongly differs per alphabet.
- Another possible extension of this format is to consider storing an additional row I array indicating the row position of the elements. This can be advantageous for cases where many row/col are empty.
- the example matrix would be stored as depicted in Fig. 13.
- Fig. 13 shows a modification of the example of Fig. 8: here, no weight index list is spent. Rather, list 66 is used directly.
- the column index list 64 is structured in a manner so that, as it has been the case in Fig. 12, the column indices relating to a certain discrete weight value and a certain row may be accessed directly by computing their rank according to a predetermined formula.
- the representation 50 of Fig. 13 comprises a list 180 of parameters, one for each discrete weight value within list 66, and each indicating for the discrete weight value within list 66 having the same rank, the number of column indices 60 contained a list 64 for the respective discrete weight value. Obviously, any number in list 180 is greater than or equal to 1 .
- the column indices 60 are ordered in subsequences 182 collecting column indices of weights of a certain row having an n th occurrence for all those discrete weight values for which the parameters in list 180 indicate that such n th occurrence could possibly exist, i.e. , where n is smaller than or equal to the parameter given for the respective discrete weight value.
- the first subsequence 182 within list 64 contains column indices 60 relating to the first row and to the first occurrence of each discrete weight value, while the second subsequence 182 collects column indices referring to weights within the first row and indicated the second occurrence of the discrete weight value merely for those discrete weight value for which the parameters in list 180 exceed 1 . In this manner, the subsequent rows are scanned with respective subsequences 182 being contained in list 64.
- FIG. 13 An alternative approach for ordering the column indices 60 within list 64 is also shown in Fig. 13. For sake of an easier comparison, both lists are depicted in Fig. 13, one on top of the other although it is clear that representation 50 may merely comprise one of these lists 64.
- the column indices 60 are ordered in subsequences of a length corresponding to the number of rows in matrix 10, i.e., the column indices are ordered along a row-wise scan with the number of scans corresponding to the sum of parameters listed in list 180.
- the first subsequence collects the column indices for the rows of matrix 10 indicating the first occurrence of the first discrete weight value of list 66, the second subsequence, the column indices of weights corresponding to the second occurrence of the first discrete weight value, while then preceding with subsequences for the second discrete weight value and third discrete weight value, respectively.
- coll was ordered in alphabet major order and transposed (such that different threads can access memory contingently), and coll' in row major order and transposed.
- the second data field comprises a column index list 140 indicating for each discrete weight value indicated by list 66 a column index of all those columns of matrix 10 within which at least one weight is contained which is of the respective discrete weight value.
- Fig. 14 also shows the possibility that list 66 also includes the special discrete weight value 34. Consequently, list 140 of Fig.
- the second data field 40 comprises an array 192 of rank indices indicated for each positions of matrix 10 to a corresponding rank position of list 140.
- matrix 192 is of the size of matrix 0 to be represented but comprises, instead of the respective weight value, a rank index pointing to a corresponding column index in list 140 as already explained with respect to Fig. 1 1 , each of the column indices in list 140 corresponds, however, by way of its value indicating a certain column out of matrix 10 and by way of its position or membership of any of the subsequences 190, to one of the pre-calculated products, namely the activation corresponding to the respective column index times the discrete weight value corresponding to the subsequence 190, this column index in list 140 is a member of. Accordingly, matrix 192 is an index of pointers pointing to pre-calculated products.
- AoSoA array-of-structure-of-array-like
- This idea can be extended to any other efficient dynamic sparse format (e.g. Iist-of-lists, dictionary format, etc) for storing the indices of each matrix.
- any other efficient dynamic sparse format e.g. Iist-of-lists, dictionary format, etc
- the probability distribution P(w) is such, that the entropy H w) is low.
- P(w) expresses the frequency of appearance of the weight values in the network.
- the representation 50 is similar to the ones discussed above with respect to Figs. 7 and 8, but there is no weight index list 92 as it has been in Fig. 7, and there is no corresponding list immediately indicating the discrete weight values per row as it has been in Fig. 8 by way of weight list 1 10, but this functionality is adopted by the pointer list which subdivides the sequence of column indices in list 64 into subsequences 68 of which each is associated with a separate pair of row and discrete weight value. To be more precise, the column indices in the case of Figs.
- subsequences 68 were ordered in a manner so that subsequences concerning the first row precedes subsequences of a second row and so forth with, additionally, subsequences 68 relating to a discrete weight value 36 listed earlier preceding subsequences concerning the same row but a discrete weight value following in the order of the listing of the discrete weight values in the first data field.
- a recipient of representation 50 of Fig. 15 is able to deduce, for each row, as to how many non-empty subsequences are for the respective row in the column index list 64, and as to which discrete weight values these non-empty subsequences 68 relate to.
- the decoder knows a set of substructures ⁇ ⁇ where the new set of alphabets are organized.
- This type of matrices can be viewed as a generalization of the 5.3 set of matrices that have more than one sets of alphabets. For such matrices, sig- nalization of the parameters of the structures, start-end array signalizing the start and end of the sequence of a structure, their corresponding alphabets and max frequent values is required. For example, in the case where a matrix has different alphabets per row, we would extend the CER or CSWR formats into storing the different alphabets in row major order.
- an array (and not a single value) of max frequent values (thus size of nr) and an additional pointer array (also of size nr) which points to parts in the alphabets array indicating the start of the sequence of the new alphabets.
- signalization of the ⁇ parameters is not required, since it is implicitly known by the decoder that we scan the values in row major order.
- the representation of Fig. 16 is similar to that of Fig. 15, but adds an explicit indication of the discrete weight values per row by using the list of discrete weight values 1 10 as used in Fig. 8 along with a corresponding pointer list 210 which subdivides this weight list 1 10 into individual portions, namely one first data field 30 per row.
- a recipient of the representation 50 of Fig. 16 thus, is able to immediately access the discrete weight values present in each row by use of the pointer list 210 pointing to the respective portions 30 and list 0, and is able to access the associated subsequences 68 of column indices for these discrete weight values present in a certain row by use of the pointers in lists 98 and 200.
- wPtr points to the locations in W where the new set of alphabets start (per row).
- low rank matrix decompositions may be included.
- transformations might allow to exploit the different primitive statistical properties in the transform domain. For example, if in the frequency domain many coefficients share the same value (thus, they are low in entropy), then applying the DCT to the matrix will allow us to exploit this statistical property.
- FC layers are permutation invariant (in the sense that the prediction of the NN is invariant to permutations of the nodes of the hidden layers)
- the encoding-decoding scheme is depicted in figures 17, 18 and 19. They describe the different scenarios or flow of processes that may be involved in the encoding-decoding pipeline. We will provide a detailed explanation of their meaning in the coming subsections.
- the lossy process 300 is characterized by the fact that it induces a modification in the prediction accuracy of the network (it can either improve or worsen). Hence, it takes any type of neural network as input 312 (either trained by pre-training 313 or not trained and either continuous or discrete) and outputs a discrete neural network 314 with desired trades-off between prediction accuracy and statistical properties.
- continuous we mean a neural network where the weights are modeled through continuous latent variables (either deterministic real values or a set of parameters from a posterior probability distribution) and thus, re uire high precision numerical representations. This consequently implies, that the probability of two or more latent variables sharing the same parameter values tends asymptotically to 0 during the training procedure.
- the lossless step 310 we transform the resulted (from the lossy step) quantized neural network 314 into a format that is efficient for certain desired objectives, without affecting the accuracy of the network.
- the compressed domain representation 316 which may be in any of the above discussed ones which were denoted with reference sign 50 or derived therefrom by additionally applying entropy coding thereto.
- the change in the accuracy is due to the quantization step 318, which is mainly characterized by the scalar quantization of the weight values of the neural network. That is, in the process we perform a mapping of the (continuous) weight values into a finite set of real numbers. This quantization of the weights can be performed partially (only a subset of the weights are quantized, e.g., sparsity) or totally (all weights are scalar quantized) and the activation values may additionally be quantized too. Furthermore, the mapping may be chosen such, that certain statistical properties in the matrices are enhanced (such as low entropy or particular structures).
- the flow maps in figures 17 and 18 show possible processes involved during the quantization step. They mainly distinguish themselves from the type of input and output they produce, but not necessarily from the method. Some methods may be applicable for different types of inputs and produce respectively different types of outputs, and some other methods may be specialized for just one type of input-output maps. We also remark that the training data is always involved during the lossy encoding process.
- This process corresponds to the usual training practice of neural networks. Namely, it takes in a neural network which is not specialized for a given task and outputs a new neural network with the same topology but has the desired prediction accuracy.
- Output Partially quantized neural network.
- a subset of the networks connectivity is quantized.
- the method may search for the optimal subset and quantizer that reaches the desired trade-off between prediction accuracy and enhancement of a desired statistical property.
- the size of the subset may vary from case to case as well as the quantizer design, and the complement set (the non quantized weights) may change their values to compensate for the quantization process.
- An example method would be maximizing sparsity in the weight matrices.
- Output Partially quantized neural network.
- the output properties correspond to those of process 2.
- the method has to not only learn the optimal partial quantizer, but also the correct predictions for the task.
- All connections of the neural network are quantized. In this particular scenario, only the previously non quantized connections are taken into account.
- the quantizer is chosen such, that the desired trade-off between prediction accuracy and quantization strength is reached.
- the output properties are equal to process 4. However, in this scenario the method attempts to find the optimal quantizer for all connections simultaneously. Naturally, it is also optimized for the desired trade-off between prediction accuracy and quantization strength.
- the output properties are equal to process 5 but it also simultaneously learns the correct predictions for the task.
- Regularization Adding a regularize tion term to the usual cost function which enforces the elements of the weight matrices to take a desired probability distribution. For example, weight sharing can be enhanced by adding a term that mimics (or actually is) the entropy of the probability distribution of the frequency of appearance of the weight values. Similarly, specific structures can be enhanced by adding corresponding terms. However, this requires continued learning of the weight values. This type of methods can be applied in all the above mentioned scenarios.
- K-means weights domain: We can cluster the weight values using the Lloyd algorithm. Modifications that take the enhancement of statistical properties into account, or the influence of the quantization to the prediction accuracy, may be considered (for example by the weighted k-means method or by changing the optimization objective).
- the weights may be determined using some ranking method. They may include Sensitivity: gradients and/or diagonals of hessian Fisher information content Relevance measure Variance of some posterior (e.g. Gaussian posterior)
- This extra information may be calculated either during or after the training procedure. If only the K-mean algorithm is applied, then this type of methods can be applied only in scenarios 2, 4 and 5 (hence, can be applied only for trained networks). However, if the K-means method is also considered during training, then it also belongs to the 3 and 6 types of procedures.
- Quantization learning Given a trained neural network, this type of methods learn (sub)optimal quantizers by analyzing the distortion in the prediction accuracy induced by the quantization step.
- additional information provided by the unquantized NN can be used in order to achieve better results. Additional information may include Preactivation values Gradients
- each matrix into two instances, a header and a body.
- the header may contain meta information such as
- the body may contain the actual matrix information encoded in the corresponding format.
- the computational graph contains information regarding the operations needed to perform inference (thus, the calculations needed to manipulate the input data such that we get the predictions as output) and it may also contain a graph for learning (that is, the calculations needed for updating the weight values).
- the LV also contains the header information of the matrices, but their content or body will be stored in the latent variable instance in their respective formats. Hence, whenever a matrix operation is needed, the CG will point to the parts in the LV instance that need to be loaded. It also gives information about the format under which the matrix content is stored and hence, the decoder will be able to know how to correctly perform the instructed matrix operation. For example, if a sparse matrix-vector multiplication is instructed, then the CG will load weight matrix in sparse format from the LV instance and the dot product will be performed using this loaded matrix representation.
- This type of format has the advantage that we can reduce redundancies in the neural network's information content. For example if several matrices share the same weights or alphabet, it would only be required to store their values just once in LV. The CG would then point to the part in LV where this weights/alphabets are stored.
- Input Compressed matrix formats + activation lookup tables + extra-info.
- Output Compressed domain representation of neural network.
- the extra-information input may contain information regarding redundancies across layers (such as multiple layers share the same weights or alphabet values) that will be taken into account when building the compressed domain representation of the neural network.
- the compressed domain representation also supports non compressed representations. That is, the decoder knows how to interpret dense matrices, activation functions and high precision numerical representations. The steps in the lossless diagram may be applied only when possible or so desired.
- the decoder scheme is shown in figure 18. It has a relative simple structure. It's an apparatus that is able to perform 5 types of operations 350-358, inference, reconstruction, learning, converter and modification; given a neural network in it's compressed representation 316. Any apparatus may be useful which is able to perform merely one or a proper subset of the 5 operation types 350 to 358.
- the decoder should be able to reconstruct 350 the neural network into it's uncompressed format. That is, he should know methods of converting compressed matrices back into dense format, replace tables with their corresponding activation functions (consequently dequantizing the activation values) and reconvert the low precision numerical representations back into high precision formats.
- the decoder should also be able to perform inference 352 in compressed domain (thus, without having to reconstruct the network). Hence, it should be able to correctly perform all matrix operations required for doing inference, with any given matrix format and numerical representation of it ' s values. This implies that the decoder has to store a corresponding set of methods that allow him to do so.
- the decoder should be able to update the matrix distribution given information for the update rule. In addition, it should be able to (if required) propagate error information between layers, create a new matrix per layer in any format type and incorporate this new matrix in the computational graph for inference.
- the information considered for the update rule may be:
- Partial derivative values where the value of the partial derivatives between the neurons of a layer and the weight of the same layer are at least required. However, partial derivative values from upper layers may also be considered.
- the necessary information required for applying this method is the error measure corresponding to the neurons of the considered layer and the matrix information content of the same layer (hence, the header and body).
- a matrix might be created in any desired format.
- the converter stores a set of methods that allows to convert 356 the matrices from one format to another without loss of information.
- the decoder should also provide a set of methods that allow him to modify 358 the neural network by any means. That is, it should be able to replace parts of a matrix with desired values (matrix stays in the same format), replace an entire matrix by another one (here the type of format may change), replace non linear activation values (respectively, replace tables) and replace type of numerical representation. In addition, it should also allow to modify the computational graph by extending it (for example by adding new operations in a layer or by adding an entirely new layer) or contracting it (eliminating operations).
- the decoder may be modular in the sense that we can construct a decoder that is able to perform just a subset of the above described tasks (a subdecoder if we may call it so). This allows to reduce the complexity (and thus the resource requirements) of running the decoder, since only a subset of methods and functions need to be stored. For example, if the user only wants to run inference on compressed neural networks, then the installed decoder may only store the methods required to run inference, neglecting all other methods.
- step 9 we proceed with step 9 and change the numerical representations into their fixed-point variants.
- step 10 and 1 1 and convert the weight matrices as well as activation functions into their compressed domain formats.
- the activation functions are converted into lookup tables and the weight matrices into, e.g. , GER formats.
- a new computational graph which takes the compressed domain representations into account, for example specifying fixed-point multiplication methods and algorithms that perform the correct dot product.
- in the latent variables instance we store unique weight values and eliminate as such, further redundancies.
- the decoder is able to perform inference in compressed domain in a very efficient way.
- the decoder was described as to be an apparatus that is able to perform different tasks given a neural network in its compressed domain representation.
- Such tasks may include: inference, i.e. prediction, learning, conversion, modifications and modularity (in this case we omitted the reconstruction task, since this can be viewed as a special case of conversion).
- inference i.e. prediction, learning, conversion, modifications and modularity
- modularity in this case we omitted the reconstruction task, since this can be viewed as a special case of conversion.
- the decoder may execute some of the mentioned tasks in a step by step example.
- the neural network of Fig. 20 is exempiarily used in order to show as to how a neural network may look like.
- the neural network is dedicated for receiving as an input 400 an image, i.e., an array of pixel signals.
- the image size is 32 x 32 pixels, but this is naturally merely an example.
- the first hidden layer 402 of the neural network is actually a set of hidden layers, here exemplary six such hidden layers.
- One of these six hidden layers of the first set 402 is exemplary indicated using reference sign 402a.
- all of these first convolutional layers 402a are of equal size, but this is not mandatory.
- the next layer of the neural network namely 404, is again a set of neuron layers, each of which is associated with a corresponding one of layers 402a and connected therewith so as to effectively perform a subsampling.
- layer 404a which is associated with layer 402a is indicated in Fig. 20.
- Layers 404a of set 404 may have different size. In the example of Fig. 20, these six layers 404a are of size 14 x 14 neurons.
- the next layer 406 of the neural network is again a set of hidden layers and they may be best understood as feature maps. They may be connected to the previous layers 404a of set 404 in a manner maintaining the spatial correspondence between neurons of layers 406a of layer set 406 on the one hand and the neurons of layers 404a of set 404 with which same are connected, but each of layer 406a may have a connection to each of the layers 404a of set 404.
- layers 406a are of equal size, but this is merely an example.
- the transition from layer set 406 to the next layer set 408 again corresponds to a subsampling ending-up into one layer 408a for each of layers 406 of the previous layer set 406.
- the next layer 410 of neurons of the neural network has here exemplary 120 neurons each of which is fully connected to the previous layer set 408, i.e., to each neuron of each layer 408a of layer set 408.
- the number, namely 120, is again merely representative.
- a next layer 412 is also a fully connected layer of here exemplary 84 neurons and the output neurons 414 are here exemplary 10 in number when connected to the previous layer 412 by Gaussian connections.
- Fig. 20 is, for instance a neural network dedicated for finding in the input image 400 certain image content or objects such as, for instance, certain car types, certain animals or the like. That is, the output neurons of output layer 414 would correspond to probability values indicating as to how likely it is that a certain image object is in the input image 400. It is again emphasized, that Fig. 20 has merely been chosen for representation purposes and explanation, and that the present application is at no manner restricted to such kind of neural network. Thus, we assume that the neural network 398 of Fig. 20 has been encoded into a representation discussed above.
- the values of the weight matrices (convolutions + fully-connected layers) as well as the activations are quantized and stored in their respective compressed domain formats (matrices in any of the proposed formats and nonlinear functions in a look-up table-like format).
- the quantization was uniform, such that all values are encoded in a fixed- point representation (here we note that the neural network may have a dynamic fixed- point representation. That is, different layers (or even different connections within a layer) may belong to different set of numbers).
- the computational graph for performing inference under such a compressed domain representation can be depicted in the Algorithm 1 shown in Fig. 21 .
- Fig. 22 shows as to how the recipient of the representation 50 of Fig. 7 acts.
- the recipient derives at 450 the information indicated in Fig. 7 from the representation 50. For example, it reads at line 2 the information on the special discrete weight value 34 from the representation 50, at line 3, list 66 concerning the predetermined discrete weight values comprised by the first data field 30, in line 4, the column index list 64 comprised by the second data field, in the fifth line, the weight index list 92 also comprised by the first data field, and in line 6 pointer list 94 and in line 7 pointer list 96.
- the formation of the partial sums for each row is then performed at 452.
- the recipient uses 454 consecutive pointers in pointer list 98 to cut-out those portions of pointer list 94 and weight index list 92 which belong to the corresponding row.
- the ⁇ ⁇ is set to at 456 to scan subsequence 100 of pointer list 94 and portions 30 of weight index list 92.
- the corresponding next loop 458 forms a partial sum at 460 over the activation values of the input vector 440 corresponding to the column indices contained in the subsequence 68 of the column index list 64 indexed by the current pointer ⁇ ⁇ ! ⁇ at 462 and the corresponding weight referred to by the weight index at rank a>ptr and the partial sum is formed at 464 with the partial sums being added-up at 466.
- Fig. 22 illustrates further the case that the special discrete weight value 34 is not known a priori to be zero, but for instance merely the most frequently assumed weight value.
- the preliminary formed 466 sum of products over the partial sums with a corresponding predetermined discrete weight value is then, for each row of matrix 10 or each output value of vector 442, summed-up with the sum of input values of vector 440, formed at 468, multiplied at 470 with the special discrete weight value with the summation per output value being performed at 472 within for-next-loop 474.
- rowPtr points to the elements in wl that belong to a particular row and iv Pin ⁇ points to the respective column positions in coll .
- Algorithm 2 in Fig. 22 calculates the dot product using the last form of the above equation.
- the pointer list 98 which helps cutting-out the corresponding pointers of pointer list 94 at 480.
- Two pointers are cut-out for row two, thereby indicating that two partial sums have to be performed.
- These two pointers point to the subsequences of column indices 68 of column index list 64 shown at 482 and 484.
- the column indices are used for indexing the corresponding input activations and summing-up same individually, i.e., for each subsequence 68, at 486 and 488, respectively.
- pointers cut-out from pointer list 94 are also used in order to then locate the associated discrete weight value with which each partial sum is then multiplied at 490 and 492, respectively.
- the product sums, thus formed, are then to subject to summation at 494.
- the extra treatment in case of the special discrete weight value not being zero has been explained above with respect to Fig. 22.
- W [ ⁇ 1 ( . . . , ⁇ ⁇ ] would contain all weight values, concatenated by the different weight sets.
- the starting point for a certain row computation i.e. , for a certain output value corresponding to this row, is pointer 98 which leads to the pointers or subsequence 202 of pointers within pointer 200. They cut-out corresponding subsequences 68 of column index list 64, wherein the subsequences 68 are ordered in a manner so that consecutive ones or runs of subsequences 68 belong to one row. Such runs of subsequences are denoted in Fig. 15 using reference sign 203. The number of subsequences 68 in a run of subsequence 203 indicates the number of discrete weight values out of set 36 being present in the respective row.
- the pointers cut-out the subsequences out of column index list 64 so as to yield a subsequence per predetermined discrete weight value at 490, 492 and 494, respectively.
- the partial sum is formed at 496, 498 and 500, respectively, wherein the partial sum formation 498 for empty subsequences 68 is, naturally, trivial as there is no add-in.
- the corresponding predetermined discrete weight value is assigned according to the order these predetermined discrete weight values are indicated in list 66, namely by multiplying each partial sum with that predetermined discrete weight value which correspond in rank in weight list 66 to the rank of the corresponding subsequence 68 of column indices which were used to address the add-ins of the partial sums, namely the corresponding input values of the input vector, i.e., the activations.
- the products where the partial sums per predetermined discrete weight value are indicated are located in Fig. 25 at 502, 504 and 506, respectively. The partial sum products are then summed-up at 508.
- This format is the 4th format introduced in section 3.3.2 shown in Fig. 1 1 .
- the idea behind this format was to first calculate all unique operations that appear in the sum-of- products operation of a dot product and subsequently, add the corresponding terms at each element of the output vector. For instance, in the above example where we calculate the dot product as depicted in Fig. 26 we would perform the multiplication 4 ⁇ 5 twice. Hence, we find redundancies in the multiplication operations. These redundancies increase for larger matrices, where the probability of finding a weight stored in the same column several times increases.
- the matrix M would take the form as shown in Fig. 1 1 .
- arrays coll and wPtr signalize the unique multiplications that need to be calculated, and arrays rowList and rowPtr signalize where these results have to be added in their respective rows. That is, when performing a dot product we would first calculate all multiplications and subsequently add these terms into their corresponding element entries in the output vector.
- the W, coll and wPtr would store the content of the mul M matrix in a format alike the CSR (but smarter in the sense, that we eliminate redundancies by taking advantage of the prior knowledge regarding the structure and statistics of the mul M matrix. Namely, it only contains 1 element per row and consecutive rows entail the same weight. Hence, we only need to signalize the unique weights that appear in the matrix, the W array, and at which rows a change in weight value happens, the wPtr array). And the rowList and rowPtr arrays would store the index matrix sum M in CSR format.
- Algorithm 4 describes a possible dot product pseudocode and is shown in Fig. 28.
- a recipient of the representation 50 of Fig. 1 1 would firstly derive all of the information indicated at the left hand side of Fig. 1 1 from the representation 50 at 510, i.e. , the special discrete weight value 34, the list 66 of predetermined discrete weight values, ' the columhlndex ' list 1 ' 40, the p ' ointer ' list 1 70 " , the row index list 150 and the row pointer list 160.
- the number of products to be pre-calculated is determined at 512. It corresponds to the length of the column index list 140.
- the pre-calculations are then performed subsequence-wise, i.e., in units of subsequences 142 of column indices in list 140.
- the pointer list 1 70 is used to access the subsequences 142 for each of the predetermined discrete weight values. That is, the predetermined discrete weight values are cycled through in the for-next-loop 514 and each of the column indices of the current subsequence 142 of column indices is used to address the corresponding activation, namely the one address by the same column index, and multiplied by the predetermined discrete weight value corresponding to the subsequence 142 in the for-next- loop 516.
- the recipient uses the pointer list 160 to access, for each row, the corresponding subsequence 152 of rank values of list 150.
- the previous precalculation of the products is intermittently stored in a vector 520 having one entry for each entry of column index list 140, namely at the corresponding position. That is, the product at the n th position of this intermittent vector 520 corresponds to the product formed by multiplying the activation indexed by the corresponding column index times the predetermined discrete weight value corresponding to the subsequence 142 which the corresponding column index is part of.
- a for-next-loop 520 cycles through all rank indices contained in the subsequence 152 indexed by the pointer list 160 for the respective row, and sums-up the corresponding pre-calculated products at 522. These sums then yield the output for each row as indicated at 524.
- Fig. 28 does not show explicitly as to how to deal with the special discrete weight value 34 in case of same not being zero, but in principle, the same may be done as described in Fig. 22 in lines 25-33.
- This formats can be trivially extended such, that redundant partial sums are also taken into consideration (thus, when two or more weights are stored in the same column configuration several times across rows). This can be accomplished by adding an additional array that indicates which elements of mul have to be added and subsequently concatenating the results into the same vector (and consequently row List would also signalize this elements).
- This format corresponds to format 2 (and 3) in section 3.3.2 presented with respect to Figs. 9 and 10.
- the design of the format depends only on the particular way used for representing the positions of the weights.
- the result 540 of the dot product compotation i.e. the dot product, namely the pre-activation of the neurons in questions, may be obtained by dividing the computational task onto several partial tasks, namely the task of applying the individual addends, 124 times 125 and, if present, 34 times 127, of the weighted sum 123 individually onto the inbound activations 542.
- the individual tasks are easy to compute and involve merely one non-trivial product per row.
- a worth mentioning extension is to add a sparseType array (same length as W) which indicates which sparse format is being used for storing the positions of a particular weight.
- W sparseType array
- This can be advantageous in cases where different weights have different statistics with regards to their position distribution (e.g. a weight value may appear only in a low number of rows and therefore, a COO-like format for storing the positions of this weights may be more advantageous.
- the distribution of some weights is structured, and formats like skyline or block-sparse formats may be a good choice).
- the focus in this type of format is to ensure that different threads have same program lengths and that they access memory in a coalesced manner. This can be accomplished by fixing the difference in the pointer-arrays (in the previous formats usually denoted with a Ptr suffix) and transposing the elements in the index arrays (usually denoted with a / suffix). Additional padding of resulting empty entries need to be taken into account.
- sum M can be efficiently represented using the ELL sparse format.
- W m X we suggested to include the W m X in the format representation because when doing so, we guarantee that the sum M matrix has this constant index distribution condition.
- I p denotes the matrix that contains the patches of the input matrix (ordered by row), and K denotes the matrix containing the kerne! elements.
- K has shared weights. For example, let's imagine that K entails only two distinct elements, k 1 and k 2 , distributed in the following way
- the convolution operation of a layer depends on the predefined number of kernels nK, how much we zero pad the input by p (zero padding means to increase the input dimensions by padding with zeros the contour of the input matrix and consequently apply convolutions on the expanded input), the stride size s, the height M and width N of the kernels, coll stores the indices of the elements of the input matrix which need to be multiplied by the weights contained in W .
- wPtr points to the positions in coll that indi ⁇ cate a change of weight.
- I p denotes the matrix that contains the patches of the input matrix (ordered by row), and K denotes the matrix containing the kernel elements.
- determining the set 36 of discrete weight values of matrix K' which, in fact, is the one to be compared with the above-discussed predetermined matrix or tensor 0, i.e., determining how predetermined discrete weight values assumed by at least one of the weights of matrix K ⁇ is equivalent to, or yields the same result, as determining the set of predetermined discrete weight values by inspecting the weights of the kernels K only.
- the kernels are of equal size, they share a common set of kernel positions. Each kernel position is uniquely associated with a set of one or more positions in matrix K'. Along column index direction, the arrangement of this one or more positions in matrix K' is constant irrespective of the kernel.
- weights a common kernel position are mapped onto sets of one or more positions in matrix K' which are aligned in column, i.e., they are arranged in the same columns of matrix K', but offset so as to be positioned in mutually disjoint sets of rows of matrix K' just as the components of output vector output' associated with the convolution with the different kernels are positioned one on top of the other.
- Fig. 30a indicates the just-outlined relationship between kernel positions on the one hand and corresponding weight positions in matrix K' on the other hand representatively for one of the four kernel positions. Let us first mention how we can considerably reduce the amount of information needed to store the matrix K' .
- the structure of K' repeats after each nP number of rows. It is easy to verify, that by knowing the values and positions of a particular kernel the respective positions on an entire nP x (N, ⁇ ,)-block in K' can be fully predicted. For example
- the matrix-vector multiplication K' ⁇ I is highly redundant with respect to the number of multiplications needed to be performed.
- the matrix-dot product wouldn't be fully efficient since we wouldn ' t take advantage of the natural structure of the matrix K' .
- K we know exactly which operations we need to perform on the input in order to get the output.
- this paradigm takes advantage of the redundancies in multiplications that appear per row (or column).
- we would store the K matrix using this representation where the corresponding coll array would scan over the rows (maybe rowl would then be a better name) of the matrix K (or we can think of also transposing the matrix K T and store the transposed version in the presented way).
- layerParam considers additional layer parameters from which the function depends on such as, padding number p, stride number s, number of input channels nC, kernel matrix dimension and input dimension. Therefore, while scanning through the indices we apply the corresponding sums of the input data, on their corresponding output, and subsequently multiply all output results with the corresponding weight.
- colPtr [0,1,2 ]
- Fig. 30b illustrates the construction of the representation 50 for this example.
- the representation 50 of Fig. 30b indicates or comprises an indication 52 of, the special discrete weight value 34, i.e., k1.
- the input activations or number of input activations corresponded, in the above-outlined examples, to the number of columns, i.e., M, but here the number of input activations is conveyed via two parameters 555, namely Ml and Nl, which indicate the size of the array 553 formed by the input activations.
- a pair of parameters 556 mainly M and N, indicates the size of the kernels, with a number the kernels indicated at 557.
- Stride length is indicated by parameter 558, i.e., s
- padding of the array 553 along the outer circumference thereof is indicated by parameter 559, i.e., p.
- a parameter 560 may optionally be present and indicate a number of channels, i.e., a number of input activations per position of array 553 so that, in effect, multiple such input arrays 553 are acted on concurrently.
- parameters 560, 559 and 558 where at least one or more thereof, are left off.
- representation 50 indicates by way of list 66 comprised by first data field 30 the set of predetermined discrete weight values. Also comprised by the representation 50, is the list 92 of weight indices containing one set of weight indices into a list 66 per kernel which corresponds to one set of indices per column of matrix K which is composed of all kernels involved.
- this representation type was to indicate for each row summation to be done for the dot product computation as to which predetermined discrete weight values are to be taken into account in the respective summation, namely in order to cluster the summation into partial summations and apply the distributive law.
- Fig. 30b this translates into the indication of occurring or assumed predetermined discrete weight values on a per kernel level, as the output of the convolution is composed of components oij each of which is formed, as can be seen from Fig. 30a, a summation over component-wise products between certain input activations and the weights of one of the kernels only.
- the representation of Fig. 30b contains one first data field 30 per kernel which indication is done in Fig. 30b by way of list 66 and another list 92 being partitioned into one partition per kernel and indexing the respective subset occurring in the respective kernel out of list 66 for which there exists an alternative as discussed above with respect to Fig. 8 relative to Fig. 7.
- the second data field 40 comprises a list of indices 64' structured into subsequences 68', namely subsequences of indices indicating for each pair of predetermined discrete weight value and kernel, as to which kernel positions within the respective kernel has weights equal to the respective predetermined discrete weight value.
- the usage of the apostrophes shall render the difference clear to Fig.
- the indices do not refer to the predetermined matrix or tensor 10, which would be K' in our example, or, to be more precise, the matrix resulting from the decomposition of matrix K' into one add-in concerning the special discrete weight value 34 and another concerning each of the predetermined discrete weight values. Rather, the indices in list 64' discriminates the various kernel positons 552 within each kernel with this circumstance being illustrated in Fig. 30b at 561 .
- the second data field 40 comprises the list 94 in order to locate the subsequences 68' of indices in list 64', in subsequences 100 or pointers pointing to subsequences 68' belonging to the same kernel but to different predetermined discrete weight values, the pointers in list 94 being ordered in the same order as the subsequences 68' in list 64' are, namely, according to some order among the kernels with, for each kernel, traversing the associated predetermined discrete weight values for this kernel as indicated by the respective portion within list 92.
- the second data field 40 comprises list 98 of pointers pointing within list 94 to the corresponding subsequences 100 so as to enable a recipient of representation 50 to locate the corresponding subsequence 100 of one or more pointers within list 94. That is, a recipient of representation 50 of Fig. 30b would do the following: it would traverse the kernels according to some order among the kernels and locate for the current kernel the corresponding pointer in list 98 so as to locate the corresponding subsequence 100 of pointers within list 94.
- the recipient could locate the corresponding subsequences 68' of indices in list 64' each subsequence 68' indicating, for an associated predetermined discrete weight value indicated by a weight index in list 92 having a corresponding rank in list 92 in terms of the ordering among the subsequences 68' in list 64', the kernel positions for the current kernel where weights of the kernel assume the respective discrete weight value.
- each index in list 64' and accordingly, each index within each of the subsequences 68' may then easily be translated or mapped into a set of one or more column indices coll indexing corresponding columns of matrix 10 and this, in turn, addresses, as already discussed above, those input activations which are to be component-wise multiplied with the corresponding predetermined discrete weight value which component-wise multiplication, however, may be alleviated by forming partial sums of those input activations corresponding to one discrete weight value and then multiplied with the corresponding discrete weight value.
- the resulting representation 50 is depicted in Fig. 30c.
- the concordance to the representation 50 of Fig. 1 1 is again highlighted by using the same reference signs as in Fig. 1 1 as far as possible and by indicating by the usage of apostrophes that the meaning of certain indices changes. Further, reference is made to the description of Fig. 30b with respect to parameters already discussed there.
- the representation 50 of Fig. 30c comprises the list 66 comprised by the first data field 30, here commonly, i.e., for the whole matrix K' the predetermined discrete weight values which are in there.
- the second data field 40 comprises the index list 140', but the indices contained therein and sub-divided into subsequences 142' do not relate to the column index coll indexing certain columns in matrix 10, but rather, they form indices discriminating or indexing certain kernel positions in order to, this time, indicate for each kernel position 552 whether at least one of the kernels has a weight at the corresponding kernel position which assumes the discrete weight value to which the subsequence 142 ' belongs.
- the remaining part of the second data field is again similar to what has been described above with respect to Fig.
- a pointer list 170 of the second data field points to the various subsequences 142' in list 140' in the order of the predetermined discrete weight values indicated in list 66 and an index list 1 50' is also present and structured into subsequences of indices 152' in order to have each subsequence of indices 152' index those pre-computed component-wise products to be summed up for the output component of the convolution output, i.e., per row of matrix K', according to the dot product prescription.
- 30c is able to map 565 the list of kernel position indices indicated by each subsequence 142' onto a set or list 566 of column indices coll indexing the columns of matrix K' where a corresponding predetermined discrete weight value associated with a respective subsequence 142 ' resides.
- the indices in list 1 50 ' index into this set or list 566 and they are clustered into the subsequences 1 52' in order to do this row-wise for matrix K' and, ac- cordingly, for each output component of the convolution output separately, respectively.
- the pointer list 160 also comprised by the second data field 40 enables to locate the various subsequences 152' so that the recipient of the representation 50 of Fig.
- 30c is able to precompute, for each predetermined discrete weight value indicated by list 66, the component-wise products of this predetermined discrete weight value with the activations associated with the columns indicated in list 566 onto which the corresponding kernel position indices indicated by the associated subsequences 142' in list 142' are mapped 565 and to then access, for each row of matrix K', i.e. , for each output component of the convolutional output, the corresponding subsequence 152' in order to sum- up those precomputed component-wise products associated with the indices in the subsequence 152'.
- 30c concerned an easy example where merely one predetermined discrete weight value was indicated in list 66. If there are more than one, then the lists 566 of column indices determined on the basis of each subsequence 142' of kernel position indices for each predetermined discrete weight value would have to be concatenated so that the indices in list 150' and the subsequences 152', respectively, would be able to distinguish component-wise products associated with different predetermined discrete weight values.
- the sum matrix is also highly structured, which implies that storing it as described above is inefficient. Nevertheless, it's structure can also be fully predicted if one knows the positions of the weights in the kernel matrix K plus the layerParam.
- the second option and the more efficient one is to store the matrix K in either CSWR or CSR format. Notice that in the above description we stored it using the CSR format (with index difference in nW , which should be called colPtr or rowPtr). Also, we changed the name from surnl to kl since now the indices point to rows in in the kernel matrix K (row! could also be a possible name).
- a recipient receiving representation 50 of Fig. 30d is able to perform the precomputations as discussed with respect to Fig. 30c on the basis of lists 66 and 140'.
- Each precomputed component-wise product is, however, addressable uniquely by knowing the predetermined discrete weight value associated or involved in the respective component-wise product, and by knowing the column index coll of matrix K'.
- each of the indices within subsequences 68' may uniquely be mapped onto a set of one or more column indices coll.
- each subsequence 68' is associated with a certain row of matrix K', i.e., with a certain convolution output component, and a corresponding predetermined discrete weight value of list 66.
- predetermined discrete weight value the respective indices belong to.
- the recipient 50 is able to form, for each convolution output component, i.e., for each of row K', the corresponding sum of component-wise products by collecting those precomputed products associated with a pair of the corresponding predetermined discrete weight value on the one hand and the one or more columns onto which each index in the subsequence 68' for this predetermined discrete weight value is mapped for the corresponding row of matrix K'.
- a resulting representation 50 corresponding to the just-outlined possibility is depicted in Fig. 30e and the essence thereof is that the first data field 30 indicate that the predetermined discrete weight values occurring in matrix K' by way of list 66 and that simply, then, for each predetermine discrete weight value, for each kernel, those kernel positions are indexed in a corresponding subsequence 68' within index list 64' which assume the respective predetermined discrete weight value so that the recipient of the representation may perform a matrix decomposition of matrix K' into a binary matrix 570 concerning, and weighted with, the special discrete weight value 34, and one binary matrix 572 for each predetermined discrete weight value, weighted with the offset 174 of this predetermined discrete weight value to the special discrete weight value 34, which indicates by ones the positions within matrix K', where weights corresponding to the respective predetermined discrete weight value are positioned, wherein the latter binary matrices 572 are computed on the basis of the second data field 40, namely its portions for each predetermined discrete weight
- padding has the effect of adding extra zeros in between the kernel values (here exactly 2, since in both sides of the image 1 zero has been added) and the stride number changes the shift of the values at each next row (here they are shifted by 3 entries).
- the second matrix can now be formatted using any of the above mentioned formats. Notice that the cost of performing the dot product of the first matrix is almost negligible. We only need to perform the sum of the elements of the vector and subsequently multiply it by the most frequent weight value once, and then add the resulting coefficient to each output element.
- rowPtr needs to only signalize change in rows when the first position in the next row has higher coll value than the last position in the previous row, or for empty rows. For instance, if we again consider the above matrix example
- rowPtr [0,2,2,1,2,1] where we took the difference of the indices for the wl and rowPtr arrays in order to reduce the bit overhead.
- sparseType [csr, coo, coo] where we separated with
- the sparseType array contains only integers.
- the training of a neural network is usually performed in two steps: a forward and a backward pass.
- a forward pass we perform inference on a set of data samples and calculate as such the prediction error.
- the backward pass we backpropagate the output error to the weights of the network and subsequently update the weights accordingly.
- the forward and backward propagation usually involves performing various matrix-vector multiplications, they can be efficiently performed using the above matrix representations (once quantized).
- training also involves constructing an error matrix of the same dimensions as each weight matrix, entailing the error value of each weight.
- This new matrix may also be quantized and hence, the decoder should be able to construct such error matrix directly into its compressed domain representation.
- format paradigm 8.1 .4 where for each discrete error value we store their positions using the COO-sparse format. This representation of the error matrix allows for efficient new element insertion operations.
- the decoder should support operations that allow to add the weight and error matrices and reconvert the resulting matrix into an efficient format for inference.
- the embedded systems convert the network from a minimal storage representation into one, that is most efficient for inference.
- the embedded systems perform inference and/or training in the compressed domain representation.
- the embedded systems convert the resulting network into a minimal storage representation.
- the central server reconstructs the received networks back into their expanded
- the modularity property allows to select a subset of functions and formats one desires for it's particular use case, constructing as such a subdecoder with lower complexity. i For instance, if one desires to only perform inference on an embedded system in an efficient way, it may be reasonable to just select a few particular formats along with their inference functions and deploy this subdecoder into the embedded systems.
- Another useful property may be the ability to change the network computational graph and data content in it's compressed domain representation. For instance, it may be the case that one desires to increase the number of layers of a number of deployed neural networks, or change their quantisation tables, or even change one convolutional layer for a fully connected one.
- a neural network in it's compressed domain representation is composed by a set of matrices stored in a compressed format, a set of non linearities stored in a table-like format, and a set of instructions that define how the input data is to be processed.
- the decoder is an apparatus that is able to interpret this set of values and instructions and perform the tasks of inference, conversion, learning and modification on it.
- Vector architectures Fixing the difference in the pointer-arrays and transposing the elements in the index arrays. This allowed to derive representations that were efficient for vector architectures.
- Convolutions Treating the kernel matrix as a matrix with shared weights. This allowed to derive efficient representations by following the above 2) and 3) paradigms.
- the encoder was described as to be an apparatus that is able to transform a given neural network into a desirable compressed domain representation, while taking the accuracy of the model into account.
- Lossy compression was characterized by the fact, that the process affects the networks prediction accuracy. Therefore, this type of methods attempt to minimize a rate- distortion like objective, where the trade-off is measured between the prediction accuracy and the quantization strength. 13.1 Ranking the weights and activations (weighted k-means)
- H (W), H (a) denotes the entropy of the weight and activation matrices respectively.
- the weights ⁇ supervise, ⁇ ⁇ reflect the influence of the particular weight or activation to the prediction error, when subjected to perturbations in their values. Thus, smaller weights indicate smaller influence and can therefore be stronger quantized.
- point 3 comes from a novel method for training neural networks under a bayesian framework.
- Each weight and activation is injected with a Gaussian noise during training, whose variance is trained along with the actual values.
- the variances of each weight and activation can be viewed as an approximative measure of the amount of influence of that weight/activation to the prediction error (the higher the variance of a particular weight is, the higher the noise and thus, the less is it ' s influence to the outcome of the network).
- Point 4 comes from the idea of taking advantage of the novel algorithm, which allows to determine which neurons and weights are most relevant for a particular outcome of the network.
- point 5 was inspired by physics and motivated by it's simplicity. Weights and neurons may be viewed as the positions of more particles that are subjected to a stochastic force field (e.g. , small particles in a thermal bath top) and thus, the gradient noise is inversely proportional to their masses. Consequently, more massive particles are more influential with respect to the total energy of the system (in other words, with respect to the prediction error of the network).
- a stochastic force field e.g. , small particles in a thermal bath top
- the entropy constrained Lloyd algorithm is an iterative algorithm that finds (sub)optimal (with respect to problem 1 1 ) partionionings and cluster centers (in other words, the values of the discretee set), given samples from a random variable. It iterates over the following three steps:
- the entropy constrain is being implicitly considered in the first step, by applying the codeword length constrain into the cluster assignment.
- this algorithm minimizes the cost function 1 1 .
- the first scenario would be to directly apply the Lloyd algorithm to the activation values a.
- the second and more recommendable scenario would be to first quantize the weight values, then perform the forward pass and subsequently quantize the resulting activation values, for example, let ' s assume that we applied the Lloyd algorithm onto the weight values and found the following optimal cluster assignment for each element of the matrix
- the Lloyd algorithm is an efficient algorithm that allows to minimize the optimization objective 1 1 .
- this optimization objective may be considered too coarse.
- solving the exact optimization 10 would require to at least replace the relaxed distortion term in steps 1 and 2 with the prediction error of the network. This translates to,
- step 1 may not be solvable.
- step 2 can by applying conventional neural network training methods (gradient descent with respect to each weight element and then update cluster centers taking the average of the gradients that were assigned to them). Therefore, the Lloyd algorithm may be extended into considering the prediction error of the network in step 2.
- the cluster assignment function is already fixed. That means we already know the decision thresholds and the cluster center positions. Hence, the objective here is to find the positions of the weight values such, that after quantising, the prediction error is minimized.
- the cluster assignment step we aim to train weight distributions such, that the activation values are as close as possible to the activation cluster centers the prediction error is minimized. We may also do this by adding the quantization constrain into the Lagrangian. In addition, we may also minimize the entropy (or cardinality) of a probability distribution the activations by aiming to minimize the cross-entropy between the given mass distribution and the actual mass distribution. Second, we calculate the cluster centers that minimize the prediction error by collecting their respective gradients and updating them using a gradient descent step.
- step 1 we considered calculating the prediction error with respect to the continuous values instead of the actual cluster values.
- adding the regularizer and increasing the lagrangian multiplier such that the relaxed prediction error eventually matches the prediction error of the quantized network by the end of training.
- one can train the cluster assignments by calculating explicitly the prediction of the quantized error and backward passing its error during training. In this way adding an additional regularizer wouldn't be necessary. So far in our experiments this method appeared to be more noisy and less efficient than the discussed above. However we do not discard the possibility of finding alternative and efficient algorithms that take the actual prediction error into account.
- the encoder After we attained a discrete neural network, the encoder will proceed into converting the entire neural network into an optimal compressed domain representation.
- the encoder may change the numerical representation of the weight as well as activation values (when applied). For instance, if the weight values of a layer were uniformly quantized,
- the encoder may lossless convert the weight matrices into one of the formats presented above (also presented above, where the encoder may select the one which is more optimal. Note, that the compressed matrix representation depends on the previous step, namely, if the weight values were previously converted into another numerical representation.
- the encoder may run a (maybe complex) compiler that analyzes the entire resulting network structure and adapts/optimizes it further, by for instance eliminating redundancies across layers and/or taking specific hardware configurations into consideration. For example, if one may have used same quantizers across different layers, then it ' s discrete values may be stored only once.
- Fig. 33 shows an apparatus 600 for performing a prediction using a neural network.
- the apparatus 600 may be implemented in software in order to run, for instance, on a mobile device such as a mobile phone, a laptop computer or some other terminal device. However, alternatively, apparatus 600 may be implemented in firmware or hardware.
- Apparatus, 600 comprises an interface 602 for receiving a representation 600 of the neural network on the basis of which apparatus 600 is to perform the prediction.
- the representation 604 comprises one or more matrices or tensors of weights which control an amplification at which activations of neurons of the neural network are forwarded downstream.
- An example of such a network has been, for example, presented in Fig. 20.
- apparatus 600 outputs the prediction result 608 such as the activations of the output neurons when you think of the example of the neural network 398 of Fig. 20.
- apparatus 600 comprises a discrete weight value deriver 610a and a position deriver 610b.
- the former derives from the representation 604 at least the set 36 of discrete weight values actually assumed by at least one of weights of a predetermined matrix/tensor portion of the predetermined matrix of tensor 10 and the latter derives for each predetermined discrete weight value of the set of predetermined discrete weight values an indication of positions of weights assuming the respective predetermined discrete weight value within the predetermined matrix/tensor portion.
- the "predetermine matrix/tensor portion” may cover the whole matrix, or merely a subsection thereof, such as a subarray thereof which covers certain rows and/or columns of the predetermined matrix or tensor 10.
- apparatus 600 comprises the actual prediction computer 612 which actually performs the prediction, and this prediction computer comprises a dot product computer 614 which uses the set of predetermined discrete weight values and the indication of the positions as output by derivers 610a and 610b so as to compute the dot product of the predetermined matrix or tensor 10 with an array or activations of neurons of the neural network.
- apparatus 600 may receive the inbound representation 604 from a digital storage medium, via digital communication such as wireless of cable based communication, or from a lossless data decompressor which retrieves representation 604 by, for instance, entropy or arithmetic decompression from a transmitted representation.
- representation 604 stored on a digital storage medium same may for instance be a programmable read-only memory, a non-transitory solid state memory, or a transitory solid state memory or any volatile memory. That is, the apparatus 600 may be provided with a representation 604 once and then, from then onwards, used the representation 604 for predictions to be done on inputs 616 which apparatus 600 may receive, for instance, at a prediction input interface 618 so as to be subject to the prediction on the basis of the neural network within prediction computer 612. Device 600 may, alternatively, intermittently receive updates of representations 604 so as to perform future predictions based on an updated representation 604.
- the representation 604 may be any of the above-discussed representations 50 or may be any other with deriver 610a and 610b deriving the corresponding information from the inbound representation 604- by -respective format conversion. Any format conversion, however, is preferably lossless, i.e., the derived information at the output of derivers 610a and 610b equals the corresponding portion of representation 604. Apparatus 600 may, for instance, be configured to read representation 604 from digital data which forms representations 604 so that derivers 610a and 610b simply obtain the corresponding derived information which represents any of the representations 50 discussed above, simply by digital data reading. However, the derivation may additionally comprise differential decoding and/or entropy decoding or some other similar task.
- computer 614 may apply the quantization of preactiva- tion values as resulting from any dot product computation onto a discrete set of activation values which may optionally be indicated by the representation 50, too.
- This procedure may involve a linear mapping of the preactivation value with then quantizing the mapped value using, for instance, a constant quantization step size, wherein alternatives may apply as well.
- representation 50 comprises one or more data fields 30 concerning the discrete weight values and, for each first data field 30, a second data field 40 indicating the positions of weights assuming the respective discrete weight value.
- representation 50 may additionally comprise optionally further information such as the indication 52 of a special discrete weight value such as the one most frequently assumed.
- Another information or data field 620 comprised by representation 50 may indicate the format underlying the representation.
- this format indication 620 might have been maintained or conserved in case of any transitioning from inbound representation 604 to representation 50. That is, even in case of format conversions having been performed since the first generation of representation 50, the recipient of representation 50, namely the apparatus 600 of Fig. 33, is able to see as to which format is most suitable for the represented neural network, in other words, the generator or deriver of representation 50 an example for an apparatus of which is described later, might have chosen format 620 with respect to some optimization thoughts so that is advantageous if this information is maintained in representation 50. Accordingly, representation 50 may, as illustrated in Fig. 34, additionally comprise information on alternative formats 622 which might be useful in certain situations differing from ones for which format 602 at which- representation 50 is currently represented.
- representation 50 may comprise one or more data fields 628 indicating a set of discrete activation values onto which activations of neurons are to be quantized during prediction, wherein the scope, i.e., the portion of the neural network, for which each of these data fields 628 apply, may be complete matrices, portions thereof or any other sections of the neural network.
- the prediction computer 612 may apply data fields 628 when performing the prediction by nonlinearly mapping pre-activated neurons, i.e., pre-activations computed using the weights represented in portions 624 and 626 onto the final activations.
- representation 50 may comprise coordinating data 630 which indicates the relationship between the portions and matrix/tensors described by data portions 624 and 626, respectively.
- the coordinating data 630 may provide a kind of survey or overview of the neural network described by representation 50.
- the dot product computer 614 may take advantage of representation 50 and its construction into one or more first data fields and, disjoint therefrom, i.e. additionally or separately therefrom, a second data field per first data field, 40, in one or more of the following manners.
- "One or more” shall denote the fact that the dot product computer may be capable of any of these three concepts discussed above in sections 8.1 in order to, for instance, apply different ones of these three possibility for different portions of a neural network of a different neural network based predictions. Alternatively, however, a dot product computer may only be able to perform one of these procedures.
- the dot product 650 may, as illustrated in Fig. 35 involve sums over component-wise products between weights of the predetermined matrix or tensor 10 and activations 652 or neurons such as the sum over corresponding components of input vector 442 -and a corresponding row of- matrix 10 so as to compute the pre-activation of a certain successor neuron of the network.
- the pre-activation as indicated at 654, one of the three above-discussed options may be used which are illus- trated in Fig. 35: according to the first option 656, the sums 654 is decomposed into partial sums.
- computer 614 identifies, on the basis of representation 50, component wise products, i.e., add-ins, within sum 654, which have the same discrete weight value as a factor in 658, computes the partial sum over these groups of component wise products, multiplies each partial sum with its corresponding discrete weight value in 662 and performs a sum 664 over these weighted partial sums if more than one group of component wise products exists.
- the number of multiplications has, thus, been reduced.
- the identification in accordance with option 656, thus, operates row- specific. This is different in the case of the second option 666.
- an identification 668 takes place, namely the identifications of weights of the predetermined matrix or tensor 10 which are of equal predetermined discrete weight value and are subject to a component wise multiplication with a same one of the activations 652 of array 442, wherein this component-wise product is computed only once in step 670 and used as an add-in in more than one of the summation 654 as indicated in 672.
- the identification 668 may, as illustrated in the above examples, identify all occurring component-wise products, i.e., all combinations of discrete weight value and activation value occurring in any of the component-wise products of the sums 654. They may be pre-calculated 670 and then addressed according to information conveyed by the second data field so as to be used as the individual add-ins in summation 654.
- the dot product 650 is decomposed 678 into a weighted sum over dot products of modified versions of the predetermined matrix or tensor 10 and the array 442 of activations, wherein each of the modified versions is a binary valued matrix, the ones of which are located, or which is populated, according to a representation 50, namely in a manner so that the ones are positioned at positions where matrix 10 has a corresponding discrete weight value, and each such binary valued matrix is weighted using the respective predetermined discrete weight value or a difference of the respective predetermined discrete weight value and an offset value, namely the special discrete weight value 36.
- the computation overhead may thus be distributed onto several computation cores.
- Each index matrix 124 may have ones at positions corresponding to the positions of weights having of the respective discrete weight.
- the dot product can then be performed such that first the activation values are summed accordingly at each output row and then, the weight value is multiplied to this values. This is done at each core, separately for its addend in the weighted sum 123. Or firstly the weight value 125 is multiplied with each activation value and then the sum over ones in each row of index matrix 124 is performed and multiplied with the corresponding premultiplied activation times weigth 125. This doesn't change the representa- tion, but it changes the order of execution of product representing each discrete weight related addend in weighted sum 123. Using one or the other may have advantages/disadvantages in particular cases.
- the dot product computer may use the predetermined discrete weight values 36 in a representation where same indicate an offset relative to the most often assumed discrete weight value 34.
- the pre-activation sums 654 indicated in Fig. 35 change as indicated in Fig. 36 and already explained above, namely to the extent that a further add-in occurs and the summation 656 for each output or pre-activation j, namely a sum over all inbound activations times the most often ly assumed discrete weight value 34.
- step 658 In associating the steps indicated in Fig. 35 with the corresponding portions of the above description, it is noted that the identification of the partial sum add-ins in step 658 have been performed in Fig. 22 on the basis of the corresponding entries, i.e. , the ones corresponding to the current row, of rowPtr and the summation itself, 660, had been performed in the for-next-loop 460.
- the identification of equal component products, 668 has been performed by deriving from the representation for each weight having one of the predetermined discrete weight values, an index to the corresponding product, namely using row List.
- Fig. 37a shows that representation 50, if aiming at exploitation or option 656 has at least with respect to the second data field a structuring into portions each of which associated with a different one of the rows for which a summation according to which 654 is to be performed.
- the left hand side illustrates the case where the representation 50 comprises one first data field per row, i.e., each first data field 30 indicates the pre-determined discrete weight values 26 occurring in the respective row, wherein a second data field 40 is present for each such first data field, thereby indicating the positions of those predetermined discrete weight values indicated by the respective first data field for this row.
- one first data field commonly denotes the predetermined discrete weight values assumed by any weight within matrix 10, i.e., within any row, but the second data field 40 is sub-divided into portions 690, each associated with a separate row.
- the first data fields 30 are of equal size and concatenated so as to be individually accessible by computing an address for accessing the respective first data fieid by use of a row index, for instance, at the indication of a number of assumed discrete weight values occurring in each row, with the same applying to second data fields, i.e., same may be concatenated and of equal sized so that each may be addressed by computing the address of the respective second data field 40 on the basis the row address and the number of a maximum number of discrete weight values occurring in each row, respectively.
- the latter circumstance would likewise apply to the portions 690 of the one second data field for the one first data field.
- both options may also be used to describe a convolutional matrix / tensor.
- the second data field 40 or portion 690 would, however, indicate for each row, i.e. for each kernel or summation for an convolution pre-activation output value, the columns in the indexing domain of the kernel positions which translates into column indices of the actual matrix / tensor 10, K', by mapping 565.
- the first data field indicates the occurring or assumed predetermined discrete weight values within the matrix of tensor 10 globally and the second data field indicates, by column index which is, as explained above, equivalent to an address for the inbound activations, within a first portion 692 for each predetermined discrete weight value, such as within an own sub-portion 694 for each predetermined discrete weight value, those columns or activations which are to be mul- tiplied with a corresponding predetermined discrete weight value in advance, so as to result into a corresponding precomputation.
- each of these column indices in this portion 692 results into a pre-computed product and the second data field then comprises additionally a further portion 696 which indicates as to which row summation 654 may be computed by adding-up which precomputed products.
- list 140 plus pointer list 170 assumed the role of portion 692, wherein some index array 192 assumed the role of portions 696.
- this type of representation when used to describe a convolutionai matrix / tensor would have the portion 692 of the second data field 40 indicating the columns/activations to be subject to pre-computation with any of the discrete weight values in the indexing domain of the kernel positions which translates into column indices of the actual matrix / tensor 10, K', by mapping 565, and portion 696 of the second data filed would for each row, i.e.
- Fig. 37c shows that a representation 50 designed for being used according to option 676, simply comprises one first data field 30 indicating the predetermined discrete samples values assumed by at least one of the weights within the matrix/tensor portion in question, while the second data field 40 is sub-divided into portions 698, one portion 698 for each predetermined discrete weight value indicated by the first data field 30 which indicates the positions of weights comprising the respective predetermined discrete weight value so that, on the basis of each portion 698, any of the binary matrices 124 may be construed and weighted according to the predetermined discrete weight values so as to obtain the matrix decomposition and compute the result thereof.
- Fig. 37c shows that a representation 50 designed for being used according to option 676, simply comprises one first data field 30 indicating the predetermined discrete samples values assumed by at least one of the weights within the matrix/tensor portion in question, while the second data field 40 is sub-divided into portions 698, one portion 698 for each predetermined discrete weight value
- different formats may be used in order to indicate the positions in the various portions 698.
- different portions 698 corresponding to, or relating to, different predetermined discrete weight values may indicate the positions of weight assuming any of these predetermined discrete weight values may be contained in the second data field 40 in different formats so as to allow for a taking into account of different statistical characteristics of the frequency of occurrence of the individual predetermined discrete weight values.
- the second data field 40 could comprise for each portion 698 an additional indication as to what weight specific format has been used for the individual portion 698.
- this type of representation when used to describe a convolutionai matrix / tensor would have the portion 698 of the second data field 40 indicating for its predetermined discrete weight value, the kernel positions within each kernel where weights assume the corresponding predetermined weight value so that the recipient of the representation 50, such as apparatus 600, is able to construct the decomposition and the binary matrices 572, respectively, using the mapping of kernel positions 552 to position 549 in the matrix 10.
- the derivation done by derivers 610a and 610b merely involves a decoding, i.e., a plain text reading from digital data, or decoding procedures such as predictive decoding and/or entropy decoding. No analysis, however, is preferably done within deriver 610a and 610b which are rather tasks performed by the apparatus described now with respect to Fig. 38.
- Fig. 38 shows an apparatus 700 for deriving a representation of a neural network.
- the apparatus 800 may be implemented in software in order to run, for instance, on a mobile device such as a mobile phone, a laptop computer or some other terminal device.
- apparatus 700 may be implemented in firmware or hardware.
- the apparatus 700 receives at an input interface 702 there of information on the neural network, i.e., its weight, the neuron interconnectivity and so forth.
- a determiner 704a then derives the one or more first data fields 30 and a position deriver 704b derives, for each of the one or more first data fields 30, the second data field 40. That is, at the output of determiner 704a and 704b, the representation 50 results in the apparatus 700 is configured to output representation 50 either as it is or in a form related to the two by lossless data conversion, at its data output 706.
- the determiner 704a and 704b of the apparatus of Fig. 38 preform an evaluation or analysis of the neural network at hand rather than a simple decoding from an already present representation.
- the apparatus 700 of Fig. 38 may receive at its input 702 an initial representation of the neural network by lossless decoding. The reception may involve, additionally, decompression and/or predictive decoding.
- apparatus 700 may output the representation 50 as a data file, for storage on a digital storage medium and/or to an apparatus for performing prediction using the neural network.
- the initial representation 708 might stem from an apparatus further described with respect to the following Figs. , namely one which optimizes the weights.
- the initial representation 708 which forms the basis for the determination in determiners 704a and 704b is of certain manner so that representation 50 represents the same neural network, i.e., the transition from the initial representation 708 to representation 50 is lossless.
- determiner 704a gathers all predetermined discrete weight values of weights within a certain portion of the predetermined matrix/tensor for which a first data field is to be determined. That is, if merely one first data field 30 is to be generated for the aforementioned predetermined tensors/matrix portion, which may be the whole matrix/tensor 10 or a portion thereof as discussed above, then the gathering takes place for this whole predetermined matrix/tensor portion, and if a first data field 30 is to be generated for each row, then the gathering takes place for each row.
- the gathering may be done by determinator 704a in a manner so as to avoid duplicates. To this end, determinator 704a may check that predetermined discrete weight values of equally valued weights are gathered merely once.
- a similar check is performed for the determination of the column indices when generating portion 692 of the second data field with respect to the columns.
- a further task which is performed by determinator 704a is to determine, for instance, the most oftenly assumed discrete weight value 34 assumed most oftenly by weights of the predetermined matrix/tensor portion for which representation 50 is to be generated.
- determinator 704a sets-up the set of predetermined discrete weight values, for instance, in such a manner so that the set 36 includes all discrete weight -values assumed- by- at least one of the weights within- the predetermined matrix/tensor portion, excluding the most oftenly assumed discrete weight value 34.
- the set of predetermined discrete weight values is then indicated by the first data field within the repre- sentation 50 separately with respect to the most oftenly assumed discrete weight value indicated in the representation 50, too.
- the extra discrete weight value 34 may alternatively be agreed to be zero by default.
- the determinator 704a may code the predetermined discrete weight values in the first data field as offsets to the extra discrete weight value.
- determinators 704a and 704b generally, perform he determination, respectively, in such a manner that the above-discussed representation results which may then be used or exploited in a manner discussed above with respect to the decoder side.
- Fig. 39 shows an apparatus 800 for deriving a representation of a neural network in the sense that apparatus designs or determines the neural network in such a manner that the discrete weight values are newly determined.
- the apparatus 800 may be implemented in software in order to run, for instance, on a computer or a server some other device. However, alternatively, apparatus 800 may be implemented in firmware or hardware.
- Apparatus 800 of Fig. 39 may perform its task of deriving the representation of the neural network from the scratch, i.e. by training the neural network from the scratch, on apparatus 800 uses a pre-trained neural network and quantizes its weight accordingly.
- apparatus 800 may comprise an input for a neural network representation 802 which, as just-outlined, is either pre-trained and, accordingly, also comprises trained weights, or merely roughly describes the neural network by providing, for instance, constraints in terms of, for instance, number of layers, neurons per layer, available neuron interconnections and so forth.
- representation 802 at input 804 of apparatus 800 could prescribe the general structure shown in Fig. 19 in terms of the types of layers, the number of layers per layer set and so forth.
- the probability value of a - - particular element of the discrete set measures the probability of it appearing in the neural network. That is, if it's probability is high, then it is highly likely that this value appears frequently throughout the network.
- a particular (discretee) weight configuration of the network can be considered as a particular sample of this probability distribution and thus, the frequency of appearance of a particular value approximates it's probability value for large networks (thus, the frequency of appearance of the discrete set of values is the empirical estimation of their probability distribution).
- the frequency of appearance of the discrete set of values is the empirical estimation of their probability distribution.
- the apparatus 800 may quantize a pre-learned state of the weights of the predetermined matrix/tensor portion, for instance, iteratively in the manner outlined above using the three steps. Each iteration may involve determining a quantization mapping, q( ), which maps each weight of a pre-learned state, w, of the weights to one of the set of discrete weight values, e.g. the ones indexed using k and denoted w k , so that intermediate frequencies, pm k , result at which the discrete weight values, w, have the weights of the predetermined matrix tensor portion mapped thereonto by the quantization mapping.
- q( ) maps each weight of a pre-learned state, w, of the weights to one of the set of discrete weight values, e.g. the ones indexed using k and denoted w k , so that intermediate frequencies, pm k , result at which the discrete weight values, w, have the weights of the predetermined
- step 1 This determination has been described above in step 1 as comprising an optimization of the quantization mapping using a Langrangian cost function, argmin fc
- argmin fc
- the respective discrete weight values are updated so as to obtain a respective updated discrete weight value by optimizing a cost function, min ⁇ w ⁇ ⁇ w k - q(w) ⁇ ⁇ , which measures a central tendency of a deviation between the respective updated discrete weight value and the weights of the pre-learned state mapped onto the respective discrete weight value by the quantization function.
- the central tendency may be L 2 norm, but any other may be used as well.
- the cost function measures an impact of the deviation between the set of discrete weight values to the weights of the pre-learned state onto the prediction using the neural network such as using ⁇ w ⁇ ⁇ ⁇ ⁇ - q(w) ⁇ ⁇ 2 .
- the L2 norm is merely a particular example and an extension could be the usage of a weighted L2 norm where the weight measures, namely here using ⁇ district, the importance of the weight w with respect to the prediction error.
- the coefficient ⁇ , ⁇ tells how much we can modify a particular element of weight w without affecting the prediction error.
- the coefficients ⁇ intend may be derived/calculated/estimated by analazying the prediction error of the pre- trained NN configuration.
- each step of the Lloyd ⁇ algorithm entails the actual -prediction ' eTror of thenetwork as distortion term. Because when doing so, we learn the quantiser q(. ) that minimises for it. However this is unfeasible in practice. Therefore we according to the embodiment outlined ehrein the (weighted) central deviation term as an approximation of the prediction error of the network and an active research topic is to find better approximations. Moreover, we also proposed to optimize the discrete values (thus the quantiser centers) under the actual prediction error of the network because this is a feasible optimisation goal. Namely, we can find local solutions using standard gradient based optimisation techniques.
- the determining the mapping may, thus, involve varying the location of the quantization function's vertical edges, i.e. varying the step widths of the floor function, to find that optimizes aforementioned Langrangian cost function, and the updating may than involve varying the quantization function's step height's, i.e. the heights of the plateaus of this function. After updating , the next iteration is performed.
- apparatus 800 may also change the NN weights such, that their configuration minimises the entropy constrained Lagrangian cost function combining terms one of which measures the prediction error, the other one of which measures the entropy after being quantised. So now the apparatus is allowed to change the weight values during the encoding (optimization) procedure.
- the input of apparatus 800 can be any NN configuration (any pre-weight configuration, e.g. , random initialisation of a given network or the configuration of a pre-trained NN is used as a starting pint. Then the encoding is performed such, that it solves two sub- problems either iteratively or simultaneously.
- apparatus 800 may do the training iteratively by performing in each iteration: iterative optimaztion of the neural network with respect to preliminary weights in the predetermined matrix/tensor portion by iteratively applaying a test input onto the neural network usingthe preliminarily weights to obtain a test prediction error and modifying the preliminary weights to reduce a Lagrangian cost function combining a functional term which measures the prediction error and an entropy term which measures an entropy of a probability distribution resulting from mapping the preliminarily weights onto the discrete weight values according to a quantization mapping.
- the iterative process may be done in quantized domain directly so that the prediction would be with the weights quantized onto the discrete weight values using the quantization function or in non-quanitzed domain.
- the Langrangian may comprise an additional term, namely a discrete weight value distance term, e.g. L_2 norm, measuring a central tendency of a distance of the preliminarily weights to the discrete weight values to which the preliminarily weights are mapped according to the quantization function.
- the discrete weight values are optimized: for each of the discrete weight values, the respective discrete weight value is updated so as to obtain a respective updated discrete weight value by optimizing a cost function, e.g.
- apparatus 800 outputs a neural network representation or description which, not necessarily, equals representation 50.
- representational description 808 may be one which may be subject as input 708 to the apparatus 700 of Fig. 38 so as to be turned, by lossless conversion, into a representation 50. That is, representation 808 describes the neural network in the sense that at least with respect to the predetermined matrix/tensor portion, the weights of the neural network has discrete weight values with a neural network ' s weights being described by a representation which may, Iosslessly, be turned into a representation 50.
- apparatus 800 uses an optimization scheme with an objective function which depends on a cardinality of a set of discrete weight values actually assumed by at least one of the weights of the predetermined matrix/tensor portion in a manner so that the optimization schemes aim at reducing the cardinality and/or uses an optimization scheme with an objective function which depends on frequencies at which discrete weight values of the set of discrete weight values are actually assumed by the weight of the predetermined matrix/tensor portion in a manner so that the optimization scheme aims at reducing the entropy of a probability distribution of the set of discrete weight values.
- apparatus 800 may additionally or alternatively perform the derivation of the representation of the neural network at output 806, i.e. the generation of representation 808, in a manner so that the representation of the neural network, respectively, is optimized with respect to the activation values.
- apparatus 800 may train the neural network from the scratch or may amend a pre-trained neural net- work in a manner so that the activations are quantized at least with respect to a certain portion of the neural network.
- apparatus 800 may use an optimization scheme with an objective functions with depends on a cardinality of the set of discrete activation values of activations for a predetermined set of neurons of the neural network in a manner so that the optimization scheme aims at reducing the cardinality, and/or an optimization scheme with an objective function which depends on frequencies at which discrete activation values of the set of discrete activation values are assumed for activations of neurons of a predetermined set of neurons of the neural network in a manner so that the optimization scheme aims at reducing an entropy of a probability distribution of the discrete activation values, e.g. reducing argmln ⁇ a ⁇ ⁇ ⁇ ⁇ - q ( ) ⁇ ⁇ 2 + ⁇ ( ⁇ ( ⁇ ).
- a neural network has, thus, been described above which is composed by a set of neurons that are connected in a particular arrangement.
- the connectivity of the neurons can be represented by a set of matrices or tensor.
- a common step is to quantize the matrix/tensor values (that is, each element of a matrix/tensor is allowed to only take values from a finite set of real values, instead of the entire E).
- the statistical property that subsets of elements may share the same value has been exploited in some of the above embodiments.
- Embodiments describe a set of new formats (data structures) for representing this type of matrices.
- the formats leverage the weight sharing property of the matrices in order to increase their efficiency with respect to certain optimization objectives.
- property weight sharing property (or WS in short).
- Method for learning (sub)optimal fixed-point representations of the weight as well as activation values of a trained NN.
- section 6 we provided a detailed explanation of our proposed encoding-decoding scheme, which was the second focus of this description.
- aspects have been described in the context of an apparatus, it is clear that these aspects also represent a description of the corresponding method, where a block or device corresponds to a method step or a feature of a method step. Analogously, aspects described in the context of a method step also represent a description of a corresponding block or item or feature of a corresponding apparatus.
- Some or all of the method steps may be executed by (or using) a hardware apparatus, like for example, a microprocessor, a programmable computer or an electronic circuit. In some embodiments, one or more of the most important method steps may be executed by such an apparatus.
- the inventive neural network representations can form a digital signal which can be stored on a digital storage medium or can be transmitted on a transmission medium such as a wireless transmission medium or a wired transmission medium such as the Internet.
- embodiments of the invention can be implemented in hardware or in software.
- the implementation can be performed using a digital storage medium, for example a floppy disk, a DVD, a Blu-Ray, a CD, a ROM, a PROM, an EPROM, an EEPROM or a FLASH memory, having electronically readable control signals stored thereon, which cooperate (or are capable of cooperat- ing) with a programmable computer system such that the respective method is performed. Therefore, the digital storage medium may be computer readable.
- Some embodiments according to the invention comprise a data carrier having electronically readable control signals, which are capable of cooperating with a programmable computer system, such that one of the methods described herein is performed.
- embodiments of the present invention can be implemented as a computer program product with a program code, the program code being operative for performing one of the methods when the computer program product runs on a computer.
- the program code may for example be stored on a machine readable carrier.
- inventions comprise the computer program for performing one of the methods described herein, stored on a machine readable carrier.
- an embodiment of the inventive method is, therefore, a computer program having a program code for performing one of the methods described herein, when the computer program runs on a computer.
- a further embodiment of the inventive methods is, therefore, a data carrier (or a digital storage medium, or a computer-readable medium) comprising, recorded thereon, the computer program for performing one of the methods described herein.
- the data carrier, the digital storage medium or the recorded medium are typically tangible and/or non- transitionary.
- a further embodiment of the inventive method is, therefore, a data stream or a sequence of signals representing the computer program for performing one of the methods described herein.
- the data stream or the sequence of signals may for example be configured to be transferred via a data communication connection, for example via the Internet.
- a further embodiment comprises a processing means, for example a computer, or a programmable logic device, configured to or adapted to perform one of the methods described herein.
- a processing means for example a computer, or a programmable logic device, configured to or adapted to perform one of the methods described herein.
- a further embodiment comprises a computer having installed thereon the computer program for performing one of the methods described herein.
- a further embodiment according to the invention comprises an apparatus or a system configured to transfer (for example, electronically or optically) a computer program for performing one of the methods described herein to a receiver.
- the receiver may, for example, be a computer, a mobile device, a memory device or the like.
- the apparatus or system may, for example, comprise a file server for transferring the computer program to the receiver.
- a programmable logic device for example a field programmable gate array
- a field programmable gate array may cooperate with a microprocessor in order to perform one of the methods described herein.
- the methods are preferably performed by any hardware apparatus.
- the apparatus described herein may be implemented using a hardware apparatus, or using a computer, or using a combination of a hardware apparatus and a computer.
- the apparatus described herein, or any components of the apparatus described herein, may be implemented at least partially in hardware and/or in software.
- the methods described herein may be performed using a hardware apparatus, or using a computer, or using a combination of a hardware apparatus and a computer.
- VSM1 1 Vincent Vanhoucke, Andrew Senior, and Mark Z. Mao. Improving the speed of neural networks on cpus. In Deep Learning and Unsupervised Feature Learning Workshop, NIPS 2011, 201 1 .
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Evolutionary Computation (AREA)
- Artificial Intelligence (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
Description
Claims
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| PCT/EP2017/077838 WO2019086104A1 (en) | 2017-10-30 | 2017-10-30 | Neural network representation |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| EP3704638A1 true EP3704638A1 (en) | 2020-09-09 |
Family
ID=60654918
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| EP17811855.0A Pending EP3704638A1 (en) | 2017-10-30 | 2017-10-30 | Neural network representation |
Country Status (2)
| Country | Link |
|---|---|
| EP (1) | EP3704638A1 (en) |
| WO (1) | WO2019086104A1 (en) |
Families Citing this family (22)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110647974A (en) * | 2018-06-27 | 2020-01-03 | 杭州海康威视数字技术股份有限公司 | Network layer computing method and device in deep neural network |
| GB2580171B (en) * | 2018-12-21 | 2021-02-17 | Imagination Tech Ltd | Methods and systems for selecting quantisation parameters for deep neural networks using back-propagation |
| CN114072844A (en) | 2019-07-02 | 2022-02-18 | Vid拓展公司 | Method and device for neural network compression framework based on nuclear tensor and tree partition |
| CN110598855B (en) * | 2019-09-23 | 2023-06-09 | Oppo广东移动通信有限公司 | Deep learning model generation method, device, equipment and storage medium |
| US12443830B2 (en) * | 2020-01-03 | 2025-10-14 | International Business Machines Corporation | Compressed weight distribution in networks of neural processors |
| US12393841B2 (en) | 2020-02-05 | 2025-08-19 | Samsung Electronics Co., Ltd. | Neural network update method, classification method and electronic device |
| CN113222103B (en) * | 2020-02-05 | 2025-12-19 | 北京三星通信技术研究有限公司 | Neural network updating method, neural network classifying method and electronic equipment |
| US20210256384A1 (en) * | 2020-02-14 | 2021-08-19 | Northeastern University | Computer-implemented methods and systems for achieving real-time dnn execution on mobile devices with pattern-based weight pruning |
| US12554987B2 (en) | 2020-02-14 | 2026-02-17 | Northeastern University | Computer-implemented methods and systems for DNN weight pruning for real-time execution on mobile devices |
| US20210303975A1 (en) * | 2020-03-25 | 2021-09-30 | Arm Limited | Compression and decompression of weight values |
| CN113537485B (en) * | 2020-04-15 | 2024-09-06 | 北京金山数字娱乐科技有限公司 | Compression method and device for neural network model |
| US11687764B2 (en) * | 2020-04-17 | 2023-06-27 | Samsung Electronics Co., Ltd. | System and method for increasing utilization of dot-product based neural network accelerator |
| US11861327B2 (en) * | 2020-11-11 | 2024-01-02 | Samsung Electronics Co., Ltd. | Processor for fine-grain sparse integer and floating-point operations |
| WO2022119466A1 (en) * | 2020-12-01 | 2022-06-09 | Huawei Technologies Co., Ltd. | Device and method for implementing a tensor-train decomposition operation |
| CN113128664A (en) * | 2021-03-16 | 2021-07-16 | 广东电力信息科技有限公司 | Neural network compression method, device, electronic equipment and storage medium |
| CN115460182B (en) * | 2021-05-21 | 2024-07-05 | 华为技术有限公司 | Coding and decoding method, device, equipment, storage medium and computer program |
| CN113743459B (en) * | 2021-07-29 | 2024-04-02 | 深圳云天励飞技术股份有限公司 | Target detection method, target detection device, electronic equipment and storage medium |
| CN114943335B (en) * | 2022-04-16 | 2025-07-25 | 国网山东省电力公司聊城供电公司 | Layer-by-layer optimization method for three-value neural network |
| EP4361890A1 (en) * | 2022-10-31 | 2024-05-01 | Imagination Technologies Limited | Implementing a scatter function on a neural network accelerator |
| WO2025048805A1 (en) * | 2023-08-31 | 2025-03-06 | Stem Ai, Inc. | Discrete internodal input/output for machine learning |
| CN117094745B (en) * | 2023-09-06 | 2024-03-12 | 天津大学 | Comprehensive energy system optimization control method and device based on IGDT-utility entropy |
| CN117194483B (en) * | 2023-09-11 | 2025-10-24 | 厦门市美亚柏科信息安全研究所有限公司 | A graph database retrieval method and system integrating entity recognition technology |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20150067009A1 (en) * | 2013-08-30 | 2015-03-05 | Microsoft Corporation | Sparse matrix data structure |
| US20150317334A1 (en) * | 2014-05-05 | 2015-11-05 | Microsoft Corporation | Sparse datatable data structure |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US10223635B2 (en) * | 2015-01-22 | 2019-03-05 | Qualcomm Incorporated | Model compression and fine-tuning |
| US10831444B2 (en) * | 2016-04-04 | 2020-11-10 | Technion Research & Development Foundation Limited | Quantized neural network training and inference |
-
2017
- 2017-10-30 WO PCT/EP2017/077838 patent/WO2019086104A1/en not_active Ceased
- 2017-10-30 EP EP17811855.0A patent/EP3704638A1/en active Pending
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20150067009A1 (en) * | 2013-08-30 | 2015-03-05 | Microsoft Corporation | Sparse matrix data structure |
| US20150317334A1 (en) * | 2014-05-05 | 2015-11-05 | Microsoft Corporation | Sparse datatable data structure |
Non-Patent Citations (9)
| Title |
|---|
| JIAN-HAO LUO ET AL: "An Entropy-based Pruning Method for CNN Compression", ARXIV.ORG, CORNELL UNIVERSITY LIBRARY, 201 OLIN LIBRARY CORNELL UNIVERSITY ITHACA, NY 14853, 19 June 2017 (2017-06-19), XP080770746 * |
| KING JAMES ET AL: "Dynamic Sparse-Matrix Allocation on GPUs", 15 June 2016, SAT 2015 18TH INTERNATIONAL CONFERENCE, AUSTIN, TX, USA, SEPTEMBER 24-27, 2015; [LECTURE NOTES IN COMPUTER SCIENCE; LECT.NOTES COMPUTER], SPRINGER, BERLIN, HEIDELBERG, PAGE(S) 61 - 80, ISBN: 978-3-540-74549-5, XP047347427 * |
| MARTIN C CARLISLE ET AL: "Timing neural networks in C and ada", SIGADA ANNUAL INTERNATIONAL CONFERENCE, ACM, 2 PENN PLAZA, SUITE 701 NEW YORK NY 10121-0701 USA, 4 November 2007 (2007-11-04), pages 71 - 74, XP058326082, ISBN: 978-1-59593-876-3, DOI: 10.1145/1315580.1315598 * |
| See also references of WO2019086104A1 * |
| SIMON WIEDEMANN ET AL: "Compact and Computationally Efficient Representation of Deep Neural Networks", ARXIV.ORG, CORNELL UNIVERSITY LIBRARY, 201 OLIN LIBRARY CORNELL UNIVERSITY ITHACA, NY 14853, 27 May 2018 (2018-05-27), XP080997979 * |
| SONG HAN ET AL: "Deep Compression: Compressing Deep Neural Networks with Pruning, Trained Quantization and Huffman Coding", 15 February 2016 (2016-02-15), XP055393078, Retrieved from the Internet <URL:https://arxiv.org/pdf/1510.00149v5.pdf> [retrieved on 20170721] * |
| SONG HAN ET AL: "EIE: efficient inference engine on compressed deep neural network", ACM SIGARCH COMPUTER ARCHITECTURE NEWS, ACM SPECIAL INTEREST GROUP ON COMPUTER ARCHITECTURE, 2 PENN PLAZA, SUITE 701 NEW YORK NY 10121-0701 USA, vol. 44, no. 3, 18 June 2016 (2016-06-18), pages 243 - 254, XP058300624, ISSN: 0163-5964, DOI: 10.1145/3007787.3001163 * |
| WENLIN CHEN ET AL: "Compressing Neural Networks with the Hashing Trick", 19 April 2015 (2015-04-19), XP055396215, Retrieved from the Internet <URL:https://arxiv.org/pdf/1504.04788.pdf> [retrieved on 20230510] * |
| ZHU JINGYANG ET AL: "BHNN: A memory-efficient accelerator for compressing deep neural networks with blocked hashing techniques", 2017 22ND ASIA AND SOUTH PACIFIC DESIGN AUTOMATION CONFERENCE (ASP-DAC), IEEE, 16 January 2017 (2017-01-16), pages 690 - 695, XP033066953, [retrieved on 20170216], DOI: 10.1109/ASPDAC.2017.7858404 * |
Also Published As
| Publication number | Publication date |
|---|---|
| WO2019086104A1 (en) | 2019-05-09 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2019086104A1 (en) | Neural network representation | |
| US12346803B2 (en) | Generating a compressed representation of a neural network with proficient inference speed and power consumption | |
| Liu et al. | Deja vu: Contextual sparsity for efficient llms at inference time | |
| US20240104786A1 (en) | Data compression using integer neural networks | |
| Zhang et al. | Post-training quantization for neural networks with provable guarantees | |
| Liu et al. | Dynamic sparse graph for efficient deep learning | |
| US20140181171A1 (en) | Method and system for fast tensor-vector multiplication | |
| Jain et al. | Low-rank matrix completion using alternating minimization | |
| Bertsekas | Incremental proximal methods for large scale convex optimization | |
| Drémeau et al. | Boltzmann machine and mean-field approximation for structured sparse decompositions | |
| US20160013773A1 (en) | Method and apparatus for fast digital filtering and signal processing | |
| CN115917556A (en) | Improved concept for representation of neural network parameters | |
| US11544542B2 (en) | Computing device and method | |
| KR102615073B1 (en) | Neural hashing for similarity search | |
| EP3115908A1 (en) | Method and apparatus for multimedia content indexing and retrieval based on product quantization | |
| CN110728350A (en) | Quantification for machine learning models | |
| Qu et al. | Budgeted embedding table for recommender systems | |
| Ou et al. | Low rank optimization for efficient deep learning: making a balance between compact architecture and fast training | |
| CN121359146A (en) | Systems and methods for training deep learning models | |
| Lakshmanan et al. | Nonequispaced fast Fourier transform boost for the Sinkhorn algorithm | |
| Huang et al. | Up-nas: Unified proxy for neural architecture search | |
| US20240028665A1 (en) | Apparatus and method for computing a matrix vector product of a certain matrix and a vector | |
| Shu et al. | Syntactic structures and code parameters | |
| Schindler et al. | Towards efficient forward propagation on resource-constrained systems | |
| Subia-Waud et al. | Probabilistic Weight Fixing: Large-scale training of neural network weight uncertainties for quantisation. |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| STAA | Information on the status of an ep patent application or granted ep patent |
Free format text: STATUS: UNKNOWN |
|
| STAA | Information on the status of an ep patent application or granted ep patent |
Free format text: STATUS: THE INTERNATIONAL PUBLICATION HAS BEEN MADE |
|
| PUAI | Public reference made under article 153(3) epc to a published international application that has entered the european phase |
Free format text: ORIGINAL CODE: 0009012 |
|
| STAA | Information on the status of an ep patent application or granted ep patent |
Free format text: STATUS: REQUEST FOR EXAMINATION WAS MADE |
|
| 17P | Request for examination filed |
Effective date: 20200415 |
|
| AK | Designated contracting states |
Kind code of ref document: A1 Designated state(s): AL AT BE BG CH CY CZ DE DK EE ES FI FR GB GR HR HU IE IS IT LI LT LU LV MC MK MT NL NO PL PT RO RS SE SI SK SM TR |
|
| AX | Request for extension of the european patent |
Extension state: BA ME |
|
| DAV | Request for validation of the european patent (deleted) | ||
| DAX | Request for extension of the european patent (deleted) | ||
| RAP3 | Party data changed (applicant data changed or rights of an application transferred) |
Owner name: FRAUNHOFER-GESELLSCHAFT ZUR FOERDERUNG DER ANGEWANDTEN FORSCHUNG E.V. |
|
| REG | Reference to a national code |
Ref country code: DE Ref legal event code: R079 Free format text: PREVIOUS MAIN CLASS: G06N0003080000 Ipc: G06N0003049500 |
|
| PUAG | Search results despatched under rule 164(2) epc together with communication from examining division |
Free format text: ORIGINAL CODE: 0009017 |
|
| STAA | Information on the status of an ep patent application or granted ep patent |
Free format text: STATUS: EXAMINATION IS IN PROGRESS |
|
| 17Q | First examination report despatched |
Effective date: 20230522 |
|
| B565 | Issuance of search results under rule 164(2) epc |
Effective date: 20230522 |
|
| RIC1 | Information provided on ipc code assigned before grant |
Ipc: G06N 3/08 20060101ALN20230516BHEP Ipc: G06N 3/10 20060101ALN20230516BHEP Ipc: G06N 3/0464 20230101ALI20230516BHEP Ipc: G06N 3/045 20230101ALI20230516BHEP Ipc: G06N 3/0495 20230101AFI20230516BHEP |