Computing device, computer system, and computing method

The arithmetic device approximates similarity calculations by quantizing vectors and selectively narrowing down key candidates, addressing high computational costs in neural networks and reducing processing time.

JP7536574B2Active Publication Date: 2024-08-20KIOXIA CORP
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
JP2020155200
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2020-09-16
Publication Date
2024-08-20
Estimated Expiration
2040-09-16

AI Technical Summary

Technical Problem

Existing neural networks face high computational costs, particularly in operations involving large vector matrix products, which can lead to inefficient processing times.

Method used

The implementation of an arithmetic device that approximates similarity calculations by quantizing vectors to low-bit representations and selectively narrows down key candidates based on similarity thresholds, followed by precise calculations on a reduced set of keys.

Benefits of technology

This approach reduces processing time and computational costs by performing approximate similarity calculations efficiently, while maintaining accuracy in neural network operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007536574000006
    Figure 0007536574000006
  • Figure 0007536574000007
    Figure 0007536574000007
  • Figure 0007536574000005
    Figure 0007536574000005
Patent Text Reader

Abstract

To provide a computation device, a computer system, and a computation method, that can accelerate even when performing approximate calculation without thinning-out processing, and can reduce cost for processing time and the like.SOLUTION: A computation device for executing processing that can be deemed as a key search corresponding to a query in a neural network comprises: an approximate similarity calculation section for approximately calculating a similarity between a query vector and each of a plural pieces of key vectors; a selection section for, as a result of the approximate calculation in the approximate similarity calculation section, selecting a key whose similarity is equal to or greater than a threshold; and a calculation section for calculating a similarity between the query and the key selected by the selection section.SELECTED DRAWING: Figure 3
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] SUMMARY OF THE PRESENT EMBODIMENTS Embodiments of the present invention relate to computing devices, computer systems, and methods. [Background technology]

[0002] Traditionally, neural networks that include a process (Attention) that uses the result of a vector-matrix multiplication as a weight to calculate the weighted sum of another matrix have been widely used in natural language processing (NLP). NLP includes multiple processes for processing human language (natural language) by machines. Neural networks that include attention are also being considered for use in the field of image processing. [Prior art documents] [Patent documents]

[0003] [Patent Document 1] JP 2019-212121 A Summary of the Invention [Problem to be solved by the invention]

[0004] An object of the present invention is to provide an arithmetic device, a computer system, and an arithmetic method that can reduce costs such as processing time. [Means for solving the problem]

[0005] The computing device of the embodiment is a neural network Weights used in A computing device for performing operations on Regarding the entered query A first vector; Regarding the weight for the queryThe computing device further comprises a first calculation unit that approximately calculates a similarity between each of a plurality of second vectors. The computing device further comprises a selection unit that selects a plurality of third vectors from the plurality of second vectors, the plurality of third vectors being vectors whose similarity is equal to or greater than a threshold value as a result of the calculation of the similarity by the first calculation unit. The computing device further comprises a second calculation unit that calculates a similarity between the first vector and the plurality of third vectors selected by the selection unit. [Brief description of the drawings]

[0006] [Figure 1] FIG. 1 is a block diagram showing an example of the configuration of a computer system including a computing device according to an embodiment. [Diagram 2] FIG. 2 is a schematic diagram for explaining an example of the configuration of a neural network executed in the computer system of the embodiment. [Diagram 3] FIG. 3 is a functional block diagram illustrating a functional configuration of the computing device according to the embodiment. [Figure 4] FIG. 4 is a flowchart showing the flow of various processes (data processing methods) performed by the computing device of the embodiment. [Diagram 5] FIG. 5 is a diagram illustrating an example of an approximate calculation of a vector matrix product according to the embodiment. [Figure 6] FIG. 6 is a functional block diagram showing a modified example of the functional configuration of the arithmetic device according to the embodiment. [Figure 7] FIG. 7 is a diagram showing a processing example in a neural network of a comparative example. [Figure 8] FIG. 8 is a diagram illustrating an example of an analog multiply-and-accumulate calculator according to an embodiment. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0007] Hereinafter, a computing device, a computer system, and a computing method according to embodiments will be described in detail with reference to the accompanying drawings. Note that the present invention is not limited to these embodiments.

[0008] Fig. 1 is a block diagram showing an example of the configuration of a computer system 1 including a computing device according to an embodiment. As shown in Fig. 1, the computer system 1 receives input data. This input data may be, for example, voice data or text data generated from voice data, or may be image data. The computer system 1 executes various processes on the input data. For example, when the input data is voice data, the computer system 1 executes natural language processing.

