Towards an Optimal Control Perspective of ResNet Training

Jens Püttschneider, Simon Heilig, Asja Fischer, Timm Faulwasser

TL;DR

This paper bridges the gap between deep learning and optimal control theory by introducing a "stage cost" regularizer to ResNet training. By penalizing intermediate layer outputs, the proposed method naturally forces unnecessary deeper layers to learn identity mappings, providing a mathematically grounded framework for layer pruning.

What Problem Does This Paper Address?

Residual Networks (ResNets) can be mathematically viewed as continuous-time dynamical systems (Neural ODEs), where forward propagation through layers mimics a state trajectory, and network weights act as control signals steering data toward a target representation.

While this optimal control perspective is highly elegant, existing frameworks suffer from two major limitations:

  1. They assume a fixed latent dimension across all layers, whereas real-world ResNets frequently change dimensions (e.g., using $1 \times 1$ convolutions in skip connections).
  2. They rely on restrictive assumptions about the loss function, often excluding standard choices like cross-entropy.

This paper tackles these limitations, extending the optimal control framework to standard, heterogeneous ResNet architectures and generic loss functions.

Methods

The authors introduce a training objective augmented by a stage cost regularizer, which evaluates the loss of intermediate predictions at each hidden residual block.

To handle the changing dimensions across different stages of a standard ResNet, the authors propose a novel data flow: intermediate outputs are obtained by propagating the hidden state through the network's existing non-trivial skip connections and the final output head. This eliminates the need to add arbitrary auxiliary layers for early exits.

Illustration of the proposed ResNet architecture with stage cost regularization, routing intermediate states through skip connections.

To analyze this setup theoretically, they introduce the concept of SubResNets—shallower versions of the target network. They prove asymptotic upper bounds showing that a deep ResNet trained with this stage cost will perform at least as well as a shallower SubResNet trained normally. Crucially, as depth increases, the weights of redundant deeper layers naturally decay to zero, effectively turning those blocks into identity mappings.

Datasets

The method was evaluated on standard image classification benchmarks:

  • MNIST
  • CIFAR-10
  • CIFAR-100

Key Insights and Ideas

  • Self-Regularizing Depth: When trained with a stage cost, the network exhibits a "turnpike-like" behavior. Once the network has processed the data enough to solve the task sufficiently, subsequent residual blocks naturally learn identity mappings (their weights vanish).
  • Faster Convergence in Depth: Unlike standard ResNets, which only optimize for the final output, stage-cost-regularized ResNets achieve high accuracy very early in the network architecture.
  • Theory-Grounded Pruning: Because the residual contributions of deeper layers vanish when they are no longer needed, the framework provides a principled, non-heuristic signal for identifying which layers can be safely pruned post-training.

Key Results

The empirical results validate the tight theoretical bounds derived by the authors:

  • Early Accuracy Plateaus: On CIFAR-10, a ResNet-54 trained with the proposed stage cost achieves a solid fit after just 12 residual blocks, reaching a 78.74% intermediate test accuracy (using the weight-sharing variant).
  • Lossless Pruning in Homogeneous Models: For a homogeneous ResNet (constant filter size) on CIFAR-10, a full ResNet-54 achieved 91.64% accuracy. Pruning it down to just 12 blocks (SubResNet-12) yielded 91.26% accuracy—nearly identical performance despite discarding most of the network.
Loss and test accuracy trajectories across residual block indices for standard ResNets and their shallower SubResNets on CIFAR-10.

Limitations and Future Work

While promising, the authors highlight a few areas for improvement:

  • Validation Guarantees: The theoretical bounds focus strictly on training dynamics and optimization to global optimality; they do not yet provide explicit generalization guarantees for validation data.
  • Surgical Pruning for Heterogeneous Dimensions: While pruning is straightforward in homogeneous networks, standard ResNets with varying dimensions (changing filter counts between stages) present a more complex challenge. The current analysis does not yet yield a lossless, straightforward pruning strategy across these dimensional boundaries, which remains a key focus for future research.

Summary updated

Abstract

We propose a training formulation for ResNets reflecting an optimal control problem that is applicable for standard architectures and general loss functions. We suggest bridging both worlds via penalizing intermediate outputs of hidden states corresponding to stage cost terms in optimal control. For standard ResNets, we obtain intermediate outputs by propagating the state through the subsequent skip connections and the output layer. We demonstrate that our training dynamic biases the weights of the unnecessary deeper residual layers to vanish. This indicates the potential for a theory-grounded layer pruning strategy.
BibTeX
@inproceedings{puttschneider2025towards,
  author = {Jens Püttschneider and Simon Heilig and Asja Fischer and Timm Faulwasser},
  title = {{Towards an Optimal Control Perspective of ResNet Training}},
  booktitle = {HiLD @ ICML},
  year = {2025},
  url = {https://openreview.net/forum?id=xMXpVetlhj},
}
Figure