Open World Classification with Adaptive Negative Samples

Ke Bai, Guoyin Wang, Jiwei Li, Sunghyun Park, Sungjin Lee, Puyang Xu, Ricardo Henao, Lawrence Carin

Abstract

Standard machine learning models typically operate under a closed-world assumption, where all test-time inputs belong to categories seen during training. In real-world applications, however, models frequently encounter "out-of-scope" or unknown inputs. Open World Classification (OWC) addresses this by requiring models to accurately classify known categories while flagging unknown samples. This paper introduces Adaptive Negative Samples (ANS), a novel approach that synthesizes challenging negative data points in the feature space to learn tighter decision boundaries. Combined with a One-Versus-Rest (OvR) classification strategy, ANS achieves state-of-the-art results across multiple benchmarks without relying on external data.

1. Introduction

In practical deployments, such as intent detection for virtual assistants, models must distinguish between supported tasks (e.g., "Check Balance") and unsupported queries (e.g., "What's the best pizza nearby?"). Traditional classifiers often fail by forcing these unknown inputs into the nearest known category. The primary challenge in OWC is defining the boundary of "known" space when no examples of "unknown" data are available during training.

2. Problem Definition: The Open World Challenge

Most existing OWC solutions rely on thresholding confidence scores. However, selecting an optimal threshold is difficult: a high threshold leads to over-rejection of known samples, while a low threshold allows out-of-scope noise to pass. Other methods utilize external datasets to represent the "rest of the world," but these often suffer from domain mismatch.

Comparison of decision boundaries: (a) standard multi-class, (b) optimal boundary, (c) adaptive decision boundary, and (d) the proposed ANS method which uses synthesized negatives to fence in known categories.

As shown in Figure 1, the goal is to move from broad, overlapping decision regions to tight, well-defined boundaries that "fence in" known categories.

3. Methodology

The proposed ANS framework consists of two core components: Adaptive Negative Sampling and a One-Versus-Rest (OvR) architecture.

3.1 Adaptive Negative Samples (ANS)

Rather than sourcing external data, ANS generates "pseudo-unknown" samples directly in the latent feature space. For each known sample, a synthetic counterpart is created by adding noise and applying gradient ascent to push the point away from the class center. These points are constrained to a "spherical shell" around the known data. This ensures they are "hard" negatives—points that are close enough to the boundary to force the model to learn a precise separation, but not so close that they overlap with the true class distribution.

3.2 One-Versus-Rest (OvR) Framework

Instead of a single $C$-way or $(C+1)$-way classifier, the model trains $C$ independent binary classifiers. During inference, a sample is labeled as "Open" if it is rejected by all $C$ classifiers. This modular approach allows the "unknown" space to be treated as a fragmented, diverse region rather than a single cohesive category.

The overall architecture of the ANS framework, showing the training stage with adaptive negative sampling and the inference stage using a bank of binary classifiers.

4. Experimental Setup

The method was evaluated on three benchmarks: Banking (77 classes), CLINC (150 classes), and StackOverflow (20 classes). To simulate an open-world environment, the researchers withheld varying percentages (25%, 50%, 75%) of classes during training, treating them as the "unknown" category during evaluation. A pretrained BERT model served as the feature extractor.

5. Results and Key Insights

ANS consistently outperformed previous state-of-the-art methods, including Adaptive Decision Boundary (ADB) and self-supervised approaches.

  • Performance Gains: On the Banking dataset with 25% known classes, ANS reached an accuracy of 83.93%, significantly exceeding the previous best of 78.85%.
  • Hard Negatives Matter: Ablation studies confirmed that the "adaptive" gradient-ascent step is critical. Random noise helps, but actively searching for challenging boundary points is what drives the tighter decision regions.
  • Binary vs. Multi-class: The OvR strategy proved superior to standard softmax. By allowing each class to define its own boundary, the system better captures the complex, non-contiguous nature of the "unknown" space.

6. Conclusion and Future Work

Adaptive Negative Sampling provides a robust mechanism for OWC by "hallucinating" the unknown during training. By focusing on the feature space and utilizing binary classifiers, the model learns to effectively fence in known categories. Future research may explore automated radius selection for the spherical shells and scaling the OvR approach to handle thousands of categories more efficiently.

Summary updated

BibTeX
@inproceedings{bai2022open,
  author = {Ke Bai and Guoyin Wang and Jiwei Li and Sunghyun Park and Sungjin Lee and Puyang Xu and Ricardo Henao and Lawrence Carin},
  title = {{Open World Classification with Adaptive Negative Samples}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.emnlp-main.295},
}
Figure