Outside the Box: Abstraction-Based Monitoring of Neural Networks

Thomas A. Henzinger, Anna Lukina, Christian Schilling

TL;DR

Researchers have developed a lightweight runtime monitor that uses "box abstractions"—simple multi-dimensional intervals—to track the internal activations of neural networks. By checking if a new input triggers a familiar pattern in the hidden layers, the system can reliably flag "novel" inputs (data the network wasn't trained for) that would otherwise result in overconfident, incorrect predictions.

What Problem Does This Paper Address?

Deep neural networks are notoriously overconfident. When you show a classifier trained on dogs and cats a picture of a fire truck, it won't say "I don't know"; it will likely pick "dog" or "cat" with high mathematical certainty. This is a massive hurdle for safety-critical systems like autonomous vehicles or medical diagnostics.

Existing "novelty detection" methods often treat the network as a black box, looking only at the final output probabilities (softmax scores). However, networks aren't explicitly trained to lower their confidence for unknown classes. Other methods that look "under the hood" at internal activations are often computationally expensive or tied to specific architectures (like ReLU). The challenge is finding a way to monitor a network's internal state that is both accurate and fast enough to run in real-time without slowing down the primary task.

Methods

The authors propose a framework called Outside-the-Box Monitoring. Instead of looking at the final answer, they "watch" specific hidden layers (usually those near the end of the network).

The process happens in three phases:

  1. Collection: During training, they record the activation values of neurons in the "watched" layers for all correctly classified training images.
  2. Clustering: Because a single class (like "dogs") might have several distinct sub-patterns, they use k-means clustering to group these activation vectors.
  3. Abstraction (The "Box"): For each cluster, they create a "box"—mathematically, a hyperrectangle or a union of intervals. This box represents the "normal" range of values seen during training for that specific class.

At runtime, when a new input arrives, the monitor looks at the activations in the watched layers. If the activation vector falls inside one of the boxes associated with the predicted class, the prediction is accepted. If it falls "outside the box," the monitor triggers a warning: "Novelty detected."

Datasets

The researchers evaluated their approach on four standard image-classification benchmarks:

  • MNIST: Handwritten digits.
  • Fashion-MNIST (F-MNIST): Clothing items.
  • CIFAR-10: General objects (planes, cars, birds, etc.).
  • GTSRB: German Traffic Sign Recognition Benchmark.

To simulate novelty, they trained the networks on a subset of classes (e.g., digits 0–7) and then tested them on the full set (0–9), treating the unseen classes as the "novel" inputs to be detected.

Key Insights and Ideas

  • Simplicity is a Feature: While complex mathematical shapes (like octagons or balls) could be used to wrap around data points, the authors found that simple "boxes" (intervals) are remarkably effective. They are computationally "cheap" to check and require very little memory.
  • The "Converged" Abstraction: The paper introduces the idea of a "converged" monitor. If you keep adding training data and the boxes stop growing, you've reached a fixpoint. At this stage, any input that falls outside the box is guaranteed to be something the network has never seen before.
  • Layer Synergy: Monitoring a single layer is good, but monitoring multiple layers is better. By requiring an input to pass the "box test" at several different depths of the network, the monitor becomes much more sensitive to subtle anomalies.
  • Internal vs. External: The core "aha" moment is that internal activations are far more "honest" than the final output. Even if the final output is 99% confident, the internal "fingerprint" of a novel input usually looks nothing like the training data.

Key Results

  • Superior Detection: The box-based monitor significantly outperformed the standard "softmax threshold" approach, especially in scenarios with many unknown classes.
  • Efficiency: Monitoring is incredibly fast. On the MNIST benchmark, the monitor took only 2.1 seconds to process 10,000 test inputs—less than a millisecond per image.
  • Scalability: Unlike "Boolean abstractions" (a competing method), which ran out of memory on larger networks (84+ neurons), the box method scales linearly with the number of neurons and clusters.
  • Tunability: Users can "bloat" or enlarge the boxes by a factor ($\gamma$) to trade off between false alarms (rejecting valid data) and missed novelties.

Limitations and Future Work

The authors acknowledge a few key areas for improvement:

  • Assumption of High-Level Features: The method relies on the assumption that layers close to the output contain high-level, class-specific information. If a network is poorly trained or the layers are chosen poorly, the monitor's effectiveness drops.
  • The Curse of Dimensionality: While boxes are efficient, the clustering step (k-means) can struggle as the number of neurons (dimensions) grows very large.
  • Adversarial Attacks: While this method is great for "natural" novelty (things the network hasn't seen), it wasn't specifically designed to stop intentional adversarial attacks (carefully crafted noise meant to fool the network), though the authors suggest it might catch some.

The team plans to apply this to real-world settings next, specifically monitoring neural-network controllers in cyber-physical systems like drones or robots.

Summary updated

BibTeX
@inproceedings{henzinger2020outside,
  author = {Thomas A. Henzinger and Anna Lukina and Christian Schilling},
  title = {{Outside the Box: Abstraction-Based Monitoring of Neural Networks}},
  booktitle = {ECAI},
  year = {2020},
  doi = {10.3233/faia200375},
}
Figure