AIOT
      • 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
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners 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
    • 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 Help
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
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners 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
    # BinaryConnect: Training Deep Neural Networks with binary weights during propagations 作者:Matthieu Courbariaux, Yoshua Bengio, Jean-Pierre David 論文連結:https://arxiv.org/abs/1511.00363 整理by: [chewei](https://hackmd.io/@WTuIbJANSB26DiAX-WL4Sg) - - - - - ## 0. 論文貢獻 本篇論文提出了BinaryConnect的 ***"方法"*** 來實現把在訓練中forward跟back propagations的權重以**二元化**後**累加**(accumulated)的方式代替**乘法**運算(multiply-accumulate operations) $\Rightarrow$大量降低耗電(power-hungry)及空間(space)使用率 ## 1. 本篇論文的研究基石 ***Noisy weights:*** 指的是權重參數加入隨機性的情況,這種隨機性可能來自於訓練數據的內在噪聲、初始化過程、或是訓練過程中使用的某些正則化技術。這種噪聲有時可以幫助模型避免過度適應訓練數據(overfitting)。 在Stochastic Gradient Descent (SGD)中,***保持期望值的高精度比高精度來的重要***,也就是只要權重的***期望值***相同,加入Noisy weights是可以有效防止overfitting發生的。 回到論文主題Binarize來看,其實這種二元化就是將權重離散化,跟Noisy weights概念相似,因此也是可以達到防止***overfitting且提高效率***的效果。 ## 2. Deterministic vs stochastic binarization >此部份與下一篇BNNs相同,在BNNs中將會探討何者較適合被用在架構內 ***Deterministic function(AKA Sign function):*** $$x^b = \text{Sign}(x) = \begin{cases} +1 & \text{if } x \geq 0, \\ -1 & \text{otherwise}, \end{cases} $$ $x^b$ 是binarized後的變數 x 是轉換前的真實變數 ***Stochastic function:*** $$x^b = \begin{cases} +1 & with \, probability \,\, p=\sigma(x),\\ -1 & with \, probability \,\, 1-p, \end{cases} $$ ***$\sigma$是"hard sigmoid" 函式:*** $$ \sigma(x)=\text{clip}( \frac{x+1}{2} \quad,0,1)= \text{max}(0,\text{min}(1,\frac{x+1}{2})) $$ ## 3. Propagations vs updates > 探討在"參數傳遞"和"SGD更新參數"時是否皆有必要進行離散化(二元化)。 **前向傳播(forward-propagation):** 給定DNN的輸入後,一層一層**計算單元**(unit)**的激活函數**(activations)直到最後一層。 **後向傳播(back-propagation):** 給定DNN的輸出後,一層一層往前**計算梯度**(gradient)直到第一層。 **參數更新(parameter update):** 在每一層計算完梯度後,會以剛才1.**計算好的梯度**2.**先前的參數值**用來**更新參數**(update parameter)。 $\rightarrow$ 作者根據以下演算法各步驟拆分開來看,發現在**更新參數**(parameter update)時,SGD所需的較高的精度來進行細微的改變(這些微小的改變是通過梯度下降獲得的),因此在這個部份的參數**不會被Binarize**。 $\rightarrow$ 只有在**前向傳播(forward-propagation)**,**後向傳播(back-propagation)** 時的參數會做**Binarize** <details> <summary>SGD with BinaryConnect演算法</summary> **Requitre:** 1. minibatch 的輸入及目標 2. 前一個參數$w_{t-1}$(weights) 3. $b_{t-1}$(biases) 4. 學習率$\eta$ **Ensure:** 更新後參數$w_t$和$b_t$ 1.**前向傳播(forward-propagation):** $$ \begin{align*} & w_b\leftarrow\text{binarize}(w_{t-1}) \\ & \text{ For } k=1 \text{ to } \text{ L ,}\text{ compute } a_k \text{ knowing } a_{k-1},w_b \text{ and } B_{t-1} \end{align*} $$ 2.**後向傳播(back-propagation):** $$ \begin{align*} & \text{Initialize output layer's activations gradient}\frac{\partial C}{\partial a_L} \\ & \text{For k=L to 2 ,compute}\frac{\partial C}{\partial a_{k-1}}\text{ Knowing }\frac{\partial C}{\partial a_k}\text{ and }w_b \end{align*} $$ 3.**參數更新(parameter update):** $$ \begin{align*} & \text{Compute}\frac{\partial C}{\partial w_b}\text{ and }\frac{\partial C}{db_{t-1}}\text{Knowing}\frac{\partial C}{\partial a_k}\text{and}a_{k-1} \\ & w_t\leftarrow\text{clip}(w_{t-1}-\eta\frac{\partial C}{\partial w_b}) \\ & b_t\leftarrow b_{t-1}-\eta\frac{\partial C}{\partial b_{t-1}} \end{align*} $$ </details> ## 4.Clipping 在每次**參數更新後**對其做clipping達到正則化效果,並把參數限制在+/-1,其作法如第2.點公式。 ![image](https://hackmd.io/_uploads/H1a-AcHT6.png) ## 5.實驗 1.以Deterministic function的方式做二元化,並且在inference時使用**二元化後的參數進行檢測** 。 2.以Stochastic function的方式做二元化,但此二元化計算完後會將權重**轉換回real-valued的權重進行檢測** 。 結果如下圖: ![image](https://hackmd.io/_uploads/r1ch9iHTp.png) $$\text{Error Rate}$$ > 二元化後的準確率不減反增,作者認為這是因為二元化可視為一種Dropout ## Reference Dropout DropConnect

    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