GELU: Difference between smooth door controls and approximation realized
The exact GELU is xΦ(x), where Φ is the standard normal cumulative distribution function.
Learning objectives and first steps2 objectives 2 first fixes
Try to do it after reading
- A fixed point to calculate the exact GELU
- Distinguishing probabilities from random discards
Suggested first
- Vector and Matrix Operations
- Counts and chain rules
Negative input can also leave a smooth response
Exact GELU is xΦ(x), with Φ the standard normal CDF. It scales input by an input-dependent smooth factor, suggesting a gating interpretation. The usual forward computation is deterministic, not a random keep/drop choice with probability Φ(x).
At x=0, Φ(0)=0.5, output is 0 and local derivative 0.5. At x=1, Φ≈0.8413447 and output≈0.8413447. At x=−1, Φ≈0.1586553 and output≈−0.1586553. Some negatives remain; it is not simply a smooth, nonnegative ReLU.
The application is x + x (x), which is the standard normal density. At x = ~1, the second was negative and the aggregate number was about 0.0833155. So GELU is not a one-stop active. If the door control factor is between 0 and 1, then it is assumed that the whole function is also between 0 and 1, leaving out the contribution of the coefficient itself as the input changes.
Project realization may choose a similar pattern based on tanh. The exact and approximate versions can be very close to most of the input, but they are still two different functions. When comparing model exports, mixing accuracy and cross-framework results, the approximation should be recorded, and it is not possible to see that the name of the module is GELU alone to require a location-by-position alignment. Error tolerance needs to match dtype and target accuracy.
The experiment of the original paper illustrated the effects of a particular mission and did not constitute evidence that any structure was superior to other activations. Selecting activation also requires checking initialization, arithmetic support and deployment of kernel. Moves the components commonly used in a word model to a time series feature network, which is controlled by a fixed data protocol.
Standard Python can compute Φ(x)=0.5[1+erf(x/√2)] using erf, independently checking these outputs without model downloads.
If cross-realization returns are performed, the input [−3,−1,1,1] may be fixed, comparing the function value with the input gradient. Only zero-point checks will miss the negative non-single areas; Training differentials associated with approximate lead numbers may be omitted only from forward error.
For example, an output may become more negative before it rises when the negative side changes slowly. The observation curve should be accompanied by cross-axis input and vertical axis output, and the absolute value of the negative output cannot be read by a category with a higher confidence.
Review with standard Python
import mathPhi=lambda x:.5*(1+math.erf(x/math.sqrt(2)))assert abs(Phi(1)-.8413447460685429)<1e-12assert abs(-Phi(-1)+.15865525393145707)<1e-12Only fixed arithmeticals and indexes are validated above and no framework training is called.
GELU(−1) Why not zero?
It is −1×Φ(−1)≈−0.1586553. A small coefficient is not zero.
Does the same input double-counting have to change like dropout?
Usually not. The standard GELU is a certainty function, and the probabilistic interpretation does not amount to the actual use of random masks.
Sources and reconciliations
Definitions, methods and interfaces are available.
Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.