Kronecker-Factored Approximate Curvature for Modern Neural Network Architectures

The core components of many modern neural network architectures, such as transformers, convolutional, or graph neural networks, can be expressed as linear layers with $\textit{weight-sharing}$. Kronecker-Factored Approximate Curvature (K-FAC), a second-order optimisation method, has shown promise to speed up neural network training and thereby reduce computational costs. However, there is currently no framework to apply it to generic architectures, specifically ones with linear weight-sharing layers. In this work, we identify two different settings of linear weight-sharing layers which motivate two flavours of K-FAC -- $\textit{expand}$ and $\textit{reduce}$. We show that they are exact for deep linear networks with weight-sharing in their respective setting. Notably, K-FAC-reduce is generally faster than K-FAC-expand, which we leverage to speed up automatic hyperparameter selection via optimising the marginal likelihood for a Wide ResNet. Finally, we observe little difference between these two K-FAC variations when using them to train both a graph neural network and a vision transformer. However, both variations are able to reach a fixed validation metric target in $50$-$75\%$ of the number of steps of a first-order reference run, which translates into a comparable improvement in wall-clock time. This highlights the potential of applying K-FAC to modern neural network architectures.

Paper

References (60)

Scroll for more · 38 remaining

Similar papers

Peer review

Reviewer hvpV7/10 · confidence 3/52023-07-05

Summary

This paper extends Kronecker-Factored Approximate Curvature (K-FAC) into training generic neural networks, especially for transformers and graph neural networks. This is done by taking advantage of the weight sharing mechanism. The authors propose two flavors of K-FAC (expand and reduce), depending on the dimension of the output tensor. The authors prove that they are exact for deep linear networks. The proposed methods reach a validation metric target of a well-tuned first-order baseline with smaller steps and less wall-clock time.

Strengths

1. This paper extends K-FAC into transformers and graph neural networks. Although some previous works try to extend K-FAC into transformers, their approximation is inexact, as pointed by the authors. 2. The proposed methods have mathematical foundations. Because the authors prove the exactness under deep linear settings. 3. The proposed methods reach a validation metric target of a well-tuned first-order baseline with smaller steps and less wall-clock time. So it is possible to replace first order methods. 4. This paper provides sufficient supplementary material, including mathematical derivations, additional experiments, and reproduction codes.

Weaknesses

1. The performance of transformers is evaluated on ImageNet. Since transformers are mostly used for language modeling, it is better to evaluate your optimizers on some language tasks (a very big dataset is unnecessary). 2. The authors prove the exactness under deep linear settings. If possible, It is better to provide some error bounds for non-linear settings. 3. It is helpful to provide the time complexity (not wall-clock time) and space complexity for both K-FAC-expand and K-FAC-reduce.

Questions

In figure 4, the K-FAC statistics are updated every 50 steps. 1. Is the same setting used in other figures? 2. What if we change the number of steps?

Rating

7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.

Confidence

3: You are fairly confident in your assessment. It is possible that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

3 good

Presentation

3 good

Contribution

3 good

Limitations

This paper has no negative societal impact.

Reviewer NJ6c5/10 · confidence 3/52023-07-07

Summary

This paper introduces two different settings of linear weight-sharing layers to fit for the second-order optimization method Kronecker-Factored Approximate Curvature (K-FAC). Experiments on GNNs and ViTs achieve less number of steps compared with the first-order baseline.

Strengths

Experiments include GNNs and ViTs, also the results are quite inspiring in the acceleration of steps.

Weaknesses

Fig. 4 doesn’t show the loss and accuracy variations after convergence.

Questions

How about the comparison with other efficient optimization methods other than weight sharing?

Rating

5: Borderline accept: Technically solid paper where reasons to accept outweigh reasons to reject, e.g., limited evaluation. Please use sparingly.

Confidence

3: You are fairly confident in your assessment. It is possible that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

3 good

Presentation

4 excellent

Contribution

3 good

Limitations

The authors discussed the runtime of the two proposed schemes.

Reviewer T2nD5/10 · confidence 3/52023-07-08

Summary

This paper propose two methods called KFAC-reduce and KFAC-expand to conduct the secon-order based training for neural networks. The key idea is to approximate the Gauss–Newton matrix with low-rank matrix decomposition. The experiments on several tasks show that the propsed method can achieves faster convergence rate compared to NAdamW optimizer.

Strengths

- The proposed method has well-grounded theoretical support. - The proposed method has shown better results than the NAdamW/SGD optimizer.

Weaknesses

My biggest concern comes from the evaluation sections. - The proposed method is only verified on limited number of tasks and networks (4 configurations). The author should show more results with various configurations. - The method is only compared with two type of optimizers. For example, SGD is the baseline for GNN experiments while NAdamW is the baseline for the ViT experiment.

Questions

