论文精读 对比学习论文综述
对比学习在计算机视觉领域的发展历程,4个阶段:
百花齐放:InstDisc(instance discrimination)、CPC、CMC。方法、模型、目标函数、代理任务都还没有统一。
CV双雄:MOCOv1、SimCLRv1、MOCOv2、SimCLRv2、CPC和CMC的延伸工作、SwaV,这个阶段发展非常迅速,以上这些工作间隔时间都很短,ImageNet上的最好成绩,基本上每个月都在被刷新。
不用负样本:BYOL及其后续改进,SimSima把所有方法都归纳总结,融入到SimSima框架之中,算是卷积神经网络做对比学习的总结性工作。
Transformer:MOCOv3、DINO,用Vision Transformer开展工作。对于自监督学习来说,无论是对比学习还是最新的掩码学习,都是用Vision Transformer做的
1.阶段一:百花齐放 1.1 InstDisc(instance discrimination)
论文名称:Unsupervised Feature Learning via Non-Parametric Instance Discrimin ...
Transformer综述
Transformer综述
论文标题: A Survey of Transformers
论文链接: https://arxiv.org/abs/2106.04554
Transformer 在自然语言处理、计算机视觉、音频处理等许多人工智能领域都取得了巨大的成功,也吸引了学术界和行业研究人员的大量兴趣。到目前为止,已经有各种各样的 Transformer 变体(又名 X-former)被提出,但是,关于这些 Transformer 变体的系统而全面的文献综述仍然缺失。这篇综述对各种 X-former 进行了全面介绍**。**
这篇综述首先简要介绍了原版 Transformer,然后提出了一种新的 X-former 分类法。接着从架构修改、预训练、应用三个角度介绍各种 X-former。最后,概述了未来研究的一些潜在方向。
1.引言Transformer 最初是作为机器翻译的 Seq2Seq 模型提出的。后来的工作表明,基于 Transformer 的预训练模型 (PTM) 可以在各种任务上实现 SOTA。因此,Transformer,特别是 PTM,已成为 NLP 中 ...
论文精读 MoCo
论文名称:Momentum Contrast for Unsupervised Visual Representation Learning
论文连接:1911.05722.pdf (arxiv.org)
0.基础知识0.1 对比学习对比学习顾名思义就是对比着学习,模型不需要知道图片具体是什么,只需要知道哪些图片类似,哪些不类似。
假设有三张图片,两张是人类,一张是狗,假如这三张图片都通过一个网络,得到了三个特征。如果已经有了一个学习好的特征空间,那么学习到的三个特征就是特征空间里的三个点,我们希望对比学习做到的就是:能把类似图片的特征尽可能的靠近,不类似的图片的特征尽可能的远离。如果能做到,那么我们就学到了一个很好的特征。
对比学习虽然不需要知道图片的标签信息,但还是需要知道哪些图片相似,哪些不相似,才能做模型训练。那为什么对比学习在视觉领域是一个无监督的训练方式呢?
因为在视觉领域,通过设计一些巧妙的代理任务,从而人为的订立一些规则,这些规则可以用来定义哪些图片是相似的,哪些是不相似的。从而可以提供一个监督信号去训练模型,这就是所谓的自监督训练。
0.2 最广泛应用的代理任务 ...
论文精读 GAN
GAN Note
最新版本论文:Generative Adversarial Nets (neurips.cc)(建议看这个)
arXiv版本论文:1406.2661.pdf (arxiv.org)(早期写的)
1.标题 + 作者近 5 年,GAN 上头条次数很多,Reddit 里 GAN 很火
使用GAN生成人脸网址:thispersondoesnotexist.com
加州法令:禁止换脸、禁止对政治人物骚操作,说未讲过的话
GAN: 两个网络相互对抗
generative: ML模型分 discriminative(AlexNet, ResNet, Transformer) 和 generative
adversarial: 对抗
nets: networks 简写,非 native speaker 不建议使用简写
2.摘要写作简洁,可直接搬运(wiki, textbook)
创新工作:讲清楚自己是谁?
拓展工作:和别人的区别、创新
本文的 framework :estimating generative models via an adversarial process; ...
论文精读 MAE
8.MAEMasked Autoencoders Are Scalable Vision Learners
MAE:CV版的BERT
论文链接:https://arxiv.org/pdf/2111.06377.pdf
论文代码:https://github.com/facebookresearch/mae
李沐讲解:MAE 论文逐段精读【论文精读】_哔哩哔哩_bilibili
MAE 2021.11.11提交 arxiv
知乎 百万 view; Reddit or Twitter 讨论不多
MAE 很新 —> 如何在读比较新的文章 获取一些新的研究思路?
0.和之前精读论文的关系?Transformer
一个纯基于注意力机制的编码器和解码器
表现比 RNN 架构好,在机器翻译任务
BERT
使用 一个 Transformer 编码器,拓展到更一般的 NLP 的任务
使用了 完型填空 的自监督的训练机制,不需要使用标号,去预测一个句子里面 不见 masked 的词 ,从而获取对文本特征抽取的能力
BERT 极大的扩展了 Transformer 的应用,在一个大规模的、没有标号 ...
论文精读 GNN
文章链接:A Gentle Introduction to Graph Neural Networks (distill.pub)
1.前言图这个数据结构相对于之前讨论的文本(文本是一个序列)、图片(图片是一个矩阵),图相对来说更加复杂一点。
图是一个很一般化的架构,十几年前,研究者提出了针对图的神经网络(图神经网络,GNN),最近它们在能力和表达上都有增强。
图神经网络的实际应用(starting to,图神经网络还是一个比较新的领域,在应用上刚起步)
药物的发现
物理模拟
虚假新闻检测
车流量的检测
推荐系统
本文旨在探索和解释现代的图神经网络
什么数据可以表示成一张图
图和别的数据有什么不同,为什么要做图神经网络,而不是使用最简单的卷积神经网络等
构建了一个GNN,看各模块的具体结构
提供了一个GNN的playground
图神经网络所关注的重点
怎样把所想要的信息表示成向量
这些向量是不是能够通过数据来学到
2.什么是图图是用来表示entity(实体)之间的关系
实体就是一个点(node,顶点)
关系就是一个边(edge)
2.1 图的构成
V:顶点
E:边
U ...
ChatGPT 相关核心算法
1.ChatGPT 相关核心算法ChatGPT 的卓越表现得益于其背后多项核心算法的支持和配合。本文将分别介绍作为其实现基础的 Transformer 模型、激发出其所蕴含知识的Prompt/Instruction Tuning 算法、其涌现出的思维链能力、以及确保其与人类意图对齐的基于人类反馈的强化学习算法。
1.基于Transformer的预训练语言模型ChatGPT 强大的基础模型采用 Transformer 架构, Transformer 是一种基于自注意力机制的深度神经网络模型,可以高效并行地处理序列数据。
原始的 Transformer 模型包含两个关键组件:编码器和解码器。编码器用于将输入序列映射到一组中间表示,解码器则将中间表示转换为目标序列。编码器和解码器都由多层的注意力模块和前馈神经网络模块组成。其中自注意力模块可以学习序列中不同位置之间的依赖关系,即在处理每个位置的信息时,模型会考虑序列中其他所有位置上的信息,这种机制使得 Transformer模型能够有效地处理长距离依赖关系。在原始 Transformer 模型基础上,相继衍生出了三类预训练语言模型:编码预训练 ...
论文精读 GPT-4
8.GPT-4GPT-4 Technical Report:2303.08774.pdf (arxiv.org)
OpenAI博客:https://openai.com/research/gpt-4
博客基本是99页技术报告的缩略版,2023.3.14发布。
0.疯狂的三月(202303)
03-08 微软发布Visual ChatGPT,聊天时可以用图片,并可以根据文字对图片进行修改
论文:https://arxiv.org/abs/2303.04671
代码:https://github.com/microsoft/visual-chatgpt
03-09 微软宣布将要发布大型多模态模型GPT4
03-09 10亿规模的模型GigaGAN推出
论文:https://arxiv.org/abs/2303.05511
03-13 斯坦福大学推出7B的Alpaca模型
代码:https://github.com/tatsu-lab/stanford_alpaca
03-14 GPT4推出
03-14 谷歌公布PALM模型的API使用
03-14 Anthropic介绍大型语言 ...
论文精读 InstructGPT
6.InstructGPTChatGPT
Chat GPT 既没有发表在 NeurlPS 上面,也没有发表在 EMNLP ,甚至连一篇论文都没有
InstructGPT是微调的GPT-3.5模型
0.前言ChatGPT0.1 ChatGPT 的四个应用官方给出四个使用的场景
1、ChatGPT asks the clarifying questions to debug code
2、ChatGPT initially refuses to answer a question that could be about illegal activities but responds after the user clarifies their intent
ChatGPT 能在安全性上避免进行一些非法的回答
3、ChatGPT is able to understand the reference (“it”) to the subject of the previous question (“fermat’s little theorem”)
ChatGPT 是能够理解上下 ...
论文精读 Swin Transformer
4.Swin TransformerSwin transformer: Hierarchical vision transformer using shifted windows
论文链接:https://arxiv.org/pdf/2103.14030.pdf
官方代码库:microsoft/Swin-Transformer
论文解读视频:https://www.bilibili.com/video/BV13L4y1475U
0.Swim Transformer简介Swin Transformer是 ICCV 21的最佳论文,它之所以能有这么大的影响力主要是因为在 ViT 之后,Swin Transformer通过在一系列视觉任务上的强大表现 ,进一步证明了Transformer是可以在视觉领域取得广泛应用的。
更新时间线:
2021年3月传到 arxiv上的
2021年4月份代码库放出
2021年5月12号又放出来了自监督版本的Swin Transformer—moby,从方法上和性能上其实和MoCo v3和DINO都差不多,只是换了个骨干网络
接下来过了一个月,Swin Tra ...
论文精读 GPT、GPT-2、GPT-3
5.GPT,GPT-2,GPT-3大力出奇迹模型
李沐讲解:GPT,GPT-2,GPT-3 论文精读
最近以GPT系列为代表的大语言模型LLM掀起了一阵热潮,许多人惊叹LLM的震撼能力,因此紧跟时代潮流,学习GPT系列论文,加深自己对LLM的理解。总的来说,GPT整体的模型架构都是以Transformer的解码器为模块进行堆叠而成。主要的创新点集中在模型训练策略,还有就是讲究一个大力出奇迹。
0.论文时间轴
GPT:Transformer解码器,在没有标号的大量的文本数据上,训练一个语言模型,来获得预训练模型,后续在子任务上做微调,得到每一个任务所用的分类器。
BERT:Transformer编码器,收集了一个更大的数据集,用来做预训练,效果比GPT好。BERT有两个模型,BERT-base模型与GPT模型参数相差不大,BERT-Large比BERT-base模型大。
GPT-2:原作者吸取教训,收集更大的数据集,训练了一个更大的模型,GPT-2的模型比BERT-large要大。继续使用Transformer的解码器,发现非常适合做Zero Shot,步子跨的太大,效果上不是那么好 ...
Transformer中的位置编码
Transformer中的位置编码原文链接:Transformer Architecture: The Positional Encoding
1.位置编码对任何语言来说,句子中词汇的顺序和位置都是非常重要的。它们定义了语法,从而定义了句子的实际语义。RNN结构本身就涵盖了单词的顺序,RNN按顺序逐字分析句子,这就直接在处理的时候整合了文本的顺序信息。
但Transformer架构抛弃了循环机制,仅采用多头自注意机制。避免了RNN较大的时间成本。并且从理论上讲,它可以捕捉句子中较长的依赖关系。
由于句子中的单词同时流经Transformer的编码器、解码器堆栈,模型本身对每个单词没有任何位置信息的。因此,仍然需要一种方法将单词的顺序整合到模型中。
想给模型一些位置信息,一个方案是在每个单词中添加一条关于其在句子中位置的信息。我们称之为“信息片段”,即位置编码。
第一个可能想到的方法是为每个时间步添加一个$[0,1]$范围内的数字,其中0表示第一个单词,1表示最后一个单词。
但这样会存在一个问题:无法计算出特定范围内有多少个单词。换句话说,时间步长在不同句子中的含义不一致。如下所示:
...
Transformer架构细节
Transformer架构细节
1.Transformer各个模块的作用(1)Encoder 模块
经典的Transformer架构中的Encoder模块包含6个Encoder Block.
每个Encoder Block包含两个⼦模块, 分别是多头⾃注意⼒层, 和前馈全连接层.
多头⾃注意⼒层采⽤的是⼀种Scaled Dot-Product Attention的计算⽅式, 实验结果表 明, Multi-head可以在更细致的层⾯上提取不同head的特征, ⽐单⼀head提取特征的 效果更佳.
前馈全连接层是由两个全连接层组成, 线性变换中间增添⼀个Relu激活函数, 具体的 维度采⽤4倍关系, 即多头⾃注意⼒的d_model=512, 则层内的变换维度d_ff=2048.
(2)Decoder 模块
经典的Transformer架构中的Decoder模块包含6个Decoder Block.
每个Decoder Block包含3个⼦模块, 分别是多头⾃注意⼒层, Encoder-D ...
论文精读 ViT
3.ViT论文链接:https://arxiv.org/abs/2010.11929
源码链接:https://github.com/rwightman/py
1.标题 + 简介An image is worth 16*16 words
每一个方格都是 16 * 16 大小,图片有很多 16 * 16 方格 patches —> an image is worth 16 * 16 words
ViT:过去一年,CV 最有影响力的工作
推翻了 2012 Alexnet 提出的 CNN 在 CV 的统治地位
有足够多的预训练数据,NLP 的 Transformer 搬运到 CV,效果很好
打破 CV 和 NLP 的壁垒,给 CV、多模态 挖坑
ViT效果有多好,CV 任务刷榜,paperwithcode网站
霸榜 ImageNet (基于 ViT)
COCO ,目标检测(Swin Transformer ICCV 21 best paper:多尺度的 ViT )的模型
下图中的的四种情况 ViT 都能处理
遮挡、数据分布的偏移(纹理的去除)、鸟头部+对 ...
Transformer中的注意力
Transformer中的注意力本文主要来自:The Illustrated Transformer
1.自注意力假设我们要翻译下边这句话:“The animal didn’t cross the street because it was too tired”。这里it指的是什么?是street还是animal?人理解起来很容易,但是对算法来讲就不那么容易了。
当模型处理it这个词的时候,自注意力会让**it和animal**关联起来。
当模型编码每个位置上的单词的时候,自注意力的作用就是:看一看输入句子中其他位置的单词,试图寻找一种对当前单词更好的编码方式。
如果你熟悉RNNs模型,回想一下RNN如何处理当前时间步的隐藏状态:将之前的隐藏状态与当前位置的输入结合起来。
在Transformer中,自注意力机制也可以将其他相关单词的“理解”融入到我们当前处理的单词中。
可以去Tensor2Tensor ,自己体验一下上图的可视化。动图如下所示:
2.图解注意力计算先画图用向量解释一下自注意力是怎么算的,之后再看一下实际实现中是怎么用矩阵算的。
第一步:计算query、key、va ...