IP Library Granted Patent US 10,984,308
Granted Patent B2
US 10,984,308 · App. 15/390,556 · Granted Apr 20, 2021

Compression method for deep neural networks with load balance

Inventors: Xin Li (Beijing, CN); Song Han (Beijing, CN); Zhilin Lu (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,984,308
App. No.
15/390,556
Filed
Dec 26, 2016
Granted
Apr 20, 2021
Kind
B2
Examiner
MANG, VAN C
Art Unit
2126
USPC
706/25
Abstract

The present invention relates to artificial neural networks, for example, deep neural networks. In particular, the present invention relates to a compression method considering load balance for deep neural networks and the device thereof. More specifically, the present invention relates to how to compress dense neural networks into sparse neural networks in an efficient way so as to improve utilization of resources of the hardware platform.

Claims (72)

1. A method for compressing a neural network, wherein connection relations between neurons of said neural network are characterized by a plurality of matrices, said method comprising:

dividing at least one of said plurality of matrices into a plurality of submatrices;

compressing each of the plurality of submatrices into a corresponding sparse submatrix according to a compression ratio common to all of the plurality of submatrices divided from a same matrix, including, for each submatrix of the plurality of submatrices divided from the same matrix:

setting weight values of M elements of all elements of the submatrix to zero, wherein M is a positive integer, wherein M divided by a number of all the elements of the submatrix is equal to the compression ratio, and wherein if all the elements of the submatrix are arranged in a list from top to bottom in order of decreasing magnitude of weight value, then said M elements are the bottom M elements in the list; and

encoding said compressed sparse submatrices to generate encoded compressed sparse submatrices,

wherein the compression ratio is determined by:

obtaining an initial word error ratio (WER initial ) of the neural network;

obtaining the word error ratios WER d1 , WER d2 . . . WER dn of the neural network compressed according to different compression ratios d 1 , d 2 , . . . d n , respectively; and

selecting the compression ratio from said different compression ratios d 1 , d 2 , d n based on said word error ratios WER d1 , WER d2 . . . WER dn of the compressed neural network, and

wherein said selecting the compression ratio from said different compression ratios includes:

calculating respective ΔWERs, which are the differences between WER initial and WER d1 , WER d2 , . . . , WER dn ; and

selecting the maximum compression ratio among all the compression ratios with a ΔWER below a predetermined threshold.

2. The method of claim 1 , wherein dividing the at least one of said plurality of matrices into the plurality of submatrices further includes:

dividing said matrix by regularly extracting one row out of every N rows and assigning such extracted rows to one submatrix, so as to form N submatrices.

3. The method of claim 2 , wherein said N is determined by the number of processing elements used for running the neural network, and said processing elements compute in a parallel manner.

4. The method of claim 1 , wherein encoding said compressed sparse submatrices further includes:

encoding said compressed sparse submatrices using the Compressed Row Storage (CRS) or Compressed Column Storage (CCS) format.

5. The method according to claim 1 , further includes:

providing the encoded compressed sparse submatrices to a plurality of parallel processing elements.

6. A method for compressing a neural network, wherein connection relations between neurons of said neural network are characterized by a plurality of matrices, said method comprising:

dividing at least one of said plurality of matrices into a plurality of submatrices;

analyzing sensitivity of each of said plurality of matrices, so as to determine a respective initial compression ratio for each of said plurality of matrices;

compressing the plurality of submatrices of the at least one of said plurality of matrices according to its corresponding initial compression ratio, including, for each submatrix of the all submatrices divided from the same matrix:

setting weight values of M elements of all elements of the submatrix to zero, wherein M is a positive integer, wherein M divided by a number of all the elements of the submatrix is equal to the corresponding initial compression ratio, and wherein if all the elements of the submatrix are arranged in a list from top to bottom in order of decreasing magnitude of weight value, then said M elements are the bottom M elements in the list; and

fine-tuning said compressed neural network, so as to obtain a final neural network,

wherein said analyzing the sensitivity of each of said plurality of matrices includes:

obtaining an initial word error ratio (WER initial ) of the neural network;

obtaining the word error ratios WER d1 WER d2 . . . WER dn of the neural network compressed according to different compression ratios d 1 , d 2 , . . . d n , respectively; and

selecting the initial compression ratio from said different compression ratios d 1 , d 2 , . . . d n based on said word error ratios WER d1 , WER d2 . . . WER dn of the compressed neural network, and

wherein said selecting the initial compression ratio from said different compression ratios includes:

calculating respective ΔWERs, which are the differences between WER initial and WER d1 , WER d2 , . . . , WER dn ; and

selecting the maximum compression ratio among all the compression ratios with a ΔWER below a predetermined threshold.

7. The method of claim 6 , further includes:

repeating said dividing at least one of said plurality of matrices into a plurality of submatrices, said analyzing the sensitivity of each of said plurality of matrices, said compressing the plurality of submatrices of respective matrix according to its corresponding initial compression ratio and said fine-tuning said compressed neural network iteratively.

8. The method of claim 6 , wherein said neural network is LSTM neural network.

9. The method of claim 6 , wherein dividing the at least one of said plurality of matrices into the plurality of submatrices further includes:

dividing each matrix by regularly extracting one row out of every N rows and assigning such extracted rows to one submatrix, so as to form N submatrices.

10. The method of claim 9 , wherein said N is determined by the number of processing elements used for running the neural network, and said processing elements compute in a parallel manner.

11. The method of claim 6 , wherein compressing the plurality of submatrices of the respective matrix according to its corresponding initial compression ratio further includes:

adjusting said initial compression ratio of each submatrix based on the word error ratio (WER) of the neural network obtained after compressing each submatrix based on its initial compression ratio, so as to obtain an adjusted compression ratio for each submatrix;

compressing each submatrix based on corresponding adjusted compression ratio, so as to obtain said compressed neural network.

12. The method according to claim 6 , wherein fine-tuning said compressed neural network further includes:

training said compressed neural network using a training dataset and updating the weight matrix;

determining whether said weight matrix has converged;

if not, returning to said training step; and

if yes, regarding the resultant neural network as said final neural network.

13. The method according to claim 12 , wherein training said compressed neural network using the training dataset and updating the weight matrix further includes:

inputting a 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 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 training said compressed neural network based on the previous valid iteration;

if the present iteration is valid, determining whether said weight matrix has converged.

14. A method for compressing a neural network, wherein weights between neurons of said neural network are characterized by a plurality of matrices, said method comprising:

analyzing sensitivity of each of said plurality of matrices, and determining an initial compression ratio for each of said plurality of matrices;

compressing each of said plurality of matrices based on said initial compression ratio, so as to obtain a compressed neural network, including

dividing each of said plurality of matrices into a plurality of submatrices;

pruning said submatrices into sparse submatrices according to said initial compression ratio, including, for each submatrix of the all submatrices divided from the same matrix:

setting weight values of M elements of all elements of the submatrix to zero, wherein M is a positive integer, wherein M divided by a number of all the elements of the submatrix is equal to said initial compression ratio, and wherein if all the elements of the submatrix are arranged in a list from top to bottom in order of decreasing magnitude of weight value, then said M elements are the bottom M elements in the list; and

fine-tuning said compressed neural network,

wherein said analyzing the sensitivity of each of said plurality of matrices and determining the initial compression ratio for each of said plurality of matrices includes:

obtaining an initial word error ratio (WER initial ) of the neural network;

obtaining the word error ratios WER d1 , WER d2 . . . WER dn of the neural network compressed according to different compression ratios d 1 , d 2 , . . . d n , respectively; and

selecting the initial compression ratio from said different compression ratios d 1 , d 2 , . . . d n based on said word error ratios WER d1 , WER d2 . . . WER dn of the compressed neural network, and

wherein said selecting the initial compression ratio from said different compression ratios includes:

calculating respective ΔWERs, which are the differences between WER initial and WER d1 , WER d2 , . . . WER dn ; and

selecting the maximum compression ratio among all the compression ratios with a ΔWER below a predetermined threshold.

15. The method of claim 14 , further includes:

repeating said analyzing the sensitivity of each of said plurality of matrices, said compressing each of said plurality of matrices based on said initial compression ratio and said fine-tuning said compressed neural network in at least one iteration.

16. The method of claim 14 , wherein dividing each of said plurality of matrices into the plurality of submatrices further includes:

dividing each matrix by regularly extracting one row out of every N rows and assigning such extracted rows to one submatrix, so as to form N submatrices.

Assignments (7)
CORRECTIVE ASSIGNMENT TO CORRECT THE ASSIGNEE NAME ON COVER SHEET PREVIOUSLY RECORDED ON REEL 045528 FRAME 0502. ASSIGNOR(S) HEREBY CONFIRMS THE CORRECTIVE ASSIGNMENT. Recorded Mar 11, 2021
From: SHAN, YI
To: BEIJING DEEPHI INTELLIGENT TECHNOLOGY CO., LTD.
Reel/Frame 055584/0433 →
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 NAME PREVIOUSLY RECORDED AT REEL: 045528 FRAME: 0491. ASSIGNOR(S) HEREBY CONFIRMS THE CORRECTIVE ASSIGNMENT. Recorded Apr 18, 2018
From: LI, XIN; LU, ZHILIN; HAN, SONG
To: BEIJING DEEPHI INTELLIGENT TECHNOLOGY CO., LTD.
Reel/Frame 046566/0637 →
CORRECTIVE ASSIGNMENT TO CORRECT THE ASSIGNEE'S NAME PREVIOUSLY RECORDED AT REEL: 041198 FRAME: 0145. ASSIGNOR(S) HEREBY CONFIRMS THE ASSIGNMENT. Recorded Mar 8, 2018
From: SHAN, YI
To: BEIJING DEEPHI TECHNOLOGY CO., LTD.
Reel/Frame 045528/0502 →
CORRECTIVE ASSIGNMENT TO CORRECT THE ASSIGNEE'S NAME PREVIOUSLY RECORDED AT REEL: 040777 FRAME: 0331. ASSIGNOR(S) HEREBY CONFIRMS THE ASSIGNMENT. Recorded Mar 8, 2018
From: LI, XIN; LU, ZHILIN; HAN, SONG
To: BEIJING DEEPHI TECHNOLOGY CO., LTD.
Reel/Frame 045528/0491 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Feb 8, 2017
From: SHAN, YI
To: BEIJING DEEPHI INTELLIGENCE TECHNOLOGY CO., LTD.
Reel/Frame 041198/0145 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 28, 2016
From: LI, XIN; LU, ZHILIN; HAN, SONG
To: BEIJING DEEPHI INTELLIGENCE TECHNOLOGY CO., LTD.
Reel/Frame 040777/0331 →
Priority Claims (4)
CN 201610663175.X · Aug 12, 2016 · national
CN 201610663201.9 · Aug 12, 2016 · national
CN 201610663563.8 · Aug 12, 2016 · national
CN 201611105081.7 · Dec 5, 2016 · national
Continuity (4)
Continuation In Part 15242622 · Aug 22, 2016
Continuation In Part 15242624 · Aug 22, 2016
Continuation In Part 15242625 · Aug 22, 2016
Related Publication 20180046914A1 · Feb 15, 2018
Cited By (2)
US 12,271,810 US 12,373,692