Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[96] Sharp Minima Can Generalize For Deep Nets #126

Open
dhkim0225 opened this issue Oct 3, 2022 · 0 comments
Open

[96] Sharp Minima Can Generalize For Deep Nets #126

dhkim0225 opened this issue Oct 3, 2022 · 0 comments

Comments

@dhkim0225
Copy link
Owner

Sharpness 를 정의하는 다양한 방법들이 잘못되었다고 지적한 논문
paper
훌륭한 영상 설명 - 딥러닝논문읽기모임

Definitions of flatness/sharpness

몇 가지 sharpness 정의 방법들을 우선 살펴보자

volume $\epsilon$-flatness

hochreiter 센세의 97년 논문 에 따른 방법.

image
image
간단하다. Loss + $\epsilon$ 에 해당하는 영역의 너비.
값이 크면 클수록 flat 하다.

$\epsilon$-sharpness

ICML17 On Large-Batch Training for Deep Learning: Generalization Gap and Sharp Minima 논문에서는 다음과 같이 sharpness를 정의한다.

image
가장 작은 loss 를 갖는 $\theta$ 에서 L2 metric space 의 $\epsilon$ ball 을 그리고, 그 중 가장 큰 Loss 와 가장 작은 Loss 의 차이.

테일러 급수는 다음과 같다.
image

$L(\theta^{'})$ 를 2차 테일러 급수를 이용해 근사한다.

$$ L(\theta^{'}) = L(\theta) + \nabla L(\theta)(\theta^{'} - \theta) + \frac{\nabla^{2}L(\theta)}{2}(\theta^{'} - \theta)^2 $$

근데, $\theta$ 쪽이 local minima 로 정의되었으니, $\nabla L(\theta)$ 항은 0으로 사라진다. (미분 값이 0인 부분이 변곡점)

$$ L(\theta^{'}) = L(\theta) + \frac{\nabla^{2}L(\theta)}{2}(\theta^{'} - \theta)^2 $$

요 녀석을 $\epsilon$-sharpness 수식에 넣으면, $\frac{(\theta^{'} - \theta) \nabla^{2}L(\theta) (\theta^{'} - \theta)}{2}$ 의 최대값을 구하는 문제가 된다.
요 문제에 대한 답은 spectral norm of hessian matrix $\nabla^{2}L(\theta)$ 이다.
(spectral norm 은 singular value 중 최대값을 말한다.)

양 옆에 곱해진 $(\theta^{'} - \theta)$ 가 unit vector 가 아니니, scaling factor 가 필요하다.
spectral norm 에 $\epsilon^2$ term 을 붙여서 다음과 같이 정리된다.
image

Properties of Deep Rectified Network

activation function $\phi$ 가 non-negative homogeneous 하다면, 다음과 같은 수식이 성립한다.
image
relu 의 경우 non-negative homogeneous 하다.
image

따라서, hidden layer 하나의 상태에서는 다음과 같은 수식이 성립한다.
image

여기서 각각의 hidden layer 에 다양한 transformation 을 가할 수 있게 된다.
image
예를 들어, alpha 값을 3으로 두면 $\theta_1$ 에는 3을 곱해주고, $\theta_2$ 에는 1/3 을 곱해주는 것이다.
이렇게 해도, neural network 의 output 은 여전히 변함없게 된다.

bias 가 있는 term 에 대해서도 일반화가 가능하다. appendix 에 추가로 설명이 되어 있다.

이제 이런 transformation 을 가하며, 시각화를 진행해 본다.
같은 등고선은 하나의 weight 에 다양한 transformation 을 가한 것이다
여러 local minima weight 등고선 간격이 넓다면 flat 하다는 의미이고, 등고선 간격이 좁다면 sharp 하다는 의미로 볼 수 있다.
분명 네트워크의 output 은 같지만, 어떤 때는 flat, 어떤 때는 sharp 하면, sharpness 측정의 의미가 없다.
image

Deep Rectified networks and flat minima

증명들은 아직 수학 머리가 없어서 건너 뛴다.
결론만 말하자면,

  1. volume $\epsilon$-flatness 는 Transform 에 따라서 무한히 많은 종류의 값을 지닐 수 있다.
  2. gradient and Hessian of the loss L 은 transform 에 따라서 바뀐다.

Allowing reparametrization

parameter 에 대해 bijection function (전단사 함수) g 를 정의한다면, transformed parameter 를 다음과 같이 정의 가능하다.
image
θ, η 은 다른 space 에 있지만 같은 predictor 이므로, 비슷한 hessian 결과가 나와야 하는데, 그렇지 않았다.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant