A Convexity-Dependent Two-Phase Training Algorithm for Deep Neural Networks

Tomas Hrycej, Bernhard Bermeitinger, Marco Pavone, G. Wiegand, Siegfried Handschuh

TL;DR

This paper proposes a novel two-phase training algorithm for deep neural networks that leverages the observed phenomenon of loss functions transitioning from non-convex to convex regions during training. By intelligently switching from a robust non-convex optimizer (Adam) to a highly efficient convex optimizer (Conjugate Gradient) at a detected "swap point," the algorithm achieves significantly faster convergence and improved accuracy compared to using a single optimizer.

What Problem Does This Paper Address?

Training deep neural networks involves minimizing a complex, often non-convex, loss function. While non-convex optimizers like Adam are widely used due to their ability to navigate these challenging landscapes, they can be slow to converge. Theoretically, any local minimum of a smooth function implies a convex region around it, where second-order methods like Conjugate Gradient (CG) offer guaranteed superlinear convergence. However, the practical challenge lies in identifying these convex regions within the vast, non-convex search space of deep learning models. This paper addresses the gap between the theoretical benefits of convex optimization in specific regions and the practical difficulty of identifying those regions during training.

Methods

The core of the proposed method is a two-phase optimization strategy.

  • Phase 1 (Non-convex): The training begins with Adam, a popular adaptive learning rate optimizer known for its effectiveness in non-convex landscapes.
  • Phase 2 (Convex): The algorithm monitors the gradient norm during training. The hypothesis is that as the training progresses and approaches a local minimum, the loss function transitions from a non-convex region to a convex one. This transition is characterized by the gradient norm initially increasing (in the non-convex region) and then decreasing (in the convex region). The point where this trend reverses is identified as the "swap point." Once this point is detected, the optimizer switches to Conjugate Gradient (CG) with a golden line search, leveraging its superior convergence properties in convex regions.

The swap point detection is based on observing the relationship between the gradient norm and the loss. Specifically, the algorithm looks for a peak in the gradient norm followed by a decrease. A tolerance is used to account for imprecision in gradient norm calculations, especially with mini-batch updates.

Datasets

The experiments were conducted on the following datasets:

  • CIFAR-10
  • CIFAR-100
  • MNIST

Key Insights and Ideas

  • The "Convexity Swap" Hypothesis: The paper posits that deep learning loss functions often exhibit a predictable structure: starting in a non-convex region and transitioning to a convex region as training progresses towards a minimum. This is a crucial assumption that underpins the entire algorithm.
  • Gradient Norm as a Convexity Indicator: The relationship between the gradient norm and the loss function serves as a practical, albeit heuristic, indicator of convexity. An increasing gradient norm with decreasing loss suggests non-convexity, while a decreasing gradient norm with decreasing loss suggests convexity.
  • Synergy of Adam and CG: The algorithm demonstrates that combining the strengths of a robust non-convex optimizer (Adam) for the initial exploration and a highly efficient convex optimizer (CG) for the final convergence can lead to significant improvements.
  • Low Risk of the Two-Phase Approach: The authors highlight that even if the convexity hypothesis doesn't perfectly hold, the two-phase approach is not disastrous. Using Adam in a convex region is inefficient but not detrimental, and using CG in a non-convex region might lead to slower convergence but doesn't necessarily trap the optimizer.

Key Results

The two-phase Adam+CG algorithm consistently outperformed a pure Adam training approach across various model variants and datasets.

  • Improved Convergence Speed: Figure 6 visually demonstrates that the two-phase approach (blue and magenta curves) achieves a significantly lower loss much faster than a pure Adam training run (blue and green curves). The CG phase, in particular, shows a considerably faster decrease in loss.
  • Better Final Loss and Accuracy: Table 1 presents quantitative results showing that the Adam+CG algorithm generally achieves lower training and validation losses and higher training and validation accuracies compared to pure Adam. For instance, on the MNIST dataset with the vit-mlp variant, Adam+CG achieved a validation loss of 0.0044 compared to 0.0061 for Adam.
  • Consistent Pattern: The observed pattern of gradient norm behavior and the effectiveness of the two-phase approach were surprisingly consistent across different Vision Transformer (ViT) variants and the VGG5 architecture, as well as across the tested datasets.

