IP Library Granted Patent US 10,832,123
Granted Patent B2
US 10,832,123 · App. 15/390,660 · Granted Nov 10, 2020

Compression of deep neural networks with proper use of mask

Inventors: Shijie Sun (Beijing, CN); Song Han (Beijing, CN); Xin Li (Beijing, CN); Yi Shan (Beijing, CN)
Assignee: XILINX TECHNOLOGY BEIJING LIMITED
G06N3/0445G06N3/0454G06N3/082
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 10,832,123
App. No.
15/390,660
Granted
Nov 10, 2020
Kind
B2
Abstract

The present invention relates to artificial neural networks, for example, deep neural networks. In particular, the present invention relates to a compression method for deep neural networks with proper use of mask and the device thereof. More specifically, the present invention relates to how to compress dense neural networks into sparse neural networks while maintaining or even improving the accuracy of the neural networks after compression.

Claims (41)

1. A method for compressing a neural network nnet 0 with a mask matrix, said neural network is characterized by a plurality of matrices, said method comprising:

mask matrix obtaining step of obtaining a mask matrix M, wherein said mask matrix M records the distribution of non-zero elements in a plurality of sparse matrices of the neural network;

first pruning step of pruning the neural network nnet 0 using said mask matrix M to obtain a pruned neural network nnet i 1 ;

first retraining step of retraining the pruned neural network nnet i 1 that has a shape of the mask matrix without a mask, wherein the pruned neural network nnet i 1 is retrained without using said mask matrix M to obtain a dense neural network nnet o 1 ;

second pruning step of pruning said dense neural network nnet o 1 using said mask matrix M to obtain a sparse neural network nnet i 2 ;

second retraining step of retraining said sparse neural network nnet i 2 using said mask matrix M to obtain a final neural network nnet o 2 .

2. The method of claim 1 , wherein said mask matrix obtaining step further includes:

pruning said neural network to be compressed nnet 0 to obtain a plurality of sparse matrices containing zero and non-zero elements;

obtaining said mask matrix M by using elements “1” to represent non-zero elements in corresponding sparse matrix.

3. The method of claim 1 , wherein said first pruning step further includes:

point multiplying said neural network to be compressed nnet 0 with said mask matrix M to obtain said pruned neural network nnet i 1 : nnet i 1 =M ⊚ nnet 0 .

4. The method of claim 1 , wherein said first retraining step further includes:

training step, for training said pruned neural network nnet i 1 using a training dataset and updating a weight matrix of the neural network to generate an updated weight matrix without using said mask matrix M;

deciding step, for determining whether the updated weight matrix has converged;

if not, returning to said training step; and

if yes, the resultant neural network is regarded as said dense neural network nnet o 1 .

5. The method according to claim 4 , wherein said training step further includes:

inputting said training dataset and calculating the derivative of a loss function for the neural network so as to obtain a gradient matrix;

updating the weight matrix of the neural network, wherein the updated weight matrix=weight matrix before updating− learning rate*gradient matrix;

calculating the loss of the neural network based on said updated weight matrix;

deciding whether the present iteration is valid, wherein if the loss of the present iteration is greater than that of the previous iteration, then the present iteration is invalid; and

if the loss of the present iteration is smaller than that of the previous iteration, the present iteration is valid;

if the present iteration is invalid and the total number of iterations does not reach its maximum, adjusting the learning rate and repeating the training step based on the previous valid iteration;

if the present iteration is valid, repeating said deciding step for determining whether said updated weight matrix has converged.

6. The method of claim 1 , wherein said second pruning step further includes:

point multiplying said dense neural network nnet o 1 with said mask matrix M to obtain said sparse neural network nnet i 2 : nnet i 2 =M ⊚ nnet 0 1 .

7. The method of claim 1 , wherein said second retraining step further includes:

training step, for training said sparse neural network nnet i 2 using a training dataset and updating a weight matrix of the neural network to generate an updated weight matrix using said mask matrix M;

deciding step, for determining whether the updated weight matrix has converged;

if not, returning to said training step; and

if yes, the resultant neural network is regarded as said final neural network nnet o 2 .

8. The method according to claim 7 , wherein said training step further includes:

inputting said training dataset and calculating the derivative of a loss function for the neural network so as to obtain a gradient matrix;

updating the weight matrix of the neural network, wherein the updated weight matrix=weight matrix before updating− learning rate*gradient matrix*said mask matrix;

calculating the loss of the neural network based on said updated weight matrix;

deciding whether the present iteration is valid, wherein if the loss of the present iteration is greater than that of the previous iteration, then the present iteration is invalid; and

if the loss of the present iteration is smaller than that of the previous iteration, the present iteration is valid;

if the present iteration is invalid and the total number of iterations does not reach its maximum, adjusting the learning rate and repeating the training step based on the previous valid iteration;

if the present iteration is valid, repeating said deciding step for determining whether said updated weight matrix has converged.

9. The method according to claim 1 , wherein said mask matrix M contains elements “0” and “1”, wherein:

elements “1” mean that elements in corresponding position of a weight matrix of the neural network are remained, while elements “0” mean that elements in corresponding position of the weight matrix are set to zero.

Assignments (5)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Aug 24, 2020
From: BEIJING DEEPHI INTELLIGENT TECHNOLOGY CO., LTD.
To: XILINX TECHNOLOGY BEIJING LIMITED
Reel/Frame 053581/0037 →
CORRECTIVE ASSIGNMENT TO CORRECT THE ASSIGNEE'S NAME PREVIOUSLY RECORDED AT REEL: 040777 FRAME: 0446. ASSIGNOR(S) HEREBY CONFIRMS THE ASSIGNMENT. Recorded Mar 8, 2018
From: SUN, SHIJIE; HAN, SONG; LI, XIN
To: BEIJING DEEPHI INTELLIGENT TECHNOLOGY CO., LTD.
Reel/Frame 045529/0051 →
CORRECTIVE ASSIGNMENT TO CORRECT THE ASSIGNEE'S NAME PREVIOUSLY RECORDED AT REEL: 042158 FRAME: 0940. ASSIGNOR(S) HEREBY CONFIRMS THE ASSIGNMENT. Recorded Mar 8, 2018
From: SHAN, YI
To: BEIJING DEEPHI INTELLIGENT TECHNOLOGY CO., LTD.
Reel/Frame 045529/0361 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 27, 2017
From: SHAN, YI
To: BEIJING DEEPHI INTELLIGENCE TECHNOLOGY CO., LTD.
Reel/Frame 042158/0940 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 28, 2016
From: SUN, SHIJIE; LI, XIN; HAN, SONG
To: BEIJING DEEPHI INTELLIGENCE TECHNOLOGY CO., LTD.
Reel/Frame 040777/0446 →
Priority Claims (4)
CN 2016 1 0663175 · Aug 12, 2016 · national
CN 2016 1 0663201 · Aug 12, 2016 · national
CN 2016 1 0663563 · Aug 12, 2016 · national
CN 2016 1 1104482 · Dec 5, 2016 · national
Continuity (4)
Continuation In Part 15242625 · Aug 22, 2016
Continuation In Part 15242624 · Aug 22, 2016
Continuation In Part 15242622 · Aug 22, 2016
Related Publication 20180046915A1 · Feb 15, 2018
Cited By (1)
US 12,566,946