ReLU 新生:从死亡困境到强势回归

背景

在深度学习领域,激活函数的探索已成为独立研究课题。诸如 GELU、SELU 和 SiLU 等新型激活函数,因具备平滑梯度与出色的收敛特性,正备受关注。经典 ReLU 凭借简洁性、固有稀疏性及其独特优势拓扑特性,依旧受青睐。然而,ReLU 网络存在重大缺陷 ------"死亡 ReLU 问题"。一旦神经元在训练中输出恒为 0,其梯度也为 0,致使神经元无法恢复,制约网络效能。为应对这一问题,LeakyReLU、PReLU、GELU、SELU、SiLU/Swish 和 ELU 等改进函数涌现。它们通过引入负预激活值的非零激活,提供不同权衡。

近期,德国吕贝克大学等机构研究者提出新型方法 SUGAR(Surrogate Gradient for ReLU),在保留 ReLU 优势的同时解决其局限性。SUGAR 于前向传播使用标准 ReLU,反向传播时以非零、连续的替代梯度函数替换 ReLU 导数,使 ReLU 能保持原始前向行为,避免梯度消失,激活死神经元。基于此,研究者设计出两种新型替代梯度函数:B-SiLU(Bounded SiLU)和 NeLU(Negative slope Linear Unit),可无缝融入多种模型。

公式推导

FGI是一种分离前向和反向梯度的操作,一般可以设计成如下方程,前向是显而易见的,主要考虑反向梯度

y = g ( x ) − s g ( g ( x ) ) + s g ( f ( x ) ) ∂ y ∂ x = ∂ ∂ x ( g ( x ) − s g ( g ( x ) ) + s g ( f ( x ) ) ) = ∂ g ( x ) ∂ x − s g ( g ( x ) ) ∂ g ( x ) ∂ g ( x ) ∂ x + ∂ s g ( f ( x ) ) ∂ f ( x ) ∂ f ( x ) ∂ x = ∂ g ( x ) ∂ x y = g(x) − sg(g(x)) + sg(f(x)) \\ \frac{∂y}{∂x} = \frac{∂}{∂x}(g(x)-sg(g(x)) + sg(f(x))) \\ =\frac{∂g(x)}{∂x} - \frac{sg(g(x))}{∂g(x)}\frac{∂g(x)}{∂x} + \frac{∂sg(f(x))}{∂f(x)}\frac{∂f(x)}{∂x} \\ =\frac{∂g(x)}{∂x} y=g(x)−sg(g(x))+sg(f(x))∂x∂y=∂x∂(g(x)−sg(g(x))+sg(f(x)))=∂x∂g(x)−∂g(x)sg(g(x))∂x∂g(x)+∂f(x)∂sg(f(x))∂x∂f(x)=∂x∂g(x)

这样的方式有个缺陷,就是反向传播时依然需要对g(x)进行autodiff求导,效率低下,所以一般会直接提供g(x)的导数函数,以乘法的形式融入公式,根据这个思路可以设计如下方程

h = x ⋅ s g ( g ′ ( x ) ) y = h − s g ( h ) + s g ( f ( x ) ) ∂ y ∂ x = ∂ ∂ x ( h − s g ( h ) + s g ( f ( x ) ) ) = ∂ ∂ x ( x ∗ s g ( g ′ ( x ) ) ) − ∂ s g ( h ) ∂ h ∂ h ∂ x + s g ( f ( x ) ) ∂ f ( x ) f ( x ) x = ∂ g ( x ) ∂ x h = x · sg(g^{'}(x)) \\ y = h - sg(h) + sg(f(x)) \\ \frac{∂y}{∂x} = \frac{∂}{∂x}(h - sg(h) + sg(f(x))) \\ = \frac{∂}{∂x}(x * sg(g^{'}(x))) - \frac{∂sg(h)}{∂h}\frac{∂h}{∂x} + \frac{sg(f(x))}{∂f(x)} \frac{f(x)}{x} \\ = \frac{∂g(x)}{∂x} h=x⋅sg(g′(x))y=h−sg(h)+sg(f(x))∂x∂y=∂x∂(h−sg(h)+sg(f(x)))=∂x∂(x∗sg(g′(x)))−∂h∂sg(h)∂x∂h+∂f(x)sg(f(x))xf(x)=∂x∂g(x)

tensorflow2实现

python 复制代码
class BSiLU_SUGAR(tf.keras.layers.Layer):
    def __init__(self, alpha=1.67, **kwargs):
        super(BSiLU_SUGAR, self).__init__(**kwargs)
        self.alpha = alpha

    def call(self, x, training=None, **kwargs):
        fx = tf.nn.relu(x)
        sigmoid_forward = tf.nn.sigmoid(x)
        gx = sigmoid_forward + (x + self.alpha) * sigmoid_forward * (1 - sigmoid_forward)
        m = x * tf.stop_gradient(gx)
        y = m - tf.stop_gradient(m) + tf.stop_gradient(fx)
        return y

    def get_config(self):
        config = {
            'alpha': self.alpha
        }
        base_config = super(BSiLU_SUGAR, self).get_config()
        return dict(list(base_config.items()) + list(config.items()))

真实数据实验效果

数据 模型 loss auc uauc
自有数据 mlp+relu 0.0918 0.8242 0.735
自有数据 mlp+新激活函数 0.0916 0.8260 0.737

结论

  • 可能有一些效果,需要再其他数据集上进行更多测试得出综合结论

Reference

  1. https://mp.weixin.qq.com/s/b29WfOloGFIyh-j8EfV96A

  2. https://arxiv.org/pdf/2505.22074

  3. https://arxiv.org/pdf/2406.00177v1

相关推荐
回眸&啤酒鸭2 天前
【回眸】Minicart 电商购物车核心功能落地指南
人工智能
一隅论数智2 天前
给AI一张“业务概念地图“:本体如何从哲学走向企业智能
大数据·人工智能·经验分享·笔记·学习·学习方法·政务
AI的探索之旅2 天前
97 个 OpenCV 实例(三十):双目立体,从标定到点云
人工智能·opencv·计算机视觉
AlbertZein2 天前
Step-5-Preview 上手实测:3D 游戏、金融分析、网页设计一次跑完
人工智能·aigc
LaughingZhu2 天前
Product Hunt 每日热榜 | 2026-09-19
人工智能·深度学习·神经网络·搜索引擎·百度
美狐美颜SDK开放平台2 天前
开发直播APP时如何接入视频美颜SDK?开发流程与注意事项
android·人工智能·计算机视觉·音视频·直播美颜sdk
wukangjupingbb2 天前
智能网联汽车安全能力框架
人工智能
龙亘川2 天前
明月照湾区,智启新赛道:从顶流文旅IP盛会看智慧文旅升级路径
人工智能·智慧城市·开源软件·数据可视化
飞猫的边缘AI2 天前
边缘AI应用:家用AI摄像头怎么做数据训练?
人工智能·边缘计算·ai算法·边缘ai