Source-linked AI summary

Shallow-Deep Networks: Understanding and Mitigating Network Overthinking

Yigitcan Kaya, Sanghyun Hong, Tudor Dumitras

arXiv:1810.07052v3cs.LGcs.CVstat.ML

TL;DR

Overthinking occurs when a DNN reaches a correct prediction before its final layer, but conventional networks obscure how predictions evolve during inference. The paper introduces SDNs with internal classifiers to study and mitigate this behavior; early exits reduce inference cost while preserving accuracy, and confusion scores indicate likely misclassifications.

  • Problem

    Conventional DNNs provide only a final prediction, obscuring how predictions evolve across layers, even though earlier correct predictions may make further computation wasteful or lead to misclassification.

    Source: §1 · p. 1
  • Method

    The paper modifies off-the-shelf DNNs into Shallow-Deep Networks with internal classifiers, then uses confidence-based early exits and confusion analysis to address overthinking.

    Source: §1 · pp. 1–2
  • Results

    Early exits reduce average inference costs by more than 50% on CIFAR-10 and CIFAR-100 and more than 25% on Tiny ImageNet while preserving accuracy; destructive overthinking occurs in up to ∼50% of CNN errors on natural inputs.

    Source: §1 · p. 2
  • Takeaways & Limitations

    Normalized confusion scores average −0.3 for correct predictions and 0.7 for incorrect predictions, suggesting confusion can help identify likely misclassifications.

    Source: §1 · p. 2

    The study focuses on off-the-shelf CNNs and leaves extension to other architectures for future work.

    Source: §3 · p. 3

Abstract

from arXiv · show

We characterize a prevalent weakness of deep neural networks (DNNs)---overthinking---which occurs when a DNN can reach correct predictions before its final layer. Overthinking is computationally wasteful, and it can also be destructive when, by the final layer, a correct prediction changes into a misclassification. Understanding overthinking requires studying how each prediction evolves during a DNN's forward pass, which conventionally is opaque. For prediction transparency, we propose the Shallow-Deep Network (SDN), a generic modification to off-the-shelf DNNs that introduces internal classifiers. We apply SDN to four modern architectures, trained on three image classification tasks, to characterize the overthinking problem. We show that SDNs can mitigate the wasteful effect of overthinking with confidence-based early exits, which reduce the average inference cost by more than 50% and preserve the accuracy. We also find that the destructive effect occurs for 50% of misclassifications on natural inputs and that it can be induced, adversarially, with a recent backdooring attack. To mitigate this effect, we propose a new confusion metric to quantify the internal disagreements that will likely lead to misclassifications.

1 Introduction

The introduction frames overthinking as correct internal predictions followed by unnecessary computation or misclassification, a process conventional DNNs obscure. It presents SDNs to expose prediction evolution and heuristics to mitigate the wasteful and destructive effects.

1 Introduction

  • Conventional DNNs reveal only a final prediction, leaving the evolution of predictions across layers opaque; earlier early-exit and error-indicator work focused on a single prediction.The paper defines overthinking as an earlier layer producing a correct classification before the final layer.Source: §1 · p. 1
  • The Shallow-Deep Network (SDN) adds internal classifiers to off-the-shelf DNNs, exposing predictions at multiple stages of the forward pass.Pre-trained networks can be converted by training only the internal classifiers; SDNs can also be trained jointly from scratch.Source: §1 · pp. 1–2
  • Up to ∼95% of instances show wasteful overthinking, while up to ∼50% of CNN errors on natural inputs involve a correct internal prediction becoming a misclassification.The destructive effect can also be induced by a recent backdooring attack (Gu et al., 2017).Source: §1 · p. 2
  • Confidence-based early exits target wasteful computation, while confusion analysis measures internal disagreements that indicate likely misclassification.Visualizing disagreements can also reveal input elements involved in confusion and offer a perspective for reasoning about interpretability.Source: §1 · p. 2
  • On CIFAR-10 and CIFAR-100, SDN early exits cut average inference costs by more than 50%, and on Tiny ImageNet they cut costs by more than 25%.They can also improve CNN accuracy by up to 8% and raise a backdoored CNN's accuracy on malicious inputs from 12% to 84%.Source: §1 · p. 2
  • The paper evaluates SDNs on CIFAR-10, CIFAR-100, and Tiny ImageNet across VGG, ResNet, Wide ResNet, and MobileNet architectures.Normalized confusion scores average −0.3 for correct predictions and 0.7 for incorrect predictions.Source: §1 · p. 2