Limitations and Future Work

  • Generalizability to Large Models: The authors acknowledge that the experiments were conducted on relatively small models to ensure feasibility within given computing resources. A key question for future work is to verify this hypothesis and the algorithm's effectiveness on much larger, state-of-the-art models.
  • Arbitrary Convexity Structures: While the paper hypothesizes a simple convex-then-non-convex structure, real-world loss functions can be much more complex, with alternating convex and non-convex regions. The current swap point detection might not be optimal in such scenarios.
  • Overdetermination Ratio: For datasets like CIFAR-100 with a high overdetermination ratio (KM/P), the performance was relatively poor, suggesting that the model size might have been insufficient for the complexity of the task, even with the improved optimization.
  • Future Work: The authors explicitly state that their next goal is to verify the hypothesis on a large text-based model. They also suggest that further research could explore more sophisticated methods for identifying the convex regions and potentially adapt the swap point detection to more complex loss landscapes.

Summary updated

Abstract

The key task of machine learning is to minimize the loss function that measures the model fit to the training data. The numerical methods to do this efficiently depend on the properties of the loss function. The most decisive among these properties is the convexity or non-convexity of the loss function. The fact that the loss function can have, and frequently has, non-convex regions has led to a widespread commitment to non-convex methods such as Adam. However, a local minimum implies that, in some environment around it, the function is convex. In this environment, second-order minimizing methods such as the Conjugate Gradient (CG) give a guaranteed superlinear convergence. We propose a novel framework grounded in the hypothesis that loss functions in real-world tasks swap from initial non-convexity to convexity towards the optimum. This is a property we leverage to design an innovative two-phase optimization algorithm. The presented algorithm detects the swap point by observing the gradient norm dependence on the loss. In these regions, non-convex (Adam) and convex (CG) algorithms are used, respectively. Computing experiments confirm the hypothesis that this simple convexity structure is frequent enough to be practically exploited to substantially improve convergence and accuracy.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
MNISTAdam+CG (vit-mlp)Train loss (MSE)0.0001split: train · fine-tuned · epochs=700 · backbone=vit-mlp · training-schedule=210 Adam + 490 CG
Source quote
L307: vit-mlp │ Adam+CG │ 0.0001 │ 0.9997 │ 0.0044 │ 0.9738 │ 3.8946
CIFAR-10Adam+CG (vit-mlp)Train loss (MSE)0.0041-0.01 vs baselinesplit: train · fine-tuned · epochs=700 · backbone=vit-mlp · training-schedule=210 Adam + 490 CG
Source quote
L317: vit-mlp │ Adam+CG │ 0.0041 │ 0.9703 │ 0.0991 │ 0.4354 │ 3.0817
CIFAR-100Adam+CG (vit-mlp)Train loss (MSE)0.0028split: train · fine-tuned · epochs=700 · backbone=vit-mlp · training-schedule=210 Adam + 490 CG
Source quote
L327: vit-mlp │ Adam+CG │ 0.0028 │ 0.7579 │ 0.0134 │ 0.1505 │ 29.7442
Reported baseline / comparator measurements (3)
BenchmarkMethodMetricScoreProtocol / Evidence
MNISTAdam (vit-mlp) baselineTrain loss (MSE)0.0008split: train · fine-tuned · epochs=700 · backbone=vit-mlp
Source quote
L306: vit-mlp │ Adam │ 0.0008 │ 0.9954 │ 0.0061 │ 0.9652 │ 3.8946
CIFAR-10Adam (vit-mlp) baselineTrain loss (MSE)0.0091split: train · fine-tuned · epochs=700 · backbone=vit-mlp
Source quote
L316: vit-mlp │ Adam │ 0.0091 │ 0.9431 │ 0.0997 │ 0.4281 │ 3.0817
CIFAR-100Adam (vit-mlp) baselineTrain loss (MSE)0.0041split: train · fine-tuned · epochs=700 · backbone=vit-mlp
Source quote
L326: vit-mlp │ Adam │ 0.0041 │ 0.7055 │ 0.0128 │ 0.1545 │ 29.7442
BibTeX
@misc{hrycej2025convexity,
  author = {Tomas Hrycej and Bernhard Bermeitinger and Marco Pavone and G. Wiegand and Siegfried Handschuh},
  title = {{A Convexity-Dependent Two-Phase Training Algorithm for Deep Neural Networks}},
  year = {2025},
  eprint = {2510.25366},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.25366},
}
Figure