Search the School
17 results for «softmax»
Lessons (4)
- Exponents and the Exponential Function…a\cdot a\cdots a. Growth and decay N(t) = N_0e^{kt}: Softmax Turning classifier logits and attention scores into probability weights. Exponential moving average In Adam and batch nor…
- Cross Entropy…single term remains: H(p,q) = -\log q_y. With Softmax If q = \operatorname{softmax}(\mathbf{z}), the gradient of the loss with respect to the logits is very simple: \frac{\partial…
- Floating Point and Numerical Stability…h in numerical derivatives. \operatorname{softmax}(\mathbf z)_k = \frac{e^{z_k - m}}{\sum_j e^{z_j - m}} This does not change the result because e^{-m} cancels from the numer…
- Tensor Applications in Deep Learning…\operatorname{Attention}(Q,K,V) = \operatorname{softmax}\!\Big(\frac{QK^\top}{\sqrt{d_k}}\Big)V For Q, K, V\in\mathbb{R}^{T\times d_k}: the scores are T\times T, and the output…
Concepts (2)
- Softmax function (Softmax)A function that turns a vector of real scores into a probability distribution by exponentiating and then dividing by the sum. (2,1,0.1) → (0.659,0.242,0.099)
- Numerical StabilityThe property of a computation that does not amplify rounding errors, such as Softmax after subtracting the maximum. softmax(1000,1001,1002) = softmax(0,1,2)
Terminology (4)
- Softmax (Softmax)A function that turns a vector of logits into a probability distribution by exponentiating and normalizing.
- Exponential FunctionThe function eˣ, whose derivative equals itself.
- The log-sum-exp trick (Log-Sum-Exp)Computing the logarithm of a sum of exponentials by subtracting the maximum to avoid overflow.
- AttentionA weighted average of the values, with weights from the similarity of queries and keys.
Questions (7)
- Compute the first element of Softmax for the scores \((\ln 3, 0)\).Compute the first element of Softmax for the scores (\ln 3, 0).
- Adding 5 to all input scores does not change the Softmax output.Adding 5 to all input scores does not change the Softmax output.
- The sum of the Softmax output probabilities over all classes equals 1.The sum of the Softmax output probabilities over all classes equals 1.
- Which of the following Softmax outputs has the highest entropy?Which of the following Softmax outputs has the highest entropy?
- The Softmax output is \((0.6, 0.3, 0.1)\) and the correct class is the second. What is the gradient component \(\partial\ell/\partial z_2\)?The Softmax output is (0.6, 0.3, 0.1) and the correct class is the second. What is the gradient component \partial\ell/\partial z_2?
- After subtracting the maximum, what is the probability of the third class in Softmax for the scores \((1000, 1001, 1002)\)? (four decimal places)After subtracting the maximum, what is the probability of the third class in Softmax for the scores (1000, 1001, 1002)? (four decimal places)
- Subtracting a constant from all scores before Softmax changes the resulting distribution.Subtracting a constant from all scores before Softmax changes the resulting distribution.