2 Preliminaries

The preliminaries position SDNs against work on internal classifiers, inference reduction, and error indicators, then specify the benchmark datasets, architectures, training setup, and evaluation metrics.

2.1 Related Work

  • Prior early-exit and adaptive-inference methods mainly target wasted computation, whereas SDNs are designed to study overthinking and preserve original performance while adding accurate internal classifiers.The related work contrasts SDNs with approaches requiring scratch training or discarding classifiers, and describes a confusion metric that needs no calibration or expensive computation.Source: §2.1 · pp. 2–3

2.2 Experimental Setup

  • CIFAR-10 and CIFAR-100 use 32×32 color images with 10 and 100 classes, while Tiny ImageNet uses 64×64 images across 200 classes.The CIFAR datasets each have 50,000 training and 10,000 validation images; Tiny ImageNet has 500 training and 50 validation images per class.Source: §2.2 · p. 3
  • Experiments use VGG-16, ResNet-56, WRN-32-4, and MobileNet, with pre-trained networks as the off-the-shelf baselines.The original networks are trained for 100 epochs; internal classifiers added to pre-trained networks are trained for 25 epochs.Source: §2.2 · p. 3
  • Inference cost is measured by average FLOPs per input, and classification performance by test-set Top-1 accuracy.Source: §2.2 · p. 3

3 The Shallow-Deep Network

The section introduces SDNs, which expose predictions at intermediate layers through internal classifiers, and describes how they are attached and trained. It then reports their computational costs and the accuracy of their internal classifiers.

3.1 Attaching the Internal Classifiers (ICs)

  • ICs pair feature reduction with a fully connected classifier; mixed max-average pooling reduces maps larger than 4x4 to 4x4, and six ICs are placed near 15%-90% of network FLOPs.The selected placements provide six internal predictions plus a final prediction.Source: §3.1 · p. 4

3.2 Training the Internal Classifiers

  • For pretrained networks, original weights are frozen and only ICs are trained; from scratch, original weights and ICs are jointly trained with IC loss weights rising from 0.01 to each IC's relative cost.IC-only training preserves the original network's predictions; the joint objective also trains for accuracy at the ICs.Source: §3.2 · p. 4

3.3 Cost of the Modification

  • ∼3x faster than original training, IC-only training also uses ∼4x fewer epochs, while SDN training increases training time by 10%.Table 1 compares off-the-shelf CNNs with SDNs using parameter count, FLOPs per sample, and training time per epoch.Source: §3.3 · p. 4, Table 1 · p. 4

3.4 The Accuracy of the Internal Classifiers

  • Up to 4.5% improvement over original accuracy: SDN training consistently yields more accurate internal classifiers, and networks reach most of their original accuracy at lower-cost internal classifiers.The accuracy comparison is for Tiny ImageNet; the reported improvement is more pronounced on more difficult tasks.Source: §3.4 · pp. 4–5, Table 2 · p. 5

4 Understanding the Overthinking Problem

The paper defines overthinking as reaching a correct internal prediction before the final layer; further computation can waste resources or turn that prediction into a misclassification. A Tiny ImageNet case study shows both effects, including destructive overthinking in up to 50% of CNN misclassifications.

4 Understanding the Overthinking Problem

  • Overthinking occurs when an internal classifier predicts the correct label; continuing the forward pass can waste computation or produce a misclassification.The case study converts a 59%-accurate Tiny ImageNet VGG-16 to VGG-16-SDN using IC-only training, preserving the original network's predictions.Source: §4 · p. 5

4.1 The Wasteful Effect of Overthinking

  • Ideal exits would reduce average inference costs by 73% on CIFAR-10, 55% on CIFAR-100, and 40% on Tiny ImageNet.The estimate assumes perfect detection of correct versus wrong predictions, which the text calls impractical.Source: §4.1 · p. 5
  • In the VGG-16-SDN case study, 24% of samples could exit at the first IC and 29% would reach the final classifier; later-exiting samples appear more complex.Earlier ICs recognize typical samples, while atypical or occluded and zoomed-out examples may need more representational complexity.Source: §4.1 · p. 5, Figure 2 · p. 6