[0009] The computer system 1 outputs a signal corresponding to the result of processing the input data, and can display the result of the processing on the display device 80. The display device 80 is a liquid crystal display, an organic EL display, or the like. The display device 80 is electrically connected to the computer system 1 via a cable or wireless communication.

[0010] The computer system 1 includes at least a GPU (Graphic Processing Unit) 10, a CPU (Central Processing Unit) 20, and a memory 70. The GPU 10, the CPU 20, and the memory 70 are communicatively connected via an internal bus.

[0011] In this embodiment, the GPU 10 executes calculations for inference processing using a neural network 100, which is a machine learning device, as described below. The GPU 10 is a processor that performs approximate similarity calculations, as described below. The GPU 10 executes processing on input data while using the memory 70 as a work area. The GPU 10 has the neural network 100, which is a machine learning device, as described below.

[0012] The CPU 20 is a processor that controls the overall operation of the computer system 1. The CPU 20 executes various processes for controlling the GPU 10 and the memory 70. The CPU 20 uses the memory 70 as a work area and controls calculations related to a neural network 100 (described later) executed by the GPU 10.

[0013] The memory 70 functions as a memory device. The memory 70 stores input data input from the outside, data generated by the GPU 10, data generated by the CPU 20, and parameters of the neural network. The data generated by the GPU 10 and the CPU 20 may include intermediate and final results of various calculations. For example, the memory 70 includes at least one selected from DRAM, SRAM, MRAM, NAND flash memory, and resistive memory (e.g., ReRAM, PCM (Phase Change Memory)). A dedicated memory (not shown) for the GPU 10 may be directly connected to the GPU 10.

[0014] The input data may be provided from a storage medium 99. The storage medium 99 is electrically coupled to the computer system 1 by a cable or wireless communication. The storage medium 99 functions as a memory device and may be any of a memory card, a USB memory, an SSD, an HDD, an optical storage medium, and the like.

[0015] FIG. 2 is a schematic diagram for explaining an example of the configuration of the neural network 100 executed in the computer system 1 of the embodiment.

[0016] In the computer system 1, the neural network 100 in Fig. 2 is used as a machine learning device. For example, the neural network 100 includes a multi-layer perceptron (MLP), a convolutional neural network (CNN), or a neural network with an attention mechanism (e.g., Transformer). Here, machine learning is a technology in which a computer learns a large amount of data and automatically constructs an algorithm or model that performs tasks such as classification and prediction.

[0017] The neural network 100 may be a machine learning model that performs any inference. For example, the neural network 100 may be a machine learning model that receives voice data as input and outputs a classification of the voice data, or may be a machine learning model that realizes noise removal and voice recognition of voice data.

[0018] The neural network 100 has an input layer 101, a hidden layer (also called an intermediate layer) 102, and an output layer (also called a fully connected layer) 103.

[0019] The input layer 101 receives input data (or a part of it) from outside the computer system 1. The input layer 101 has a plurality of arithmetic devices (also called neurons or neuron circuits) 118. The arithmetic devices 118 may be dedicated devices, or may be realized by a general-purpose processor executing a program. Hereinafter, the term arithmetic device will be used in the same sense. In the input layer 101, each arithmetic device 118 converts the input data by performing any processing (for example, linear transformation, addition of auxiliary data, etc.), and transmits the converted data to the hidden layer 102.

[0020] The hidden layer 102 (102A, 102B) performs various calculation processes on the data from the input layer 101.

[0021] The hidden layer 102 includes a plurality of arithmetic devices 110 (110A, 110B). In the hidden layer 102, each arithmetic device 110 executes a multiply-and-accumulate operation using a predetermined parameter (e.g., a weighting coefficient) on the supplied data (hereinafter, also referred to as device input data for differentiation). For example, each arithmetic device 110 executes a multiply-and-accumulate operation using mutually different parameters on the supplied data.

[0022] The hidden layer 102 may be layered. In this case, the hidden layer 102 includes at least two layers (a first hidden layer 102A and a second hidden layer 102B).

[0023] Each computing device 110A in the first hidden layer 102A executes a predetermined calculation process on the device input data, which is the processing result of the input layer 101. Each computing device 110A transmits the calculation result to each computing device 110B in the second hidden layer 102B. Each computing device 110B in the second hidden layer 102B executes a predetermined calculation process on the device input data, which is the calculation result of each computing device 110A. Each computing device 110B transmits the calculation result to the output layer 103.

