Softmax vs Sigmoid
When to use softmax or sigmoid, what each one does to a model's scores, and which loss goes with which, explained for your AI interview.
In short
Sigmoid scores each label on its own, so several labels can be yes at once. Softmax turns all the scores into shares that add up to 1, so the labels compete and the biggest share is the pick.
12 min readBeginnerCommon · estimateFacts checked 27 November 2026
Say it out loud
Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.
Sigmoid and softmax both turn raw scores into numbers between 0 and 1, but they answer different questions. Sigmoid scores each label on its own, so a ticket can get several yes answers. Softmax scores all the labels together, and the shares add up to 100%, so the labels compete and the biggest share is the pick. The first question I ask is whether one example can have more than one label. Then I pick the function and the loss that goes with it.
Sigmoid and softmax both take a model's raw scores and turn them into numbers between 0 and 1. The difference is what the numbers mean. Sigmoid works on one score at a time. Each label gets its own yes or no chance, so a bank ticket can be flagged for fraud and for billing at the same time. Softmax works on all the scores together. It gives each label a share, and the shares always add up to 1, so the labels compete and the biggest share is the pick.
The question I ask first is whether an example can belong to more than one label. If it can, I use sigmoid on each label, even when there are many labels. If it must be exactly one, such as one queue for a support ticket, I use softmax. Google's machine learning course puts the softmax rule plainly: it assumes each example is a member of exactly one class.
The loss function is the other half of the pair. For a sigmoid output I use binary cross-entropy, which PyTorch offers as one class that already includes the sigmoid. For a softmax output I use cross-entropy, which expects raw logits too. The trap is applying the function twice, once in my code and once inside the loss.
I also say the limits. Full softmax is cheap with a few classes but gets very expensive as the number of classes grows. A share shows how strongly the model leaned on a label. It says nothing certain about accuracy, so I test the model on past tickets before I quote any rate.
What are softmax and sigmoid, in plain words?
A model gives every possible label a raw score, called a logit. A logit can be any number, positive or negative, and on its own it means little to a person. Sigmoid and softmax are two ways to turn those scores into answers people can use.
Sigmoid is a curve that takes any number and squeezes it into a range from 0 to 1. Each score goes through it by itself, so each label ends up with its own chance. Softmax looks at all the scores at once and turns them into shares of one whole. The shares always add up to 100%, so a bigger share means a smaller share for someone else.
Think of a loan application form. The customer can tick home loan, car loan and credit card, or any mix of the three. That is sigmoid: a separate yes or no for each box. Now think of a branch that must send each application to exactly one underwriting queue. That is softmax: the queues share the whole, and one of them wins. In an AI app, the same choice decides whether a support ticket can carry two tags or must go to exactly one queue. The bank case later in this answer uses both.
Key words
- Logit
- The raw score a model gives each possible label, before any scaling. It can be negative.
- Sigmoid
- A curve that turns any number into a value from 0 to 1, one score at a time.
- Softmax
- A function that turns all the scores into shares that add up to exactly 1.
- Multi-class
- Exactly one label per example, chosen from three or more labels.
- Multi-label
- Any number of labels on one example, each one on or off.
How do you choose for a real bank ticket system?
Take a mid-size bank's support inbox, with about 40,000 made-up tickets a month. The model reads each ticket and must do two jobs. Routing needs exactly one queue: card disputes, loan servicing or account access. Tagging needs any mix of fraud check, billing and urgent, because one ticket can be all three at once.
“Softmax assumes that each example is a member of exactly one class.”
Google Machine Learning Crash Course, multi-class
“Some examples, however, can simultaneously be a member of multiple classes.”
Google Machine Learning Crash Course, multi-class
So routing uses softmax, and tagging uses one sigmoid per tag. Google's course says that when an example can carry several labels, you must use several logistic regressions instead of softmax. A logistic regression is a simple yes or no model, and each one here is a sigmoid on a single label. The loss is the score that says how wrong the model was, and training pushes it down. Cross-entropy is the usual loss for these outputs. PyTorch is a widely used deep-learning library, and its loss functions are covered in the loss setup section.
Pick the function and the loss together
One label or several?
The question to ask first
Exactly one label
Softmax
Shares that add up to 1
Any mix of labels
Sigmoid per label
A yes or no score each
Cross-entropy loss
Pairs with a softmax output
Binary cross-entropy
Pairs with a sigmoid output
- 1One label per ticket: the softmax path.
- 2Several labels can be on: the sigmoid path.
- 3Softmax's shares train with cross-entropy.
- 4Each sigmoid output trains with binary cross-entropy.
Here is the same idea in plain Python, with made-up logits for the two jobs. Lines 10 to 14 hold softmax and lines 17 and 18 hold sigmoid.
# A bank's support model scores one incoming ticket. The logits are made-up numbers.
import math
QUEUES = ["card disputes", "loan servicing", "account access"]
queue_logits = [2.0, 0.5, -1.0] # exactly one queue must get the ticket
TAGS = ["fraud check", "billing", "urgent"]
tag_logits = [1.5, 0.8, -2.0] # a ticket can carry several tags
def softmax(scores):
top = max(scores) # subtract the top score first, so exp() stays small
exps = [math.exp(s - top) for s in scores]
total = sum(exps)
return [e / total for e in exps]
def sigmoid(score):
return 1 / (1 + math.exp(-score))
print("One queue (softmax, shares add up to 1):")
for name, p in zip(QUEUES, softmax(queue_logits)):
print(f" {name:<16}{p:.3f}")
print(f" {'total':<16}{sum(softmax(queue_logits)):.3f}")
print("Several tags (sigmoid, each on its own):")
for name, s in zip(TAGS, tag_logits):
print(f" {name:<16}{sigmoid(s):.3f}")
print(f" {'total':<16}{sum(sigmoid(s) for s in tag_logits):.3f}")
gap = tag_logits[0] - tag_logits[1]
print(f"Two options: softmax gives {softmax(tag_logits[:2])[0]:.3f}, sigmoid of the gap gives {sigmoid(gap):.3f}")Output
One queue (softmax, shares add up to 1): card disputes 0.786 loan servicing 0.175 account access 0.039 total 1.000 Several tags (sigmoid, each on its own): fraud check 0.818 billing 0.690 urgent 0.119 total 1.627 Two options: softmax gives 0.668, sigmoid of the gap gives 0.668
Two things to see. The queue shares add up to 100%, but the tag scores add up to 1.627, which is fine, because each tag stands on its own. And the last line shows the two-option case: softmax over two scores gives the same number as sigmoid of their gap.
How would you set up the loss for this model?
- 1
Pick the output shape first
Queue routing gets a softmax over the queues. Tagging gets one sigmoid per tag.
- 2
Use the loss built for that output
PyTorch's binary loss for logits includes the sigmoid in one class. Its cross-entropy loss takes raw logits and applies a log-softmax inside, which is a softmax step followed by a log.
- 3
Feed raw logits, once
Do not put a sigmoid or softmax layer in front of these losses. Applying the function twice feeds the loss the wrong numbers.
- 4
Check the shapes in a test
Run one ticket through. The queue shares should add up to 1, and each tag score should sit between 0 and 1.
PyTorch's cross-entropy page says its input is the raw logits for each class, which need not be positive or add up to 1. Its binary loss page says combining the sigmoid and the loss in one class is more numerically stable than a plain sigmoid followed by a binary loss.
Tip
Asked how you would build the output layer, start with the shape of the answer. Exactly one label means softmax with cross-entropy. Several labels mean sigmoid with binary cross-entropy. In both cases, the loss takes the raw logits.
What does the interviewer want to hear?
A strong answer covers
- Sigmoid scores each label alone, so several can be yes at once.
- Softmax makes shares that add up to 1, so the labels compete.
- The first question: can one example have more than one label?
- Loss pairing: binary cross-entropy with sigmoid, cross-entropy with softmax.
- Both losses take raw logits, so the function is never applied twice.
- Limits: full softmax gets costly with many classes, and a share shows lean, not accuracy.
Common traps
Trap"Sigmoid is for yes or no, and softmax is for many classes."
BetterAsk whether one example can have several labels. With several labels, use a sigmoid for each label, even with many classes.
Trap"Softmax is better because its output is a probability."
BetterBoth give numbers between 0 and 1. The real question is whether the labels can overlap.
Trap"The loss needs a sigmoid, so I add one before it."
BetterThe binary loss already applies the sigmoid. Pass the raw logits, or the numbers go through the function twice.
Can you spot the mistake?
Spot the mistake
A teammate builds the ticket model. Which setup is wrong?
Quick check
A ticket can be both a fraud check and urgent. Which output fits?
Can you answer these from memory?
Flash cards · tap a card to flip it
What will they ask next?
Learn it in depth
Last updated on 27 November 2026
Building a model that routes or tags tickets?
Venkat designs and builds AI products and agents, the interface and the system behind it. Book a short call and say what you need, and I will talk you through whether a model fits.