introduction to deep compression

24
ディープラーニングの最新動向 圧縮技術編① Deep Compression 2017/1/5 株式会社ウェブファーマー 大政 孝充

Upload: -

Post on 12-Jan-2017

68 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Introduction to Deep Compression

ディープラーニングの最新動向 圧縮技術編① Deep Compression

2017/1/5 株式会社ウェブファーマー

大政 孝充

Page 2: Introduction to Deep Compression

今回取り上げるのはこれ

[1] S. Han, et al.”Deep Compression: Compressing Deep Neural Networks with Pruning, Trained Quantization and Huffman Coding.”ICLR 2016 - Best Paper Award. Deep Neural Networkのパラメータ容量を3段階の圧縮技術を用いて大幅に縮減した!

Page 3: Introduction to Deep Compression

解説のポイント

①取り組んだ課題とは ②手法の説明  1)Pruning  2)Quantization  3)Haffman Encoding ③結果どうなった?

Page 4: Introduction to Deep Compression

解説のポイント

①取り組んだ課題とは ②手法の説明  1)Pruning  2)Quantization  3)Haffman Encoding ③結果どうなった?

Page 5: Introduction to Deep Compression

Deep Learningはパラメータ容量が巨大なので こんなに不便

●問題1:巨大過ぎてAppStoreなどで扱えない

コンピュータ で学習

数百MB

Page 6: Introduction to Deep Compression

Deep Learningはパラメータ容量が巨大なので こんなに不便

●問題2:モバイルのバッテリーを大量消費する

すぐに電池がなくなる

数百MBそもそもメモリ上に 展開できない

Page 7: Introduction to Deep Compression

よってモバイル向けに容量を減らしたい!

コンピュータ で学習

数百MB

数十MB? 数MB?

Page 8: Introduction to Deep Compression

解説のポイント

①取り組んだ課題とは ②手法の説明  1)Pruning  2)Quantization  3)Haffman Encoding ③結果どうなった?

Page 9: Introduction to Deep Compression

手法全体の流れ

第1段階 Pruning

第2段階Quantization

第3段階Huffman Encoding

Page 10: Introduction to Deep Compression

解説のポイント

①取り組んだ課題とは ②手法の説明  1)Pruning  2)Quantization  3)Haffman Encoding ③結果どうなった?

Page 11: Introduction to Deep Compression

圧縮第1段階:Pruning(切り詰める)

普通に学習した後、閾値を超えないような小さな値の重みを削減する。

・ ・

・ ・

・ ・

・ ・

・ ・

・ ・

0.0008

0.007

・ ・

・ ・

・ ・

・ ・

・ ・

・ ・

0.001

これで10分の1とかにする

Page 12: Introduction to Deep Compression

解説のポイント

①取り組んだ課題とは ②手法の説明  1)Pruning  2)Quantization  3)Haffman Encoding ③結果どうなった?

Page 13: Introduction to Deep Compression

圧縮第2段階:Quantization(量子化)

まず、似た重み同士でまとめる

この例の場合、16個の重みを4種類にまとめる

Page 14: Introduction to Deep Compression

圧縮第2段階:Quantization(量子化)

まとめ方は、k-means法を用いる argminC

w−Ci2

w∈Ci

∑i=1

k

4種類のクラスタにまとまった。

Page 15: Introduction to Deep Compression

圧縮第2段階:Quantization(量子化)

求まった重みを初期値としてFine-Tuningする back propagationはクラスタごとの勾配を求める

∂L∂Ck

=∂L∂Wij

∂Wij

∂Cki, j∑ =

∂L∂Wij

Ι Iij = k( )i, j∑ :indicator functionΙ ⋅( )

Page 16: Introduction to Deep Compression

圧縮第2段階:Quantization(量子化)

第2段階全体図

Page 17: Introduction to Deep Compression

解説のポイント

①取り組んだ課題とは ②手法の説明  1)Pruning  2)Quantization  3)Haffman Encoding ③結果どうなった?

Page 18: Introduction to Deep Compression

圧縮第3段階:Haffman Encoding(ハフマン符号化)

Haffman Encodingを用いてさらに容量を減らす

重みの値1 1.0 00

重みの値2 2.0 01

重みの値3 3.0 10

例)

1.0 00

1.0 00

3.0 10

2.0 01

2.0 01

2.0 01

2.0 01

14 bits

よく出現する数字には短い bit をあて、 余り出現しない数字には長い bit をあてる

1.0 10

1.0 10

3.0 110

2.0 0

2.0 0

2.0 0

2.0 0

11 bits

Page 19: Introduction to Deep Compression

解説のポイント

①取り組んだ課題とは ②手法の説明  1)Pruning  2)Quantization  3)Haffman Encoding ③結果どうなった?

Page 20: Introduction to Deep Compression

いろいろなモデルの圧縮率

LeNetで40分の1、AlexNetで35分の1、VGGNetではなんと、49分の1!

Page 21: Introduction to Deep Compression

いろいろなモデルのスピード増加率

どのモデルにおいても、のきなみ早くなっている

Page 22: Introduction to Deep Compression

いろいろなモデルの電力消費削減率

どのモデルにおいても、のきなみ電力が削減されている

Page 23: Introduction to Deep Compression

結論

l  LeNet、AlexNet、VGGNetいずれにおいてもパラメータの容量を大幅に削減できた

l  結果、速度の大幅な上昇、および電力消費の大幅な削減が達成できた

l  このしくみにより、Deep Learningがモバイルでも使用できそうだ!

Page 24: Introduction to Deep Compression

おわり