As far as I understand one can in principle model the distribution over a set of $k$ categories using e.g.:

As far as I can tell, both use $k$ parameters to model the distribution over $k$ categories.

My questions:

  • Does the "softmax distribution" have a name?
  • Why isn't the softmax discussed more frequently in textbooks?
  • If the Dirichlet distribution is a common distribution of choice for categorical outcomes, why do NNs use softmax layers instead of Dirichlet ones?


Almost very textbook that I have encountered and that introduces common distributions (Binomial, Beta, Gaussian, Gamma, Poisson, Dirichlet) never mentions it (e.g. see this list of common distributions in Wikipedia).

Why isn't it presented more commonly in introductory books as type of common distribution? For almost any common distribution, Wikipedia (for example) covers their moments, marginal distributions, entropy, relationship to other known distributions, etc. Why not the same with the softmax distribution?

This is quite perplexing for me given the fact that softmax layers are actually extremely common in neural networks, and the converse is equally true, I have never encountered neural networks using "Dirichlet layers" for modeling categorical outcomes.

What explains this discrepancy? Is it a matter of tradition? Or is there a deeper connection and equivalency between them, and they just happen to go by different names?


3 Answers 3


The softmax function is a function. For a fixed input, you get a fixed output, just as for any other function. Someone might have invented a softmax distribution in some context, but that's not the meaning of "softmax function," as described in your post, or commonly used in neural networks.

The Dirichlet distribution is a distribution. Drawing from a Dirichlet distribution with some parameters will almost surely give a different result each time. The Dirichlet distribution is not a distribution over categories, it's a distribution over probability vectors.

The commonality that you've found between the softmax function and the Dirichlet distribution is that the results (function outputs, random draws) are always probability vecotrs: the vectors are non-negative, and sum to 1.

The normal distribution is a probability distribution which assigns positive probability to any real number. A linear function yields real number for any input. But you wouldn't conflate the two, because they're clearly different things in important ways. Likewise, the softmax function and Dirichlet distribution are distinct.

  • $\begingroup$ Thanks Sycorax! But once you get a vector of probabilities, sampling from that vector is independent of how we get them, isn't it? In other words, I could create a distribution from the Softmax distribution and sample from it in the same way I would sample from a Dirichlet distribution, no? $\endgroup$
    – Josh
    Commented Aug 3, 2020 at 0:56
  • 1
    $\begingroup$ @Josh You're using "sampling" in a strange sense. You could take a sample from a Dirichlet and the results of a softmax and use that set of probabilities as hyperparameters for something else. But you're not sampling from a softmax. It's not a distribution. $\endgroup$
    – Wayne
    Commented Aug 3, 2020 at 1:16
  • 1
    $\begingroup$ @Josh Sampling from a Dirchlet distribution yields a vector of probabilities. It's not clear what you mean by sampling from a "softmax distribution" because softmax isn't a distribution -- or, at least, you haven't described how a softmax distribution is related to a softmax function. Perhaps you're conflating a distribution over several categories with a distribution over probability vectors? As contrast, the beta distribution is a distribution over probability, and the binomial distribution is binary, but the beta-binomial is its own beast. $\endgroup$
    – Sycorax
    Commented Aug 3, 2020 at 1:17

In fact, the distribution that is equivalent to the softmax function is the Boltzman distribution, which is in the list of common distributions you linked to. (The Wikipedia entry focusses on its original use in statistical mechanics and you would obviously ignore the $kT$ denominator for machine learning uses, though it's worth noting that softmax is not invariant under scale).

I can't answer why the Dirichlet PDF (as a function) is not as popular in NNs, though I suspect that this answer comparing softmax to normalisation is the reason. It suggests that softmax has the nice property of effectively cancelling out the log in cross entropy loss, leading to faster learning when the loss is larger.


A softmax function serves multiple purposes. The output of a softmax function is typically interpreted as the parameters of a Categorical distribution (a.k.a. Multinomial distribution with event count equals 1). However, it may be alternatively known as the mean of a Dirichlet distribution (Nandy et al., 2020). In addition, if a softmax is applied to a Gaussian random variable, the output of the softmax is a so-called Logistic Normal (Aitchison et al., 1980; Blei et al., 2007) random variable.

Literatures, indeed, admit the name "softmax distribution", e.g. (Dieng et al., 2020). You might need to infer its meaning from the context.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.