每日论文230925-Distilling the knowledge in a neural network

模型蒸馏(红色)的Google trends热度和ORB-SLAM对比

简介

论文链接:https://arxiv.org/abs/1503.02531

Many insects have a larval form that is optimized for extracting energy and nutrients from the environment and a completely different adult form that is optimized for the very different requirements of traveling and reproduction.

 Hintion在论文开头用了一个生物的例子,“昆虫在幼虫阶段的形态通常用于从大自然中吸取营养,但成年后,它们又被优化为了不同的形态,用于满足飞行和生産的需求“。 用这个例子来表达KD的动机,还是很有想象力的。

在towardsdatasciense中,也有另一个贴切的比喻,像是在备考时,老师不可能什么都教,而是要”画重点“。

A simple analogy is that a student with a small and compact brain studying for an exam tries to absorb as much information as possible from the teacher. However the teacher just teaches everything, the student not knowing which questions will come out in the exam tries its best to absorb everything.

Once the cumbersome model has been trained, we can then use a different kind of training, which we call "distillation" to transfer the knowledgefrom the cumbersome model to a small model that is more suitable for deployment.

之前很多失败的research是因为试图让模型学习到的参数保持一致, 而如果只是学习输入到输出的mappiing,也许会取得不错的进展。

Our more general solution, called “distillation”, is to raise the temperature of the final softmax until the cumbersome model produces a suitably soft set of targets. 

 可以使用原有的训练数据或者未标注的数据去训练小模型。我们发现使用原有的训练集去训练小模型效果也很好,尤其是我们添加term让目标函数去预测和大模型一致的soft targets时。

至于为什么是希望通过大网络来教小网络而不是直接利用grund truth label来学习,hinton也给了一个例子:比如说在MNIST数据集中,有两个数字“2”,但是写法是不一样的:一个可能写的比较像3(后面多出了一点头),一个写的比较像7(出的头特别的短)。在这样的情况下,gt label都是“2”,然而一个学习的很好的大网络会给label “3” 和 “7” 都有一定的概率值。通常叫这种信息为 “soft targets”;相对的,gt label 是一种 “hard target” 因为它是one-hot label。总的来说就是,通过大网络的“soft targets”,能得到更加多的信息来更好的训练小网络。

Distillation

神经网络通常通过softmax输出结果。

这里的T代表温度,使用更大的T将产生更soft的输出

小模型的目标函数通常由两个目标函数组成,包括

损失函数一: 学生和老师模型的softmax输出的cross entropy

损失函数二: 学生和老师模型预测的正确label的cross entropy

基于transfer net,学生模型就可以用来训练和缩小蒸馏Loss

实验

Minst数据集

在minst数据上,Teacher Model效果最佳,Distilled Model相差不多,但是,如果基于hart target进行蒸馏,效果则差很多

推荐阅读:FitNets- Hints for Thin Deep Nets

Drawback

Its effectiveness only limits to softmax loss function, and relies on the number of classes. For example, in a binary classification problem, KD could hardly improve the performance since almost no additional supervision could be provided.

参考文档

论文笔记 《Distilling the Knowledge in a Neural Network》 | BLOG

https://towardsdatascience.com/distilling-knowledge-in-neural-network-d8991faa2cdc

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值