[0024] In this way, when the hidden layer 102 has a hierarchical structure, the inference, learning / training, and classification capabilities of the neural network 100 can be improved. The number of layers in the hidden layer 102 may be three or more, or may be one. One hidden layer may be configured to include any combination of processes such as a product-sum operation process, a pooling process, a normalization process, and an activation process.

[0025] The output layer 103 receives the results of various calculation processes performed by each computing device 110 in the hidden layer 102, and performs various processes.

[0026] The output layer 103 has a plurality of arithmetic devices 119. Each arithmetic device 119 executes a predetermined process on device input data, which is the calculation result from the plurality of arithmetic devices 110B. This allows inference and classification to be performed on the data supplied to the neural network 100 based on the calculation result by the hidden layer 102. Each arithmetic device 119 can store and output the obtained processing result (classification result). The output layer 103 also functions as a buffer and interface for outputting the calculation result of the hidden layer 102 to the outside of the neural network 100.

[0027] Note that the neural network 100 may be provided outside the GPU 10. In other words, the neural network 100 may be realized using not only the GPU 10 but also the CPU 20, memory 70, storage medium 99, and the like within the computer system 1.

[0028] In the computer system 1 of this embodiment, the neural network 100 executes, for example, various types of calculation processing for natural language processing / inference, and various types of calculation processing for machine learning (e.g., deep learning) of natural language processing / inference.

[0029] For example, in computer system 1, based on various calculation processes performed by neural network 100 on voice data, it becomes possible for computer system 1 to infer (recognize) and classify with high accuracy what the voice data is, or for computer system 1 to learn to recognize / classify voice data with high accuracy.

[0030] In this embodiment, the computing devices 110 (110A, 110B) in the neural network 100 include one or more processing circuits, as follows.

[0031] 3 is a functional block diagram showing a functional configuration of the computing device 110 according to the embodiment. As shown in FIG. 3, the computing device 110 includes a query acquisition unit 1101, a key acquisition unit 1102, an approximation calculation unit 1103, a selection unit 1104, and a calculation unit 1105.

[0032] A query acquisition unit 1101 acquires a vector as a query related to the supplied device input data. A key acquisition unit 1102 acquires a matrix as an array of n keys related to the supplied device input data.

[0033] The approximation calculation unit 1103 functions as a first calculation unit and approximately calculates the similarity between a d-dimensional vector (first vector) as a query and each of multiple d-dimensional vectors (a matrix as an array of n keys) which are second vectors.

[0034] As a result of the similarity calculation in the approximation calculation unit 1103, the selection unit 1104 selects a plurality of keys that are vectors (third vectors) whose similarity is equal to or greater than a threshold value from among the plurality of second vectors.

[0035] The calculation unit 1105 functions as a second calculation unit, and calculates the similarity between the query and the k keys selected by the selection unit 1104 .

[0036] Here, Fig. 4 is a flowchart showing the flow of various processes (data processing methods) by the computing device 110 of the embodiment, and Fig. 5 is a diagram showing an example of approximate calculation of vector matrix multiplication of the embodiment. The vector matrix multiplication can be regarded as a process of searching for a key corresponding to a query, with a vector as a query and a matrix as a key array. Note that the key array here is assumed to have n d-dimensional vectors (keys).

[0037] As shown in FIG. 4, the query acquisition unit 1101 acquires a vector as a query related to the supplied device input data (S1).

[0038] Furthermore, the key acquisition unit 1102 acquires a matrix as an arrangement of n keys related to the supplied device input data (S2).

[0039] Next, the approximation calculation unit 1103 approximately calculates the similarity between the vector as the query and the matrix as the key arrangement (S3). That is, the approximation calculation unit 1103 ranks the related keys (similarity). In other words, the approximation calculation unit 1103 approximately calculates the similarity by lowering the precision of either or both of the d-dimensional vector (first vector) and n d-dimensional vectors (multiple second vectors) as the query, and performing an inner product calculation using the lower-precision vector.

[0040] As shown in FIG. 5, first, the approximation calculation unit 1103 calculates a matrix (n, d) as an array of n d-dimensional vectors (keys) using a d-dimensional vector (1, d) as a query. T A vector matrix product, which is the similarity, is obtained by performing an approximate inner product between each of the queries and the keys. At this time, the approximation calculation unit 1103 performs the approximation by quantizing the query and the key to low bits. Quantizing to low bits means, for example, converting a query or a key that was originally expressed in a single-precision floating-point format into a format that can be processed quickly at low bits, such as an 8-bit integer or a 4-bit integer. In order to perform such an approximation, the vector matrix product obtained here is an approximately calculated weight (1, n).

