Embedding Watermarks into Deep Neural Networks
(深層ニューラルネットワークへの電⼦透かしの埋め込み)
ICMRʼ17 Best Paper Award
MIRU 2017
内⽥祐介*
株式会社ディー・エヌ・エー
永井有希
KDDI総合研究所
酒澤茂之*
⼤阪⼯業⼤学
佐藤真⼀
国⽴情報学研究所
* 本発表は著者らがKDDI総合研究所所属中に
⾏った研究 (ICMR’17) をもとにしています
Deep Learning
Deep Learning
→   データが命
データは当然重要な資産。その資産を
時間をかけて学習したモデルパラメータも重要な資産
モデルパラメータ
! モデルパラメータは効率的な研究開発において重要
" 研究成果の再現
" ⼤規模データで学習されたモデルパラメータのFine-tuneにより
⼩数データ・短時間で⾼精度なモデルが構築可能
研究開発的な観点
Trained models
(e.g. Model Zoo)
Researchers Developers
Researchers Developers
Share
Sharing trained models helps rapid progress
for research and development.
! 独⾃に学習したモデルパラメータは重要な資産
! 権利保護によりモデルパラメータの不正利⽤を防ぎたい
ビジネス的な視点
Researchers Developers
Customers
(Business)
license
product /
service
💰
•  前向きな考え⽅をすると、適切な権利保護により
将来的にはモデルパラメータを売買できるような
プラットフォームビジネスができるかも(e.g. Alexa Skills Store)
! モデルパラメータを画像や⾳楽のように技術で権利保護できないか?
New Challenge
! モデルパラメータを画像や⾳楽のように技術で権利保護できないか?
New Challenge
→ 電⼦透かしによる
  不正利⽤検出
1.  Deep Neural Networks (DNN) への電⼦透かしの埋め込みという
新たな問題を提起
"  DNNへの電⼦透かしへの要求項⽬、埋め込みパターン、攻撃パターンを定義
2.  DNNへの電⼦透かしの埋め込み⽅法として汎⽤的な⼿法を提案
"  電⼦透かしを埋め込む損失関数を定義することで学習時に埋め込み
3.  広範な実験によりDNNへの電⼦透かしの埋め込みの実現性を検証
"  パラメータの65%をPruningしても消えない電⼦透かし
本研究の貢献
DNNへの電⼦透かしの埋め込み:問題定義
画像ドメイン DNNドメイン
忠実性
Fidelity
透かしの埋め込みによって可
能な限り元画像が(視覚的
に)劣化しないこと
透かしの埋め込みによってホスト
ネットワークのタスクの精度が低
下しないこと
ロバスト性
Robustness
画像圧縮や切り抜き、リサイ
ズ等の画像処理によって埋め
込んだ透かしが消えないこと
Fine-tuningやモデル圧縮といった
モデル変更によって埋め込んだ透
かしが消えないこと
DNNへの電⼦透かしの埋め込みへの要求項⽬
※ホストネットワーク=埋め込み対象のDNN
※埋め込み容量、埋め込み・検出速度、セキュリティ等の要件は画像と同じ
! どのように電⼦透かしを埋め込むか
" 学習済みのモデルに後から埋め込む(画像では普通)
•  ホストネットワークの精度が⼤きく劣化
" 学習しながら電⼦透かしを埋め込む
•  精度を維持しながら埋め込みが可能、以降はこのケースのみを考える
•  学習しながらの埋め込みも下記の3パターンが考えられる
DNNへの電⼦透かし埋め込みパターン
埋め込みパターン Train-to-embed Fine-tune-to-embed Distill-to-embed
ホストネットワークを
最初から学習する際に
埋め込み
ホストネットワークを
fine-tuneする際に埋め
込み
ホストネットワークを
distillationで学習する際
に埋め込み
Fine-tune?
Use label?
! Fine-tuning
" 訓練時間の短縮、転移学習、⼩数データでの学習のために利⽤
" 追加学習によりモデルパラメータが変化
" (意図的・⾮意図的にせよ)⼀番多い攻撃パターン
! モデル圧縮
" モデルのメモリサイズ圧縮、処理時間の短縮のために利⽤
" ⾮可逆圧縮によりモデルパラメータが変化
" 実応⽤においてホットな技術
想定される電⼦透かしへの攻撃
PROPOSED FRAMEWORK
! ホストネットワークの (flatten) 重みをw、埋め込みキーをXとすると
X w ≧ 0 により透かしを定義
! 学習過程でオリジナルのタスクのロスに加えて
所望の透かしになるように埋め込みロス(embedding loss)を定義
! オリジナルのタスクの精度を担保しつつ、透かしを埋め込む
アプローチ
Weightw
Secret Key X
(fixed)
1 if ≧0
0 otherwise= → Watermark
より⼀般的には、wを⼊⼒とし2値出⼒の
DNNと定義しても良い
(その固定パラメータがsecret key)
Embedding lossによるDNNへの電⼦透かしの埋め込み
出⼒ ラベル
タスクのロス
ホストネットワーク
E0
Embedding lossによるDNNへの電⼦透かしの埋め込み
出⼒ ラベル
タスクのロス
ホストネットワーク
E0
Weightw
パラメータ
(e.g. 3x3x64x64)
出⼒フィルタ⽅向
に平均化+flatten
Embedding lossによるDNNへの電⼦透かしの埋め込み
出⼒ ラベル
タスクのロス
ホストネットワーク
E0
パラメータ
(e.g. 3x3x64x64)
出⼒フィルタ⽅向
に平均化+flatten
Secret
Key X
(fixed)
Weightw
Sigmoid
出⼒
Embedding lossによるDNNへの電⼦透かしの埋め込み
出⼒ ラベル
タスクのロス
ホストネットワーク
E0
パラメータ
(e.g. 3x3x64x64)
出⼒フィルタ⽅向
に平均化+flatten
Secret
Key X
(fixed)
Weightw
Sigmoid
出⼒ 透かし
埋め込みロス
1
0
1
1
ER
Embedding lossによるDNNへの電⼦透かしの埋め込み
出⼒ ラベル
タスクのロス
ホストネットワーク
パラメータ
(e.g. 3x3x64x64)
出⼒フィルタ⽅向
に平均化+flatten
Secret
Key X
(fixed)
Weightw
Sigmoid
出⼒ 透かし
埋め込みロス
1
0
1
1
E0
ER
E = E0 + λER
タスクのロスおよび
埋め込みロスを同時に最⼩化
Embedding lossによるDNNへの電⼦透かしの埋め込み
出⼒ ラベル
タスクのロス
ホストネットワーク
パラメータ
(e.g. 3x3x64x64)
出⼒フィルタ⽅向
に平均化+flatten
Secret
Key X
(fixed)
Weightw
Sigmoid
出⼒ 透かし
埋め込みロス
1
0
1
1
E0
ER
E = E0 + λER
Parameter regularizer
として実装可能
(cf. weight decay)
タスクのロスおよび
埋め込みロスを同時に最⼩化
EXPERIMENTS
実験設定
データセット
CIFAR-10 (60,000 32 x 32 color images, 10 classes)
- 50,000 images for training
- 10,000 images for test
ネットワークアー
キテクチャおよび
パラメータ
-  WideResNet [4]
(N = 1, k = 4)
-  SGD with Nesterov
momentum
-  cross-entropy loss
-  the initial learning rate = 0.1
-  weight decay = 5.0 x10-4
-  momentum = 0.9
-  minibatch size = 64
-  λ = 0.01
電⼦透かし 256 bit (T = 256)
埋め込み対象 conv2 group
[4] S. Zagoruyko and N. Komodakis. Wide residual networks. In Proc. of ECCV, 2016.
conv1
conv2
group
conv3
group
conv4
group
arg-pool
fc
M= 36864(3 x 3 x 64 x 64 )
! Secret Key X は任意の⾏列
! 本発表では単純な下記の3通りを検証
" Xdirect
wの1つの次元に埋め込む⾏列
" Xdiff
wの2つの次元の差に埋め込む⾏列
" Xrandom
wの全ての次元に分散して埋め込む⾏列
X ~ N(0, 1)
Fidelity: Train-to-embed(スクラッチからの学習時に埋め込み)
Secret Key X
(fixed)
Weightw
sign
透かし
1
1
1 1
1
1
1-1
-11
1
-1-1
-1
Fidelity: Train-to-Embed(スクラッチからの学習時に埋め込み)
Training curves for the host network on CIFAR-10
! 3種類の X 全て埋め込みは可能
! randomがテストエラーおよび埋め込みロスともに最良
(埋め込みなしと同等のテストエラー)
The best test errors and embedding losses
Testerror
Trainingloss
! 再学習を⾏う場合でも、埋めなしと同等のテストエラー
Fidelity: Fine-tune-to-embed and Distill-to-embed
CIFAR-10で学習したネットワークを
CIFAR-10で再学習
Caltech-10で学習したネットワークを
CIFAR-10で再学習
CIFAR-10で学習したネットワークの
出⼒を利⽤してCIFAR-10で再学習
Robustness: fine-tuning
! 透かしを埋め込んだモデルをfine-tuningして透かしが消えるか?
" 同⼀ドメインでのfine-tuning (CIFAR-10 → CIFAR-10)
" 異なるドメインでのfine-tuning (Caltech-101 → CIFAR-10)
! どちらのケースでもfine-tuningで透かしは消えない
テストエラーも埋め込みなし (8.04%) と同等
Note: Caltech-101 dataset were resized to 32 x 32 for compatibility with the CIFAR-10
dataset though their original sizes is roughly 300 x 200.
埋め込みロス
before after
! モデル圧縮で透かしが消えるか?
" lossless : Huffman cording [5]
" lossy : weight quantization[5, 6], parameter pruning [5, 6]
Robustness: model compression
[5] S. Han, H. Mao, and W. J. Dally. Deep compression: Compressing deep neural networks with pruning, trained
quantization and huffman coding. In Proc. of ICLR, 2016.
[6] S. Han, J. Pool, J. Tran, and W. J. Dally. Learning both weights and connections for efficient neural networks.
In Proc. of NIPS, 2015.
! 重みパラメータのうち、⼩さいもの (Ascending) N %を0とした際の
埋め込みロスと透かしのビットエラー率
! パラメータの65%を削除してもビットエラー率は0
Robustness: compression (parameter pruning)
Embeddingloss
Pruning rate
0.0 0.2 0.4 0.6 0.8 1.0
Biterrorrate
0.5
0.4
0.3
0.2
01
0.0
Pruning rate
0.2 0.4 0.6 0.8 1.00.0
DISCUSSION
! It is well-known that deep neural networks have many local
minima, and all local minima are almost optimal [8, 9].
Why Did Our Approach Work So Well?
[7] A. Choromanska et al. The loss surfaces of multilayer networks. In Proc. of AISTATS, 2015.
[8] Y. Dauphin et al. Identifying and attacking the saddle point problem in high-dimensional non-convex
optimization. In Proc. of NIPS, 2014.
Loss
Parameter space
Standard SGD
! It is well-known that deep neural networks have many local
minima, and all local minima are almost optimal [8, 9].
! Our embedding regularizer guides model parameters toward
a local minima, which has the desired watermark.
! Let us assume that we want to
embed the watermark “11”…
Why Did Our Approach Work So Well?
[7] A. Choromanska et al. The loss surfaces of multilayer networks. In Proc. of AISTATS, 2015.
[8] Y. Dauphin et al. Identifying and attacking the saddle point problem in high-dimensional non-convex
optimization. In Proc. of NIPS, 2014.
Loss
Parameter space
00 01 10 11
Detected
watermark
Standard SGD
SGD with
Embedding Loss
! Limitations
" Watermark overwriting
" Robustness against distilling, model transformations
! Alternatives to the watermarking approach
" Digital fingerprinting
Future Work
…and many other things remain as future work. (see paper!)
1.  Deep Neural Networks (DNN) への電⼦透かしの埋め込みという
新たな問題を提起
"  DNNへの電⼦透かしへの要求項⽬、埋め込みパターン、攻撃パターンを定義
2.  DNNへの電⼦透かしの埋め込み⽅法として汎⽤的な⼿法を提案
"  電⼦透かしを埋め込む損失関数を定義することで学習時に埋め込み
3.  広範な実験によりDNNへの電⼦透かしの埋め込みの実現性を検証
"  様々な埋め込みパターンでホストネットワークの性能を低下させずに
埋め込み可能であることを⽰した
"  Fine-tuningやパラメータpruningにロバストであることを⽰した
Conclusions
Our code is available at https://github.com/yu4u/dnn-watermark .
Thank you!
For more details, please refer to…
Y. Uchida, Y. Nagai, S. Sakazawa, and S. Satoh,
“Embedding Watermarks into Deep Neural Networks,”
in Proc. of International Conference on Multimedia Retrieval 2017.

Embedding Watermarks into Deep Neural Networks