From the course: Deep Learning with Python: Optimizing Deep Learning Models

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Gradient clipping

Gradient clipping

- [Instructor] Gradient Clipping is a technique used in deep learning to prevent the gradients of a model from becoming excessively large during training. This phenomenon known as exploding gradients occurs when the gradients of the loss function respectively model's parameters grow excessively large during back propagation, this can destabilize training cause numerical issues and prevent the model from converging to an optimal solution. Gradient clipping solves this problem by putting a limit or cap on how large the gradients can get. There are two primary approaches to gradient clipping, clipping by value and clipping by norm. In clipping by value, each individual gradient is clipped so that it doesn't exceed a specific minimum value or maximum value. Let's walk through a simple example of how this works. Suppose we have a gradient vector G with values two, negative six, eight, negative three, and five with a gradient threshold C set to four. This means that the minimum greater…

Contents