{
  "id": 101416,
  "title": "Batch Normalization or Weight Normalization?",
  "url": "/competitions/generative-dog-images/discussion/101416",
  "author_name": "",
  "post_date": "2019-07-25T16:14:26.188491800Z",
  "votes": 4,
  "comment_count": 1,
  "views": 0,
  "content": "<p>I recently noticed a very nice <a href=\"https://arxiv.org/pdf/1704.03971.pdf\">paper</a> which describes some advantages of using Weight Normalization instead of Batch Normalization. It should result to a more stable training and may'be also better LB score ;-)</p>\n\n<p>I haven't been able to find an official implementation of a Keras Weight Normalization layer. I was however able to find the code at this <a href=\"https://github.com/krasserm/weightnorm/tree/master/keras_2\">github repository</a>. With that code I've made an implementation with it in this <a href=\"https://www.kaggle.com/rsmits/keras-dcgan-with-weight-normalization\">notebook</a>. </p>\n\n<p>I've had a kernel with exact the same code but then using Adam and Batch Normalization. The implementation with Weight Normalization gave me a small improvement in the LB score. Also I get the impression that it allows for more changes in the hyperparameters and still remains 'stable' when training the GAN.</p>\n\n<p>I'am curious to hear if anybody else is using Weight Normalization and what your impressions about it are?</p>",
  "messages": [
    {
      "id": "584257",
      "postDate": "07/25/2019 16:14:26",
      "content": "<p>I recently noticed a very nice <a href=\"https://arxiv.org/pdf/1704.03971.pdf\">paper</a> which describes some advantages of using Weight Normalization instead of Batch Normalization. It should result to a more stable training and may'be also better LB score ;-)</p>\n\n<p>I haven't been able to find an official implementation of a Keras Weight Normalization layer. I was however able to find the code at this <a href=\"https://github.com/krasserm/weightnorm/tree/master/keras_2\">github repository</a>. With that code I've made an implementation with it in this <a href=\"https://www.kaggle.com/rsmits/keras-dcgan-with-weight-normalization\">notebook</a>. </p>\n\n<p>I've had a kernel with exact the same code but then using Adam and Batch Normalization. The implementation with Weight Normalization gave me a small improvement in the LB score. Also I get the impression that it allows for more changes in the hyperparameters and still remains 'stable' when training the GAN.</p>\n\n<p>I'am curious to hear if anybody else is using Weight Normalization and what your impressions about it are?</p>",
      "rawMarkdown": "I recently noticed a very nice [paper](https://arxiv.org/pdf/1704.03971.pdf) which describes some advantages of using Weight Normalization instead of Batch Normalization. It should result to a more stable training and may'be also better LB score ;-)\n\nI haven't been able to find an official implementation of a Keras Weight Normalization layer. I was however able to find the code at this [github repository](https://github.com/krasserm/weightnorm/tree/master/keras_2). With that code I've made an implementation with it in this [notebook](https://www.kaggle.com/rsmits/keras-dcgan-with-weight-normalization). \n\nI've had a kernel with exact the same code but then using Adam and Batch Normalization. The implementation with Weight Normalization gave me a small improvement in the LB score. Also I get the impression that it allows for more changes in the hyperparameters and still remains 'stable' when training the GAN.\n\nI'am curious to hear if anybody else is using Weight Normalization and what your impressions about it are?",
      "votes": null
    },
    {
      "id": "1690036",
      "postDate": "02/14/2022 16:48:02",
      "content": "<p>Batch normalization(BN) to stabilize and improve GAN training is a common practice in many deep network models. But some experiments show that the use of BN can be unstable and negatively impact the quality of the trained model. One of the reasons is that BN is memory-bandwidth bounded and runs into signiﬁcant run-time during training. </p>\n<p>Well, several research studies have recently explored weight normalization (WN) algorithms for GAN training, which have shown significant improvement in the stability and quality of the generated samples. </p>\n<p>Researchers in this <a href=\"https://arxiv.org/abs/1704.03971\" target=\"_blank\">paper</a> conclude that training using WN is superior to BN for GANs. Their results achieve 10% lower mean squared loss for reconstruction and significantly better qualitative results than BN.</p>\n<p>Then there’s this <a href=\"https://www.researchgate.net/publication/320033027_Comparison_of_Batch_Normalization_and_Weight_Normalization_Algorithms_for_the_Large-scale_Image_Classification\" target=\"_blank\">paper</a> demonstrating that WN algorithms outperform BN only for moderately small networks and datasets. Although they have better training curves, WN algorithms show about 6% lower test top-1 accuracy, which cannot be restored by dropout or increasing weight decay.  </p>\n<p>Their conclusion is that WN algorithms are limited in practical application to relatively shallow networks and thus cannot replace batch normalization for large-scale scenarios. </p>\n<p>Check out if you can get more insight on: <a href=\"https://github.com/stormraiser/gan-weightnorm-resnet\" target=\"_blank\">https://github.com/stormraiser/gan-weightnorm-resnet</a></p>\n<p>I have yet to try my hands with WN but my suggestion would be to experiment with the approach and find out if it gives you better results. </p>\n<p>To easily validate your data and results, I’d suggest <a href=\"https://docs.deepchecks.com/en/stable/\" target=\"_blank\">deepchecks</a> Good luck! </p>",
      "rawMarkdown": "Batch normalization(BN) to stabilize and improve GAN training is a common practice in many deep network models. But some experiments show that the use of BN can be unstable and negatively impact the quality of the trained model. One of the reasons is that BN is memory-bandwidth bounded and runs into signiﬁcant run-time during training. \n\nWell, several research studies have recently explored weight normalization (WN) algorithms for GAN training, which have shown significant improvement in the stability and quality of the generated samples. \n\nResearchers in this [paper](https://arxiv.org/abs/1704.03971) conclude that training using WN is superior to BN for GANs. Their results achieve 10% lower mean squared loss for reconstruction and significantly better qualitative results than BN.\n\nThen there’s this [paper](https://www.researchgate.net/publication/320033027_Comparison_of_Batch_Normalization_and_Weight_Normalization_Algorithms_for_the_Large-scale_Image_Classification) demonstrating that WN algorithms outperform BN only for moderately small networks and datasets. Although they have better training curves, WN algorithms show about 6% lower test top-1 accuracy, which cannot be restored by dropout or increasing weight decay.  \n\nTheir conclusion is that WN algorithms are limited in practical application to relatively shallow networks and thus cannot replace batch normalization for large-scale scenarios. \n\nCheck out if you can get more insight on: https://github.com/stormraiser/gan-weightnorm-resnet\n\nI have yet to try my hands with WN but my suggestion would be to experiment with the approach and find out if it gives you better results. \n\nTo easily validate your data and results, I’d suggest [deepchecks](https://docs.deepchecks.com/en/stable/) Good luck!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1690036,
      "author_name": "erickbecker",
      "author_url": "",
      "post_date": "02/14/2022 16:48:02",
      "content": "<p>Batch normalization(BN) to stabilize and improve GAN training is a common practice in many deep network models. But some experiments show that the use of BN can be unstable and negatively impact the quality of the trained model. One of the reasons is that BN is memory-bandwidth bounded and runs into signiﬁcant run-time during training. </p>\n<p>Well, several research studies have recently explored weight normalization (WN) algorithms for GAN training, which have shown significant improvement in the stability and quality of the generated samples. </p>\n<p>Researchers in this <a href=\"https://arxiv.org/abs/1704.03971\" target=\"_blank\">paper</a> conclude that training using WN is superior to BN for GANs. Their results achieve 10% lower mean squared loss for reconstruction and significantly better qualitative results than BN.</p>\n<p>Then there’s this <a href=\"https://www.researchgate.net/publication/320033027_Comparison_of_Batch_Normalization_and_Weight_Normalization_Algorithms_for_the_Large-scale_Image_Classification\" target=\"_blank\">paper</a> demonstrating that WN algorithms outperform BN only for moderately small networks and datasets. Although they have better training curves, WN algorithms show about 6% lower test top-1 accuracy, which cannot be restored by dropout or increasing weight decay.  </p>\n<p>Their conclusion is that WN algorithms are limited in practical application to relatively shallow networks and thus cannot replace batch normalization for large-scale scenarios. </p>\n<p>Check out if you can get more insight on: <a href=\"https://github.com/stormraiser/gan-weightnorm-resnet\" target=\"_blank\">https://github.com/stormraiser/gan-weightnorm-resnet</a></p>\n<p>I have yet to try my hands with WN but my suggestion would be to experiment with the approach and find out if it gives you better results. </p>\n<p>To easily validate your data and results, I’d suggest <a href=\"https://docs.deepchecks.com/en/stable/\" target=\"_blank\">deepchecks</a> Good luck! </p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "584257": "I recently noticed a very nice [paper](https://arxiv.org/pdf/1704.03971.pdf) which describes some advantages of using Weight Normalization instead of Batch Normalization. It should result to a more stable training and may'be also better LB score ;-)\n\nI haven't been able to find an official implementation of a Keras Weight Normalization layer. I was however able to find the code at this [github repository](https://github.com/krasserm/weightnorm/tree/master/keras_2). With that code I've made an implementation with it in this [notebook](https://www.kaggle.com/rsmits/keras-dcgan-with-weight-normalization). \n\nI've had a kernel with exact the same code but then using Adam and Batch Normalization. The implementation with Weight Normalization gave me a small improvement in the LB score. Also I get the impression that it allows for more changes in the hyperparameters and still remains 'stable' when training the GAN.\n\nI'am curious to hear if anybody else is using Weight Normalization and what your impressions about it are?",
    "1690036": "Batch normalization(BN) to stabilize and improve GAN training is a common practice in many deep network models. But some experiments show that the use of BN can be unstable and negatively impact the quality of the trained model. One of the reasons is that BN is memory-bandwidth bounded and runs into signiﬁcant run-time during training. \n\nWell, several research studies have recently explored weight normalization (WN) algorithms for GAN training, which have shown significant improvement in the stability and quality of the generated samples. \n\nResearchers in this [paper](https://arxiv.org/abs/1704.03971) conclude that training using WN is superior to BN for GANs. Their results achieve 10% lower mean squared loss for reconstruction and significantly better qualitative results than BN.\n\nThen there’s this [paper](https://www.researchgate.net/publication/320033027_Comparison_of_Batch_Normalization_and_Weight_Normalization_Algorithms_for_the_Large-scale_Image_Classification) demonstrating that WN algorithms outperform BN only for moderately small networks and datasets. Although they have better training curves, WN algorithms show about 6% lower test top-1 accuracy, which cannot be restored by dropout or increasing weight decay.  \n\nTheir conclusion is that WN algorithms are limited in practical application to relatively shallow networks and thus cannot replace batch normalization for large-scale scenarios. \n\nCheck out if you can get more insight on: https://github.com/stormraiser/gan-weightnorm-resnet\n\nI have yet to try my hands with WN but my suggestion would be to experiment with the approach and find out if it gives you better results. \n\nTo easily validate your data and results, I’d suggest [deepchecks](https://docs.deepchecks.com/en/stable/) Good luck!"
  },
  "source": "meta"
}