fhuszar
    • 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
      • Invitee
      • No invitee
    • Publish Note

      Publish Note

      Everyone on the web can find and read all notes of this public team.
      Once published, notes can be searched and viewed by anyone online.
      See published notes
      Please check the box to agree to the Community Guidelines.
    • 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
    • Engagement control
    • 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 Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control 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
Invitee
No invitee
Publish Note

Publish Note

Everyone on the web can find and read all notes of this public team.
Once published, notes can be searched and viewed by anyone online.
See published notes
Please check the box to agree to the Community Guidelines.
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
1
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
--- title: DeepNN Notes on Why Deep Networks Generalize tags: DeepNN, Teaching, Lecture Notes description: Lecture notes on how classical learning theory and generalisation theory was unable to explain the good performance of deep neural netwoks, and new insights that were needed --- # Deep Learning Shouldn't Work (But it Does) In these notes, to accompany lecture 3 of the DeepNN module, I'm going to illustrate the classical learning theory view on generarlisation in machine learning, and explain how it fails to predict the surprisingly good generalisation performance of huge deep neural networks. I'm then going to briefly mention a few new insights and tools that allow us to understand why deep learning works. ## Classical view on generalisation. Recall components of the classical view of genearlisation from [Neil's notes](https://mlatcl.github.io/deepnn/background/background-generalisation.html): * expected error/risk/generalisation error $R(\mathbf{w})$: how well a model with parameters $\mathbf{w}$ does on a test distribution * empirical loss $\hat{R}(\mathbf{w}, \mathcal{D}) = \frac{1}{N}\sum L(x_n, y_n, \mathbf{w})$: the expected loss on a finite training dataset $\mathcal{D} = \{(x_n, y_n), n=1\ldots N\}$ * a model class: the different values $\mathbf{w}$ can take, or the different predictors we can implement by setting the value of $\mathbf{w}$ The following picture illustrates how traditional learning theory reasons about generalisation of various models: ![](https://i.imgur.com/qNXjBnc.png) Our ultimate goal is to find parameters within the model class which have sufficiently low risk or test loss, which is illustrated by the magenta set. In empirical risk minimization (ERM), we do this by minimising the empirical loss on a given training dataset assumed to be sampled from the same distribution that appears in the definition of the risk. The model that minimises the empirical risk (or perhaps a regularised version of it) is shown by the green star. The question of generalisation is, under what assumptions can we guarantee that the green star falls within the magenta set with high probability (we can't guarantee that this happens all the time, which is what the so called *no free lunch* theoems state). Most results in learning theory gave guarantees in tems of the size or complexity of the model class: If the model class is sufficiently small, with sufficient data we can guarantee that minimising empirical risk leads to low (test) risk. There are a number of different results along these lines and a number of different ways to capture the richness of model class, including [Rademacher complexity](https://en.wikipedia.org/wiki/Rademacher_complexity) and the [VC-dimension](https://en.wikipedia.org/wiki/Vapnik%E2%80%93Chervonenkis_dimension). But the story has largely been the same: the larger the model class, the less we can expect machine learning to generalise. However, the model class described by deep neural networks is very rich. Thus, based on the complexity of model class, we shouldn't expect deep learning to work. A lot of people were skeptical about ever-growing neural networks, and expected them to stop working once the model class is too rich for generalisation ## The missing piece of the story But despite these predictions, deep neural networks do seem to generalise well (i.e. the gap between training and test loss is often small). So what's going on? ### Multiple "global" minima There are a number of ways deep learning is different from the classical view. One important difference is that the minimum of the empirical risk is not unique, in the following sense. The loss function in deep learning is non-convex, and as such it may have many local minima. People initially thought this is a problem, because gradient-based optimisation might get stuck in a poor local minimum and achieve sub-optimal performance. However, what seems to be the case, at least in some applications, is that although there are many local optima, most of these are virtually equally good. For example, in image classification with large enough neural networks, there are several local minima, each of which achieve zero misclassiciation error on the training set. In this sense, it makes sense to think of these very good local minima as if they were all multiple global minima, as Neil likes to say. So the following picture is more appropriate in this situation: ![](https://i.imgur.com/8QF5yp4.png) Instead of a single green star, we now have a whole set of models which are virtually indistinguishably good on the training set. The reasoning of generalisation theory would be to guarantee that the green set to be inside the magenta set with a high probability. However, this **does not happen** for large neural networks. Several papers demonstrate that it is possible to find neural networks that have zero training error (green set) yet arbitrarily poor test error. One of the first paper that highlighted this was ([Zhang et al, 2016](https://arxiv.org/abs/1611.03530)) with the title "Understanding deep learning requires rethinking generalization". So, if classical genealisation theory doesn't work, how can we explain why deep learning works at all? Turns out, we have to consider more than just the model class and loss function, and also take into account the optimisation algorithm we use to find one of the minima in the green set. Let's run a thought experiment where we train a neural netwok on the same dataset multiple times, but from a different randomly chosen initialization each time. Because the initialisation is random, we'll end up with a distibution of trained models, it's likely we will find a different "global" minimum each time: ![](https://i.imgur.com/dykku9I.png) What seems to be the case is that stochastic gradient descent (SGD) with random initialisation does not find all of the minima of the training loss with equal probability. It seems to prefer certain minima over others, and this bias or preference turns out to be in favour of minima that generalise well. In other words, while the whole of the green set cannot be guaranteed to be inside the magenta set, the majority of the solutions that SGD finds inside this green set are. Making this kind of statement required completely new approaches to generalisation theory, which also considers the *implicit regularisation* of optimization methods. ## Further reading: new insights Here I give a few pointers to new insights that the community has developed in the past 5 years to help us understand why deep learning works. ### Infinite-width networks, neural tangent kernels Interesting insights can be gained by studying the limit where we increase the number of units at every layer of a neural network to infinity. This regime has been studied before, and when we randomly choose the weight of such an infinitely wide network, they start to behave like Gaussian processes ([Neal, 1994](https://arxiv.org/pdf/1912.02803.pdf)). However, we know know a bit more about infinitely wide networks: we can also tell how they evolve during gradient descent optimisation. This allows us to connect neural network training with kernel methods, whose generalisation properties are better understood. I wrote a [blog post](https://arxiv.org/pdf/1912.02803.pdf) on NTKs if you're intersted in more detail. ### Study of deep linear models As I mentioned elsewhere in the notes, the study of deep linear networks can teach us a lot about the implicit regularisation behaviour of gradient descent. [Arora et al, (2019)](https://papers.nips.cc/paper/2019/file/c0c783b5fc0d7d808f1d14a6e9c8280d-Paper.pdf) consider the problem of matrix completion, with deep linear models. As discussed above, deep linear models (deep nets without the nonlinearity $\phi$) are the same as ordinary linear models, because the composition of linear functions is still a linear function. Yet, it turns out that if you redundantly parametrise linear functions in this way, and train them using gradient descent, you get different solutions depending on the parametrization and initialization. The reason why I mention this here is to highlight that reasoning about the model class neural networks can represent only tells you a small part of the story as to why they are useful. ### New generalisation theory Since the seminal paper of [Zhang et al, (2016)](https://arxiv.org/abs/1611.03530), researchers have been trying to develop new bounds on the generalisation of various deep learning algorithms. There are several avenues for current research, a recent paper titled "Fantastic Generalization Measures and Where to Find Them" ([Jiang et al, 2020](https://arxiv.org/abs/1912.02178)) surveys the most promising current approaches. There was even a competition held at the NeurIPS 2020 conference on which theory can predict the generalisation error of neural networks better ([Jiang et al, 2020](https://arxiv.org/abs/2012.07976)).

Import from clipboard

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 is not available.
Upgrade
All
  • All
  • Team
No template found.

Create custom 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

How to use Slide mode

API Docs

Edit in VSCode

Install browser extension

Get in Touch

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
Upgrade to Prime Plan

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

No updates to save
Compare with
    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

      Upgrade

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Upgrade

      Danger Zone

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

      Syncing

      Push failed

      Push successfully