Study the paper

Scaling Laws for Neural Language Models

Lessons, visuals, quizzes, flashcards, and resources—organized in teaching order.

All activities

Hyperparameter and Shape Independence

Hyperparameter and Shape Independence

Hyperparameter and Shape Independence

Robustness to Architectural Hyperparameters

Sources

S3.F5

Figure 5: Performance depends very mildly on model shape when the total number of non-embedding parameters Nš‘N is held fixed. The loss varies only a few percent over a wide range of shapes. Small differences in parameter counts are compensated for by using the fit to L​(N)šæš‘L(N) as a baseline. Aspect ratio in particular can vary by a factor of 40 while only slightly impacting performance; an (nlayer,dmodel)=(6,4288)subscriptš‘›layersubscriptš‘‘model64288(n_{\mathrm{layer}},d_{\mathrm{model}})=(6,4288) reaches a loss within 3% of the (48,1600)481600(48,1600) model used in [RWC+19].

Transformer performance depends very weakly on specific architectural hyperparameters—such as the number of layers nlayern_{\rm layer}, the number of attention heads nheadsn_{\rm heads}, or the dimension of the feed-forward layers dffd_{\rm ff}—when the total non-embedding parameter count NN is held constant.

Sources

S3.SS1.p1.10

Transformer performance depends very weakly on the shape parameters nlayer,nheadssubscriptš‘›layersubscriptš‘›headsn_{\rm layer},n_{\rm heads}, and dffsubscriptš‘‘ffd_{\rm ff} when we hold the total non-embedding parameter count Nš‘N fixed. To establish these results we trained models with fixed size while varying a single hyperparameter. This was simplest for the case of nheadssubscriptš‘›headsn_{\rm heads}. When varying nlayersubscriptš‘›layern_{\rm layer}, we simultaneously varied dmodelsubscriptš‘‘modeld_{{\rm model}} while keeping Nā‰ˆ12​nlayer​dmodel2š‘12subscriptš‘›layersuperscriptsubscriptš‘‘model2N\approx 12n_{\rm layer}d_{{\rm model}}^{2} fixed. Similarly, to vary dffsubscriptš‘‘ffd_{\rm ff} at fixed model size we also simultaneously varied the dmodelsubscriptš‘‘modeld_{{\rm model}} parameter, as required by the parameter counts in Table 1. Independence of nlayerssubscriptš‘›layersn_{\rm layers} would follow if deeper Transformers effectively behave as ensembles of shallower models, as has been suggested for ResNets [VWB16]. The results are shown in Figure 5.

For example, the aspect ratio of the model can vary by a factor of 40 with only a negligible impact on performance. A very shallow and wide model can achieve performance within 3% of a much deeper, narrower baseline model of the same total size NN. This independence suggests that deeper Transformers may behave similarly to ensembles of shallower models.

Sources

S3.F5

Figure 5: Performance depends very mildly on model shape when the total number of non-embedding parameters Nš‘N is held fixed. The loss varies only a few percent over a wide range of shapes. Small differences in parameter counts are compensated for by using the fit to L​(N)šæš‘L(N) as a baseline. Aspect ratio in particular can vary by a factor of 40 while only slightly impacting performance; an (nlayer,dmodel)=(6,4288)subscriptš‘›layersubscriptš‘‘model64288(n_{\mathrm{layer}},d_{\mathrm{model}})=(6,4288) reaches a loss within 3% of the (48,1600)481600(48,1600) model used in [RWC+19].

S3.SS1.p1.10

Transformer performance depends very weakly on the shape parameters nlayer,nheadssubscriptš‘›layersubscriptš‘›headsn_{\rm layer},n_{\rm heads}, and dffsubscriptš‘‘ffd_{\rm ff} when we hold the total non-embedding parameter count Nš‘N fixed. To establish these results we trained models with fixed size while varying a single hyperparameter. This was simplest for the case of nheadssubscriptš‘›headsn_{\rm heads}. When varying nlayersubscriptš‘›layern_{\rm layer}, we simultaneously varied dmodelsubscriptš‘‘modeld_{{\rm model}} while keeping Nā‰ˆ12​nlayer​dmodel2š‘12subscriptš‘›layersuperscriptsubscriptš‘‘model2N\approx 12n_{\rm layer}d_{{\rm model}}^{2} fixed. Similarly, to vary dffsubscriptš‘‘ffd_{\rm ff} at fixed model size we also simultaneously varied the dmodelsubscriptš‘‘modeld_{{\rm model}} parameter, as required by the parameter counts in Table 1. Independence of nlayerssubscriptš‘›layersn_{\rm layers} would follow if deeper Transformers effectively behave as ensembles of shallower models, as has been suggested for ResNets [VWB16]. The results are shown in Figure 5.