引導式測驗 · 中等 等級
梯度累積測驗
測試微批量梯度總和、有效批量大小、損失縮放、優化器計時、歸一化限制和過早重置錯誤。
問題 1 的 8
梯度累積主要讓你做什麼?
預覽每個問題8 問題
當您參加測驗時,就會出現答案和解釋。
- 梯度累積主要讓你做什麼?
- 無需任何 GPU 即可訓練
- 跳過向後傳遞
- 在有限的記憶體上模擬更大的有效批量大小
- 完全消除優化器
- 對於微批量大小為 4 和 8 的累積步驟,有效批次大小為:
- 32
- 4
- 8
- 12
- With an accumulation factor N, when should optimizer.step() and zero_grad() occur?
- 每個微批次之後
- 從來沒有
- 向前傳球前
- Call optimizer.step() after N micro-batches, then clear gradients before the next accumulation window
- 為了保持有效學習率正確,每微批次損失通常為:
- 乘以 N
- 除以累加步數N
- 設定為零
- 替換為準確度
- 哪個歸一化層與梯度累積配對得更乾淨?
- 層或群組標準化,因為它們不依賴批量統計數據
- 批量歸一化,因為牠喜歡小批量
- 沒有規範化可以用它
- 僅有輟學
- 使用梯度累積的主要成本是:
- 峰值時使用更多 GPU 內存
- 丟失所有梯度
- 每次有效更新的掛鐘時間更長
- 無法使用優化器
- A training loop clears gradients after every micro-batch but steps the optimizer every fourth batch. What is lost?
- The model weights are deleted
- The earlier micro-batch contributions to the accumulated update
- The effective batch becomes four times larger
- The loss automatically becomes zero
- Why may four micro-batches with BatchNorm behave differently from one physical batch of the same total size?
- The optimizer cannot accept four backward passes
- Gradient addition is forbidden in BatchNorm
- The number of training examples changes
- BatchNorm uses statistics from each micro-batch rather than the combined batch