[0041] Next, as shown in Fig. 4, the selection unit 1104 selects k keys whose similarity is greater than or equal to a threshold (S4). In other words, as shown in Fig. 5, the selection unit 1104 selects a small number (here, k) of columns whose inner product value is greater than or equal to a threshold for the approximately calculated weight (1, n), and selects them as (k, d). T Let us assume that.

[0042] This threshold value may be a predetermined value, or may be determined according to the value of the inner product so that the number of columns to be selected becomes a predetermined number k.

[0043] Next, as shown in Fig. 4, the calculation unit 1105 calculates the similarity for k keys (S5). As shown in Fig. 5, the calculation unit 1105 calculates the similarity for the original matrix (n, d) T A small matrix (k,d) with selected columns from T For k, we calculate the vector-matrix product with the d-dimensional vector (1,d) as the query. The vector-matrix product obtained here is the weight (1,k).

[0044] The results of the vector-matrix multiplication thus calculated are used as weights for taking the weighted sum.

[0045] As described above, one of the features of the arithmetic device 110 of this embodiment is that the d-dimensional vector (key) that is selected changes depending on the d-dimensional vector (1, d) as the query.

[0046] Note that the k keys selected by the selection unit 1104 and used by the calculation unit 1105 are not limited to being a part of the n key data present in the approximation calculation unit 1103. FIG. 6 is a modified functional block diagram showing the functional configuration of the arithmetic device 110 of the embodiment. As shown in FIG. 6, key data corresponding to the n keys is stored in the memory 70 or storage medium 99 functioning as a key storage unit (storage unit). At this time, the key data is stored in association with an index capable of identifying the n keys. The selection unit 1104 may select k indexes indicating a string in which the similarity is greater than or equal to a threshold, and the calculation unit 1105 may read and use the key data corresponding to the selected k indexes from the memory 70 or storage medium 99 functioning as a key storage unit.

[0047] Fig. 7 is a diagram showing a processing example in a neural network of a comparative example. As shown in Fig. 7, the neural network of the comparative example includes a process (attention mechanism) of calculating a weighted sum of another matrix using the result of vector matrix multiplication as a weight. As shown in Fig. 7, the neural network of the comparative example has a problem that the amount of calculation of vector matrix multiplication: d × (d, n) becomes very large, especially when n is large.

[0048] However, in the neural network of the comparative example, the distribution of the results of the vector-matrix product used as the weights for calculating the weighted sum is often biased and as a result, many of them are negligible (the weights are almost 0).

[0049] Therefore, in this embodiment, in a neural network including a process that can be regarded as a key search corresponding to a vector as a query, first, a key search calculation is performed approximately to narrow down the candidates, and then, the key search calculation is performed again for the small number of narrowed down keys. This allows the calculation to be performed roughly approximately, so that the approximate calculation can be performed at high speed without thinning out, thereby reducing costs such as processing time.

[0050] In this embodiment, the ranking of the related keys (similarity) is calculated by the approximate inner product, but the present invention is not limited to this and a calculation method other than the inner product may be used. For example, the ranking of the related keys (similarity) may be calculated by using cosine similarity, Hamming distance, or the like.

[0051] In addition, in this embodiment, the GPU 10 is used as a dedicated processor for performing approximate similarity calculation, but the present invention is not limited to this, and the CPU 20 may perform approximate similarity calculation. In this case, the CPU 20 realizes a calculation device. As an approximation method, a method of quantizing the query and the key to low bits is shown, but other approximation methods may be used. For example, if the inner product calculation can be accelerated by approximation such as treating the inner values ​​of each element of the query or key vector that are smaller than a predetermined value as 0, such approximation can also be effective. In addition, an analog multiply-accumulate calculator using a resistance-change memory or the like may be used to perform approximate similarity calculation. In this case, the analog multiply-accumulate calculator using the resistance-change memory realizes the calculation device.

[0052] An example of an analog multiply-accumulate calculator is shown in FIG. 8. The analog multiply-accumulate calculator is composed of, for example, multiple horizontal (row) wirings WL, multiple vertical (column) wirings BL, and resistor elements whose terminals are connected to the WL and BL at their intersections. FIG. 8 shows three rows from row i-1 to row i+1 and three columns from row j-1 to row j+1, but this shows only a part of, for example, d rows and n columns. Here, d and n are integers of 2 or more, i is an integer of 1 to d-2, and j is an integer of 1 to n-2. When an input voltage is applied to each WL, a current is generated according to the voltage value and the resistance value of the resistor element, and a current flows through each BL. The currents generated on the same BL are added together to become the output y. As a result, the voltage value applied to each row of d rows is expressed as a d-dimensional vector, and the inverse (conductance) of the resistance value of the resistor element in row d and column n is expressed as (n,d). T When the matrix is ​​set to the above, a process corresponding to vector-matrix multiplication is executed.

[0053] The arithmetic device of this embodiment, a computer system including the arithmetic device of this embodiment, and a storage medium that stores the arithmetic method of this embodiment can be applied to smartphones, mobile phones, personal computers, digital cameras, in-vehicle cameras, surveillance cameras, security systems, AI equipment, system libraries (databases), and artificial satellites, etc.

[0054] In the above description, an example is shown in which the arithmetic device, computer system, and arithmetic method of the present embodiment are applied to a neural network in a computer system 1 related to natural language processing that processes human language (natural language) mechanically. However, the arithmetic device and arithmetic method of the present embodiment are applicable to various computer systems including a neural network, and various data processing methods that execute calculation processing by a neural network.

[0055] Although some embodiments of the present invention have been described, these embodiments are presented as examples and are not intended to limit the scope of the invention. These novel embodiments can be implemented in various other forms, and various omissions, substitutions, and modifications can be made without departing from the spirit of the invention. These embodiments and their modifications are included in the scope and spirit of the invention, and are included in the scope of the invention and its equivalents described in the claims. [Explanation of symbols]

[0056] 1. Computer System 70 Memory device, storage unit 99 Memory devices, storage units 100 Neural Networks 110 Computing Devices 1103 1st calculation section 1104 Selection section 1105 2nd calculation section

Claims

1. A computing device for performing computations on weights used in a neural network, comprising: a first calculation unit that approximately calculates a similarity between a first vector related to an input query and each of a plurality of second vectors related to weights for the query; a selection unit that selects a plurality of third vectors from among the plurality of second vectors as a result of the calculation of the similarity by the first calculation unit, the third vectors being vectors whose similarity is equal to or greater than a threshold value; a second calculation unit that calculates a similarity between the first vector and a plurality of third vectors selected by the selection unit; A computing device comprising:

2. the first calculation unit reduces the precision of one or both of the first vector and the plurality of second vectors, and approximately calculates the similarity by performing an inner product calculation using the reduced precision vector; The computing device of claim 1 .

3. the first calculation unit approximately calculates the similarity by using an analog product-sum calculator that applies a voltage to a resistive element to generate a current according to a resistance value and a voltage value, and performs a product-sum calculation by adding up the currents; The computing device of claim 1 .

4. A storage unit for storing data of the plurality of second vectors is further provided, the selection unit selects a plurality of the third vectors whose similarity is equal to or greater than a threshold value, and reads out data corresponding to the selected plurality of the third vectors from among the stored data of the plurality of the second vectors, from the storage unit; the second calculation unit calculates a similarity between data corresponding to the first vector and data corresponding to the read third vector; A computing device according to any one of claims 1 to 3.

5. A computing device according to any one of claims 1 to 4, A memory device that stores data to be operated by the arithmetic device; A computer system comprising:

6. 1. A method of computing in a computing device for performing computations on weights used in a neural network, comprising: approximating a similarity between a first vector related to an input query and each of a plurality of second vectors related to weights for the query; selecting a plurality of third vectors from among the plurality of second vectors as a result of the calculation of the similarity, the plurality of third vectors being vectors whose similarity is equal to or greater than a threshold value; calculating a similarity between the first vector and the selected third vectors; A calculation method including:

7. The calculating step includes approximately calculating the similarity by reducing the precision of either or both of the first vector and the plurality of second vectors and performing an inner product calculation using the reduced precision vector. The calculation method according to claim 6.

Citation Information

Patent Citations

  • Retrieval device and semiconductor device

    JP2018010505A

  • Retrieval program, retrieval method and information processing apparatus operating retrieval program

    JP2019045894A

  • Machine learning system

    JP2019212121A

  • Neural network circuit

    JP2020009112A

  • Attention-based sequence-to-sequence neural network

    JP2020506466A