對文字分類模型的對抗式攻擊

Deep Learning for Text with PyTorch

Shubham Jain

Instructor

什麼是對抗式攻擊?

  • 對輸入資料做微調
  • 非隨機,而是惡意計算的改動
  • 可能大幅影響 AI 的決策
Deep Learning for Text with PyTorch

健全性的重要性

  • AI 判斷使用者留言是否惡意或良性
  • AI 可能因偏誤資料而放大負面刻板印象
  • AI 提供誤導性的資訊
Deep Learning for Text with PyTorch

快速梯度符號法(FGSM)

  • 利用模型的學習訊息
  • 以極小改動欺騙模型

FGSM 攻擊

Deep Learning for Text with PyTorch

投影梯度下降(PGD)

  • 比 FGSM 更進階:採用反覆迭代
  • 嘗試找到最有效的擾動

PGD 攻擊

Deep Learning for Text with PyTorch

Carlini & Wagner(C&W)攻擊

  • 著重最佳化損失函式
  • 不只要騙過模型,還要難以偵測

C&W 攻擊

Deep Learning for Text with PyTorch

建構防禦:策略

  • 模型集成:
    • 使用多個模型

 

  • 強健資料增強:
    • 進行資料增強

 

  • 對抗式訓練:
    • 預先因應欺騙

模型集成

Deep Learning for Text with PyTorch

建構防禦:工具與技術

  • PyTorch 的 Robustness Toolbox:
    • 強化文字模型

 

  • 梯度遮罩:
    • 為訓練資料增加多樣性以隱藏可被利用的模式

 

  • 正規化技術:
    • 維持模型平衡

Python Robustness toolbox

梯度遮罩

正規化技術

1 https://adversarial-robustness-toolbox.readthedocs.io/en/latest/, https://stock.adobe.com/ie/contributor/209161356/designer-s-circle
Deep Learning for Text with PyTorch

一起來練習吧!

Deep Learning for Text with PyTorch

Preparing Video For Download...