- Fig 4., the loss is not flat and still tend to decrease. Could the author extend the training steps until the loss curve becomes flat?

Rating

5: Borderline accept: Technically solid paper where reasons to accept outweigh reasons to reject, e.g., limited evaluation. Please use sparingly.

Confidence

3: You are fairly confident in your assessment. It is possible that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

3 good

Presentation

2 fair

Contribution

2 fair

Limitations

Please check the weakness sections.

Reviewer M1Nr7/10 · confidence 3/52023-07-13

Summary

The researchers propose a framework for applying the Kronecker-Factored Approximate Curvature (K-FAC) method to neural networks with linear weight-sharing layers. They identify two different settings of linear weight-sharing layers, leading to two variations of K-FAC: expand and reduce. They demonstrate that both variations are exact for deep linear networks with weight-sharing in their respective settings. They find that K-FAC-reduce is generally faster than K-FAC-expand and leverage this to accelerate automatic hyperparameter selection for a Wide ResNet. They also show that both K-FAC variations can achieve a target validation metric in a significantly reduced number of steps compared to a first-order baseline, resulting in a comparable improvement in training time.

Strengths

Very interesting perspective by looking at modern NN building blocks as weight shared linear layers. Solid results and thorough experiments. It's great that the authors measure actual wall-clock time speedup instead of simply recording the steps. This shows that it's a method with practical merits.

Weaknesses

Minor issues in presentations, such as the plots are not really hard to read, and organization of the propositions are too clustered to be read comfortably.

Questions

1. what does Exactness of K-FAC-reduce and K-FAC-expand? why is this property important? 2. How does it fare in lower precision setting, is this still numerically stable?

Rating

7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.

Confidence

3: You are fairly confident in your assessment. It is possible that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

3 good

Presentation

2 fair

Contribution

3 good

Limitations

providing more intuition in the theory section will be highly appreciated. From the reader points of view, who are not familiar with the notation setup, it looks like a "wall of math", everyone complains about.

Reviewer 1aFR7/10 · confidence 2/52023-07-25

Summary

The paper formalizes two variants of the K-FAC optimisation method for a family of neural network architectures that can be expressed as linear layers with weight sharing. Experiments are conducted to validate that the proposed method can be applied to different kinds of neural network architectured speeding-up training.

Strengths

The paper is a bit out of the scope of my specific field of expertise and it is possible that I failed to fully understand all technical details and mathematical formulation, but the general mathematical formulation of the method seems sound and complete. The family or achitectures where the two variants of the proposed method can be applied is formally defined, and the conditions for which exact approximations can be obtained are also defined.

Weaknesses

I miss a better contextualitzation, both from a theoretical and experimental point of view, of the proposed method with other existing approaches, cited in the related work, that also make use of K-FAC and that have also been applied to similar architectures using convolutional networks, transformers or GNNs. From a theoretical point of view, a better justification of the contribution of the proposed method with respect to other applications of K-FAC. From an experimental point of view, a comparison of the proposed method with other works also using K-FAC.

Questions

See above, in the weaknesses section. Basically, contextualization of the proposed method with other similar approaches. ------------------------------- I have read the rebuttal, other reviewers comments, feedback and discussion and I got a better understanding of the contribution of the paper. I increase my rating to accept.

Rating

7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.

Confidence

2: You are willing to defend your assessment, but it is quite likely that you did not understand the central parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

2 fair

Presentation

3 good

Contribution

3 good

Limitations

Limitations of the method are partially addressed.

Reviewer t9fV6/10 · confidence 4/52023-07-27

Summary

This paper considers linear layers with weight-sharing, which is used in many neural network architectures, such as transformers, convolutional and graph neural networks. Two variants of K-FAC, K-FAC –expand and K-FAC-reduce are considered for two different settings of linear weight sharing layers. The authors also show that they are exact for deep linear networks with weight-sharing in their respective setting. Numerical results show the efficiency of the proposed K-FAC variants.

Strengths

This paper is well-written and organized. The use of second-order methods is typically influenced by the specific network architecture. In this paper, we focus on linear weight-sharing layers, which are crucial and commonly used in Transformer, convolutional, and graph networks, but have not received adequate attention in the realm of second-order methods. In my opinion, a more thoughtful analysis of the architecture could enhance the performance of second-order methods like KFAC and others. Undoubtedly, this paper will expand the applicability of second-order methods and their potential benefits for machine learning tasks. This paper provides a correct mathematical representation of gradient for the weight-sharing linear layer structure, which is not trivial and can facilitate the development of related optimization methods.

Weaknesses

