5
$\begingroup$

Can vanishing gradients be detected by the change in distribution (or lack thereof) of my convolution's kernel weights throughout the training epochs? And if so how?

For example, if only 25% of my kernel's weights ever change throughout the epochs, does that imply an issue with vanishing gradients?

Here are my histograms and distributions, is it possible to tell whether my model suffers from vanishing gradients from these images? (some middle hidden layers omitted for brevity)

enter image description here enter image description here enter image description here enter image description here

$\endgroup$
2
  • $\begingroup$ What did you do to visualize weights during training, please? $\endgroup$
    – Avv
    Commented Mar 4, 2023 at 19:59
  • 1
    $\begingroup$ @Avv I used Tensorboard, and went to the histograms tab. Please google a good Tensorboard tutorial. $\endgroup$ Commented Mar 9, 2023 at 15:39

1 Answer 1

3
$\begingroup$

Vanishing Gradients can be detected from the kernel weights distribution. All you have to look for is whether the weights are dying down to 0.

If only 25% of your kernel weights are changing that does not imply a vanishing gradient, it might be a factor, but there can be a variety of reasons, such as poor data, loss function used to the optimizer, etc. Kernel's weight not changing only points out that the model is not learning well.

From the histograms, only the conv_2d_2 layer shows any form of vanishing gradients since the numbers are pretty small. But even that seems to be picking after 600 epochs. Usually, a good indicator is to have the mean of the weights in a layer to be closer to 0 and the standard deviation to be closer to 1. So, if this is maintained to a good extent during training, you're good to go.

$\endgroup$
1
  • $\begingroup$ how I can visualize weights during training, please as @Elegant Code did? $\endgroup$
    – Avv
    Commented Mar 4, 2023 at 19:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .