Review: Meta Pseudo Labels — Series 3 of 3

Guan
工人智慧
Published in
16 min readJun 23, 2021

--

這是 Google Self-training 系列的最後一篇,這個系列第一篇提出了一個新的Teacher-student 的訓練架構:加入適當的噪聲後,在不斷的迭代訓練下,能夠不斷的推昇準確度。

系列二則是討論了 pre-training, train from scratch, noisy student 三種訓練架構的優缺,以及適合的應用場景。

系列三,也就是本篇,檢討了系列一的缺點,提出了一個改良版,使 Teacher Model 能隨著 Student Model 的表現同時被訓練,更進一步提昇準確度,並成為 ImageNet 的榜首。

Introduction

Noisy Student 是透過已經訓練好的 Teacher Model 輸出某一未被標籤圖片的偽標籤,讓 Student Model 以此標籤為目標預測該圖片結果,當擁有遠多於標籤資料的大量未標籤資料,卻也想取用該未標籤資料的訊息時,Noisy Student 是很棒的選擇。

但問題也十分明顯:如果 Teacher Model 輸出的偽標籤不準確呢?有兩種可能,以 ImageNet 為例:

  1. 就算以本篇取得的 ImageNet SOTA 作為 Teacher Model,不過也是 90.2% 的 Top1 Acc. 而已,還是有 10% 的預測是錯誤的。即 Confirmation Bias。
  2. 該未標籤資料帶有 Teacher Model 未曾見過的模式,譬如說加上某些未知的 Augmentations。

所以 Noisy Student 的缺點是: Teacher Model 是固定的、不隨新加入的資訊(未標籤資料) 訓練!

Despite the strong performance of Pseudo Labels methods, they have one main drawback: if the pseudo labels are inaccurate, the student will learn from inaccurate data. As a result, the student may not get significantly better than the teacher. This drawback is also known as the problem of confirmation bias in pseudo-labeling.

This drawback is also known as the problem of confirmation bias in pseudo-labeling. In this paper, we design a systematic mechanism for the teacher to correct the bias by observing how its pseudo labels would affect the student.

那下個問題便是,如果 Teacher Model 要被訓練,要以什麼訓練他呢?

由於新加入的資料是未標籤資料,當然不可能使用 Supervised training ,況且這也會失去 Noisy Student 原先的立意。答案很直觀:老師當然是透過學生的表現去被訓練。當學生表現的好時,表示老師給出的教學很正確,表現不好時則否(個人認為,這邊有嗅到一絲絲 Reinforcement Learning 的味道)。

Meta Pseudo Labels

這一章節討論了 Loss Function 的設計,經過一連串 model and loss dependency 的推導後,我們可以得出:

事實上,
Student Model 最終在 Labeled dataset 上要能得到最小的 Loss,看似要最佳化的是 Student Model 的參數,但應該是要最佳化 Teacher Model 的參數才對!因為 Student Model 是 Teacher Model 參數的函數!

但由於他們的相依性實在太複雜,根本無法微分,所以論文採用實務上可微分的近似解(ideas from Darts: Differentiable architecture search, Hanxiao Liu et al. and Model agnostic meta-learning for fast adaptation of deep networks, Chelsea Finn et al.):

所以有了,

也就是說,每次 Student Model 使用 unlabeled data 上的 Loss 更新參數後(使用 Teacher 提供的 pseudo label ),然後對 labeled data 運算 Loss, 作為 Teacher Model 的 Loss,去更新 Teacher Model 的參數。

Teacher’s auxiliary loss

除了使用來自於 Student Model 回饋的損失函數外,也嘗試使用其他多種損失函數一起訓練,譬如直接對 Labeled data 訓練得到的 Cross Entropy,以及 unsupervised learning 的 UDA (Unsupervised Data Augmentation)。

Auxiliary Loss

Small Scale Experimen

TwoMoon Experiment

設置了經典的 Two Moon 資料集,雖然僅僅是二維的資料,卻表現出可視的複雜 manifold。

Pseudo Labels uses the bad classifier from Supervised Learning and hence receives incorrect pseudo labels on the unlabeled data.

Meta Pseudo Labels, on the other hand, uses the feedback from the student model’s loss on the labeled instances to adjust the teacher to generate better pseudo labels.

此段的用意很明顯,就是當使用了一個 "bad classifier" 當作老師,Meta Pseudo Labels 很明顯的能夠表現更好。

CIFAR-10–4K, SVHN-1K, and ImageNet-10% Experiments

: Image classification accuracy on CIFAR-10–4K, SVHN-1K, and ImageNet-10%

這一小節並沒有什麼營養,僅是表示在同樣架構的模型和訓練條件下,Meta Pseudo Labels 在小規模數據上確實是行。

..., Meta Pseudo Labels has achieved the best accuracies among the same model architectures on all the three datasets...

ResNet-50 Experiment

Top-1 and Top-5 accuracy on ImageNet with ResNet-50

同上節,展示得到了幾乎在各方法中最好的 ResNet-50,在 Top-5 稍稍惜敗 FAIR 的 Billion-scale ,但 FAIR 使用的 3.5B labeled Instagram 確實還是比 JFT 大了不少。

Large Scale Experiment: Pushing the Limits of ImageNet Accuracy

Top-1 and Top-5 accuracy on ImageNet

Meta Pseudo Labels 超越 Noisy Student 將近 2% Top-1 Acc. ,但這是有非常大代價的。

在 Model parallelism 小節中,說明了同樣在 2048 TPUv3 cores 上,即便在使用了 model parallelism 後,Meta Pseudo Labels 仍花費了 11 天訓練 EfficientNet-L2;而 Noisy Student 中則僅花費 6 天,原因之一是 Noisy Student 是 fixed teacher,它可以將訓練圖片先運算儲存為 logits,故在記憶體使用及運算時間上都遠遠少於本篇。

A lite version of Meta Pseudo Labels

顯然,原版的 Meta Pseudo Labels 不論在資料集、運算機器上都遠非一般人能夠想像,佛心來著的 Google 提供了另一個 "lite version":

首先,JFT-300M 並非開源資料,於是替算成「僅有」100M 圖片的 YFCC 資料集作為 unlabeled data。

此外,訓練架構嘗試使用 fixed teacher 的想法,使用原始 Teacher Model 對所有 unlabeled data 計算出 logits 並儲存。在 Student Model 的訓練階段,使用一個簡單的模型,如 MLP 作為 Teacher Model 。

這樣的架構不但同樣能夠得到原先強大 Teacher Model 的資訊,也能夠在訓練階段,讓 MLP 模型根據 Student Model 的表現調整 logits。

這樣的訓練架構和 Noisy Student 非常像似,也承襲 Meta Pseudo Labels 的優點,我個人認為,這算是本篇論文的一大亮點。

Benchmark of Reduced Meta Pseudo Labels

不過,還有一些值得討論,譬如:

  1. 如果將原版的 Meta Pseudo Labels 使用 YFCC 100M 作為比較,我們能夠看到將原先的 Teacher Model 換成 MLP 後,會損害多少表現。
  2. 如果使用一個 ResNet-50 而非 MLP 呢?
  3. 綜合以上兩點,使用的 unlabeled dataset 大小和 Reduced Teacher Model 對於 Meta Pseudo Labels 的影響是什麼?

總之,對於運算力庶民的我來說,"Reduced" Meta Pseudo Labels 反而是我想了解更多的部份。

Related Works

這一節有價值的部份是闡述了 Pseudo Labels 與其他演算法的差異或本片的借鑑,如

  1. 與 Self-supervised Learning 的差別是,對於使用 labeled data 的 SSL,如 RotationJigsaw PuzzleColorization etc.,模型表現將受限於資料量。對於不使用 labeled data 而透過資料本身帶有的資訊去訓練的演算法,如 SimCLR,Meta Pseudo Labels 這種透過強烈先驗 (Teacher Model) 給出的資訊,顯然更勝於僅使用資料本身的 trivial information。

First, the student in Meta Pseudo Labels never learns directly from labeled data, which helps to avoid overfitting, especially when labeled data is limited. Second, the signal that the teacher in Meta Pseudo Labels receives from the student’s performance on labeled data is a novel way of utilizing labeled data.

2. 與 Knowledge Distillation,共同之處是 soft labels,用更好的方式來設計 soft labels 都是雙方達成更好表現的關鍵。只不過同大多數演算法, Knowledge Distillation 的 soft labels 通常都是不隨訓練變動的,這是與 MPL 的不同之處。

Both of these methods can be seen as adjusting the labels of the training examples to improve optimization and generalization.

