GROD: Enhancing Generalization of Transformer with Out-of-Distribution Detection
<|reference_start|>GROD: Enhancing Generalization of Transformer with Out-of-Distribution Detection: Transformer networks excel in natural language processing (NLP) and computer vision (CV) tasks. However, they face challenges in generalizing to Out-of-Distribution (OOD) datasets, that is, data whose distribution differs from that seen during training. The OOD detection aims to distinguish data that deviates from the expected distribution, while maintaining optimal performance on in-distribution (ID) data. This paper introduces a novel approach based on OOD detection, termed the Generate Rounded OOD Data (GROD) algorithm, which significantly bolsters the generalization performance of transformer networks across various tasks. GROD is motivated by our new OOD detection Probably Approximately Correct (PAC) Theory for transformer. The transformer has learnability in terms of OOD detection that is, when the data is sufficient the outlier can be well represented. By penalizing the misclassification of OOD data within the loss function and generating synthetic outliers, GROD guarantees learnability and refines the decision boundaries between inlier and outlier. This strategy demonstrates robust adaptability and general applicability across different data types. Evaluated across diverse OOD detection tasks in NLP and CV, GROD achieves SOTA regardless of data format. The code is available at https://anonymous.4open.science/r/GROD-OOD-Detection-with-transformers-B70F.<|reference_end|>
@article{zhou2024grod:,
    title={GROD: Enhancing Generalization of Transformer with Out-of-Distribution
  Detection},
    author={Yijin Zhou, Yuguang Wang},
    journal={arXiv preprint arXiv:2406.12915},
    year={2024},
    archivePrefix={arXiv},
    eprint={2406.12915},
    primaryClass={cs.LG math.PR}
}