ishizuka
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 6/2ゼミ発表 ## 1.導入 - トランスフォーマーとは - NLP(自然言語処理)における最も重要なモデル・アイデア - RNNやCNNを用いず注意機構のみを用いたモデル - 並列化がかなりしやすく訓練時間が圧倒的に削減可能 - 汎用性が高く現在は画像分類などなどのほかのタスクにも使われる - 背景 - 自己注意機構がトランスフォーマーの性能に不可欠であるかはわかっていない - 目的 - 自己注意機構の必要性を実験する - 注意機構を使わない代替案としてgMLPを提案しその性能をトランスフォーマーと比較する - gMLPとは - 今回提案するMLPベースのモデルで、MLPにゲート機構を組み合わせたもの - MLP:入力層、中間層(隠れ層)、出力層の少なくとも3つ以上の層からなり、各層が全結合されているニューラルネットワーク - ゲート機構:どのゲートから入力を保持し、どの入力を忘れるか制御する機構 - 注意機構を一切使わない - 実験方法 - gMLPとトランスフォーマーの精度を比較する - 画像分類とNLPの二つのタスクのに分けて検証 - NLPはBERTのMLM(Masked Language Model)で検証 - 画像分類はImageNetでVIT(Vision Transformer)と比較 ## 2.モデルの説明 ![](https://i.imgur.com/bAA72cJ.png) - gMLPのモデルの入力は、ビジョントランスフォーマーやBERTと同じように、トークンを線形変換した埋め込みの系列で行われる。これはトークン数×埋め込みの次元数の行列Xによって表される。 - トークンとは - 形態素や単語みたいな単位、ただし統計的に区切る場合はへんな区切り方になる場合もある(SentencePieceの場合など) - ビジョントランスフォーマー(ViT)とは - 画像処理で一般的なCNNなどを利用せずに純粋にTransformerのみを利用しているモデル - 「Norm」:はじめにデータを正規化する - 正規化とは - データを一定のルールに基づいて変形し、利用しやすくすること - 「Channel projection」:次に、チャンネル投影レイヤーで、各トークンごとにチャンネル方向を混ぜ合わせる - ここでいう「チャンネル」は、「埋め込み次元」のことを表している。この操作はトークンごとに独立に適用される。 - 例:特徴量1が、「このトークンはingで終わるか」、特徴量2が、「このトークンの前は、be動詞か」というようなものであった場合、それらを組み合わせて、新しい特徴量3「このトークンは、現在進行形か」というような情報が合成される、というイメージ - 「Activation」:非線形の活性層 - Channel projectionとActivationで行われる操作を数式で表すと、<img src="https://latex.codecogs.com/gif.latex?Z&space;=&space;\sigma&space;(XU)" /> となる。 ここでUはd×dの行列、σは活性化関数。またこれは、トランスフォーマーの順方向伝搬ネットワーク(FFN)の構造と同じ。 - 活性化関数とは - あるニューロンから次のニューロンへと出力する際に、あらゆる入力値を別の数値に変換して出力する関数 - 活性化関数を使うことで 「表現の自由度を上げる」 ことができ、難しい予測や分類をすることが可能になる - 順方向伝搬ネットワーク(FFN)とは - ディープラーニングで用いられるニューラルネットワークの一つ。入力層で受け取ったデータが出力層へ向け、一方通行で処理されていくのが特徴。 - 「Spatial Gating Unit」:次に、前に出力された値を空間ゲーティング層へと入力する - この空間ゲーティング層がこの gMLP の最も重要な要素。これは、例を使うと、「トークン 1 とトークン 2 が文の先頭に並んでいた場合、次の層のトークン 1' の埋め込みは、トークン 1 の埋め込みに、トークン 2 の埋め込みを半分足したものとする」ような関係を表すもの - これを行うことでトークン間の空間情報を所得している - 「Spatial Gating Unit」の中身 - データ長の重み行列のWを用いて線形射影をすることで空間情報を獲得。数式で書くと<img src="https://latex.codecogs.com/gif.latex?f_w,_b&space;(&space;Z&space;)&space;=&space;W&space;Z&space;&plus;&space;b" /> bはバイアス項 - 重みとは - 入力値の重要度を数値化したようなもの - バイアスとは - ニューラルネットワークにおける出力を行うか判断する閾値のようなもの - 次にgMLPでは、上で求めた空間情報に2点の変更を加えることでより適切な空間情報を獲得できるようにした - 1. 線形変換前と後の値の要素ごとの積を計算するゲーティング機構を使う - 2. GLUsのように、入力のZを(例えば0~127次元目、128〜255次元目、のように)2つに分割し、それぞれをゲートする方に別々に使うというもの - これらを数式で書くと次のようになる。<img src="https://latex.codecogs.com/gif.latex?s&space;(&space;Z&space;)&space;=&space;Z_&space;1&space;\odot&space;f_&space;W&space;,&space;_b&space;(&space;Z&space;_2&space;)" /> ここで<img src="https://latex.codecogs.com/gif.latex?\odot" />は要素ごとの積を表しています。 - 「Channel projection」:最後にチャンネル投影レイヤーをもう一度適用すれば完成。 - トランスフォーマーの注意層が、入力の埋め込みの値に応じて「動的に」注意の重みを計算し、他の埋め込みを混ぜ合わせるのに対し、MLP では「静的に」、すなわち、入力の値によらず、学習されたネットワークの重みに応じて他の埋め込みを混ぜ合わせる点が異なっている。 - 具体的には、トランスフォーマーではポジションエンベディング層で文章のトークンの位置などを判断していたが、gMLPではSpatial Gating Unitがそのような情報を取得してくれる ## 3.画像分類 - gMLPを画像分類のタスク(ImageNet)に適用した - gMLPモデルの容量はViT/DeiTと同等に設定した(表1) - 以下のような結果が得られた(表2,ImageNet Top-1) - DeiTと同等の精度およびデータ効率 - 他のMLPの方式を上回った(空間ゲートユニット/Spatial Gating Unitの有効性による) - ConvNetモデルや注意機構を用いたハイブリッドモデルには劣る - 空間射影行列(図3)には局所性と空間的普遍性が見られた - データ駆動型で不規則な非正方形カーネルによる畳み込みを学習している ## 4.BERTを用いたMLM(Masked Language Modeling) - MLMタスクにおける実証研究 - 事前学習とファインチューニングの入出力フォーマットはBERTに準じている。 - Transformerモデルとは異なり位置エンコーディングは使用しない。 - BERTのベースライント様々な空間投影手法を比較 - SGU(Special Gating Unit)がPerplexityにおいてほかのバリエーションよりも低くすぐれていて、SGUを用いたgMLPはTransformerと同様のperplexityを示している。 - Transformer(BERTbase+rel pos)=4.26, gMLP(Multiplicative, split)=4.36 - モデルサイズが大きくなった時の挙動 - 具体的にはモデルの深さを{0.5,1,2,4}でスケーリングし比較した。 - 結果はサイズの小さい(18,36程度)のレイヤーではTransformerが有利(Perplexityが低い)という結果になったがサイズを大きくしていき十分に深いレイヤー(72,144程度)になるとgMLPのほうが有利であるという結果になった。また、SST-2(感情分析)のタスクに転移学習した場合にはgMLPのほうが高い精度を示したが、一方で自然言語推論(MNLI)ではTransformerよりも劣っているという結果が得られた。 - 真ん中のトークンに注目し前の層のどのトークンの埋め込みがどのような強さで混ぜ合わせられているか - 主に前のトークンに注目するフィルタや後ろ、両方向に注目するフィルタなど様々な種類のフィルタが学習できた。 - これまで、自己注意機構はMLMのperplexityやscalabilityを満たすためには必要でないことがわかっている - その一方でgMLPがNLPファインチューニングタスクにおいてTransformerよりも低いことを示した。 - attentionのないSST-2なら有利だがMNLIでは不利である(←有益な情報) - SST-2は単文課題、MNLIは文のペアであるため ↓ - とても小さいアテンションモジュール(サイズ1の単一のヘッド)を持たせた。→aMLP - Transformerは12個のヘッドを持ち全体のサイズは768 - これによりMNLIにおいてもTransformerに匹敵する性能を示し、gMLPとTransformerのいいとこどりができた。 - スケーリング性においてはperplexity(クロスエントロピー)、SST-2、MNLIのすべてにおいてTransformerを超える性能を示している。 - BERTセットアップにおける事前学習とファインチューニングの結果 - gMLPはTransformerとperplexityの点で競合しており大規模な設定であればよりその傾向が顕著である。 - gMLPがTransformerを下回るタスクではモデルが大規模になるのに伴い性能差が縮まる傾向がある - 例えば、baseスケールではgMLPはTransformerよりも8.5%劣っていたがlargeスケールではその差は2.7%に縮まっていた。 - また、gMLPがSQuAD-v1.1で89.5%のF1を達成した。これはDevinらがBERTbaseで報告した結果(88.5%)を大きく上回っている - ただし、公正な比較ではない - そしてaMLPは難易度の高いSQuAD-v2.0でもTransformerよりも高い性能を達成している。 - この結果はTransformerの多数のヘッドを用いた自己注意機構の大部分が冗長であることを示し、その機能の大部分をgMLPの空間ゲーティング層で補うことができる。計算量が増えるとこのわずかなattentionの利点が消えてしまう可能性があるがgMLPの実用的にさせる。 ## 5.結論 - トランスフォーマーはNLPとコンピュータビジョン全体で広く採用されている。 - 特にNLPで多くの印象的な結果が得られた。 - 現在まで、トランスフォーマーがどうして成功結果をもたらすのか明らかになっていない。 - フィードフォワードの性質 - マルチヘッド(Multi-Head)構造と「Self-Attention Layer」 - gMLPは、トランスフォーマーと以下の点において競合できる - pretraining perplexity とViTの精度 - 増加したデータとコンピュータに対するScalability - gMLPは、SQuADなどの困難なタスクに対して注意を払わずとも、魅力的な結果を得ることができる。 - 場合によっては、トランスフォーマーから得られる結果を大きく上回る可能性もある。 - トランスフォーマーの multi-head self-attentionが、センテンス間の調整に必要なタスクに役立つ。 - しかし、gMLPを大きくするだけで、トランスフォーマーとの差が縮まる。 - 実用的にするならば、single-head attentionの少しをgMLPに混ぜるだけで、優れた結果が得られる。 - モデルサイズを大きくする必要がない。

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    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.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully