Normalization Layer Per-Example Gradients are Sufficient to Predict Gradient Noise Scale in Transformers

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Gray, Gavia, Tiwari, Aman, Bergsma, Shane, Hestness, Joel
Formato: Preprint
Publicado: 2024
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866916465827905536
author Gray, Gavia
Tiwari, Aman
Bergsma, Shane
Hestness, Joel
author_facet Gray, Gavia
Tiwari, Aman
Bergsma, Shane
Hestness, Joel
contents Per-example gradient norms are a vital ingredient for estimating gradient noise scale (GNS) with minimal variance. Observing the tensor contractions required to compute them, we propose a method with minimal FLOPs in 3D or greater tensor regimes by simultaneously computing the norms while computing the parameter gradients. Using this method we are able to observe the GNS of different layers at higher accuracy than previously possible. We find that the total GNS of contemporary transformer models is predicted well by the GNS of only the normalization layers. As a result, focusing only on the normalization layer, we develop a custom kernel to compute the per-example gradient norms while performing the LayerNorm backward pass with zero throughput overhead. Tracking GNS on only those layers, we are able to guide a practical batch size schedule that reduces training time by 18% on a Chinchilla-optimal language model.
format Preprint
id arxiv_https___arxiv_org_abs_2411_00999
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Normalization Layer Per-Example Gradients are Sufficient to Predict Gradient Noise Scale in Transformers
Gray, Gavia
Tiwari, Aman
Bergsma, Shane
Hestness, Joel
Machine Learning
I.2.6
Per-example gradient norms are a vital ingredient for estimating gradient noise scale (GNS) with minimal variance. Observing the tensor contractions required to compute them, we propose a method with minimal FLOPs in 3D or greater tensor regimes by simultaneously computing the norms while computing the parameter gradients. Using this method we are able to observe the GNS of different layers at higher accuracy than previously possible. We find that the total GNS of contemporary transformer models is predicted well by the GNS of only the normalization layers. As a result, focusing only on the normalization layer, we develop a custom kernel to compute the per-example gradient norms while performing the LayerNorm backward pass with zero throughput overhead. Tracking GNS on only those layers, we are able to guide a practical batch size schedule that reduces training time by 18% on a Chinchilla-optimal language model.
title Normalization Layer Per-Example Gradients are Sufficient to Predict Gradient Noise Scale in Transformers
topic Machine Learning
I.2.6
url https://arxiv.org/abs/2411.00999