One of my concerns is the applicability of second-order methods, particularly for modern architectures such as the LLM model. As noted in the AlgoPerf paper[1], the use of KFAC requires detailed architectural information, which may limit its use in practice. In contrast, methods like Shampoo and NG+ appear to offer more flexibility. Additionally, while the direct approach is effective in practice, there is a lack of theoretical understanding regarding the rationale for using the KFAC-reduce approximation. The computational complexity of the proposed method appears to be higher than previous approaches, which could pose challenges for implementation. However, there is no direct comparison with the current implementation of the KFAC method in this setting, and it would be beneficial to include such a comparison. Additionally, it is recommended to compare the proposed method with other second-order approaches to gauge its effectiveness. [1] Dahl G E, Schneider F, Nado Z, et al. Benchmarking Neural Network Training Algorithms[J]. arXiv preprint arXiv:2306.07179, 2023.

Questions

To improve the clarity of the paper, it is suggested to provide a detailed description of the current implementations mentioned in section 3.2 [13, 29, 31, 43] in section 2, which will help readers follow the paper more easily and understand the differences more clearly. Besides, some mathematical derivations in appendix can be put in the main text. It would be better to mention som related works. 1.) the NG+ method [1], which is similar to Shampoo and uses a direct approach to approximate the Fisher matrix. 2.) AdaHessian method [2], which dynamically incorporates the curvature of the loss function via ADAptive estimates of the Hessian matrix. 3.) the SENG method [3], which employs a sketching method to approximate the empirical Fisher matrix and is implemented in the ASDL package. The computational complexity of using regular K-FAC approximation over N R terms instead of the usual N terms in the KFAC-expand method is higher, and when the batch size is large, as reported in the numerical experiments, it also increases memory usage. In the KFAC-reduce setting, where $\widehat{A_l}$ (also $\widehat{B_l}$) is a symmetric matrix with rank at most N, this rank is small when a smaller batch size is used. However, it is unclear whether this reduction preserves sufficient curvature information. Do the authors consider use moving averaging in the implementation? [1] Yang, Minghan, et al. "An efficient fisher matrix approximation method for large-scale neural network optimization." IEEE Transactions on Pattern Analysis and Machine Intelligence 45.5 (2022): 5391-5403. [2] Yao, Zhewei, et al. "Adahessian: An adaptive second order optimizer for machine learning." proceedings of the AAAI conference on artificial intelligence. Vol. 35. No. 12. 2021. [3] Yang, Minghan, et al. "Sketch-based empirical natural gradient methods for deep learning." Journal of Scientific Computing 92.3 (2022): 94.

Rating

6: Weak Accept: Technically solid, moderate-to-high impact paper, with no major concerns with respect to evaluation, resources, reproducibility, ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

3 good

Presentation

3 good

Contribution

3 good

Limitations

N/A

Reviewer 1aFR2023-08-18

Dear authors, Than you for your response. After reading all the comments, feedback and discussion I got a better understanding of the contribution of the paper. I will increase my rating to accept.

Reviewer t9fV2023-08-18

Reply to Rebuttal by Authors

