Transformer(编解码架构)-Question

1. Transformer 模型架构说一下?

2. Transformer 结构, BERT有几种Embedding编码,分词方法?

  • Transformer中Embedding:Token Embedding、Positional Encoding;分词方法:Byte-pair Encoding(BPE)、Word-piece。
  • BERT中Embedding:Token Embedding、Segment Embedding、Positional Embedding;分词方法:Word-piece。

3. 讲下attention在seq2seq中的用法,transformer中的self-attention。

  • seq2seq中attention是一种编解码attention,Q来自于解码器,K、V来自于编码器。
  • transformer中的self-attention与attention的计算方式相同,Q、K、V都来自于同一个源。


4. 介绍一下self-attention,self-attention怎么做?

softmax(QK^T)*V

5. local attention和global attention的区别。

global attention和local attention的区别:whether the “attention”is placed on all source positions or on only a few source positions。

Global Attention 和 Local Attention 各有优劣,实际中 Global 的用的更多一点,因为:

  • Local Attention 当 encoder 不长时,计算量并没有减少;
  • 位置p_t的预测并不非常准确,直接影响到Local Attention的准确率;

6. 询问对生成模型的了解,发展情况,询问项目中的难点,回答解码策略,谈到了 Beam Search 和 Random Sample 策略。

生成模型:

  • NLG Review:Language Modeling、Conditional Language Modeling。

训练时Scheduled Sampling:
掷色子选择是使用Teacher Forcing(From reference)还是使用Distribution Input(from model)

  • Decoding Algorithm:Greedy、Beam Search、Sampling。

Decoding Algorithm->Greedy:

Decoding Algorithm->Beam Search:

  • beam search只在预测的时候需要。训练的时候因为知道正确答案(Teacher Forcing),并不需要再进行这个搜索。

Decoding Algorithm->Random Sample:

7. Probability Distribution

8. 谈谈Transformer、BERT、GPT、GPT2

Transformer:

  • 6 layers block。
  • WMT 2014 English-German数据集由byte-pair encoding处理。WMT 2014 English-French数据集由word-piece处理。

BERT:(双向二阶段预训练模型-word-piece)

  • Special Token:[CLS][SEP]
  • BERT_Base(12 layers)、BERT_Large(24 layers)
  • Pre-training:Task #1: Masked LMTask #2: Next Sentence Prediction
  • Special Token:start and end tokens (<s>, <e>)delimiter token ($)

  • Fine-tuning:Two Sentence ClassificationSingle Sentence ClassificationQuestion AnsweringSingle Sentence Tagging

GPT:(单向二阶段预训练模型byte-pair encoding,BPE)

  • 12-layer decoder-only transformer with masked self-attention heads (768 dimensional states and 12 attention heads).
  • Pre-training:Unsupervised pre-training(LM)
  • Fine-tuning:Supervised fine-tuning(Classification、Entailment、Similarity、Multiple Choice、Question Answering)

GPT2:(单向通用模型Byte Pair Encoding,BPE)

  • For example, a translation training example can be written as the sequence (translate to french, english text, french text). Like- wise, a reading comprehension training example can be written as (answer the question, document, question, answer).

  • GPT2的创新点在于验证了无监督的语言建模能够学习到有监督任务所需的特征。

  • GPT-2 在 GPT 的基础上采用单向语言模型,并舍去 Fine-tuning 阶段,利用高质量多样化的大文本数据训练得到一个巨型模型,最终在语言模型相关的任务中取得了不错的成绩。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容