hiw3c 日报精选
arXiv cs.AI/CL/LG 网页快照

针对Softmax和交叉熵问题的解决方案

原文标题 · A Fix for Softmax and Cross-Entropy

作者:Jonathan T. Barron, Dan Gnanapragasam, Michael Tschannen | 标准的Softmax、log-softmax和交叉熵算法存在两个数值上的错误。第一个错误是“Softmax崩溃”,当某个逻辑变量的梯度远大于其他变量时,该变量的梯度会被四舍五入为零,从而导致梯度之和不再为零。第二个错误是“Softmax消除”,当学生逻辑变量的数值接近教师逻辑

来源:arXiv cs.AI/CL/LG · arxiv.org

正文为英文,可一键机器翻译(仅首次需要等待)

Computer Science > Machine Learning

Title: A Fix for Softmax and Cross-Entropy

Abstract: Standard implementations of softmax, log-softmax, and cross-entropy have two numerical bugs. The first bug, Softmax Collapse, rounds the target logit's gradient to zero if that one logit is much larger than the others, resulting in gradients that no longer sum to zero. The second bug, Softmax Cancellation, occurs when student logits are close to teacher logits, and produces non-zero gradients even when the student and teacher logits are equal. We present simple implementations of log-softmax, softmax, and cross-entropy that fix both bugs. Our fix eliminates the previously-observed "Slingshot" phenomenon, speeds up grokking with weight decay, prevents accuracy collapse without weight decay, stops student networks from drifting away from the teacher during distillation, and shows that after memorization, logit growth is bounded by an equilibrium between weight decay and Adam's $\epsilon$ hyperparameter.

Submission history

Access Paper:

Additional Features

Current browse context:

References & Citations

BibTeX formatted citation

Bookmark

Bibliographic and Citation Tools

Code, Data and Media Associated with this Article

Demos

Recommenders and Search Tools

arXivLabs: experimental projects with community collaborators

arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.

Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.

Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs .