导读
本文通过解读对比学习的经典论文和综述,介绍对比学习的概念,主流方法和优势。对于不同方法的算法设计和实验结果,作者提供了他的深入思考。
Metrics learning + self-supervised learning
论文链接:http://proceedings.mlr.press/v9/gutmann10a/gutmann10a.pdf
论文讲解(这篇论文的证明很不错,很值得学习):
One Sentence Summary
给现有的样本加上噪声,作为负样本,模型对原本真实的样本和新增的负样本进行区分,从而将softmax这种低效的计算转化成二分类的logloss,计算效率更高,下面公式里的
代表真实的样本,
代表加了noise后的样本。
但是这里会出现一个问题,如果我们的noise分布选的不好,效果可能并不一定会好,所以在这篇paper里作者也提到了在增加noise的时候,尽量和现有的数据分布相似,这样能最大程度上提高训练的效果。
Intuitively, the noise distribution should be close to the data distribution, because otherwise, the classification problem might be too easy and would not require the system to learn much about the structure of the data. As a consequence, one could choose a noise distribution by first estimating a preliminary model of the data, and then use this preliminary model as the noise distribution.
这个方法在推荐里的应用,个人观点是可以在召回里来尝试,毕竟现在的召回面临着很大的selection bias问题(有朋友在召回里尝试过,效果一般,只能说明老paper时间比较久了,已经被现在的SOTA beat掉了,不过这篇文章的idea很有意思,数学证明也很不错,可以学习下)
论文链接:https://arxiv.org/pdf/1807.03748.pdf
论文讲解:https://zhuanlan.zhihu.com/p/317711322
One Sentence Summary
提出CPC框架,将representation的学习从一个生成模型,转换成了分类模型,用于下游的其他任务。文章优化的目标从最大化
预测
的概率
变成优化最大化
和
之间的互信息
,通过最大化互信息,可以抽取出输入之间的一些共性的潜变量。
由于没有办法获得到
的联合概率,因此文章通过建模两种样本的密度比的方式来绕过联合概率(两种样本:真实样本和采样出来的负样本),其中
表示
的预测和未来
的相似程度,
是将
转换到
空间,然后用内积来表示相似程度,文章也证明了
f_k 正比于密度比的证明
本文训练的loss
转变成了分类模型
和
可以用于下游的任务:比如分类任务等等
论文链接:https://arxiv.org/pdf/1808.06670.pdf
论文讲解传送门:https://zhuanlan.zhihu.com/p/277660074
One Sentence Summary
加入了更细致的local feature与output的互信息,加上了先验,让先验服从一定的分布,从而能更好的具有编码空间
我对这一点有点concern,什么样的编码空间是 更好的空间呢?这个先验也只能去拍,怎么去拍,只能不断的去尝试吗,是不是可以学成一个动态的空间,如果我们的数据是多峰的,可能一个分布就不太能拟合,混合高斯分布会不会更优?感觉都是可以改进的方向)
Global
local
主要思想和InfoNCE差不多,多了local/prior matching,和具体场景有关,感觉更像是在bagging loss
Prior matching
Loss:前面两项分别对应global和local,最后一项对应Prior matching
论文链接:https://arxiv.org/abs/2002.05709
One Sentence Summary
提出了一个对比学习的框架,在今天看来框架不算特别新颖,但做了非常详实的实验,来验证对比学习到底能从哪些方面受益;个人感觉更像是一篇实验总结性paper:告诉你对比学习的一些特性,提供一些实操中的调参方向
算法
后面加了一个
,然后进行loss的计算和梯度的回传,最后真正在使用的时候用的只有
,这里作者的猜想和实验确实很有意思,很值得借鉴。(虽然在SimCLRV2中这个结论有变的很不一样了哈哈哈,后面会讲到)
和
同时训练,但是训练完后,就把
扔掉了,只保留
,这里是我觉得这篇论文最有意思的点,一般的思路其实应该是直接用
的输出去计算对比学习的loss~
框架图
算法步骤
代表data augmentation方式的集合:比如旋转,灰度,裁剪等等
中选择两种data augmentation,得到两张图片,这两张图片就是一个正样本对,总共可以生成2N个样本,每个样本有一个样本和自己是正样本对,剩下的2N-2都是负样本,这里是用了一个softmax+temperature的loss
SimCLR算法
实验
实验图太多就不贴了,想看detail的可以直接看我的「paper_reading记录:https://bytedance.feishu.cn/docx/doxcn0hAWqSip1niZE2ZCpyO4yb」,只对个人认为有意思的点说下
Furthermore, even when nonlinear projection is used, the layer before the projection head, h, is still much better than the layer after, z = g(h), which shows that the hidden layer before the projection head is a better representation than the layer after
论文链接:https://arxiv.org/abs/2006.10029
One Sentence Summary
提出了一个基于对比学习半监督学习框架,在SimCLR后面接了一个distillation模块在做半监督学习,从而很好的提升了效果。(这篇paper很有意思的点:用了self-distillation居然会比原始的模型效果更好,这一点在组内做paper reading的时候,同事提出来了这个问题,后来调研了下,主要是说做self-distillation会让teacher模型学到不同的视图)
算法
分为三步:pre-training、fine-tuning、distillation(self-distillation)
实验结果
实验图就不全贴了,想看detail的可以直接看我的「paper_reading记录:https://bytedance.feishu.cn/docx/doxcn9P6oMZzuwZOrYAhYc5AUUe」
看一张放在论文首页的图吧(按照李沐大神的话说,放在首页的图一定是非常牛逼的图!),确实可以看出只用1%的数据+标签,就能获得到和有监督学习用100%数据+标签的效果;用10%的数据+标签就已经超过SOTA了,确实还是挺牛逼的
论文链接:https://arxiv.org/abs/1801.04062
One Sentence Summary
将互信息加入到loss function中,从理论上证明了MINE更flexible/scalable;减轻了GAN中的mode-dropping问题,同时提高了ALI的重建和推理效果。(这篇文章的理论推导很多,感兴趣的建议看原paper或者Link)
算法
,其中
就是我们的训练集,batch_size = b
实验
实验图就不全贴了,想看detail的可以直接看我的「paper_reading记录:https://bytedance.feishu.cn/docx/doxcnMHzZBeWFV4HZV6NAU7W73o」
接下来看下怎么将互信息运用到GAN和Bi-GAN上。
在召回阶段:
对比学习的优势:
# 参考文献
Gutmann M, Hyvärinen A. Noise-contrastive estimation: A new estimation principle for unnormalized statistical models[C]//Proceedings of the thirteenth international conference on artificial intelligence and statistics. JMLR Workshop and Conference Proceedings, 2010: 297-304.
Oord A, Li Y, Vinyals O. Representation learning with contrastive predictive coding[J]. arXiv preprint arXiv:1807.03748, 2018.
Hjelm R D, Fedorov A, Lavoie-Marchildon S, et al. Learning deep representations by mutual information estimation and maximization[J]. arXiv preprint arXiv:1808.06670, 2018.
Hjelm R D, Fedorov A, Lavoie-Marchildon S, et al. Learning deep representations by mutual information estimation and maximization[J]. arXiv preprint arXiv:1808.06670, 2018.
GitHub - asheeshcric/awesome-contrastive-self-supervised-learning: A comprehensive list of awesome contrastive self-supervised learning papers. (https://github.com/asheeshcric/awesome-contrastive-self-supervised-learning)
张俊林:对比学习(Contrastive Learning):研究进展精要 (https://zhuanlan.zhihu.com/p/367290573)
极市平台:深度学习三大谜团:集成、知识蒸馏和自蒸馏:https://zhuanlan.zhihu.com/p/347890400
Chen T, Kornblith S, Norouzi M, et al. A simple framework for contrastive learning of visual representations[C]//International conference on machine learning. PMLR, 2020: 1597-1607.
Chen T, Kornblith S, Swersky K, et al. Big self-supervised models are strong semi-supervised learners[J]. Advances in neural information processing systems, 2020, 33: 22243-22255.
Belghazi M I, Baratin A, Rajeshwar S, et al. Mutual information neural estimation[C]//International conference on machine learning. PMLR, 2018: 531-540.
Allen-Zhu Z, Li Y. Towards understanding ensemble, knowledge distillation and self-distillation in deep learning[J]. arXiv preprint arXiv:2012.09816, 2020.