4.2 The Destructive Effect of Overthinking

  • For VGG-16 on Tiny ImageNet, cumulative accuracy is 75%, 16% above the original; destructive-effect gaps are 4% on CIFAR-10, 13% on CIFAR-100, and 14% on Tiny ImageNet.Cumulative accuracy counts a sample as correct if any internal or final prediction is correct.Source: §4.2 · p. 5
  • Up to 50% of CNN misclassifications show destructive overthinking, when a correct internal prediction becomes wrong at the final classifier.At a certain IC, destructive effects can outweigh accuracy gains from greater feature complexity, after which accuracy decreases.Source: §4 · p. 5, §4.2 · p. 6
  • The first IC alone correctly classifies 46 Tiny ImageNet cases that VGG-16 and the other ICs misclassify, plausibly because later layers focus on irrelevant fine details.The authors hypothesize that these images contain confusing elements, sometimes associated with multiple classes.Source: §4.2 · p. 6, Figure 3 · p. 6
  • In a backdoored CIFAR-10 VGG-16, correct predictions on trigger inputs fall from 87% at IC4 to 76% at IC5, 38% at IC6, and 12% at the final classifier.The experiment uses a small white-square trigger that targets the dog class.Source: §4.2 · p. 6

5 Mitigating the Overthinking Problem

The section proposes confidence-based early exits to reduce wasted inference and confusion analysis to identify inputs likely to be misclassified. Together, these heuristics address overthinking’s wasteful and destructive effects.

5.1 Confidence-Based Early Exits

  • Confidence-based exits use an internal prediction’s estimated probability and threshold q; higher q makes exits more conservative and reduces their rate.If no prediction is confident enough, the mechanism returns the most confident prediction; q is selected to meet computational constraints on a small unlabeled holdout set.Source: §5.1 · pp. 6–7
  • Early exits reduce inference costs by more than 50% on CIFAR-10 and CIFAR-100, and by more than 25% on Tiny ImageNet, usually without accuracy loss on Tiny ImageNet.With SDN training, early-exit accuracy can exceed the original accuracy on CIFAR-10 and CIFAR-100; Table 3 compares accuracy under inference-cost budgets.Source: §5.1 · p. 7, Table 3 · p. 7
  • At q = 0.8, early exits raised correct predictions on backdoor inputs from 12% to 84% and reduced target-class predictions from 98% to 17%.The attack was previously identified as inducing overthinking’s destructive effect.Source: §5.1 · p. 7
  • Correct predictions affected by destructive overthinking had average confidence of ∼0.3, versus ∼0.6 for other correct predictions, so they often bypass early exits.Disagreement among internal predictions signals confusion in these cases.Source: §5.1 · p. 7

5.2 Network Confusion Analysis

  • The confusion metric sums L1 distances between the final prediction and each internal prediction, then normalizes the score using training-set statistics.It quantifies how much the final prediction diverges from internal predictions.Source: §5.2 · p. 7
  • On Tiny ImageNet, wrong predictions averaged 0.71 confusion versus −0.29 for correct predictions; confusion produced fewer false negatives than prediction confidence.Only 5.5% of misclassified instances had less confusion than an average correct prediction, compared with 24% that had more confidence in the original CNN.Source: §5.2 · p. 8, Figure 4 · p. 8
  • Grad-CAM visualizations show the first internal classifier focusing on general structure while the final classifier focuses on fine details.In the banana-versus-ice-cream example, confusing details mislead the final classifier into predicting ice cream.Source: §5.2 · p. 8, Figure 5 · p. 8

6 Conclusions

The conclusion presents SDNs as a way to monitor prediction evolution and expose overthinking. It reports that early exits reduce inference cost while confusion analysis indicates likely misclassifications and supports visual error interpretation.

6 Conclusions

  • SDNs add internal classifiers to off-the-shelf DNNs, exposing how predictions evolve through the forward pass.The paper reports that this monitoring helps reveal overthinking in CNNs, which can waste computation and cause misclassifications on natural and adversarial inputs.Source: §6 · p. 8
  • Confidence-based early exits significantly reduce average inference cost while preserving original performance.The conclusion also presents confusion analysis as a reliable indicator of inputs likely to be misclassified.Source: §6 · p. 8
  • Confusion analysis reveals internal-classifier disagreements and supports visualizing input elements responsible for confusion.The authors hope these findings lay foundations for more efficient and accurate networks less susceptible to overthinking.Source: §6 · p. 8
Loading 1810.07052v3…