ACL2020 Contextual Embeddings When Are They Worth It 精读
上下文嵌入(Bert词向量): 什么时候值得用?
ACL 2018
预训练词向量 (上下文嵌入Bert,上下文无关嵌入Glove, 随机)详细分析文章
1 背景

图1 Bert
| 优点 | 效果显著 |
| 缺点 | 成本昂贵 (Memory,Time, Money) (GPT-3,1700亿的参数量) |
| 困惑 | 线上环境,资源受限(内存 CPU GPU) bert不一定是最佳 选择 用word2vec, glove等词向量有时候也能取得近似效果 但什么时候可以近似,需要实验说明,于是作者设计了实验 |
2 三种词向量

图2 三种词向量
| 类型 | 说明 | 实验 |
|---|---|---|
| 上下文词嵌入 | BERT XLNet | 作者实验中选BERT 768维 |
| 上下文词无关嵌入 | Glove Word2Vec FastText | 作者实验中选Glove 300维 |
| 随机嵌入 | n*d矩阵 (n是词汇量, d是嵌入维度) | 作者实验中选循环随机嵌入 800维, 空间复杂度O(nd) => O(n) |
3 实验和结论
| 任务 | 模型 |
|---|---|
| 命名实体识别 (NER) | BiLSTM |
| 情感分析 (sentiment analysis) | TextCNN |
3.1 影响因素一:训练数据规模

图3 影响因素一:训练数据规模 01

图4 影响因素一:训练数据规模 02
在许多任务中,供充足的数据,GloVe这些词向量可匹配BERT
3.2 影响因素二:语言的特性
3.2.1 Complexity of setence structure
NER: 实体占据几个token (George Washington)

图5 NER中的句子复杂度
Sentiment analysis:句子依存分析中依赖标记对之间的平均距离

图6 Sentiment analysis中的句子复杂度
3.2.2 Ambiguity in word usage
NER: 实体有几个标签(George Washington可以作为人名、地名、组织名)

图7 NER中的句子复杂度
Sentiment analysis:
\begin{array}{l}
H\left( {\frac{1}{{\left| S \right|}}\sum\limits_{w \in S} {p\left( { + 1\left| w \right.} \right)} } \right) \
{\rm{where }}H\left( p \right) = - p{\log _2}\left( p \right) - \left( {1 - p} \right){\log _2}\left( {1 - p} \right) \
\end{array}

图8 Sentiment analysis中的句子复杂度
3.2.3 Prevalence of unseen words
NER: token出现次数得倒数

图9 NER中的句子复杂度
Sentiment analysis:
给定一个句子,句子中未在训练集中出现token占比

图10 Sentiment analysis中的句子复杂度

图11 Bert和随机向量对比

图12 Bert和Glove对比
文本结构复杂度高和单词歧义性方面: BERT更好
未登录词方面: GloVe 更好
总结
大量训练数据和简单语言的任务中,考虑算力和设备等,GloVe 代表的 Non-Contextual embeddings 是个不错的选择
对于文本复杂度高和单词语义歧义比较大的任务,BERT代表的 Contextual embeddings 有明显的优势。
未登录词方面: GloVe 更好
ACL2020 Contextual Embeddings When Are They Worth It 精读的更多相关文章
- Attention-over-Attention Neural Networks for Reading Comprehension论文总结
Attention-over-Attention Neural Networks for Reading Comprehension 论文地址:https://arxiv.org/pdf/1607.0 ...
- bert 硬件要求
https://github.com/google-research/bert BERT ***** New May 31st, 2019: Whole Word Masking Models *** ...
- 论文翻译——Deep contextualized word representations
Abstract We introduce a new type of deep contextualized word representation that models both (1) com ...
- 关于情感分类(Sentiment Classification)的文献整理
最近对NLP中情感分类子方向的研究有些兴趣,在此整理下个人阅读的笔记(持续更新中): 1. Thumbs up? Sentiment classification using machine lear ...
- 论文阅读笔记:《Contextual String Embeddings for Sequence Labeling》
文章引起我关注的主要原因是在CoNLL03 NER的F1值超过BERT达到了93.09左右,名副其实的state-of-art.考虑到BERT训练的数据量和参数量都极大,而该文方法只用一个GPU训了一 ...
- Word Embeddings: Encoding Lexical Semantics
Word Embeddings: Encoding Lexical Semantics Getting Dense Word Embeddings Word Embeddings in Pytorch ...
- Word Embeddings: Encoding Lexical Semantics(译文)
词向量:编码词汇级别的信息 url:http://pytorch.org/tutorials/beginner/nlp/word_embeddings_tutorial.html?highlight= ...
- Android Contextual Menus之二:contextual action mode
Android Contextual Menus之二:contextual action mode 接上文:Android Contextual Menus之一:floating context me ...
- Android Contextual Menus之一:floating context menu
Android Contextual Menus之一:floating context menu 上下文菜单 上下文相关的菜单(contextual menu)用来提供影响UI中特定item或者con ...
随机推荐
- UDP/TCP 流程与总结
1 UDP流程 前序:可以借助网络调试助手工具进行使用 1 UDP 发送方 1 创建UDP套接字 2 准备目标(发送方) IP和端口 3 需要发送的数据内容 4 关闭套接字 from socket i ...
- testNG jar包启动找不到org.testng.TestNG
主要是因为打包时依赖的jar包没有打入,网上有很多需要将对应的jar单独拷贝出来然后通过classpath引用启动,但是感觉这个就是个无底洞.拷贝了这么多个包最后还是说找不到ObjectId 启动命令 ...
- day62 作业
熟练使用无名有名分组 urls.py url(r'^edit/(\d+)/',views.edit_user,name='edit'), views.py def edit_user(request, ...
- java 基本语法(十一) 数组(四)数组的常见算法
1.数组的创建与元素赋值: 杨辉三角(二维数组).回形数(二维数组).6个数,1-30之间随机生成且不重复. 杨辉三角 public class YHSJ { public static void m ...
- CocosCreator之AssetBundle使用方案分享
前言 Creator2.4 推出了AssetBundle,使得所有平台都有了分包的能力.那么该如何使用这个强大的功能呢?下面介绍一下我个人的用法,仅供参考,水平有限,非喜勿喷. 根据官方文档 指出,之 ...
- js 自定义阻止事件冒泡函数
// 以下改方法全兼容Chrome function stopBubble(event){ if(event.stopPropagation){ // 兼容火狐(firebox) event.st ...
- 各种jar包下载地址
standard.jar和jstl.jar的下载地址 http://repo2.maven.org/maven2/javax/servlet/jstl/ http://repo2.maven.org/ ...
- QTimer
目录 简述 详细说明 精度 替代QTimer 成员函数 信号 示例 简述 QTimer类提供了重复和单次触发信号的定时器. QTimer类为定时器提供了一个高级别的编程接口.很容易使用:首先,创建一个 ...
- P1536 村村通(洛谷)并查集
隔壁的dgdger带我看了看老师的LCA教程,我因为学习数学太累了(就是懒),去水了一下,感觉很简单的样子,于是我也来写(水)个博客吧. 题目描述 某市调查城镇交通状况,得到现有城镇道路统计表.表中列 ...
- Springboot整合SpringSecurity--对静态文件进行权限管理
文章目录 一.要求 二.依赖管理 三.配置config文件 四.扩展 一.要求 index.html 可以被所有用户访问 1.html只能被VIP1访问 2.html只能被VIP2访问 3.html只 ...