Exploring the Impact of Temperature Scaling in Softmax for Classification and Adversarial Robustness

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Xuan, Hao, Yang, Bokai, Li, Xingyu
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866917940146733056
author Xuan, Hao
Yang, Bokai
Li, Xingyu
author_facet Xuan, Hao
Yang, Bokai
Li, Xingyu
contents The softmax function is a fundamental component in deep learning. This study delves into the often-overlooked parameter within the softmax function, known as "temperature," providing novel insights into the practical and theoretical aspects of temperature scaling for image classification. Our empirical studies, adopting convolutional neural networks and transformers on multiple benchmark datasets, reveal that moderate temperatures generally introduce better overall performance. Through extensive experiments and rigorous theoretical analysis, we explore the role of temperature scaling in model training and unveil that temperature not only influences learning step size but also shapes the model's optimization direction. Moreover, for the first time, we discover a surprising benefit of elevated temperatures: enhanced model robustness against common corruption, natural perturbation, and non-targeted adversarial attacks like Projected Gradient Descent. We extend our discoveries to adversarial training, demonstrating that, compared to the standard softmax function with the default temperature value, higher temperatures have the potential to enhance adversarial training. The insights of this work open new avenues for improving model performance and security in deep learning applications.
format Preprint
id arxiv_https___arxiv_org_abs_2502_20604
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Exploring the Impact of Temperature Scaling in Softmax for Classification and Adversarial Robustness
Xuan, Hao
Yang, Bokai
Li, Xingyu
Machine Learning
Artificial Intelligence
The softmax function is a fundamental component in deep learning. This study delves into the often-overlooked parameter within the softmax function, known as "temperature," providing novel insights into the practical and theoretical aspects of temperature scaling for image classification. Our empirical studies, adopting convolutional neural networks and transformers on multiple benchmark datasets, reveal that moderate temperatures generally introduce better overall performance. Through extensive experiments and rigorous theoretical analysis, we explore the role of temperature scaling in model training and unveil that temperature not only influences learning step size but also shapes the model's optimization direction. Moreover, for the first time, we discover a surprising benefit of elevated temperatures: enhanced model robustness against common corruption, natural perturbation, and non-targeted adversarial attacks like Projected Gradient Descent. We extend our discoveries to adversarial training, demonstrating that, compared to the standard softmax function with the default temperature value, higher temperatures have the potential to enhance adversarial training. The insights of this work open new avenues for improving model performance and security in deep learning applications.
title Exploring the Impact of Temperature Scaling in Softmax for Classification and Adversarial Robustness
topic Machine Learning
Artificial Intelligence
url https://arxiv.org/abs/2502.20604