What it does
Softmax exponentiates every score and divides by the sum. The largest score gets the largest share, and adding the same constant to every score changes nothing, so only differences between scores matter. Dividing the scores by a temperature before the softmax controls how peaked the result is: a low temperature sharpens it toward the top class, a high one flattens it toward uniform. Classifiers end with it, attention uses it to turn match scores into mixing weights, and generative models sample from it. LogSoftmax returns the logarithm directly, which is numerically safer for training and CTC decoding.
Formula
softmax(z)i = ezi / τ / Σj ezj / τsoftmax(z + c) = softmax(z)logsoftmax(z)i = zi − log Σj ezjShapes and parameters
- Shapes
- Any shape in, the same shape out; each slice along the chosen axis sums to one.
- Parameters
- None. The temperature τ is a setting chosen at run time, not a learned parameter.
- Used for
- The output of classifiers (plants, expressions, emotions, voice commands, sound events), attention weights, next-token and next-note sampling, CTC transcription.
In WeightSpace
No parameters of its own, but it is where most WeightSpace edits show up. Adding δ to one class bias multiplies that class’s unnormalized probability by e^δ before renormalizing, so +2 makes it about 7.4 times more likely relative to the others.
Where it appears
- Segment an object by clickingSlimSAM199.7M params
- Translate a Chinese sentenceHelsinki-NLP OPUS-MT18111M params
- Forecast a time seriesGranite TinyTimeMixer R216805K params
- Find a caption that fits a photoTinyCLIP ViT-8M/161323M params
- Estimate depth from a photoDepth Anything V2 Small1225M params
- Fill a gap in ChineseBERT Base Chinese12102M params
- Find beats and downbeatsBeat This! Small123.2M params
- Name the emotion in a sentenceALBERT Base v2 Emotion1212M params
- Read a phrase aloudKokoro 82M1281M params
- Transcribe a short English recordingWav2Vec2 Base 960h1294M params
- Change how a voice speakstiny-voca114.5M params
- Classify text with your labelsXtremeDistil zero-shot613M params
- Find an answer in a passageDistilBERT SQuAD665M params
- Find the most relevant answerall-MiniLM-L6-v2623M params
- Track a subject between framesOpenCV VitTrack3174K params
- Ask a question about a tableGoogle TAPAS Tiny24.5M params
- Find rows and cells in a tablePaddleOCR SLANet+21.9M params
- Rerank search resultsMS MARCO TinyBERT-L224.4M params
- Continue a melodyMagenta MelodyRNN13.2M params
- Identify houseplantsMobileNet V11219K params
- Recognize 18 spoken wordsSpeech Commands 18w11.5M params
- Recognize voice commandsSpeech Commands11.4M params
- Separate a person from the backgroundPP-HumanSeg11.5M params