eze^{z}

The exponential function

Read "e to the z" (also written exp(z)). It raises e ≈ 2.718 to the power z. The result is always positive: e⁰ = 1, and it shrinks toward 0 as z becomes very negative.

Two facts explain how the course uses it:

  • ez>0e^{z} > 0 for every real zz. So softmax can never output a negative probability.
  • ea+b=eaebe^{a+b} = e^a e^b. So subtracting the same constant from every input of a softmax multiplies the top and bottom of the fraction by the same factor, and it cancels exactly.

As zz goes to −∞-\infty, eze^{z} goes to 00. That is how the causal mask works: a score of −∞-\infty becomes a weight of exactly zero.

Example

e0=1,e1≈2.718,e−5≈0.0067e^{0} = 1, \quad e^{1} \approx 2.718, \quad e^{-5} \approx 0.0067

Positive in every case; large negative inputs give tiny positive outputs.

Where the course uses it

Related terms