勾配消失と勾配爆発
深いネットワークを壊す原因と初期の対策を学びます
「勾配消失と勾配爆発」はCoddyKit上の無料Deep Learning Academyレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはDeep Learning Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Deep Learning Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Gradients Are a Product
Through many layers, backprop multiplies many local derivatives together. The size of that long product decides whether learning works or breaks.
Multiplying Small Numbers
If each link's derivative is below one, the product shrinks fast. After many layers the gradient becomes tiny, almost zero by the time it reaches early layers.
That Is Vanishing Gradients
When gradients shrink to near zero, early layers barely update and stop learning. This is the vanishing gradient problem that long stalled deep nets.
Multiplying Big Numbers
If each derivative is above one, the product blows up instead. Gradients grow huge as they travel back, and the weights lurch wildly.
That Is Exploding Gradients
Runaway gradients are the exploding gradient problem. Loss often jumps to NaN as updates overshoot far past any useful value. 💥
Sigmoid Made It Worse
Sigmoid and tanh squash inputs, so their derivatives stay well below one. Stacking them multiplied small numbers and made vanishing gradients common.
ReLU to the Rescue
ReLU has a derivative of exactly one for positive inputs, so it does not shrink the gradient. Switching to ReLU was a key early fix.
relu_grad = 1.0 if x > 0 else 0.0Careful Weight Initialization
Smart schemes like Xavier and He initialization scale starting weights so the gradient product stays near one across many layers.
Clip Exploding Gradients
For explosions, gradient clipping caps the gradient's size before the update, keeping a single huge step from wrecking the model.
torch.nn.utils.clip_grad_norm_(model.parameters(), 1.0)Skip Connections Help
ResNet adds skip connections that let gradients flow straight back, sidestepping the long chain of multiplications that causes vanishing.
Why It All Matters
Keeping the gradient product near one is what lets very deep nets train at all. Every fix here exists to protect that balance.
Quick Check
Let's check the failure modes.
Recap
Long products of derivatives can vanish or explode. ReLU, careful init, clipping, and skip connections keep gradients healthy through deep nets. 💥
よくある質問
「勾配消失と勾配爆発」レッスンは無料ですか?
はい。「勾配消失と勾配爆発」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Deep Learning Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Deep Learning Academyコースには全4レッスンが含まれています。
「勾配消失と勾配爆発」で何を学びますか?
深いネットワークを壊す原因と初期の対策を学びます ブラウザで直接実行するハンズオンコードでDeep Learning Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Deep Learning Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのDeep Learning Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。
「勾配消失と勾配爆発」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このDeep Learning Academyレッスンでコードを書いて実行できますか?
はい。すべてのDeep Learning Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。