US20200302288A1 - Using output equalization in training an artificial intelligence model in a semiconductor solution - Google Patents
Using output equalization in training an artificial intelligence model in a semiconductor solution Download PDFInfo
- Publication number
- US20200302288A1 US20200302288A1 US16/586,432 US201916586432A US2020302288A1 US 20200302288 A1 US20200302288 A1 US 20200302288A1 US 201916586432 A US201916586432 A US 201916586432A US 2020302288 A1 US2020302288 A1 US 2020302288A1
- Authority
- US
- United States
- Prior art keywords
- weights
- cnn model
- output
- chip
- convolution layer
- 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.)
- Abandoned
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/06—Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
- G06N3/063—Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N20/00—Machine learning
- G06N20/10—Machine learning using kernel methods, e.g. support vector machines [SVM]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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; CALCULATING OR 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/048—Activation functions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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/084—Backpropagation, e.g. using gradient descent
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/04—Inference or reasoning models
- G06N5/046—Forward inferencing; Production systems
Definitions
- This patent document relates generally to systems and methods for providing artificial intelligence solutions. Examples of training a convolution neural network model for uploading to an artificial intelligence semiconductor are provided.
- AI semiconductor solutions include using embedded hardware in an AI integrated circuit (IC) to perform NI tasks.
- CNN convolutional neural network
- the weights of a CNN model are trained outside the chip, they are usually stored in floating point.
- the weights of a CNN model in floating point are loaded into an AI chip they usually lose data bits from quantization, for example, from 16- or 32-bits to 1- to 8-bits.
- the loss of data bits in an AI chip compromises the performance of the AI chip due to lost information and data precision.
- existing training methods are often performed in a high performance computing environment, such as on a desktop, without accounting for the hardware constraints in a physical AI chip. This often causes performance degradation when a trained AI model is loaded into an AI chip.
- FIG. 1 illustrates an example training system in accordance with various examples described herein.
- FIG. 2 illustrates a flow diagram of an example process of training that may be implemented in a convolution quantization unit in accordance with various examples described herein.
- FIG. 3 illustrates an example of mask values in a 3-bit configuration in accordance with various examples described herein.
- FIG. 4 illustrates a flow diagram of an example process of training that may be implemented in an activation quantization unit in accordance with various examples described herein.
- FIG. 5 illustrates a diagram of an example convolution neural network in an AI chip in accordance with various examples described herein.
- FIG. 6A illustrates a flow diagram of an example process of training an AI model for executing in an AI chip in accordance with various examples described herein.
- FIG. 6B illustrates an example distribution of output values of an AI model in accordance with various examples described herein.
- FIG. 7 illustrates a flow diagram of an example process of training that may be implemented in a chip customization unit in accordance with various examples described herein.
- FIG. 8 illustrates a flow diagram of an example process of fine tuning in accordance with various examples described herein.
- FIG. 9 illustrates various embodiments of one or more electronic devices for implementing the various methods and processes described herein.
- AI logic circuit includes a logic circuit that is configured to execute certain AI functions such as a neural network in AI or machine learning tasks.
- An AI logic circuit can be a processor.
- An AI logic circuit can also be a logic circuit that is controlled by an external processor and executes certain AI functions.
- integrated circuit semiconductor chip
- chip semiconductor device
- integrated circuits include integrated circuits (ICs) that contain electronic circuits on semiconductor materials, such as silicon, for performing certain functions.
- ICs integrated circuits
- an integrated circuit can be a microprocessor, a memory, a programmable array logic (PAL) device, are application-specific integrated circuit (ASIC), or others
- ASIC application-specific integrated circuit
- An AI integrated circuit may include an integrated circuit that contains an AI logic circuit.
- AI chip examples include hardware- or software-based device that is capable of performing functions of an AI logic circuit.
- An AI chip may be a physical IC.
- a physical AI chip may include a CNN, which may contain weights and/or parameters.
- the AI chip may also be a virtual chip, i.e., software-based.
- a virtual AI chip may include one or more processor simulators to implement functions of a desired AI logic circuit.
- AI model examples include data containing one or more parameters that, when loaded inside an AI chip, are used for executing the AI chip.
- an AI model for a given CNN may include the weights, biases, and other parameters for one or more convolutional layers of the CNN.
- the weights and parameters of an AI model are interchangeable.
- FIG. 1 illustrates an example training system in accordance with various examples described herein.
- a training system 100 may include a training network 101 to train an AI model.
- the system 100 may upload the AI model 112 to an AI chip in an AI system 114 .
- an AI model may include a convolutional neural network (CNN) that is trained to perform AI tasks, e.g., voice or image recognition tasks.
- a CNN may include multiple convolutional layers, each of which may include multiple parameters, such as weights and/or other parameters.
- an AI model may include parameters of the CNN model.
- a CNN model may include weights, such as a mask and a scalar for a given layer of the CNN model.
- a kernel in a CNN layer may be represented by a mask that has multiple values in lower precision multiplied by a scalar in higher precision.
- a CNN model may include other parameters.
- a CNN layer may include one or more bias values that, when added to the output of the output channel, adjust the output values to a desired range.
- each cell may be a signed 2 or 8 bit integer.
- a kernel may contain data with non-binary values, such as 7-value. Other bit length or values may also be possible.
- the scalar may include a value having a bit width, such as 12-bit or 16-bit. Other bit length may also be possible.
- the bias b may contain a value having multiple bits, such as 18 bits. Other bit length or values may also be possible.
- the output Y may be further discretized into a signed 5-bit or 10-bit integer. Other bit length or values may also be possible.
- the AI chip in the AI system 114 may include an embedded cellular neural network that has memory containing the multiple parameters in the CNN.
- the memory in an AI chip may be a one-time-programmable (OTP) memory that allows a user to load a CNN model into the physical AI chip once.
- the AI chip may have a random access memory (RAM), magneto-resistive random access memory (MRAM), other types of memory that allows a user to update and load a CNN model into the physical AI chip multiple times.
- the AI chip may include convolutional, Pooling, and ReLU layers in a CNN model. In such case, the AI chip may perform all computations in an AI task.
- the AI chip may include a subset of the convolutional, Pooling, and ReLU layers in a CNN model. In such case, the AI chip may perform certain computations in an AI task, leaving the remaining, computations in the AI task performed in a CPU/GPU or other host processors outside the AI chip.
- the training network 101 may be configured to include, a forward propagation neural network, in which information may flow from the input layer to one or more hidden layers of the network to the output layer.
- An AI training system may also be configured to include a backward propagation network to update the weights of the AI model based on the output of the AI chip.
- an AI training system may include a combination of forward and backward propagation networks.
- training data 102 may be provided for use in training the AI model 112 .
- training data 102 may be used for training an AI model that is suitable for face recognition tasks, and the training data may contain any suitable dataset collected for performing face recognition tasks.
- the training data may be used for training an AI model suitable for scene recognition in video and images, and thus the training data may contain any suitable scene dataset collected for performing scene recognition tasks.
- training data may reside in a memory in a host device. In one or more other scenarios, training data may reside in a central data repository and is available for access the training network 101 via the communication network 103 .
- an AI model may be trained by using one or more devices to implement one or more training units 104 - 110 as shown in FIG. 1 . Details are further described with reference to FIGS. 1-9 .
- the training network 101 may include a floating-point model training unit 104 , which may be configured to train an AI model, e.g., a CNN model using one or more sets of training data 102 .
- the floating-point model training unit may be implemented on a desktop computer (CPU, and/or GPU) in floating point, in which one or more weights of the CNN model are in floating point. Any known or later developed methods may be used to train a CNN model.
- the training system 400 may further include one or more units to convert the floating-point model to a hardware-supported model, as further illustrated in FIG. 1 .
- the training system 100 may include a convolution quantization unit 106 and/or activation quantization unit 108 , each of which may be configured to update the weights of a CNN model to adapt to an AI chip.
- the convolution quantization unit 106 may convert the trained weights in floating-point to weights in fixed-point so that the weights can be supported by the AI chip.
- the activation quantization unit 108 may further update the weights of the CNN so that the CNN output values based on the updated weights are also supported by the AI chip.
- the order of the convolution quantization unit 106 and the activation quantization unit 108 may not matter.
- the activation quantization unit 108 may access the training weights (e.g., from the floating-point model training unit 104 ) in floating-point and generate updated weights in fixed-point.
- the convolution quantization unit 106 may access the updated weights in fixed-point from the activation quantization unit 108 and further update the weights to those the can be supported by the AI chip.
- the updated weights from the convolution quantization unit 106 and/or the activation quantization unit 108 may be in fixed-point and have the bit-width, equal to that supported by the AI chip, such as 1-bit, 2-bit, 5-bit, 8-bit etc.
- the output values that are generated by the AI model based on the updated weights from the convolution quantization unit 106 and/or the activation quantization unit 108 may also result in fixed-point values and have the bit-width equal to that supported by activation layers in the AI chip, such as 5-bit, or 10-bit.
- the training network 101 may include a chip customization unit 110 which may be configured to further update the weights of the AI model to maximize the resources supported by the hardware AI chip.
- the chip customization unit 110 may be configured to perform batch normalization merge, image mean merge, scalar mean merge, and/or a combination thereof, which are described in the present disclosure.
- the chip customization unit 110 may further train the weights in a manner that mimics the characteristics of the hardware in the AI chip.
- the training may include shift-based quantization which may mimic the features of the hardware.
- the one or more units in the training network 101 may be serially coupled in that the output of one unit is fed to the input of another unit.
- the one or more units may be coupled in the order of 104 , 108 , 106 and 110 , where 104 receives the training data and produces a floating-point AI model, where each of the units 105 , 108 and 110 further converts or updates the weights of the AI model and unit 110 produces the final AI model 112 uploadable to an AI chip for executing an AI task.
- the one or more units may be coupled in the order of 104 , 106 , 108 and 110 .
- a lesser of 104 , 106 , 108 and 110 may be serially coupled.
- boxes 104 , 106 and 110 , or boxes 104 , 108 and 110 may be respectively serially coupled to train and update the weights of the AI model and generate the final AI model 112 .
- the AI system 114 may be coupled to one or more sensors 116 .
- the sensor(s) 116 may be configured to capture various types of data, such as image, video, audio, text, or any information in various media formats.
- the AI system 114 may be executed to implement an AI task in the AI chip based on the captured sensor data from sensor(s) 116 , and generate AI task output 118 .
- the AI chip in the AI system 114 may contain an AI model for performing certain AI tasks. Executing an AI chip or an AI model may include causing the AI chip to perform an AI task based on the AI model inside the AI chip and generate an output.
- Examples of an AI task may include image recognition, voice recognition, object recognition, data processing and analyzing, or any recognition, classification, processing tasks that employ artificial intelligence technologies.
- An example of an AI system such as a camera having a built-in AI chip, is described in the present disclosure. Now, each of the units in the training network 101 is further described in detail with reference to FIGS. 2-9 .
- FIG. 2 illustrates a diagram of an example process of training that may be implemented in a convolution quantization unit, such as 106 in FIG. 1 , in accordance with various examples described herein.
- a process 200 may include accessing training weights of an AI model at 202 .
- the AI model may be trained in the floating-point model training unit ( 104 in FIG. 1 ) and include weights in floating-point.
- the trained weights may be the weights of a CNN model and may be stored in floating point.
- the weights may be stored in 32-bit or 16-bit.
- the process 200 may further include quantizing the trained weights at 204 , determining output of the AI model based on the quantized weights at 206 , determining a change of weights at 208 and updating the weights at 210 .
- the quantized weights may correspond to the limit of the hardware, such as the physical AI chip.
- the number of quantization levels may correspond to the hardware constraint of the AI chip so that the quantized weights can be uploaded to the AI chip for execution.
- the AI chip may include a CNN model.
- the weights may include 1-bit (binary value), 2-bit, 3-bit, 5-bit or other suitable bits, such as 8-bit.
- the structure of the CNN may correspond to that of the hardware in the AI chip.
- the number of quantization levels will be two.
- quantizing the weights to 1-bit may include determining a threshold to properly separate the weights into two groups: one below the threshold and one above the threshold, where each group takes one value, such as ⁇ 1, ⁇ 1 ⁇ .
- quantizing the weights at 204 may include a dynamic fixed point conversion.
- the quantized weights may be determined by:
- nbit is the bit-size of the weights in the physical AI chip.
- nbit may be 8-bit, 12-bit etc. Other values may be possible.
- quantizing the weights at 204 may include determining the quantized weights based on the interval in which the values of the weights fall, where the interval is defined depending on the value of nbit.
- the weights of a CNN model rimy be quantized into two quantization levels.
- the weight values may be divided into two intervals. For example, the first interval is [0, ⁇ ), and the second interval ( ⁇ , 0).
- the intervals may be defined by ( ⁇ , ⁇ W mean /4), [ ⁇ W mean /4, W mean /4] and (W mean /4, ⁇ ).
- the weights may be quantized into:
- W Q ( W mean ) shift-quantized , when W k ⁇ W mean /4;
- W Q ⁇ ( W mean ) shift-quantized , when W k ⁇ W mean /4.
- W max may be used instead of W mean .
- Denominators other than the values of 4 may also be used.
- the intervals may be defined, as shown in FIG. 3 .
- W′ mean W mean /4.
- the weights may be quantized into:
- W Q ( W′ mean ) shift-quantized , when 3 W′ mean 2 ⁇ 3 W′ mean /2;
- W Q (2 W′ mean ) shift-quantized , when 3 W′ mean /2 ⁇ W k ⁇ 3 W′ mean ;
- W Q (4 W′ mean ) shift-quantized , when W k >3 W′ mean ;
- W Q ⁇ ( W′ mean ) shift-quantized , when ⁇ 3 W′ mean /2 ⁇ W k ⁇ W′ mean /2;
- W Q ⁇ (2 W′ mean ) shift-quantized , when ⁇ 3 W′ mean ⁇ W k ⁇ 3 W′ mean /2;
- W Q ⁇ ( W′ mean ) shift-quantized , when W k ⁇ 3 W′ mean ;
- W max may be used instead of W mean .
- Denominators other than the values of 4 to 2 may also be used.
- a mask may include a k ⁇ k kernel and each value in the mask may have a bit-width, such as 1-bit, 2-bit, 3-bit, 5-bit, 8-bit or other bit sizes.
- the process 200 may further include determining a change of weights at 208 based on the output of the CNN model.
- the output of the CNN model may be the output of the activation layer of the CNN.
- the process 200 may further update the weights of the CNN model at 210 based on the change of weights.
- the process 200 may be implemented in a forward propagation and backward propagation framework.
- the process 200 may perform operation 206 in a layer by layer fashion in a forward propagation, in which the inference of the AI model is propagated from the first convolution layer to the last convolution layer in a CNN (or a subset of the convolution layers in the CNN).
- the output inferred from the first layer will be fed to the second layer, the output inferred from the second layer will be fed to the third layer, so on and so forth until the output of the last layer is inferred.
- the operations 208 and 210 may be performed in a layer by layer fashion in a backward propagation, in which a change of weights is determined for each layer in a CNN from the last year to the first layer tor a subset of the convolution layers in the CNN), and the weights in each layer are updated based on the change of weights.
- a loss function may be determined based on the output of the CNN model (e.g., the output of the last convolution layer of the CNN), and the changes of weights may be determined based on the loss function. This is further explained.
- the process 200 may repeat updating the weights of the CNN model in one or more iterations.
- blocks 206 , 208 , 210 may be implemented using a gradient descent method, in which a suitable loss function may be used.
- a loss function may be defined as:
- y i is the prediction of the network, e.g., the output of the CNN based on the ith training instance.
- the CNN output includes two image labels (e.g., dog or cat)
- y i may have the value of 0 or 1.
- N is the number of training instances in the training data set.
- the probability p(y i ) of a training instance being y i and may be determined from the training.
- the loss function h( ) may be defined based on a sum of loss values over a plurality of training instances in the training data set, wherein the loss value of each of the plurality of training instances is a difference between an output of the CNN model for the training instance and a ground truth of the training instance.
- the training data 209 may include a plurality of training input images.
- the ground truth data may include information about one or more objects in the image, or about whether the image contains a class of objects, such as a cat, a dog, a human face, or a given person's face.
- Inferring the AI model may include generating a recognition result indicating which class to which the input image belongs.
- the loss function may be determined based on the image labels in the ground truth and the recognition result generated from the AI chip based on the training input image.
- the gradient descent may be used to determine a change of weight
- the weights (or updated weights) in each iteration such as W t and W t+1 may be stored in floating point.
- the quantized weights W Q t at each iteration t may be stored in fixed point.
- the gradient descent may include known methods, such as stochastic gradient descent method.
- the process 200 may further include repeating blocks 204 , 206 , 208 , 210 iteratively, in one or more iterations, until a stopping criteria is net at 214 .
- the process may perform operations 204 , 206 , 208 , 210 in forward and backward propagations as disclosed in the present disclosure.
- the process 200 may determine the output of the CNN at 206 by inference in a layer by layer fashion in a forward propagation.
- the process 200 may also determine the change of weights at 208 and update the weights at 210 in a layer by layer fashion in a backward propagation.
- the process 200 may use a batch of training images selected from the training data 209 .
- the batch size may vary, For example, the batch size may have a value of 32, 64, 128, or other number of images.
- the process 200 may determine whether a stopping criteria has been met at 214 . If the stopping criteria has been met, the process may store the updated weights of the CNN model at the current iteration at 216 for use by another unit (e.g., a unit in 101 in FIG. 1 ). If the stopping criteria has not been met, the process 200 may repeat blocks 204 , 206 , 208 , 210 in a new iteration. In determining whether a stopping criteria has been met, the process 200 may count the number of iterations and determine whether the number of iterations has exceeded a maximum iteration number. For example, the maximum iteration may be set to a suitable number, such as 100, 200, or 1000, or 10,000, or an empirical number.
- determining whether a stopping criteria has been met may also determine whether the value of the loss function at the current iteration is greater than the value of the loss function at a preceding iteration. If the value of the loss function increases, the process 200 may determine that the iterations are diverting and determine to stop the iterations. Alternatively, and/or additionally, if the iterations are diverting, the process 200 may adjust the gradient descent hyper-parameters, such as learning rate, batch size, gradient decent updating mechanism, etc. In some examples, if the value of the loss function does not decrease over a number of iterations, the process 200 may also determine that the stopping criteria is met.
- the process 200 may be implemented entirely on a desktop using a CPU or a GPU.
- certain operations in the process 200 may be implemented in a physical AI chip, where the trained weights or updated weights are uploaded inside the AI chip.
- FIG. 4 illustrates a diagram of an example process of training that may be implemented in an activation quantization unit, such as 108 (in FIG. 1 ) in accordance with various examples described herein.
- a training process 400 may perform operations in one or more iterations to train and update the weights of a CNN model, where the trained weights may be output in fixed point, which is suitable for an AI chip, to execute.
- the process 400 may include accessing trained weights of an AI model at 402 .
- the AI model may include quantized weights from the process 200 ( FIG. 2 ), where the quantized weights are stored in fixed point (at 216 in FIG. 2 ).
- the AI model may be trained in the floating-point model training unit ( 104 in FIG.
- the trained weights may be the weights of a CNN model.
- the process 400 may further include determining output of the AI model based on the weights at 408 . If the weights of the CNN are in fixed point, such as determined from the convolution quantization unit 106 in FIG. 1 , the operation of determining the output of the CNN may be performed in fixed point. If the weights of the CNN are in floating point, such as trained from the floating-point model training unit ( 104 in FIG. 1 ), the operation of determining the output of the CNN may be performed in floating point. Determining the output of the AI model at 408 may include inferring the AI model using the training data 409 and the weights obtained from box 402 .
- determining the output of the CNN model at 408 may be performed on a CPU or GPU processor outside the AI chip. In some or other scenarios, determining the output of the CNN model may also, be performed directly on an AI chip, where the AI chip may be a physical chip or a virtual AI chip, and executed to produce output. If the weights are in fixed-point and supported by a physical AI chip, the weights may be uploaded into the AI chip. In that case, the process 400 may load quantized weights into the AI chip for execution of the AI model.
- the training data 409 may be similar to the training data 209 in FIG. 2 .
- the process 400 may further include quantizing the output of the CNN at 406 .
- quantizing the output of the CNN may include quantizing at least one activation layer.
- an activation layer in an AI chip may include a rectified linear unit (ReLU) of a CNN. The quantization of the activation layer may be based on the hardware constraints of the AI chip so that the quantized output of the activation layer can mimic the characterization of the physical AI chip.
- FIG. 5 illustrates, a diagram of an example CNN in an AI chip in accordance with various examples described herein.
- a CNN 500 in an AI chip may include one, or more convolution layers, e.g., 502 , 504 , 506 . . .
- these convolution layers may include weights stored in fixed point or floating-point. Each of the convolution layers may produce the output in fixed point.
- a convolution layer may also include an activation layer (e.g., ReLU layer), which may also include fix point values.
- FIG. 6A illustrates a diagram of an example process of training an AI model for executing in an AI chip in accordance with various examples described herein.
- a process 600 may quantize the output of one or more convolution layers in a CNN during the training process.
- the one or more convolution layers in the CNN model may correspond to one or more convolution layers in the AI chip in FIG. 5 .
- the trained CNN model may be expected to achieve a performance in an AI chip close to that achieved in a CPU/GPU during the training.
- the quantization effect over the CNN model during the training may mimic that of the AI chip so that performance of the CNN model during the training may accurately reflect the anticipated performance of the physical AI chip when the trained CNN model is uploaded and executed in the AI chip.
- the, process 600 may include accessing the input of a first convolution layer at 602 and determining the output of the first convolution layer at 604 .
- the first convolution layer may be any of the convolution layers in a CNN model that corresponds to a convolution layer, e.g. 502 , 504 , 506 . . . in an AI chip.
- the output of the convolution may be stored in floating point.
- Accessing the input of the first convolution layer at 602 may include assessing the input data, if the first convolution layer is the first layer after the input in the CNN, or assessing the output of the preceding layer, if the first convolution layer is an intermediate layer.
- Determining the output of the first convolution layer at 604 may include executing a CNN model to produce an output at the first convolution layer, in a training process, determining the output of the convolution layer may be performed outside of a chip, e.g., in a CPU/GPU environment. Alternatively, determining the output of the convolution layer may be performed in an AI chip.
- the process 600 may further quantize the output of the first convolution layer at 606 .
- the method of quantizing the output of the convolution layer may mimic the configuration of an AI chip such as the number of bits and the quantization behavior of a convolution layer in an AI chip.
- the quantized output of the CNN model may be stored in fixed point in the same bit-length of the activation layer of the corresponding convolution layer in the AI chip.
- the output of each convolution layer in an AI chip may have 5 bits (in hardware), where the output values range from 0 to 31.
- the process 600 may determine a range for quantization based on the bit-width of the output of each convolution layer of the AI chip.
- the range for quantization may be 0-31, which corresponds to 5-bits in the hardware configuration.
- the process 600 may perform a clipping over the output of a convolution layer in the CNN model, which sets a value beyond a range to a closest minimum or maximum of the range.
- FIG. 6B illustrates an example of distribution for layout output values of an AI model.
- the layer output values from multiple runs of the AI chip over multiple instances of a training set are all greater than zero.
- a clipping was done at the maximum value y i ⁇ , where i stands for the ith convolution layer.
- the process may set the value to the maximum value: 31.
- a value of [0, ⁇ ] may be represented by a maximum number of bits in the activation layer, e.g., 5-bit, 10-bit, or other values. If a weight is in the range of [0, ⁇ ], then the quantization becomes a linear transformation. If a weight has a value of less than zero or a value of greater than ⁇ , then the quantization clips the weight at zero or ⁇ , respectively.
- the quantization of activation layer limns the value of the output to the same limit in the hardware. In a non-limiting example, if the bit-width of an activation layer in an AI chip is 5 bits, then [0, ⁇ ] may be represented by 5 bits. Accordingly, the quantized value will be represented by 5 bits.
- the process 600 may further repeat similar operations for a second convolution layer.
- the process 600 may access input of the second convolution layer at 608 , determine the output of the second convolution layer at 610 , and quantize the output of the second convolution layer at 612 .
- the second convolution layer may correspond to a convolution layer in the AI chip, such as 504 , or 506 in FIG. 5 .
- the process may take the output of the preceding layer.
- accessing the input of the second layer may include accessing the output values of the first layer (e.g., 502 ). If the values of the output of the first layer are quantized, then accessing the input of the second layer includes accessing the quantized output of the first layer.
- Blocks 610 and 612 may perform in a similar fashion as blocks 604 and 606 . Further, the process 600 may repeat blocks 608 - 612 for one Of more additional layers at 614 . In some examples, the process 600 may quantize the output for all convolution layers in a CNN in a layer-by-layer fashion. In some examples, the process 600 may quantize the output of some convolution layers in a CNN model. For example, the process 600 may quantize the output of one or more last few convolution layers in the CNN.
- the process 400 may further include determining a change of weights at 408 and updating the weights at 410 .
- the process 400 may further repeat the processes 404 , 406 , 408 , 410 until a stopping criteria is met at 414 .
- Determining the change of weights at 408 and updating the weights at 410 may include a similar training process as in FIG. 2 .
- the process 400 may include determining a change of weights at 408 based on the output of the CNN model.
- the output of the CNN model may be the output of the activation layer of the CNN.
- the process 400 may further update the weights of the CNN model at 410 based on the change of weights.
- the process may repeat updating the weights of the CNN model in one or more iterations. Similar to FIG. 2 , in each iteration, the process 400 may also be implemented in forward and background propagations in a layer by layer manner. In some examples, blocks 404 , 406 , 408 , 410 may be implemented using a gradient descent method. The gradient descent method may perform in a similar fashion as described in FIG. 2 . For example, a loss function may be defined as:
- y i is the prediction of the network, e.g., the output of the CNN based on the ith training instance.
- the CNN output includes two image labels (e.g., dog or cat)
- y i may have the value of 0 or 1.
- N is the number of training instances in the training data set.
- the probability p(y i ) of a training instance being y i and may be determined from the training.
- the loss function H( ) may be defined based on a sum of loss values over a plurality of training instances in the training data set, wherein the loss value of each of the plurality of training instances is a difference between an output of the CNN model for the training instance and a ground truth of the training instance.
- the gradient descent may be used to determine a change of weights
- the weights (or updated weights) in each iteration such as W t and W t+1 , may be stored in floating point.
- the quantized weights W Q t at each iteration t may be stored in fixed point.
- the gradient descent may include known methods, such as a stochastic gradient descent method.
- the process 400 may store the updated weights at 416 for use by another unit (e.g., a unit in 101 in FIG. 1 ).
- the process 400 may be implemented entirely on a desktop using a CPU or a GPU.
- certain operations in the process 400 may be implemented in a physical AI chip, where the trained weights or updated weights are uploaded inside the AI chip.
- FIG. 7 illustrates a diagram of an example process of training that may be implemented in a chip customization unit, such as 110 (in FIG. 1 ) in accordance with various examples described herein.
- a process 700 may include accessing trained weights at 702 .
- the trained weights may be determined from processes 200 or 400 (in FIGS. 2 or 4 , respectively).
- the process 700 may further including one or more linear transformations, such as performing batch normalization merge at 704 , performing image mean merge at 706 , performing image scale merge at 708 , performing output equalization at 710 , and/or performing a combination thereof.
- a hatch normalization may be expressed as:
- ⁇ and ⁇ may be learned from the training process. Accordingly, the weights and biases may be updated based on:
- the weights and biases may be updated per convolution layer.
- the updating of weights and biases may be performed independently between layers.
- a batch refers to a data batch, such as a plurality of images. Average values and standard deviations may be determined over the plurality of images in each batch. The values for ⁇ and ⁇ are learned during the gradient descent training, independently from the weights and biases of the AI model.
- a batch normalization may normalize the inputs of each layer to the same range of values. This may help speed up the training process (to converge faster). For example, batch normalization may prevent early saturation of non-linear activation functions.
- the batch normalization merge at 704 essentially merges the batch normalization parameters into the convolution layer of an AI model. This reduces memory usage on the chip, and increases inference speed when running the AI model on the chip.
- performing the image mean merge at 706 may include updating the weights and biases of the AI model to give the effect of merging the mean of an image.
- the mean of multiple images having R, G, B values may be a particular color pixel value (R, G, B). This gives:
- the updating of weights and biases in the image mean merge may be performed for the first convolution layer, which is connected to an image layer at the input.
- the image mean merge makes sure the input pixel values of the training images are within the pixel value range, e.g., [0, 255]. Further, the image mean is used during the training to adjust the input image pixel range to be balanced around the value of zero to facilitate training convergence.
- performing the image scale merge at 708 may include updating the weights and biases of the AI model to give the effect of scaling the input image.
- the weights and biases may be updated as:
- the updating of weights and biases in the image scale merge may be performed for the first convolution layer, which is connected to an image layer at the input.
- the image scale merge gives the effect of adjusting the input image to take values to take full advantage of the size of the input image channel in the AI chip. For example, if the pixel values of the image are above the maximum value allowed in the AI chip, the image scale merge gives the effect of scaling down the image values, or normalizing the image values to within the maximum allowed range of the input image in the AI chip. Conversely, if the pixel values of the image are in a small range, the image scale merge gives the effect of scaling up the image values, or normalizing the values to take full advantage of the maximum allowed range of the input image in the AI chip.
- performing the output 710 may include updating the weights and biases of the AI model so that the output of each convolution layer the AI model has a value within the allowed output value range in the AI chip.
- the allowed output value range maybe 3-bit. 5-bit, 8-bit, 10-bit, or other values.
- the operation of output equalization may be performed for one or more, or all of the convolution layers in the AT model.
- the maximum output value of the ith layer ⁇ i may be statistically determined from the multiple images in a batch.
- ⁇ i and ⁇ i ⁇ 1 may each represent the statistical maximum output value of the ith layer and its preceding layer, the (i ⁇ l)th layer, respectively. Then, the weights and biases of the AI model may be updated as:
- nbit is the maximum bit-size of the output value of each layer.
- the quantized value will be in the range of [0, ⁇ ] represented in nbit, such as 5-bit.
- the output equalization causes the quantization grid to be 1, which is feasible by the AI chip hardware.
- the various linear transformation operations in FIG. 7 may update the weights and biases of a CNN model so that they are more suitable for a hard ware environment.
- batch normalization normalizes each layer's input data (previous layer's output data) to make the training easy to converge.
- the output equalization operation may update the weights of the AI model to cause the inputs and/or outputs of each layer of the AI model to be equalized to the same level, and within the range allowed in the physical AI chip. It ensures that the trained/updated model can be loaded onto the physical chip with low degradation of performance.
- the image mean merge and image scale merge may adjust the input image to an optimal range that maximizes the use of the input image buffer in the physical AI chip.
- the process 700 may further perform fine-tuning at 712 such that the weights and biases of the trained/updated AI model will be even closer to the characteristics of the physical AI chip.
- the fine-tuning at 712 may be based on training data 709 .
- FIG. 8 illustrates a diagram of an example process of fine tuning in accordance with various examples described herein.
- a fine tuning process 800 may include accessing trained weights at 802 .
- accessing trained weights may include accessing the updated weights and biases from block 710 or any of the linear transformation operations 704 , 706 , 708 (in FIG. 7 ).
- accessing training, weights may include accessing the updated weights and biases from one or more units in the training network 101 , such as convolution quantization unit 106 or activation quantization unit 108 (in FIG. 1 ).
- the process 800 may further perform shift-based quantization on the access weights at 804 .
- Shift-based quantization may mimic the characteristics of a hardware chip because shift registers are commonly available inside a chip.
- the weights and biases are updated based on a shift value.
- the shift value may be an integer. For example,
- W Q and b Q are the quantized weights and biases
- nbit represents the maximum allowed value in the physical AI chip.
- the weights and biases are updated for one or more convolution layers in a CNN model.
- the process 800 may further include determining the output of the CNN model based on the quantized weights at 808 and determining a change of weights at 810 .
- Determining the output of the AI model at 808 may include inferring the AI model using the training data 809 and the linear transformed weights from one or more operations 704 - 710 (in FIG. 7 ). Determining the output of the AI model may be implemented in a CPU, GPU or inside an AI chip (physical or virtual).
- the process 800 may further include updating the weights at 812 based on the change of weights, and repeating the process until a stopping criteria is met at 814 .
- the training data 809 may be obtained from training data 709 (in FIG. 7 ) and similar to the training data 209 (in FIG. 2 ).
- Determining the change of weights at 810 and updating the weights at 812 may include a similar training process as in FIGS. 2 and 4 , in which the loss function may be similarly defined and the change of weights may also be similarly determined.
- blocks 808 , 810 , 812 may be implemented using a gradient descent method.
- a loss function may be defined as:
- y i is the prediction of the network, e.g., the output of the CNN based on the ith training instance.
- the CNN output includes two image labels (e.g., dog or cat)
- y i may have the value of 0 or 1.
- N is the number of training instances in the training data set.
- the probability p(y i ) of a training instance being y i and may be determined from the training.
- the loss function H( ) may be defined based on a sum of loss values over a plurality of training instances n the training data set, wherein the loss value of each of the plurality of training instances is a difference between an output of the CNN model for the training instance and a ground truth of the training instance.
- the gradient descent may be used to determine a change of weights
- the weights (or updated weights) in each iteration such as W t and W t+1 , may be stored in floating point.
- the quantized weights W Q t at each iteration t may be stored in fixed point.
- the gradient descent may include known methods, such as stochastic gradient descent method.
- the stopping criteria may defined in a similar fashion as in FIGS. 2 and 4 .
- the process 800 may count the number of iterations and determine whether the number of iterations has exceeded a maximum iteration number.
- the maximum iteration may be set to a suitable number, such as 100, 200, or 1000, or 10,000, of an empirical number.
- determining whether a stopping criteria has been met may also determine whether a value of the loss function at the current iteration is greater than a value of the loss function at a preceding iteration. If the value of the loss function increases, the process 800 may determine that the iterations are diverting and determine to stop the iterations.
- the process 800 may be implemented entirely on a desktop using a CPU or a GPU. Alternatively, certain operations in the process 800 may be implemented in a physical AI chip, where the trained weights or updated weights are uploaded inside the AI chip. Once the stopping criteria is met at 814 , the process 800 may store the updated weights at 816 .
- the process 700 may further include uploading the weights to the AI chip at 716 .
- the weights uploaded to the AI chip may be trained and fine-tuned from box 712 , and/or any of the operations 704 - 710 or a combination thereof.
- Uploading the weights to the AI chip may include uploading the updated weights and biases of the CNN model to the AI chip so that the AI chip may be capable of performing an AI task.
- the process 700 may further include executing the AI chip to perform an AI task at 718 in a real-time application, and outputting the result of the AI task at 720 .
- An example of an AI task may include recognizing, one or more classes of object from an input image, such as a crying or smiley face.
- an AI chip may be installed in a camera and store the trained weights and/or other parameters of the CNN model, such as those trained/quantized/updates weights generated in any of units in the training network 101 (in FIG. 1 ) or any of the processes 200 ( FIG. 2 ), 400 ( FIG. 4 ), 600 ( FIG. 6A ), 700 ( FIG. 7 ) or 800 ( FIG. 8 ).
- the AI chip may be configured to receive a captured image from the camera, perform an image recognition task based on the captured image and the stored CNN model, and present the recognition result on an output device, such as a display.
- the camera may display, via a user interface, the recognition result.
- the CNN model may be trained for face recognition.
- a captured image may include one or more facial images associated with one or more persons.
- the recognition result may include the names associated with each input facial image.
- the camera may present the output of the recognition result on an output device, such as a display.
- the user interface may display a person's name next to or overlaid on each of the input facial image associated with the person.
- FIGS. 1-8 may vary.
- the number of iterations in process 200 in FIG. 2 , process 400 in FIG. 4 , and process 800 in FIG. 8 may vary and may be independent.
- the quantization of weights at 204 in FIGS. 2 and 804 in FIG. 8 may be interchangeable.
- the quantization of activation layer 404 in FIG. 4 may be independent from quantization of weights 204 in FIGS. 2 and 804 in FIG. 8 in a training process.
- a training process such as process 800 in FIG.
- quantizing weights at 804 may be optional, while determining the output of the CNN at 808 may be based on the accessed trained weights 802 in FIG. 8 .
- one or more processes 200 (in FIG. 2 ), 400 (in FIGS. 4 ) and 800 (in FIG. 8 ) may be combined.
- a combined process may perform quantization of activation layer (e.g., 404 in FIG. 4 ) and quantization of weights (e.g., 204 in FIG. 2 ) in a single training process.
- a training process such as 200 (in FIG. 2 ), 400 (in FIG. 4 ) or 800 (in FIG. 8 ) may be performed multiple times, each using a separate training set.
- processes 200 in FIG. 2 ), 400 (in FIG. 4 ), 600 (in FIG. 6A ), 700 (in FIG. 7 ) and 800 (in FIG. 8 ) may be performed entirely on a CPU/GPU processor. Alternatively, certain operations in these processes may be performed on an AI chip. It is appreciated that other variations may be possible.
- FIG. 9 depicts an example of internal hardware that may be included in any electronic device or computing system for implementing various methods in the embodiments described in FIGS. 1-8 .
- An electrical bus 900 serves as an information highway interconnecting the other illustrated components of the hardware.
- Processor 905 is a central processing device of the system, configured to perform calculations and logic operations required to execute programming instructions.
- the terms “processor” and “processing device” may refer to a single processor or any number of processors in a set of processors that collectively perform a process, whether a central processing unit (CPU) or a graphics processing unit (GPU) or a combination of the two.
- CPU central processing unit
- GPU graphics processing unit
- ROM Read only memory
- RAM random access memory
- flash memory hard drives
- other devices capable of storing electronic data constitute examples of memory devices 925 .
- a memory device also referred to as a computer-readable medium, may include a single device or a collection of devices across which data and/or instructions are stored.
- An optional display interface 930 may permit information from the bus 900 to be displayed on a display device 935 in visual, graphic, or alphanumeric format.
- An audio interface and audio output (such as a speaker) also may be provided.
- Communication with external devices may occur using various communication ports 940 such as a transmitter and/or receiver, antenna, an RFID tag and/or short-range, or near-field communication circuitry.
- a communication port 940 may be attached to a communications network, such as the Internet, a local area network, or a cellular telephone data network.
- the hardware may also include a user interface sensor 945 that allows for receipt of data from input devices 950 such as a keyboard, a mouse, a joystick, a touchscreen, a remote control, a pointing device, a video input device, and/or an audio input device, such as a microphone.
- Digital image flames may also be received from an imaging capturing device 955 such as a video or camera that can either be built-in or external to the system.
- Other environmental sensors 960 such as a GPS system and/or a temperature sensor, may be installed on system and communicatively accessible by the processor 905 , either directly or via the communication ports 940 .
- the communication ports 940 may also communicate with the AI chip to upload or retrieve data to/from the chip.
- a trained AI model with updated quantized weights obtained from the training system 100 ( FIG. 1 ), or the processes 200 ( FIG. 2 ), 400 ( FIG. 4 ), 600 ( FIG. 6A ), 700 ( FIG. 7 ) or 800 ( FIG. 8 ) may be shared by one or more processing devices on the network running other training processes or AI applications.
- a device on the network may receive the trained AI model from the network and upload the trained weights, to an AI chip for performing an AI task via the communication port 940 and an SDK (software development kit).
- the communication port 940 may also communicate with any other interface circuit or device that is designed for communicating with an integrated circuit.
- the hardware may not need to include a memory, but instead programming instructions are run on one or more virtual machines or one or more containers on a cloud.
- programming instructions are run on one or more virtual machines or one or more containers on a cloud.
- the various methods illustrated above may be implemented by a server on a cloud that includes multiple virtual machines, each virtual machine having an operating system, a virtual disk, virtual network and applications, and the programming instructions for implementing various functions in the robotic system may be stored on one or more of those virtual machines on the cloud.
- the AI chip having a CNN architecture may be residing in an electronic mobile device.
- the electronic mobile device may use the built-in AI chip to produce recognition results and generate performance values.
- training the CNN model can be performed in the mobile device itself, where the mobile device retrieves training data from a dataset and uses the built-in AI chip to perform the training.
- the processing device may be a server device in the communication network (e.g., 102 in FIG. 1 or may be on the cloud.
- FIGS. 1-9 may help obtain an optimal AI model that may be executed in a physical AI chip with a performance close to an expected performance in the training process by mimicking the hardware configuration in the training process.
- the quantization of weights and output values of one or more convolution layers may use various methods.
- the configuration of the training process described herein may facilitate both forward and backward propagations that would take advantage of classical training algorithms, such as gradient decent, in training weights of an AI model.
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Mathematical Physics (AREA)
- General Engineering & Computer Science (AREA)
- Biophysics (AREA)
- Health & Medical Sciences (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- Computing Systems (AREA)
- Biomedical Technology (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Molecular Biology (AREA)
- General Health & Medical Sciences (AREA)
- Neurology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Medical Informatics (AREA)
- Image Analysis (AREA)
Abstract
A system for training an artificial intelligence (AI) model for an AI chip may include an AI training unit to train weights of an AI model in floating point, and one or more quantization units for updating the weights of the AI model while accounting for the hardware constraints in the AI chip. The system may also include customization unit for performing one or more linear transformations on the updated weights. The system may also perform output equalization for one or more convolution layers of the AI model to equalize the inputs and/or outputs of each layer of the AI model to within the range allowed in the physical AI chip. The system may further update the weights by performing shift-based quantization that mimics the characteristics of a hardware chip. The updated weights may be stored in fixed point and uploadable to an AI chip implementing an AI task.
Description
- This application claims the filing benefit of U.S. Provisional Application No. 62/821,437, filed Mar. 20, 2019 and U.S. Provisional Application No. 62/830,269, filed Apr. 5, 2019. These applications are incorporated by reference herein in their entirety and for all purposes.
- This patent document relates generally to systems and methods for providing artificial intelligence solutions. Examples of training a convolution neural network model for uploading to an artificial intelligence semiconductor are provided.
- Artificial intelligence (AI) semiconductor solutions include using embedded hardware in an AI integrated circuit (IC) to perform NI tasks. Hardware-based solutions, as well as software solutions, still encounter the challenges of obtaining an optimal AI model, such as a convolutional neural network (CNN) for the hardware. For example, if the weights of a CNN model are trained outside the chip, they are usually stored in floating point. When the weights of a CNN model in floating point are loaded into an AI chip they usually lose data bits from quantization, for example, from 16- or 32-bits to 1- to 8-bits. The loss of data bits in an AI chip compromises the performance of the AI chip due to lost information and data precision. Further, existing training methods are often performed in a high performance computing environment, such as on a desktop, without accounting for the hardware constraints in a physical AI chip. This often causes performance degradation when a trained AI model is loaded into an AI chip.
- The present solution will be described with reference to the following figures, in which like numerals represent like items throughout the figures.
-
FIG. 1 illustrates an example training system in accordance with various examples described herein. -
FIG. 2 illustrates a flow diagram of an example process of training that may be implemented in a convolution quantization unit in accordance with various examples described herein. -
FIG. 3 illustrates an example of mask values in a 3-bit configuration in accordance with various examples described herein. -
FIG. 4 illustrates a flow diagram of an example process of training that may be implemented in an activation quantization unit in accordance with various examples described herein. -
FIG. 5 illustrates a diagram of an example convolution neural network in an AI chip in accordance with various examples described herein. -
FIG. 6A illustrates a flow diagram of an example process of training an AI model for executing in an AI chip in accordance with various examples described herein. -
FIG. 6B illustrates an example distribution of output values of an AI model in accordance with various examples described herein. -
FIG. 7 illustrates a flow diagram of an example process of training that may be implemented in a chip customization unit in accordance with various examples described herein. -
FIG. 8 illustrates a flow diagram of an example process of fine tuning in accordance with various examples described herein. -
FIG. 9 illustrates various embodiments of one or more electronic devices for implementing the various methods and processes described herein. - As used in this document, the singular forms “a”, “an”, and “the” include plural references unless the context clearly dictates otherwise. Unless defined otherwise, technical and scientific terms used herein have the same meanings as commonly understood by one of ordinary skill in the art. As used in this document, the term “comprising” means “including, but not limited to.”
- An example of “artificial intelligence logic circuit” and “AI logic circuit” includes a logic circuit that is configured to execute certain AI functions such as a neural network in AI or machine learning tasks. An AI logic circuit can be a processor. An AI logic circuit can also be a logic circuit that is controlled by an external processor and executes certain AI functions.
- Examples of “integrated circuit” “semiconductor chip,” “chip,” and “semiconductor device” include integrated circuits (ICs) that contain electronic circuits on semiconductor materials, such as silicon, for performing certain functions. For example, an integrated circuit can be a microprocessor, a memory, a programmable array logic (PAL) device, are application-specific integrated circuit (ASIC), or others, An AI integrated circuit may include an integrated circuit that contains an AI logic circuit.
- Examples of “AI chip” include hardware- or software-based device that is capable of performing functions of an AI logic circuit. An AI chip may be a physical IC. For example, a physical AI chip may include a CNN, which may contain weights and/or parameters. The AI chip may also be a virtual chip, i.e., software-based. For example, a virtual AI chip may include one or more processor simulators to implement functions of a desired AI logic circuit.
- Examples of “AI model” include data containing one or more parameters that, when loaded inside an AI chip, are used for executing the AI chip. For example, an AI model for a given CNN may include the weights, biases, and other parameters for one or more convolutional layers of the CNN. Here, the weights and parameters of an AI model are interchangeable.
-
FIG. 1 illustrates an example training system in accordance with various examples described herein. In some example, atraining system 100 may include atraining network 101 to train an AI model. Thesystem 100 may upload theAI model 112 to an AI chip in anAI system 114. In some examples, an AI model may include a convolutional neural network (CNN) that is trained to perform AI tasks, e.g., voice or image recognition tasks. A CNN may include multiple convolutional layers, each of which may include multiple parameters, such as weights and/or other parameters. In such case, an AI model may include parameters of the CNN model. In some examples, a CNN model may include weights, such as a mask and a scalar for a given layer of the CNN model. For example, a kernel in a CNN layer may be represented by a mask that has multiple values in lower precision multiplied by a scalar in higher precision. In some examples, a CNN model may include other parameters. For example, a CNN layer may include one or more bias values that, when added to the output of the output channel, adjust the output values to a desired range. - In a non-limiting, example, in a CNN model, a computation in a given layer in the CNN may be expressed by Y=W* X+b, where X is input data. Y is output data, W is a kernel, and b is a bias; all variables are relative to the given layer. Both the input data and the output data may have a number of channels. Operation “*” is a convolution. Kernel W may include weights. For example, a kernel may include 9 cells in a 3×3 mask, where each cell may have a binary value, such as “1” and “−1.” In such case, a kernel may be expressed by multiple binary values in the 3×3 mask multiplied by a scalar. In other examples, for some or all kernels, each cell may be a signed 2 or 8 bit integer. Alternatively, and/or additionally, a kernel may contain data with non-binary values, such as 7-value. Other bit length or values may also be possible. The scalar may include a value having a bit width, such as 12-bit or 16-bit. Other bit length may also be possible. The bias b may contain a value having multiple bits, such as 18 bits. Other bit length or values may also be possible. In a non-limiting example, the output Y may be further discretized into a signed 5-bit or 10-bit integer. Other bit length or values may also be possible.
- In some examples, the AI chip in the
AI system 114 may include an embedded cellular neural network that has memory containing the multiple parameters in the CNN. In some scenarios, the memory in an AI chip may be a one-time-programmable (OTP) memory that allows a user to load a CNN model into the physical AI chip once. Alternatively, the AI chip may have a random access memory (RAM), magneto-resistive random access memory (MRAM), other types of memory that allows a user to update and load a CNN model into the physical AI chip multiple times. In a non-limiting example, the AI chip may include convolutional, Pooling, and ReLU layers in a CNN model. In such case, the AI chip may perform all computations in an AI task. In other examples, the AI chip may include a subset of the convolutional, Pooling, and ReLU layers in a CNN model. In such case, the AI chip may perform certain computations in an AI task, leaving the remaining, computations in the AI task performed in a CPU/GPU or other host processors outside the AI chip. - In some examples, the
training network 101 may be configured to include, a forward propagation neural network, in which information may flow from the input layer to one or more hidden layers of the network to the output layer. An AI training system may also be configured to include a backward propagation network to update the weights of the AI model based on the output of the AI chip. In some examples, an AI training system may include a combination of forward and backward propagation networks. - In some examples,
training data 102 may be provided for use in training theAI model 112. For example,training data 102 may be used for training an AI model that is suitable for face recognition tasks, and the training data may contain any suitable dataset collected for performing face recognition tasks. In another example, the training data may be used for training an AI model suitable for scene recognition in video and images, and thus the training data may contain any suitable scene dataset collected for performing scene recognition tasks. In some scenarios, training data may reside in a memory in a host device. In one or more other scenarios, training data may reside in a central data repository and is available for access thetraining network 101 via the communication network 103. In some examples, an AI model may be trained by using one or more devices to implement one or more training units 104-110 as shown inFIG. 1 . Details are further described with reference toFIGS. 1-9 . - In some examples, the
training network 101 may include a floating-pointmodel training unit 104, which may be configured to train an AI model, e.g., a CNN model using one or more sets oftraining data 102. For example, the floating-point model training unit may be implemented on a desktop computer (CPU, and/or GPU) in floating point, in which one or more weights of the CNN model are in floating point. Any known or later developed methods may be used to train a CNN model. Thetraining system 400 may further include one or more units to convert the floating-point model to a hardware-supported model, as further illustrated inFIG. 1 . - In some examples, the
training system 100 may include aconvolution quantization unit 106 and/oractivation quantization unit 108, each of which may be configured to update the weights of a CNN model to adapt to an AI chip. For example, theconvolution quantization unit 106 may convert the trained weights in floating-point to weights in fixed-point so that the weights can be supported by the AI chip. Theactivation quantization unit 108 may further update the weights of the CNN so that the CNN output values based on the updated weights are also supported by the AI chip. Alternatively, and/or additionally, the order of theconvolution quantization unit 106 and theactivation quantization unit 108 may not matter. For example, theactivation quantization unit 108 may access the training weights (e.g., from the floating-point model training unit 104) in floating-point and generate updated weights in fixed-point. Conversely, theconvolution quantization unit 106 may access the updated weights in fixed-point from theactivation quantization unit 108 and further update the weights to those the can be supported by the AI chip. For, example, the updated weights from theconvolution quantization unit 106 and/or theactivation quantization unit 108 may be in fixed-point and have the bit-width, equal to that supported by the AI chip, such as 1-bit, 2-bit, 5-bit, 8-bit etc. The output values that are generated by the AI model based on the updated weights from theconvolution quantization unit 106 and/or theactivation quantization unit 108 may also result in fixed-point values and have the bit-width equal to that supported by activation layers in the AI chip, such as 5-bit, or 10-bit. - In some examples, the
training network 101 may include achip customization unit 110 which may be configured to further update the weights of the AI model to maximize the resources supported by the hardware AI chip. For example, thechip customization unit 110 may be configured to perform batch normalization merge, image mean merge, scalar mean merge, and/or a combination thereof, which are described in the present disclosure. Thechip customization unit 110 may further train the weights in a manner that mimics the characteristics of the hardware in the AI chip. For example, the training may include shift-based quantization which may mimic the features of the hardware. In some examples, the one or more units in thetraining network 101 may be serially coupled in that the output of one unit is fed to the input of another unit. For example, the one or more units may be coupled in the order of 104, 108, 106 and 110, where 104 receives the training data and produces a floating-point AI model, where each of theunits unit 110 produces thefinal AI model 112 uploadable to an AI chip for executing an AI task. Alternatively, the one or more units may be coupled in the order of 104, 106, 108 and 110. In other scenarios, a lesser of 104, 106, 108 and 110 may be serially coupled. For example,boxes boxes final AI model 112. - With further reference to
FIG. 1 , theAI system 114 may be coupled to one ormore sensors 116. The sensor(s) 116 may be configured to capture various types of data, such as image, video, audio, text, or any information in various media formats. TheAI system 114 may be executed to implement an AI task in the AI chip based on the captured sensor data from sensor(s) 116, and generateAI task output 118. For example, in some scenarios, the AI chip in theAI system 114 may contain an AI model for performing certain AI tasks. Executing an AI chip or an AI model may include causing the AI chip to perform an AI task based on the AI model inside the AI chip and generate an output. Examples of an AI task may include image recognition, voice recognition, object recognition, data processing and analyzing, or any recognition, classification, processing tasks that employ artificial intelligence technologies. An example of an AI system, such as a camera having a built-in AI chip, is described in the present disclosure. Now, each of the units in thetraining network 101 is further described in detail with reference toFIGS. 2-9 . -
FIG. 2 illustrates a diagram of an example process of training that may be implemented in a convolution quantization unit, such as 106 inFIG. 1 , in accordance with various examples described herein. In some examples, aprocess 200 may include accessing training weights of an AI model at 202. For example, the AI model may be trained in the floating-point model training unit (104 inFIG. 1 ) and include weights in floating-point. In a non-limiting example, the trained weights may be the weights of a CNN model and may be stored in floating point. For example, the weights may be stored in 32-bit or 16-bit. - In some examples, the
process 200 may further include quantizing the trained weights at 204, determining output of the AI model based on the quantized weights at 206, determining a change of weights at 208 and updating the weights at 210. In some examples, the quantized weights may correspond to the limit of the hardware, such as the physical AI chip. In a non-limiting example, the quantized weights may be of 1-bit (binary value), 2-bit, 3-bit, 5-bit, or other suitable bits, such as 8-bit. Determining the output of the AI model at 206 may include inferring the AI model using thetraining data 209 and the quantized trained weights. - With further reference to
FIG. 2 , in quantizing the weights at 204, the number of quantization levels may correspond to the hardware constraint of the AI chip so that the quantized weights can be uploaded to the AI chip for execution. For example, the AI chip may include a CNN model. In the CNN model, the weights may include 1-bit (binary value), 2-bit, 3-bit, 5-bit or other suitable bits, such as 8-bit. The structure of the CNN may correspond to that of the hardware in the AI chip. In case of 1-bit, the number of quantization levels will be two. In some scenarios, quantizing the weights to 1-bit may include determining a threshold to properly separate the weights into two groups: one below the threshold and one above the threshold, where each group takes one value, such as {1, −1}. - In some examples, quantizing the weights at 204 may include a dynamic fixed point conversion. For example, the quantized weights may be determined by:
-
- nbit is the bit-size of the weights in the physical AI chip. For example, nbit may be 8-bit, 12-bit etc. Other values may be possible.
- In some examples, quantizing the weights at 204 may include determining the quantized weights based on the interval in which the values of the weights fall, where the interval is defined depending on the value of nbit. In a non-limiting example, when nbit=1, the weights of a CNN model rimy be quantized into two quantization levels. In other words, the weight values may be divided into two intervals. For example, the first interval is [0, ∞), and the second interval (−∞, 0). When Wk≥0, WQ=(Wk)Q=(Wmean)shift-quantized, where Wk represents the weights for a kernel in a convolution layer of the CNN model, Wmean=mean(abs(Wk)), and a shift-quantization of a weight w may be determined by
-
- where |W|max is the maximum value of absolute values of the weights. Similarly, when Wk<0, WQ=−(Wmean)shift-quantized. The mean and maximum values are relative to a convolution layer in the CNN model.
- In a non-limiting example, when nbit=2, the intervals may be defined by (−∞, −Wmean/4), [−Wmean/4, Wmean/4] and (Wmean/4, ∞). Thus, the weights may be quantized into:
-
W Q=0, when |W k |≤W mean/4; -
W Q=(W mean)shift-quantized, when W k <W mean/4; -
W Q=−(W mean)shift-quantized, when W k <−W mean/4. - It is appreciated that other variations may also be possible. For example, Wmax may be used instead of Wmean. Denominators other than the values of 4 may also be used.
- In another non-limiting example, when nbit=3, the intervals may be defined, as shown in
FIG. 3 . Define W′mean=Wmean/4. Thus, the weights may be quantized into: -
W Q=0when |W k |≤W′ mean/2; -
W Q=(W′ mean)shift-quantized, when 3W′ mean2<3W′ mean/2; -
W Q=(2W′ mean)shift-quantized, when 3W′ mean/2<W k<3W′ mean; -
W Q=(4W′ mean)shift-quantized, when W k>3W′ mean; -
W Q=−(W′ mean)shift-quantized, when −3W′ mean/2<W k <−W′ mean/2; -
W Q=−(2W′ mean)shift-quantized, when −3W′ mean <W k<−3W′ mean/2; -
W Q=−(W′ mean)shift-quantized, when W k<3W′ mean; - It is appreciated that other variations may also be possible. For example, Wmax may be used instead of Wmean. Denominators other than the values of 4 to 2 may also be used.
- Alternatively, and/or additionally, quantizing the weights at 204 may also include compressed-fixed point conversion, where a weight value may be separated into a scalar and a mask, where W=scalar×mask. Here, a mask may include a k×k kernel and each value in the mask may have a bit-width, such as 1-bit, 2-bit, 3-bit, 5-bit, 8-bit or other bit sizes. In some examples, a quantized weight may be represented by a product of a mask and an associated scalar. The mask may be selected to maximize the bit size of the kernel, where the scalar may be a maximum common denominator among all of the weights. In a non-limiting example, when nbit=5 or above, scalar=min(abs(wk)) for all weights in kth kernel, and
-
- The
process 200 may further include determining a change of weights at 208 based on the output of the CNN model. In some examples, the output of the CNN model may be the output of the activation layer of the CNN. Theprocess 200 may further update the weights of the CNN model at 210 based on the change of weights. In some examples, theprocess 200 may be implemented in a forward propagation and backward propagation framework. For example, theprocess 200 may performoperation 206 in a layer by layer fashion in a forward propagation, in which the inference of the AI model is propagated from the first convolution layer to the last convolution layer in a CNN (or a subset of the convolution layers in the CNN). The output inferred from the first layer will be fed to the second layer, the output inferred from the second layer will be fed to the third layer, so on and so forth until the output of the last layer is inferred. - In some examples, the
operations - In some examples, the
process 200 may repeat updating the weights of the CNN model in one or more iterations. In some examples, blocks 206, 208, 210 may be implemented using a gradient descent method, in which a suitable loss function may be used. In a non-limiting example, a loss function may be defined as: -
- where yi is the prediction of the network, e.g., the output of the CNN based on the ith training instance. In a non-limiting example, if the CNN output includes two image labels (e.g., dog or cat), then yi may have the value of 0 or 1. N is the number of training instances in the training data set. The probability p(yi) of a training instance being yiand may be determined from the training. In other words, the loss function h( ) may be defined based on a sum of loss values over a plurality of training instances in the training data set, wherein the loss value of each of the plurality of training instances is a difference between an output of the CNN model for the training instance and a ground truth of the training instance.
- In a non-limiting example, the
training data 209 may include a plurality of training input images. The ground truth data may include information about one or more objects in the image, or about whether the image contains a class of objects, such as a cat, a dog, a human face, or a given person's face. Inferring the AI model may include generating a recognition result indicating which class to which the input image belongs. In the training process, such as 200, the loss function may be determined based on the image labels in the ground truth and the recognition result generated from the AI chip based on the training input image. - In some examples, the gradient descent may be used to determine a change of weight
-
ΔW=ƒ(W Q t) - by minimizing the loss function H( ), where WQ t stand for the quantized weights at time t. The process may update the weight from a previous iteration based on the change of weight, e.g., Wt+1=WtΔW, where Wtand Wt+1 stand for the weights in a preceding iteration and the weights in the current iteration, respectively. In some examples, the weights (or updated weights) in each iteration, such as Wt and Wt+1 may be stored in floating point. The quantized weights WQ t at each iteration t may be stored in fixed point. In some examples, the gradient descent may include known methods, such as stochastic gradient descent method.
- With further reference to
FIG. 2 , theprocess 200 may further include repeatingblocks operations process 200 may determine the output of the CNN at 206 by inference in a layer by layer fashion in a forward propagation. Theprocess 200 may also determine the change of weights at 208 and update the weights at 210 in a layer by layer fashion in a backward propagation. For each iteration, theprocess 200 may use a batch of training images selected from thetraining data 209. The batch size may vary, For example, the batch size may have a value of 32, 64, 128, or other number of images. - In each iteration, the
process 200 may determine whether a stopping criteria has been met at 214. If the stopping criteria has been met, the process may store the updated weights of the CNN model at the current iteration at 216 for use by another unit (e.g., a unit in 101 inFIG. 1 ). If the stopping criteria has not been met, theprocess 200 may repeatblocks process 200 may count the number of iterations and determine whether the number of iterations has exceeded a maximum iteration number. For example, the maximum iteration may be set to a suitable number, such as 100, 200, or 1000, or 10,000, or an empirical number. In some examples, determining whether a stopping criteria has been met may also determine whether the value of the loss function at the current iteration is greater than the value of the loss function at a preceding iteration. If the value of the loss function increases, theprocess 200 may determine that the iterations are diverting and determine to stop the iterations. Alternatively, and/or additionally, if the iterations are diverting, theprocess 200 may adjust the gradient descent hyper-parameters, such as learning rate, batch size, gradient decent updating mechanism, etc. In some examples, if the value of the loss function does not decrease over a number of iterations, theprocess 200 may also determine that the stopping criteria is met. - In some examples, the
process 200 may be implemented entirely on a desktop using a CPU or a GPU. Alternatively, certain operations in theprocess 200 may be implemented in a physical AI chip, where the trained weights or updated weights are uploaded inside the AI chip. -
FIG. 4 illustrates a diagram of an example process of training that may be implemented in an activation quantization unit, such as 108 (inFIG. 1 ) in accordance with various examples described herein. Atraining process 400 may perform operations in one or more iterations to train and update the weights of a CNN model, where the trained weights may be output in fixed point, which is suitable for an AI chip, to execute. Theprocess 400 may include accessing trained weights of an AI model at 402. For example, the AI model may include quantized weights from the process 200 (FIG. 2 ), where the quantized weights are stored in fixed point (at 216 inFIG. 2 ). Alternatively, the AI model may be trained in the floating-point model training unit (104 inFIG. 1 ) and include weights in floating-point. In a non-limiting example, the trained weights may be the weights of a CNN model. Theprocess 400 may further include determining output of the AI model based on the weights at 408. If the weights of the CNN are in fixed point, such as determined from theconvolution quantization unit 106 inFIG. 1 , the operation of determining the output of the CNN may be performed in fixed point. If the weights of the CNN are in floating point, such as trained from the floating-point model training unit (104 inFIG. 1 ), the operation of determining the output of the CNN may be performed in floating point. Determining the output of the AI model at 408 may include inferring the AI model using thetraining data 409 and the weights obtained frombox 402. - Similar to
FIG. 2 , determining the output of the CNN model at 408 may be performed on a CPU or GPU processor outside the AI chip. In some or other scenarios, determining the output of the CNN model may also, be performed directly on an AI chip, where the AI chip may be a physical chip or a virtual AI chip, and executed to produce output. If the weights are in fixed-point and supported by a physical AI chip, the weights may be uploaded into the AI chip. In that case, theprocess 400 may load quantized weights into the AI chip for execution of the AI model. Thetraining data 409 may be similar to thetraining data 209 inFIG. 2 . - With further reference to
FIG. 4 , theprocess 400 may further include quantizing the output of the CNN at 406. In some examples, quantizing the output of the CNN may include quantizing at least one activation layer. In some examples, an activation layer in an AI chip may include a rectified linear unit (ReLU) of a CNN. The quantization of the activation layer may be based on the hardware constraints of the AI chip so that the quantized output of the activation layer can mimic the characterization of the physical AI chip.FIG. 5 illustrates, a diagram of an example CNN in an AI chip in accordance with various examples described herein. In some example, aCNN 500 in an AI chip may include one, or more convolution layers, e.g., 502, 504, 506 . . . etc. In operation, these convolution layers may include weights stored in fixed point or floating-point. Each of the convolution layers may produce the output in fixed point. In some examples, a convolution layer may also include an activation layer (e.g., ReLU layer), which may also include fix point values. -
FIG. 6A illustrates a diagram of an example process of training an AI model for executing in an AI chip in accordance with various examples described herein. In some examples, aprocess 600 may quantize the output of one or more convolution layers in a CNN during the training process. The one or more convolution layers in the CNN model may correspond to one or more convolution layers in the AI chip inFIG. 5 . By quantizing the output of the convolution layers during the training, the trained CNN model may be expected to achieve a performance in an AI chip close to that achieved in a CPU/GPU during the training. In other words, the quantization effect over the CNN model during the training may mimic that of the AI chip so that performance of the CNN model during the training may accurately reflect the anticipated performance of the physical AI chip when the trained CNN model is uploaded and executed in the AI chip. - In some examples, the,
process 600 may include accessing the input of a first convolution layer at 602 and determining the output of the first convolution layer at 604. For example, the first convolution layer may be any of the convolution layers in a CNN model that corresponds to a convolution layer, e.g. 502, 504, 506 . . . in an AI chip. The output of the convolution may be stored in floating point. Accessing the input of the first convolution layer at 602 may include assessing the input data, if the first convolution layer is the first layer after the input in the CNN, or assessing the output of the preceding layer, if the first convolution layer is an intermediate layer. Determining the output of the first convolution layer at 604 may include executing a CNN model to produce an output at the first convolution layer, in a training process, determining the output of the convolution layer may be performed outside of a chip, e.g., in a CPU/GPU environment. Alternatively, determining the output of the convolution layer may be performed in an AI chip. - With further reference to
FIG. 6A , theprocess 600 may further quantize the output of the first convolution layer at 606. In some examples, the method of quantizing the output of the convolution layer may mimic the configuration of an AI chip such as the number of bits and the quantization behavior of a convolution layer in an AI chip. For example, the quantized output of the CNN model may be stored in fixed point in the same bit-length of the activation layer of the corresponding convolution layer in the AI chip. In a non-limiting example, the output of each convolution layer in an AI chip may have 5 bits (in hardware), where the output values range from 0 to 31. Theprocess 600 may determine a range for quantization based on the bit-width of the output of each convolution layer of the AI chip. In the above example, the range for quantization may be 0-31, which corresponds to 5-bits in the hardware configuration. Theprocess 600 may perform a clipping over the output of a convolution layer in the CNN model, which sets a value beyond a range to a closest minimum or maximum of the range.FIG. 6B illustrates an example of distribution for layout output values of an AI model. In such example, the layer output values from multiple runs of the AI chip over multiple instances of a training set are all greater than zero. A clipping was done at the maximum value yi α, where i stands for the ith convolution layer. In the above example in which the convolution layer contains 5-bit values, for a value above 31, the process may set the value to the maximum value: 31. - Returning to
FIG. 6A ., quantizing the activation layer may include quantizing the output values of one or more convolution layers in the CNN. For example, Y=W*X+b represents the output value of an activation layer, then, the activation layer may be quantized as: -
- Here, a value of [0, α] may be represented by a maximum number of bits in the activation layer, e.g., 5-bit, 10-bit, or other values. If a weight is in the range of [0, α], then the quantization becomes a linear transformation. If a weight has a value of less than zero or a value of greater than α, then the quantization clips the weight at zero or α, respectively. Here, the quantization of activation layer limns the value of the output to the same limit in the hardware. In a non-limiting example, if the bit-width of an activation layer in an AI chip is 5 bits, then [0, α] may be represented by 5 bits. Accordingly, the quantized value will be represented by 5 bits.
- With further reference to
FIG. 6A , theprocess 600 may further repeat similar operations for a second convolution layer. Theprocess 600 may access input of the second convolution layer at 608, determine the output of the second convolution layer at 610, and quantize the output of the second convolution layer at 612. For example, the second convolution layer may correspond to a convolution layer in the AI chip, such as 504, or 506 inFIG. 5 . In accessing the input of the second convolution layer, the process may take the output of the preceding layer. If the first and second convolution layers in the CNN model are consecutive layers, for example, the first layer in the CNN model corresponds to layer 502 in the AI chip and the second layer in the CNN corresponds to layer 504 in the AI chip, then accessing the input of the second layer (e.g., 504) may include accessing the output values of the first layer (e.g., 502). If the values of the output of the first layer are quantized, then accessing the input of the second layer includes accessing the quantized output of the first layer. -
Blocks blocks process 600 may repeat blocks 608-612 for one Of more additional layers at 614. In some examples, theprocess 600 may quantize the output for all convolution layers in a CNN in a layer-by-layer fashion. In some examples, theprocess 600 may quantize the output of some convolution layers in a CNN model. For example, theprocess 600 may quantize the output of one or more last few convolution layers in the CNN. - Returning to
FIG. 4 , theprocess 400 may further include determining a change of weights at 408 and updating the weights at 410. Theprocess 400 may further repeat theprocesses FIG. 2 . For example, theprocess 400 may include determining a change of weights at 408 based on the output of the CNN model. In some examples, the output of the CNN model may be the output of the activation layer of the CNN. Theprocess 400 may further update the weights of the CNN model at 410 based on the change of weights. The process may repeat updating the weights of the CNN model in one or more iterations. Similar toFIG. 2 , in each iteration, theprocess 400 may also be implemented in forward and background propagations in a layer by layer manner. In some examples, blocks 404, 406, 408, 410 may be implemented using a gradient descent method. The gradient descent method may perform in a similar fashion as described inFIG. 2 . For example, a loss function may be defined as: -
- where yi is the prediction of the network, e.g., the output of the CNN based on the ith training instance. In a non-limiting example, if the CNN output includes two image labels (e.g., dog or cat), then yi may have the value of 0 or 1. N is the number of training instances in the training data set. The probability p(yi) of a training instance being yi and may be determined from the training. In other words, the loss function H( ) may be defined based on a sum of loss values over a plurality of training instances in the training data set, wherein the loss value of each of the plurality of training instances is a difference between an output of the CNN model for the training instance and a ground truth of the training instance.
- In some examples, the gradient descent may be used to determine a change of weights
-
ΔW=ƒ(W Q t) - by minimizing the loss function H( ), where WQ t stands for the quantized weights at time t. In other words, WQ t=Q(Wt). The process may update the weight from a previous iteration based on the change of weight, e.g., Wt+1=Wt+ΔW, where Wt and Wt+1 stand for the weights in a preceding iteration and the weights in the current iteration, respectively. In some examples, the weights (or updated weights) in each iteration, such as Wt and Wt+1, may be stored in floating point. The quantized weights WQ t at each iteration t may be stored in fixed point. In some examples, the gradient descent may include known methods, such as a stochastic gradient descent method.
- With further reference to
FIG. 4 , once the stopping criteria is met at 414, theprocess 400 may store the updated weights at 416 for use by another unit (e.g., a unit in 101 inFIG. 1 ). In some examples, theprocess 400 may be implemented entirely on a desktop using a CPU or a GPU. Alternatively, certain operations in theprocess 400 may be implemented in a physical AI chip, where the trained weights or updated weights are uploaded inside the AI chip. -
FIG. 7 illustrates a diagram of an example process of training that may be implemented in a chip customization unit, such as 110 (inFIG. 1 ) in accordance with various examples described herein. Aprocess 700 may include accessing trained weights at 702. For example, the trained weights may be determined fromprocesses 200 or 400 (inFIGS. 2 or 4 , respectively). Theprocess 700 may further including one or more linear transformations, such as performing batch normalization merge at 704, performing image mean merge at 706, performing image scale merge at 708, performing output equalization at 710, and/or performing a combination thereof. - In some examples, performing batch normalization merge at 704 may include updating the weights and biases of the CNN model by merging the batch normalization into the convolution layers such that the input values of a convolution layer Y=W*X+b are effectively normalized to Y″=W′*X+b where W′ and b′ are updated weights and biases. In some examples, a hatch normalization may be expressed as:
-
- where the mean and std are the average and standard deviations of the input values (or output values of previous layers) for each batch of images X. Here, γ and β may be learned from the training process. Accordingly, the weights and biases may be updated based on:
-
- In some examples, the weights and biases may be updated per convolution layer. The updating of weights and biases may be performed independently between layers. A batch refers to a data batch, such as a plurality of images. Average values and standard deviations may be determined over the plurality of images in each batch. The values for γ and β are learned during the gradient descent training, independently from the weights and biases of the AI model. A batch normalization may normalize the inputs of each layer to the same range of values. This may help speed up the training process (to converge faster). For example, batch normalization may prevent early saturation of non-linear activation functions. The batch normalization merge at 704 essentially merges the batch normalization parameters into the convolution layer of an AI model. This reduces memory usage on the chip, and increases inference speed when running the AI model on the chip.
- With further reference to
FIG. 7 , performing the image mean merge at 706 may include updating the weights and biases of the AI model to give the effect of merging the mean of an image. In other words, in image mean merge, Y=W*(X-mean)+b is equivalent to Y+W′*X+b′, where the mean is the average of the images in a batch. In some examples, the mean of multiple images having R, G, B values may be a particular color pixel value (R, G, B). This gives: -
W′=W -
b′=b−W*mean - In some examples, the updating of weights and biases in the image mean merge may be performed for the first convolution layer, which is connected to an image layer at the input. As shown, the image mean merge makes sure the input pixel values of the training images are within the pixel value range, e.g., [0, 255]. Further, the image mean is used during the training to adjust the input image pixel range to be balanced around the value of zero to facilitate training convergence.
- With further reference to
FIG. 7 , performing the image scale merge at 708 may include updating the weights and biases of the AI model to give the effect of scaling the input image. In other words, in image scale merge, Y=W*(X/a)+b is equivalent to W=W′*X+b′, where the value a is the average scale of the images in a batch and can be learned from the input images. For example, it the input image is not [0, M], but instead [0, M*scale], where M is the maximum value as allowed in a physical AI chip (e.g., M=255), the value of scale can be learned. Once the value of a is determined, the weights and biases may be updated as: -
- In some examples, the updating of weights and biases in the image scale merge may be performed for the first convolution layer, which is connected to an image layer at the input. As shown, the image scale merge gives the effect of adjusting the input image to take values to take full advantage of the size of the input image channel in the AI chip. For example, if the pixel values of the image are above the maximum value allowed in the AI chip, the image scale merge gives the effect of scaling down the image values, or normalizing the image values to within the maximum allowed range of the input image in the AI chip. Conversely, if the pixel values of the image are in a small range, the image scale merge gives the effect of scaling up the image values, or normalizing the values to take full advantage of the maximum allowed range of the input image in the AI chip.
- With further reference to
FIG. 7 , performing theoutput 710 may include updating the weights and biases of the AI model so that the output of each convolution layer the AI model has a value within the allowed output value range in the AI chip. In a non-limiting example, the allowed output value range maybe 3-bit. 5-bit, 8-bit, 10-bit, or other values. The operation of output equalization may be performed for one or more, or all of the convolution layers in the AT model. - In some examples, the maximum output value of the ith layer αi may be statistically determined from the multiple images in a batch. For example, αi and αi−1 may each represent the statistical maximum output value of the ith layer and its preceding layer, the (i−l)th layer, respectively. Then, the weights and biases of the AI model may be updated as:
-
- where nbit is the maximum bit-size of the output value of each layer. In the above example, the quantized value will be in the range of [0, α] represented in nbit, such as 5-bit. Then the quantization grid is α/(2nbit . . . 1)=α/31. After output equalization, the quantization value will be in the range of [0, 31], with an effective quantization grid being 31/31 (=1.0). In other words, the output equalization causes the quantization grid to be 1, which is feasible by the AI chip hardware.
- The various linear transformation operations in
FIG. 7 , such as 704-710 may update the weights and biases of a CNN model so that they are more suitable for a hard ware environment. For example, batch normalization merge normalizes each layer's input data (previous layer's output data) to make the training easy to converge. The output equalization operation may update the weights of the AI model to cause the inputs and/or outputs of each layer of the AI model to be equalized to the same level, and within the range allowed in the physical AI chip. It ensures that the trained/updated model can be loaded onto the physical chip with low degradation of performance. Further, the image mean merge and image scale merge may adjust the input image to an optimal range that maximizes the use of the input image buffer in the physical AI chip. - With further reference to
FIG. 7 , theprocess 700 may further perform fine-tuning at 712 such that the weights and biases of the trained/updated AI model will be even closer to the characteristics of the physical AI chip. In some examples, the fine-tuning at 712 may be based ontraining data 709. -
FIG. 8 illustrates a diagram of an example process of fine tuning in accordance with various examples described herein. In some examples, afine tuning process 800 may include accessing trained weights at 802. For example, accessing trained weights may include accessing the updated weights and biases fromblock 710 or any of thelinear transformation operations FIG. 7 ). In another example, accessing training, weights may include accessing the updated weights and biases from one or more units in thetraining network 101, such asconvolution quantization unit 106 or activation quantization unit 108 (inFIG. 1 ). - The
process 800 may further perform shift-based quantization on the access weights at 804. Shift-based quantization may mimic the characteristics of a hardware chip because shift registers are commonly available inside a chip. In some examples, the weights and biases are updated based on a shift value. The shift value may be an integer. For example, -
- where WQ and bQ are the quantized weights and biases, and nbit represents the maximum allowed value in the physical AI chip. In some examples, the weights and biases are updated for one or more convolution layers in a CNN model.
- With further reference to
FIG. 8 , theprocess 800 may further include determining the output of the CNN model based on the quantized weights at 808 and determining a change of weights at 810. Determining the output of the AI model at 808 may include inferring the AI model using thetraining data 809 and the linear transformed weights from one or more operations 704-710 (inFIG. 7 ). Determining the output of the AI model may be implemented in a CPU, GPU or inside an AI chip (physical or virtual). Theprocess 800 may further include updating the weights at 812 based on the change of weights, and repeating the process until a stopping criteria is met at 814. Thetraining data 809 may be obtained from training data 709 (inFIG. 7 ) and similar to the training data 209 (inFIG. 2 ). - Determining the change of weights at 810 and updating the weights at 812 may include a similar training process as in
FIGS. 2 and 4 , in which the loss function may be similarly defined and the change of weights may also be similarly determined. For example, blocks 808, 810, 812 may be implemented using a gradient descent method. A loss function may be defined as: -
- where yi is the prediction of the network, e.g., the output of the CNN based on the ith training instance. In a non-limiting example, if the CNN output includes two image labels (e.g., dog or cat), then yi may have the value of 0 or 1. N is the number of training instances in the training data set. The probability p(yi) of a training instance being yi and may be determined from the training. In other words, the loss function H( ) may be defined based on a sum of loss values over a plurality of training instances n the training data set, wherein the loss value of each of the plurality of training instances is a difference between an output of the CNN model for the training instance and a ground truth of the training instance.
- In some examples, the gradient descent may be used to determine a change of weights
-
ΔW=ƒ(W Q t) - by minimizing the loss function H( ), where WQ t stands for the quantized weights at time t. In other words, WQ t=Q(Wt). The process may update the weight from a previous iteration based on the change of weight, e.g., Wt+1=Wt+ΔW, where Wt and Wt+1 stand for the weights in a preceding iteration and the weights in the current iteration, respectively. In some examples, the weights (or updated weights) in each iteration, such as Wt and Wt+1, may be stored in floating point. The quantized weights WQ t at each iteration t may be stored in fixed point. In some examples, the gradient descent may include known methods, such as stochastic gradient descent method.
- The stopping criteria may defined in a similar fashion as in
FIGS. 2 and 4 . For example, in determining whether a stopping criteria has been met, theprocess 800 may count the number of iterations and determine whether the number of iterations has exceeded a maximum iteration number. The maximum iteration may be set to a suitable number, such as 100, 200, or 1000, or 10,000, of an empirical number. In some examples, determining whether a stopping criteria has been met may also determine whether a value of the loss function at the current iteration is greater than a value of the loss function at a preceding iteration. If the value of the loss function increases, theprocess 800 may determine that the iterations are diverting and determine to stop the iterations. - In some examples, the
process 800 may be implemented entirely on a desktop using a CPU or a GPU. Alternatively, certain operations in theprocess 800 may be implemented in a physical AI chip, where the trained weights or updated weights are uploaded inside the AI chip. Once the stopping criteria is met at 814, theprocess 800 may store the updated weights at 816. - Returning to
FIG. 7 , theprocess 700 may further include uploading the weights to the AI chip at 716. For example, the weights uploaded to the AI chip may be trained and fine-tuned frombox 712, and/or any of the operations 704-710 or a combination thereof. Uploading the weights to the AI chip may include uploading the updated weights and biases of the CNN model to the AI chip so that the AI chip may be capable of performing an AI task. Once the trained/updated weights are uploaded to the AI chip, theprocess 700 may further include executing the AI chip to perform an AI task at 718 in a real-time application, and outputting the result of the AI task at 720. An example of an AI task may include recognizing, one or more classes of object from an input image, such as a crying or smiley face. - In an example application, an AI chip may be installed in a camera and store the trained weights and/or other parameters of the CNN model, such as those trained/quantized/updates weights generated in any of units in the training network 101 (in
FIG. 1 ) or any of the processes 200 (FIG. 2 ), 400 (FIG. 4 ), 600 (FIG. 6A ), 700 (FIG. 7 ) or 800 (FIG. 8 ). The AI chip may be configured to receive a captured image from the camera, perform an image recognition task based on the captured image and the stored CNN model, and present the recognition result on an output device, such as a display. For example, the camera may display, via a user interface, the recognition result. In a face recognition application, the CNN model may be trained for face recognition. A captured image may include one or more facial images associated with one or more persons. The recognition result may include the names associated with each input facial image. The camera may present the output of the recognition result on an output device, such as a display. For example, the user interface may display a person's name next to or overlaid on each of the input facial image associated with the person. - It is appreciated that the disclosures of various embodiments in
FIGS. 1-8 may vary. For example, the number of iterations inprocess 200 inFIG. 2 ,process 400 inFIG. 4 , andprocess 800 inFIG. 8 may vary and may be independent. In other examples, the quantization of weights at 204 inFIGS. 2 and 804 inFIG. 8 may be interchangeable. In other examples, the quantization ofactivation layer 404 inFIG. 4 may be independent from quantization ofweights 204 inFIGS. 2 and 804 inFIG. 8 in a training process. In other examples, in a training process, such asprocess 800 inFIG. 8 , quantizing weights at 804 may be optional, while determining the output of the CNN at 808 may be based on the accessed trainedweights 802 inFIG. 8 . Alternatively, one or more processes 200 (inFIG. 2 ), 400 (inFIGS. 4 ) and 800 (inFIG. 8 ) may be combined. For example, a combined process may perform quantization of activation layer (e.g., 404 inFIG. 4 ) and quantization of weights (e.g., 204 inFIG. 2 ) in a single training process. Similarly, a training process, such as 200 (inFIG. 2 ), 400 (inFIG. 4 ) or 800 (inFIG. 8 ) may be performed multiple times, each using a separate training set. Further, the operations in processes 200 (inFIG. 2 ), 400 (inFIG. 4 ), 600 (inFIG. 6A ), 700 (inFIG. 7 ) and 800 (inFIG. 8 ) may be performed entirely on a CPU/GPU processor. Alternatively, certain operations in these processes may be performed on an AI chip. It is appreciated that other variations may be possible. -
FIG. 9 depicts an example of internal hardware that may be included in any electronic device or computing system for implementing various methods in the embodiments described inFIGS. 1-8 . Anelectrical bus 900 serves as an information highway interconnecting the other illustrated components of the hardware.Processor 905 is a central processing device of the system, configured to perform calculations and logic operations required to execute programming instructions. As used in this document and in the claims, the terms “processor” and “processing device” may refer to a single processor or any number of processors in a set of processors that collectively perform a process, whether a central processing unit (CPU) or a graphics processing unit (GPU) or a combination of the two. Read only memory (ROM), random access memory (RAM), flash memory, hard drives, and other devices capable of storing electronic data constitute examples of memory devices 925. A memory device, also referred to as a computer-readable medium, may include a single device or a collection of devices across which data and/or instructions are stored. - An
optional display interface 930 may permit information from thebus 900 to be displayed on adisplay device 935 in visual, graphic, or alphanumeric format. An audio interface and audio output (such as a speaker) also may be provided. Communication with external devices may occur usingvarious communication ports 940 such as a transmitter and/or receiver, antenna, an RFID tag and/or short-range, or near-field communication circuitry. Acommunication port 940 may be attached to a communications network, such as the Internet, a local area network, or a cellular telephone data network. - The hardware may also include a
user interface sensor 945 that allows for receipt of data frominput devices 950 such as a keyboard, a mouse, a joystick, a touchscreen, a remote control, a pointing device, a video input device, and/or an audio input device, such as a microphone. Digital image flames may also be received from animaging capturing device 955 such as a video or camera that can either be built-in or external to the system. Otherenvironmental sensors 960, such as a GPS system and/or a temperature sensor, may be installed on system and communicatively accessible by theprocessor 905, either directly or via thecommunication ports 940. Thecommunication ports 940 may also communicate with the AI chip to upload or retrieve data to/from the chip. For example, a trained AI model with updated quantized weights obtained from the training system 100 (FIG. 1 ), or the processes 200 (FIG. 2 ), 400 (FIG. 4 ), 600 (FIG. 6A ), 700 (FIG. 7 ) or 800 (FIG. 8 ) may be shared by one or more processing devices on the network running other training processes or AI applications. For example, a device on the network may receive the trained AI model from the network and upload the trained weights, to an AI chip for performing an AI task via thecommunication port 940 and an SDK (software development kit). Thecommunication port 940 may also communicate with any other interface circuit or device that is designed for communicating with an integrated circuit. - Optionally, the hardware may not need to include a memory, but instead programming instructions are run on one or more virtual machines or one or more containers on a cloud. For example, the various methods illustrated above may be implemented by a server on a cloud that includes multiple virtual machines, each virtual machine having an operating system, a virtual disk, virtual network and applications, and the programming instructions for implementing various functions in the robotic system may be stored on one or more of those virtual machines on the cloud.
- Various embodiments described above may be implemented and adapted to various applications. For example, the AI chip having a CNN architecture may be residing in an electronic mobile device. The electronic mobile device may use the built-in AI chip to produce recognition results and generate performance values. In some scenarios, training the CNN model can be performed in the mobile device itself, where the mobile device retrieves training data from a dataset and uses the built-in AI chip to perform the training. In other scenarios, the processing device may be a server device in the communication network (e.g., 102 in
FIG. 1 or may be on the cloud. These are only examples of applications in which an AI task can be performed in the AI chip. - The various systems and methods disclosed in this patent document provide advantages over the prior art, whether implemented standalone or combined. For example, using the systems and methods described in
FIGS. 1-9 may help obtain an optimal AI model that may be executed in a physical AI chip with a performance close to an expected performance in the training process by mimicking the hardware configuration in the training process. Further, the quantization of weights and output values of one or more convolution layers may use various methods. The configuration of the training process described herein may facilitate both forward and backward propagations that would take advantage of classical training algorithms, such as gradient decent, in training weights of an AI model. Above illustrated embodiments are described in the context of training a CNN model for an AI chip (physical or virtual), but can also be applied to various other applications, For example, the current solution is not limited to implementing the CNN but can also be applied to other algorithms or architectures inside an AI chip. - It will be readily understood that the components of the present solution as generally described herein and illustrated in the appended figures could be arranged and designed in a wide variety of different configurations. Thus, the detailed description of various implementations, as represented herein and in the figures, is not intended to limit the scope of the present disclosure, but is merely representative of various implementations. While the various aspects of the present solution are presented in drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
- The present solution may be embodied in other specific forms without departing from its spirit or essential, characteristics. The described embodiments are to be considered in all respects only as illustrative and not restrictive. The scope of the present solution is, therefore, indicated by the appended claims rather than by this detailed description. All changes which come within the meaning and range of equivalency of the claims are to be embraced within their scope.
- Reference throughout this specification to features, advantages, or similar language does not imply that all of the features and advantages that may be realized with the present solution should be or are in any single embodiment thereof. Rather, language referring to the features and advantages is understood to mean that a specific feature, advantage, or characteristic described in connection with an embodiment is included in at least one embodiment of the present solution. Thus, discussions of the features and advantages, and, similar language, throughout the specification may, but do not necessarily, refer to the same embodiment.
- Furthermore, the described features, advantages, and characteristics of the present solution may be combined in any suitable manner in one or more embodiments. One ordinarily skilled in the relevant art will recognize, in light, of the description herein, that the present solution can be practiced without one or more of the specific features or advantages of a particular embodiment. In other instances, additional features and advantages may be recognized in certain embodiments that may not be present in all embodiments of the present solution.
- Other advantages can be apparent to those skilled in the art from the foregoing specification. Accordingly, it will be recognized by those skilled in the art that changes, modifications, or combinations may be made to the above-described embodiments without departing from the broad inventive concepts of the invention. It should therefore be understood that the present solution is not limited to the particular embodiments described herein, but is intended to include all changes, modifications, and all combinations of various embodiments that are within the scope and spirit of the invention as defined in the claims.
Claims (20)
1. A system comprising,
a processor; and
non-transitory computer readable medium contain programming instructions that, when executed, will cause the processor to:
access eights of a convolution neural network (CNN) model;
perform one or more linear transformations on the weights;
perform a output equalization operation to update the weights of the CNN model to cause output of one or more convolution layers of the CNN model to be equalized; and
upload the updated weights of the CNN model to an artificial intelligence (AI) chip capable of executing an AI task.
2. The system of claim 1 , wherein the programming instructions for performing one or more linear transformations comprise programming instructions configured to perform one or more operations of:
performing a batch normalization merge;
performing an image mean merge; or
performing an image scale merge.
3. The system of claim 1 , wherein the programming instructions for performing the output equalization operation comprise programming instructions configured to:
based on a training image set, use the weights of the CNN model to determine a first maximum output value of a first convolution layer of the CNN model and determine a second maximum, output value of a second convolution layer of the CNN model; and
update the weights of the second layer of the CNN model based on the first and second maximum output values.
4. The system of claim 3 , wherein each convolution layer of the CNN model comprises a bias value, and the programming instructions for performing the gain edition operation also comprise programming instructions configured to:
update the bias value of the second. convolution layer based on the second maximum value and a bit-size of the second convolution layer corresponding to a convolution layer of the AI chip.
5. The system of claim 1 further comprising additional programming instructions configured to, before uploading the updated weights to the AI chip, perform a fine-tuning operation comprising:
accessing the updated weights of the CNN model from the output equalization operation;
in one or more iterations until a stopping criteria is met, performing operations comprising:
performing shift-based quantization to quantize the updated weights of the CNN model;
determining output of the AI model based on the quantized weights of the CNN model and a training data set;
determining a change of weights based on the output of the CNN model; and
updating the weights of the CNN model based on the change of weights.
6. The system of claim 5 , wherein programming instructions for performing the shift-based quantization comprise programing instructions configured to:
determine a shift value for a convolution layer of the CNN model corresponding to a convolution layer of the AI chip, based on a bit-size of the corresponding convolution layer of the AI chip and a maximum value of the weights of the CNN model; and
quantize the updated weights of the convolution layer of the CNN model based on the determined shift value.
7. The system of claim 5 , wherein the programming instructions for determining the change of weights of the CNN model comprise using a gradient descent method, wherein a loss function in the gradient descent method is based on a sum of loss values over a plurality of training instances in the training data set, wherein the loss value of each of the plurality of training instances is a difference between the quantized output of the CNN model for the training instance and a ground truth of the training instance.
8. The system of claim 1 further comprising additional programming instructions configured to cause the AI chip to;
perform the AI task to generate output of the AI task; and
presenting the output of the AI task on an output device;
wherein the updated weights of the CNN model are uploaded into an embedded cellular neural network architecture in the AI chip.
9. A method comprising, at a processing device:
accessing weights of a convolution neural network (CNN) model;
performing one or more linear transformations on the weights;
performing a output equalization operation to update the weights of the CNN model to cause output of one or more convolution layers of the CNN model to be equalized; and
uploading the updated weights of the CNN model to an artificial intelligence (AI) system comprising an AI chip capable of executing an AI task; and
at the AI system:
causing the AI chip to perform the AI task to generate output of the AI task; and
presenting the output of the AI task on an output device;
wherein the updated weights of the CNN model are uploaded into an embedded cellular neural network architecture in the AI chip.
10. The method of claim 9 , wherein performing the linear transformations comprises performing one or more operations comprising:
performing a batch normalization merge;
performing an image mean merge; and
performing an image scale merge.
11. The method of claim 9 , wherein performing the output equalization operation comprises:
based on a training image set, using the weights of the CNN model to determine a first maximum output value of a first convolution layer of the CNN model and determine a second maximum output value of a second convolution layer of the CNN model; and
updating the weights of the second convolution layer of the CNN model based on the first and second maximum output values.
12. The method of claim 11 , wherein each convolution layer of the CNN model comprises a bias value, and performing the gain edition operation also comprises:
updating the bias value of the second convolution layer based on the second maximum value and a bit-size of the second convolution layer corresponding to a convolution layer of the AI chip.
13. The method of claim 9 further comprising, before uploading the updated weights to the AI chip:
accessing the updated weights of the CNN model from the output equalization operation; and
in one or more iterations until a stopping criteria is met, performing operations comprising:
performing shift-based quantization to quantize the updated weights of the CNN model;
determining output of the AI model based on the quantized weights of the CNN model and a training data set;
determining a change of weights based on the output of the CNN model; and
updating the weights of the CNN model based on the change of weights.
14. The method of claim 13 , wherein perforating the shift-based quantization comprises:
determining a shift value for a convolution layer of the CNN model corresponding to a convolution layer of the AI chip, based on a bit-size of the corresponding convolution layer of the AI chip and a maximum value of the weights of the CNN model; and
quantizing weights of the convolution layer of the CNN model based on the determined shift value.
15. The method of claim 13 , wherein determining the change of weights comprises using a gradient descent method, wherein a loss function in the gradient descent method is based on a sum of loss values over a plurality of training instances in the training data set, wherein the loss value of each of the plurality of training instances is a difference between the quantized output of the CNN model for the training instance and a ground truth of the training instance.
16. A method comprising, at a processing device:
accessing weights of a convolution neural network (CNN) model;
performing one or more linear transformations on the weights, the linear transformations comprising performing one or more operations comprising:
performing a batch normalization merge;
performing an image mean merge; and
performing an image scale merge;
performing a output equalization operation to update the weights of the CNN model by updating the weights of a first convolution layer of the CNN model based on statistical output values of the first convolution layer and a second convolution layer preceding the first convolution layer based on a training image set; and
uploading the updated weights of the CNN model to an artificial intelligence (AI) system comprising an AI chip capable of executing an AI task.
17. The method of claim 16 further comprising, at the AI system:
causing the AI chip to perform the AI task to generate output of the AI task; and
presenting the output of the AI task on an output device;
wherein the updated weights of the CNN model are uploaded into an embedded cellular neural network architecture in the AI chip.
18. The method of claim 16 , wherein, performing the output equalization operation comprises:
based on the training image set, using the weights of the CNN model to determine a first maximum output value of the first convolution layer and determine a second maximum output value of the second convolution layer; and
updating the weights of the first convolution layer of the CNN model based on the first and second maximum output values.
19. The method of claim 18 , wherein each convolution layer of the CNN model comprises, a bias value, and performing the output equalization operation also comprises:
updating the bias value of the second convolution layer based on the second maximum value and a bit-size of the second convolution layer corresponding to a convolution layer of the AI chip.
20. The method of claim 16 further comprising, before uploading the updated weights to the AI chip:
accessing the updated weights of the CNN model form the output equalization operation; and
in one or more iterations until a stopping criteria is met, performing operations comprising:
performing shift-based quantization on the weights of the CNN model;
determining output of the AI model based on the updated weights of the CNN model and a training data set;
determining a change of weights based on the output of the CNN model; and
updating the weights of the CNN model based on the change of weights.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US16/586,432 US20200302288A1 (en) | 2019-03-20 | 2019-09-27 | Using output equalization in training an artificial intelligence model in a semiconductor solution |
Applications Claiming Priority (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US201962821437P | 2019-03-20 | 2019-03-20 | |
US201962830269P | 2019-04-05 | 2019-04-05 | |
US16/586,432 US20200302288A1 (en) | 2019-03-20 | 2019-09-27 | Using output equalization in training an artificial intelligence model in a semiconductor solution |
Publications (1)
Publication Number | Publication Date |
---|---|
US20200302288A1 true US20200302288A1 (en) | 2020-09-24 |
Family
ID=72514570
Family Applications (3)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US16/586,500 Abandoned US20200302276A1 (en) | 2019-03-20 | 2019-09-27 | Artificial intelligence semiconductor chip having weights of variable compression ratio |
US16/586,432 Abandoned US20200302288A1 (en) | 2019-03-20 | 2019-09-27 | Using output equalization in training an artificial intelligence model in a semiconductor solution |
US16/586,467 Active 2041-04-28 US11475298B2 (en) | 2019-03-20 | 2019-09-27 | Using quantization in training an artificial intelligence model in a semiconductor solution |
Family Applications Before (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US16/586,500 Abandoned US20200302276A1 (en) | 2019-03-20 | 2019-09-27 | Artificial intelligence semiconductor chip having weights of variable compression ratio |
Family Applications After (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US16/586,467 Active 2041-04-28 US11475298B2 (en) | 2019-03-20 | 2019-09-27 | Using quantization in training an artificial intelligence model in a semiconductor solution |
Country Status (1)
Country | Link |
---|---|
US (3) | US20200302276A1 (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20200250523A1 (en) * | 2019-02-05 | 2020-08-06 | Gyrfalcon Technology Inc. | Systems and methods for optimizing an artificial intelligence model in a semiconductor solution |
CN114580630A (en) * | 2022-03-01 | 2022-06-03 | 厦门大学 | Neural network model training method and graph classification method for AI chip design |
US11354579B2 (en) | 2019-07-15 | 2022-06-07 | Microsoft Technology Licensing, Llc | Dynamic multi-layer execution for artificial intelligence modeling |
KR20220093739A (en) * | 2020-12-28 | 2022-07-05 | 경희대학교 산학협력단 | Device performing AI inference through quantization and batch folding |
US11436019B2 (en) * | 2019-07-15 | 2022-09-06 | Microsoft Technology Licensing, Llc | Data parallelism in distributed training of artificial intelligence models |
US11520592B2 (en) | 2019-07-15 | 2022-12-06 | Microsoft Technology Licensing, Llc | Executing large artificial intelligence models on memory-constrained devices |
WO2023129347A1 (en) * | 2021-12-31 | 2023-07-06 | Snap Inc. | Fixed-point multiplication for network quantization |
US11704555B2 (en) * | 2019-06-24 | 2023-07-18 | Baidu Usa Llc | Batch normalization layer fusion and quantization method for model inference in AI neural network engine |
Families Citing this family (25)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018176000A1 (en) | 2017-03-23 | 2018-09-27 | DeepScale, Inc. | Data synthesis for autonomous control systems |
US11409692B2 (en) | 2017-07-24 | 2022-08-09 | Tesla, Inc. | Vector computational unit |
US11893393B2 (en) | 2017-07-24 | 2024-02-06 | Tesla, Inc. | Computational array microprocessor system with hardware arbiter managing memory requests |
US10671349B2 (en) | 2017-07-24 | 2020-06-02 | Tesla, Inc. | Accelerated mathematical engine |
US11157441B2 (en) | 2017-07-24 | 2021-10-26 | Tesla, Inc. | Computational array microprocessor system using non-consecutive data formatting |
CN108228696B (en) * | 2017-08-31 | 2021-03-23 | 深圳市商汤科技有限公司 | Face image retrieval method and system, shooting device and computer storage medium |
US11561791B2 (en) | 2018-02-01 | 2023-01-24 | Tesla, Inc. | Vector computational unit receiving data elements in parallel from a last row of a computational array |
US11215999B2 (en) | 2018-06-20 | 2022-01-04 | Tesla, Inc. | Data pipeline and deep learning system for autonomous driving |
US11361457B2 (en) | 2018-07-20 | 2022-06-14 | Tesla, Inc. | Annotation cross-labeling for autonomous control systems |
US11636333B2 (en) | 2018-07-26 | 2023-04-25 | Tesla, Inc. | Optimizing neural network structures for embedded systems |
US11562231B2 (en) | 2018-09-03 | 2023-01-24 | Tesla, Inc. | Neural networks for embedded devices |
CN113039556B (en) | 2018-10-11 | 2022-10-21 | 特斯拉公司 | System and method for training machine models using augmented data |
US11196678B2 (en) | 2018-10-25 | 2021-12-07 | Tesla, Inc. | QOS manager for system on a chip communications |
US11816585B2 (en) | 2018-12-03 | 2023-11-14 | Tesla, Inc. | Machine learning models operating at different frequencies for autonomous vehicles |
US11537811B2 (en) | 2018-12-04 | 2022-12-27 | Tesla, Inc. | Enhanced object detection for autonomous vehicles based on field view |
US11610117B2 (en) | 2018-12-27 | 2023-03-21 | Tesla, Inc. | System and method for adapting a neural network model on a hardware platform |
US10997461B2 (en) | 2019-02-01 | 2021-05-04 | Tesla, Inc. | Generating ground truth for machine learning from time series elements |
US11150664B2 (en) | 2019-02-01 | 2021-10-19 | Tesla, Inc. | Predicting three-dimensional features for autonomous driving |
US11567514B2 (en) | 2019-02-11 | 2023-01-31 | Tesla, Inc. | Autonomous and user controlled vehicle summon to a target |
US10956755B2 (en) | 2019-02-19 | 2021-03-23 | Tesla, Inc. | Estimating object properties using visual image data |
JP7272121B2 (en) * | 2019-06-07 | 2023-05-12 | 富士通株式会社 | Arithmetic processing device, control method, and control program |
WO2021036908A1 (en) * | 2019-08-23 | 2021-03-04 | 安徽寒武纪信息科技有限公司 | Data processing method and apparatus, computer equipment and storage medium |
KR102657904B1 (en) * | 2020-05-12 | 2024-04-17 | 한국전자통신연구원 | Method and apparatus for multi-level stepwise quantization for neural network |
CN113177638B (en) * | 2020-12-11 | 2024-05-28 | 联合微电子中心有限责任公司 | Processor and method for generating binarized weights for neural networks |
CN114900190A (en) * | 2022-04-24 | 2022-08-12 | 国网安徽省电力有限公司 | Multi-target fusion differential protection data compression method |
Family Cites Families (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10163061B2 (en) * | 2015-06-18 | 2018-12-25 | International Business Machines Corporation | Quality-directed adaptive analytic retraining |
US11100388B2 (en) * | 2016-11-22 | 2021-08-24 | International Business Machines Corporation | Learning apparatus and method for learning a model corresponding to real number time-series input data |
US11195096B2 (en) * | 2017-10-24 | 2021-12-07 | International Business Machines Corporation | Facilitating neural network efficiency |
US11429862B2 (en) * | 2018-03-20 | 2022-08-30 | Sri International | Dynamic adaptation of deep neural networks |
US11551077B2 (en) * | 2018-06-13 | 2023-01-10 | International Business Machines Corporation | Statistics-aware weight quantization |
KR102621118B1 (en) * | 2018-11-01 | 2024-01-04 | 삼성전자주식회사 | Encoding apparatus and method of image using quantization table adaptive to image |
US11334801B2 (en) * | 2018-11-13 | 2022-05-17 | Gyrfalcon Technology Inc. | Systems and methods for determining an artificial intelligence model in a communication system |
US20200151558A1 (en) * | 2018-11-13 | 2020-05-14 | Gyrfalcon Technology Inc. | Systems and methods for updating an artificial intelligence model by a subset of parameters in a communication system |
US10901896B2 (en) * | 2018-11-27 | 2021-01-26 | International Business Machines Corporation | Cached result use through quantum gate rewrite |
US20200234119A1 (en) * | 2019-01-17 | 2020-07-23 | Gyrfalcon Technology Inc. | Systems and methods for obtaining an artificial intelligence model in a parallel configuration |
US11068784B2 (en) * | 2019-01-26 | 2021-07-20 | Mipsology SAS | Generic quantization of artificial neural networks |
US20200250523A1 (en) * | 2019-02-05 | 2020-08-06 | Gyrfalcon Technology Inc. | Systems and methods for optimizing an artificial intelligence model in a semiconductor solution |
US20200293856A1 (en) * | 2019-03-14 | 2020-09-17 | Gyrfalcon Technology Inc. | Implementing residual connection in a cellular neural network architecture |
US20200293865A1 (en) * | 2019-03-14 | 2020-09-17 | Gyrfalcon Technology Inc. | Using identity layer in a cellular neural network architecture |
US11475308B2 (en) * | 2019-03-15 | 2022-10-18 | Samsung Electronics Co., Ltd. | Jointly pruning and quantizing deep neural networks |
US20200311541A1 (en) * | 2019-03-28 | 2020-10-01 | International Business Machines Corporation | Metric value calculation for continuous learning system |
-
2019
- 2019-09-27 US US16/586,500 patent/US20200302276A1/en not_active Abandoned
- 2019-09-27 US US16/586,432 patent/US20200302288A1/en not_active Abandoned
- 2019-09-27 US US16/586,467 patent/US11475298B2/en active Active
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20200250523A1 (en) * | 2019-02-05 | 2020-08-06 | Gyrfalcon Technology Inc. | Systems and methods for optimizing an artificial intelligence model in a semiconductor solution |
US11704555B2 (en) * | 2019-06-24 | 2023-07-18 | Baidu Usa Llc | Batch normalization layer fusion and quantization method for model inference in AI neural network engine |
US11354579B2 (en) | 2019-07-15 | 2022-06-07 | Microsoft Technology Licensing, Llc | Dynamic multi-layer execution for artificial intelligence modeling |
US11436019B2 (en) * | 2019-07-15 | 2022-09-06 | Microsoft Technology Licensing, Llc | Data parallelism in distributed training of artificial intelligence models |
US11520592B2 (en) | 2019-07-15 | 2022-12-06 | Microsoft Technology Licensing, Llc | Executing large artificial intelligence models on memory-constrained devices |
KR20220093739A (en) * | 2020-12-28 | 2022-07-05 | 경희대학교 산학협력단 | Device performing AI inference through quantization and batch folding |
KR102505043B1 (en) | 2020-12-28 | 2023-03-02 | 경희대학교 산학협력단 | Device performing AI inference through quantization and batch folding |
WO2023129347A1 (en) * | 2021-12-31 | 2023-07-06 | Snap Inc. | Fixed-point multiplication for network quantization |
CN114580630A (en) * | 2022-03-01 | 2022-06-03 | 厦门大学 | Neural network model training method and graph classification method for AI chip design |
Also Published As
Publication number | Publication date |
---|---|
US20200302289A1 (en) | 2020-09-24 |
US11475298B2 (en) | 2022-10-18 |
US20200302276A1 (en) | 2020-09-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11475298B2 (en) | Using quantization in training an artificial intelligence model in a semiconductor solution | |
US11875268B2 (en) | Object recognition with reduced neural network weight precision | |
US11373087B2 (en) | Method and apparatus for generating fixed-point type neural network | |
CN110084281B (en) | Image generation method, neural network compression method, related device and equipment | |
US20210004663A1 (en) | Neural network device and method of quantizing parameters of neural network | |
US11657254B2 (en) | Computation method and device used in a convolutional neural network | |
US12026611B2 (en) | Method and apparatus for quantizing parameters of neural network | |
US20180350109A1 (en) | Method and device for data quantization | |
US11507829B2 (en) | Greedy approach for obtaining an artificial intelligence model in a parallel configuration | |
US20200320385A1 (en) | Using quantization in training an artificial intelligence model in a semiconductor solution | |
US20190147322A1 (en) | Method and apparatus for quantizing artificial neural network | |
JP2020009444A (en) | Method and apparatus of processing parameter in neural network | |
US20200151558A1 (en) | Systems and methods for updating an artificial intelligence model by a subset of parameters in a communication system | |
CN113326930B (en) | Data processing method, neural network training method, related device and equipment | |
CN110766063A (en) | Image classification method based on compressed excitation and tightly-connected convolutional neural network | |
US11429853B2 (en) | Systems and methods for determining an artificial intelligence model in a communication system | |
US20230042954A1 (en) | Method and apparatus with floating point processing | |
US20240095522A1 (en) | Neural network generation device, neural network computing device, edge device, neural network control method, and software generation program | |
US11334801B2 (en) | Systems and methods for determining an artificial intelligence model in a communication system | |
US20200293865A1 (en) | Using identity layer in a cellular neural network architecture | |
CN111401546A (en) | Training method of neural network model, medium thereof, and electronic device | |
US20200250523A1 (en) | Systems and methods for optimizing an artificial intelligence model in a semiconductor solution | |
US11335045B2 (en) | Combining feature maps in an artificial intelligence semiconductor solution | |
CN114945105B (en) | Wireless earphone audio hysteresis cancellation method combined with sound compensation | |
US20220058487A1 (en) | Electronic apparatus and method for controlling thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
STPP | Information on status: patent application and granting procedure in general |
Free format text: DOCKETED NEW CASE - READY FOR EXAMINATION |
|
AS | Assignment |
Owner name: GYRFALCON TECHNOLOGY INC., CALIFORNIA Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNORS:REN, YONGXIONG;FAN, YI;ZHANG, YEQUN;AND OTHERS;REEL/FRAME:060052/0256 Effective date: 20190924 |
|
STPP | Information on status: patent application and granting procedure in general |
Free format text: NON FINAL ACTION MAILED |
|
STCB | Information on status: application discontinuation |
Free format text: ABANDONED -- FAILURE TO RESPOND TO AN OFFICE ACTION |