3. Bi-level optimization,中文通常翻作雙層規劃或雙層最佳化,簡單但不嚴謹的定義是「如果下層模型的輸出是上層模型的參數」,就可以被理解為 Bi-level optimization。這個比較少在 Deep Learning 的領域中看到,除了 meta-learning 領域,而 MPL Gradient approximation 是基於 Bi-level optimization 所得出的結果。

Appendix

本篇論文的附錄也是非常精彩,如 A 有關於 Teacher Model 和 Student Model 近似 Loss function 的推導,C 則是為了打破 SOA 的hyper parameter tuning,D 則是由演算法觀點分析 Meta Pseudo Labels ,值得一讀

Appendix D

D.1. Visualizing the Contributions of Meta Pseudo Labels

Contributions of MPL (Meta Pesudo Labels)

文中提到這裡有兩個觀察:

  1. 在少量訓練樣本下(此處使用 ImageNet 10%),MPL 是很好的 Regularization,甚至勝過 RandAugment。在 Supervised 情境下,使用 MPL 是將 labeled data 作為 unlabeled data,並輸出 soft label,如同 label smoothing 一樣,只是 label smoothing 的函數是固定的,而 MPL 則隨著學生表現持續更新。
  2. 在少量訓練樣本下,UDA 遠勝過 Supervised + MPL + Finetune,MPL + UDA 更是強強聯手,讓已經很強大的 UDA 再躍昇 5.25% top-1 acc.。

D.2. Meta Pseudo Labels Is An Effective Regularization Strategy

這一小節則是將 MPL 作為 Regularization ,不過是選用兩個小資料集,前一小節勝過 RandAugment,比較令人驚訝。

MPL as Regularization on CIFAR-10 and SVHN

D.3. Meta Pseudo Labels Is a Mechanism to Addresses the Confirmation Bias of Pseudo Labels

MPL 的另一個重點,就是要解決 Noisy Student Confirmation Bias 問題,即,Teacher Model 若非百分之百準確,Pseudo Labels 終究與真實答案有若差,自然 Student Model 的學習也會有落差。

Training accuracy of Meta Pseudo Labels and of supervise learning

在 CIFAR-10 與 ImageNet-10% 中可以看到不同的現象,前者為慢於 Supervised 收斂,而後者則是快於。本作認為,這兩種行為都是為了使 Student Model 更好的學習,避免 confirmation bias。

  1. CIFAR-10
    因為 CIFAR-10 標記資料非常少,如果Teacher Model太快的收斂(像是 Supervised 一樣),就無法 generalize to unlabeled data並給出可靠的 pseudo labels。而上圖中,Teacher and Student 都收斂得很慢,Student Model 顯然「不同意」pseudo labels,導致 Teacher Model 不斷修正 pseudo labels,又更拉長 Student Model 收斂的時間。長的收斂時間避免了 confirmation bias。
  2. ImageNet 10%
    Student Model 的快速收斂,甚至還要快於 Teacher Model,後者只好快速的學習,兩邊相輔相成。文中並懷疑 Supervised 是 overfitting,若以 Supervised 作為 Teacher Model (即 pseudo labels),則會導致confirmation bias。

我個人感覺這一節有點牽強,或是說明不足,看似能夠自圓其說,但缺少 Testing Acc. 的比較,為什麼 ImageNet10% 上的 Supervised 是 overfitting ,而 CIFAR-10 上就不是呢(如果是,表示 MPL 也 overfitting 了)?只因為 MPL 讓 Teacher and Student Model 花費更多時間收斂?過幾天再來重新看看這章節,如果對原文有其他理解,也請留言指導。

D.4. Meta Pseudo Labels with Different Training Techniques for the Teacher

MPL with other training techniques

本小節指出, MPL 與現行常用的訓練技巧皆可共用。圖中為 Student Model 之 acc.。

D.5. Meta Pseudo Labels with Different Amounts of Labeled Data

Discussion

近日另有一篇相關論文為 Knowledge distillation: A good teacher is patient and consistent ,與本篇共同闡述了 trade-off of model scale and performance :

  1. 透過 Meta Pseudo Labels,相似規模的模型,可以透過 Meta Pseudo Labels 達到超越該規模模型常規的精確度。
  2. 透過 "Patient Teacher" ,有希望讓輕量模型達到大規模模型的表現。

雙方的目的不同,但都是為了提升 performance / cost ,期望這系列論文能夠融合兩種觀點,在架構及訓練上釐清如何產生更有效率的模型。

--

--