or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
tags:
Deep Learning
,archived
T5 Note
基本介紹
T5 的全名是 Transfer Learning with a Unified Text-to-Text Transformer,在 2019 年底提出,2020 年在 GLUE 上成為榜首,順利擠下了自家的 ALBERT。
T5 基本上可視為 Transformer 模型結構,由 Encoder 和 Decoder 兩部份所組成。
Encoder 架構的經典例子為 BERT 等模型。
Decoder 架構的經典例子為 GPT-2 等模型。
而 T5 模型則為完整 Transformer 模型,故能將所有 NLP 任務都轉換成 Text-to-Text(以往都稱為 Seq-to-Seq,將文字輸入通過 Encoder 進行編碼、再由 Decoder 進行解碼得到最終文字輸出)。
而 T5 為一適用於 NLP 領域的預訓練模型(pre-trained model)。而應用預訓練模型於自己的任務領域進行微調(fine-tune)是近年主流方法,主要是先使用大量不同領域的未標記資料在非監督式學習中訓練出一個預訓練模型,再於下游任務調整權重;好處是下游任務(目標領域)的資料量不足以訓練出好的模型參數,所以用大量其他領域的資料讓預訓練模型有一定程度的推理能力。
而在原始論文中,針對 T5 一共做了近 70 組實驗。
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →資料集
C4 (crawl from Common Crawl,每月爬 20TB,清理成 750GB 訓練資料),取名為 Colossal Clean Crawled Corpus(大型乾淨爬蟲語料庫),就是 C4 簡稱的由來。也有一說是影射鑽石評級的 4C 規格。
清理規則如下:
模型架構
Step 1: 測試以下三種模型架構
Encoder-Decoder
Seq-to-Seq 常用模型,即分為 Encoder 和 Decoder 兩階段。
Encoder 可以看到前一層全部的資料;
Decoder 僅能看到前一層自己神經元位置前的資料。
如大家耳熟能詳的 BERT 就是 Encoder 的部份。
Language Model
可以想像成 Decoder 結構,當前時間步僅能看到當前時間步之前的資訊。
如大家耳熟能詳的 GPT-2 就是 Decoder。
Prefix LM (Language Model)
Encoder 和 Decoder 的融合,一部分 Encoder 能看見所有資訊、一部分 Decoder 只能看到當前時間步前的資訊。
如 UniLM 便是此架構。
最後實驗結果得出使用 Encoder-Decoder 是最適當的模型架構。
Step 2: 預訓練任務
其中 BERT-style 的效果最好。
效果最好的是 Replace Span,如 SpanBERT 也是使用這種方式。
此為破壞掉文本資料的比例。最後選定了跟 BERT 同樣 15% 的破壞比例。
由於 replace span 需要決定該何種長度的 span,於是測試了不同長度的破壞;最後發現長度 3 的效果最好。
使用方法
資料輸入
一個任務目的的 prompt,加上特徵輸入(文本)與標籤輸出(文本)
以下分別為『機器翻譯』、『分類任務』、『句子相似度』等不同任務的資料輸入輸出。
Example 1:
Input: ["translate English to German", "This is good."]
Output: ["Das ist gut."]
Example 2:
Input: ["cola sentence", "The course is jumping well."]
Output: ["not acceptable"]
Example 3:
Input: ["stsb sentence1: The rhino grazed on the grass.", "stsb sentence2: A rhino is grazing in a field"]
Output: ["3.8"]
預訓練模型
T5 模型也有多變體,可以衡量自己的任務需求與硬體配置來選擇。
Sample Code
以下是一段範例程式碼,想要做減法的任務。
不過效果不算很好。
使用者可以簡單地抽換成自己的任務。
延伸問題
問題一:如何計算信賴區間/信賴分數(confidence score)
References