I apologize for the delayed response to the rebuttal. Thank you for addressing my questions, as it has helped me gain a clearer understanding of this paper. Training large transformer models still poses a challenge for second-order methods. The nanoGPT experiments are encouraging, although the number of parameters in nanoGPT (as indicated in https://github.com/karpathy/nanoGPT) is still smaller compared to the commonly used Transformer models such as GPT-3 and GPT-4. It would be beneficial if the authors reported the train/val loss and compared KFAC with other methods like AdamW. I understand that the authors' focus is on generalizing K-FAC to modern neural network architectures. However, not everyone in the deep learning community is aware of the effectiveness of KFAC. To enhance the persuasiveness of the paper, it would be better to include other first and second-order methods in the numerical experiments. Furthermore, I still have some questions listed below. The method K-FAC is specifically developed to approximate the Fisher Information Matrix (FIM). In general cases, the Generalized Gauss-Newton (GGN) is not equivalent to the FIM. The reference [7] mentioned in section 2.4 can be viewed as a Kronecker-factored approximation to GGN, rather than "KFAC to approximate GGN". I understand that the approach to approximate Fisher can be extended to the GGN case. However, these two concepts should be distinguished. There appears to be a mistake in equation 26. Could you please explain how the second equation was derived? In general cases, $(A \otimes B) D (A^\top \otimes B^\top) \neq (AA^\top) \otimes (BDB^\top)$, where $A\in R^{p\times 1}$, $B\in R^{b\times C}$, $D\in R^{C\times C}$, and $C > 1$. Since Lemma 3 relies on equation 26, please provide clarification on this matter. The case in KFAC-expand and the case in [13] are different. In [13], the authors do not consider the loss with N·R terms. Why does line 199 state that the approximation (6) has been derived for CNN? In the authors' previous reply, the statement "K-FAC-expand is the currently used K-FAC variation for linear weight-sharing layers" is not applicable to the CNN case. I noticed the idea in ``Eva: A General Vectorized Approximation Framework for Second-order Optimizationv'' is very similar to the KFAC-reduce. Please see eq 9 in that paper.

Authorsrebuttal2023-08-18

> Training large transformer models still poses a challenge for second-order methods. (...) We fully agree that training large models still poses challenges for second-order methods, probably mostly due to the memory overhead. We believe this could be addressed by considering sparse structures to approximate the Kronecker factors, see e.g. [1]. However, this is beyond the scope of our paper. While we could not provide full training results for GPT-2 due to the time constraints of the rebuttal, we agree that this will be an interesting experiment. > I understand that the authors' focus is on generalizing K-FAC to modern neural network architectures. (...) The first-order baseline we show per experiment is the best one among AdamW, NAdamW, SGD with Nesterov momentum, and SGD with heavy ball momentum, as described in appendix C.1. Comparing the K-FAC variations to other second-order methods is definitely interesting and could increase the appeal to some readers, but we do not think that this is necessary for the central claims and contributions of the paper. However, we are happy to add at least one second-order baseline for the camera-ready version, e.g. Shampoo. > The method K-FAC is specifically developed to approximate the Fisher Information Matrix (FIM). In general cases, the Generalized Gauss-Newton (GGN) is not equivalent to the FIM. (...) We agree that the two approximations should be distinguished in the case where the FIM and the GGN do not coincide. For the cases where they do, which include common loss functions like the cross-entropy and mean squared error loss we consider in the paper, the two approximations are exactly identical. Hence why we decided to also talk about "K-FAC to approximate the GGN". We will add a clarifying sentence to the paper. > There appears to be a mistake in equation 26. (...) In general cases, $(A \\otimes B) D (A^T \\otimes B^T) \\neq (AA^T) \\otimes (BDB^T)$, where $A \\in \\mathbb{R}^{p \\times 1}$, $B \\in \\mathbb{R}^{b \\times C}$, $D \\in \\mathbb{R}^{C \\times C}$, and $C > 1$. Since Lemma 3 relies on equation 26, please provide clarification on this matter. Sure. The crucial detail is that $A \\in \\mathbb{R}^{p \\times 1}$ is a vector, as you correctly define. In this case the equality indeed holds. To see this, we can rephrase your claim to $(A \\otimes B) D \\neq (A \\otimes BD),$ since if this was an equality we could write $(A \\otimes BD) (A^T \\otimes B^T) = (AA^T) \\otimes (BDB^T)$ due to the mixed-product property of the Kronecker product. We will now show that this inequality is in fact an equality. We have $$(A \\otimes B) D = \\begin{bmatrix} A_1B \\ ... \\ A_pB \\end{bmatrix}^T D = \\begin{bmatrix} A_1BD \\ ... \\ A_pBD \\end{bmatrix}^T = (A \\otimes BD),$$ where $A_1, ..., A_p$ are the scalar components of the vector $A$. > The case in KFAC-expand and the case in [13] are different. In [13], the authors do not consider the loss with N·R terms. (...) In [13] the authors derive K-FAC-expand for CNNs by simply explicitly stating the independence assumptions it implies and not by arguing about the exactness in the deep linear case. We have to distinguish between the setting of K-FAC-expand, i.e. a loss with NR terms, and the approximation itself. As explained in the paper, we can also use K-FAC-expand in the reduce setting and K-FAC-reduce in the expand setting -- which is also what we do in the experiments, since we apply both approximations in the same setting. Crucially, K-FAC-expand was the only approximation known for both settings. However in the reduce setting, K-FAC-expand cannot be motivated by making statements about the exactness in the deep linear case with a Gaussian likelihood. In contrast, we can motivate K-FAC-reduce in this way in the case of a CNN for image classification (assuming average pooling as the aggregation function). We state this in lines 240-242 of the paper, below Proposition 2. To provide some intuition on why K-FAC-expand and K-FAC-reduce can both always be used for linear weight-sharing layers, please refer to the Python code snippet in Listing 1 in the appendix. Here you can see that the quantities needed to calculate the K-FAC approximation will have the same shape in both settings, allowing us to arbitrarily choose one of the two K-FAC variations to deal with the weight-sharing dimension. > I noticed the idea in "Eva(...)" is very similar to the KFAC-reduce. (...) Thanks for the reference. The difference is that the approximation in Eva sums over the mini-batch dimension, whereas K-FAC-reduce takes a sum/mean over the weight-sharing dimension. This is quite different, since Eva does not have a clear motivation in terms of the connection to the exact Fisher/GGN, leads to rank-1 Kronecker factors, and is completely unrelated to weight-sharing. [1] R. Grosse, J. Bae, C. Anil et al. Studying Large Language Model Generalization with Influence Functions. Preprint (arXiv: 2308.03296), 2023.

Program Chairsdecision2023-09-21

Decision

Accept (spotlight)

© 2026 NYSGPT2525 LLC