[Paper Review] Extremely Simple Activation Shaping for Out-of-Distribution Detection
ASH is a post-hoc activation shaping method that prunes and slightly reshapes late-layer activations to boost OOD detection with minimal impact on ID accuracy, achieving state-of-the-art results on ImageNet and strong results on CIFAR.
The separation between training and deployment of machine learning models implies that not all scenarios encountered in deployment can be anticipated during training, and therefore relying solely on advancements in training has its limits. Out-of-distribution (OOD) detection is an important area that stress-tests a model's ability to handle unseen situations: Do models know when they don't know? Existing OOD detection methods either incur extra training steps, additional data or make nontrivial modifications to the trained network. In contrast, in this work, we propose an extremely simple, post-hoc, on-the-fly activation shaping method, ASH, where a large portion (e.g. 90%) of a sample's activation at a late layer is removed, and the rest (e.g. 10%) simplified or lightly adjusted. The shaping is applied at inference time, and does not require any statistics calculated from training data. Experiments show that such a simple treatment enhances in-distribution and out-of-distribution distinction so as to allow state-of-the-art OOD detection on ImageNet, and does not noticeably deteriorate the in-distribution accuracy. Video, animation and code can be found at: https://andrijazz.github.io/ash
Motivation & Objective
- Motivate post-hoc solutions that improve deployment-time robustness without retraining.
- Propose a simple activation shaping operation that can be applied during inference.
- Demonstrate that pruning and light reshaping of late-layer activations improves OOD detection across benchmarks.
- Show that ASH preserves in-distribution accuracy while enhancing OOD separation.
Proposed method
- Apply ASH at inference by pruning a high-percentile portion of a sample’s late-layer activations.
- Process remaining activations with one of three treatments: ASH-P (prune only), ASH-B (binarize remaining activations), ASH-S (scale remaining activations).
- Use energy-based scoring for OOD detection, with ASH applied before routing to the rest of the network.
- Evaluate ASH across CIFAR-10/100 and ImageNet with multiple OOD datasets and architectures (DenseNet-101, ResNet-50, MobileNetV2).
- Conduct ablations on placement, pruning strength, and combination with other methods (e.g., ReAct, DICE)..
Experimental results
Research questions
- RQ1Can post-hoc activation shaping improve OOD detection without retraining or access to training distributions?
- RQ2What is the impact of ASH on in-distribution accuracy across different pruning levels and treatments?
- RQ3Where in the network should ASH be placed for best ID-OOD trade-off?
- RQ4How does ASH interact with existing OOD detection methods when combined?
- RQ5Is ASH compatible with large-scale benchmarks like ImageNet and smaller benchmarks like CIFAR-10/100?
Key findings
- ASH achieves a strong ID-OOD trade-off, forming a Pareto frontier better than baseline methods in ImageNet experiments.
- ASH variants (ASH-B and ASH-S) establish new state-of-the-art OOD detection on ImageNet across multiple datasets while preserving ID accuracy.
- ASH-P (pruning only) also yields competitive OOD gains and can outperform Energy, Softmax, and ODIN in some settings.
- ASH preserves in-distribution accuracy well, with only small drops at moderate pruning and robustness up to high pruning levels in some variants.
- ASH is plug-and-play and can be combined with methods like ReAct or ODIN to yield immediate improvements.
- ASH-RAND experiments show that even random values for unpruned activations can retain strong OOD performance, underscoring representation redundancy.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.