Every LLM turns raw logits into a probability distribution over the vocabulary with softmax. A temperature controls how sharp that distribution is:
Implement softmax(logits, temperature=1.0) returning a NumPy array of probabilities.
Requirements
[1000, 1001] must not overflow.Example
softmax(np.array([1.0, 2.0, 3.0]))
# array([0.0900, 0.2447, 0.6652])