激活函数-GELU

  • GELU (Gaussian Error Linear Unit)

  • 近似于 ReLU,在神经网络中表现良好,但具有更加平滑的导数,在某些情况下能够提供更好的性能。

  • CDF: cumulative distribution function of the standard Gaussian distribution(标准正态分布的累积分布函数)

  • 公式:

GELU(x)=xΦ(x)

其中 Φ(x) 是标准正态分布的累积分布函数(CDF)

Φ(x)=12(1+erf(x2))

简化版:

GELU(x) ≈ 0.5 ⋅ x ⋅ (1 + tanh[√((2/π)) ⋅ (x + 0.044715 ⋅ x^3)]

erf(x):误差函数(Error Function),是统计学中用于描述正态分布的函数
GELU(x)0.5x(1+tan(2π(x+0.044715x3))
https://img.zhaoweiguo.com/uPic/2024/11/a1RWsJ.png

The x-axis shows the function inputs and the y-axis shows the function outputs.

其他

  • SwiGLU (Sigmoid-Weighted Linear Unit)