We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← Decoding Strategies step 2 of 8
Easy
Research
Temperature Scaling
Implement Temperature Scaling from “On Calibration of Modern Neural Networks” (Guo et al., 2017).
Temperature scaling is a simple post-hoc calibration method. It divides logits by a learned temperature T before applying softmax:
$$\hat{q}_i = \text{softmax}(z_i / T)$$
- T > 1: softer (more uniform) distribution — reduces overconfidence
- T < 1: sharper (more peaked) distribution
- T = 1: no change
Input:
-
logits: shape(batch, n_classes)— raw model outputs -
temperature: float T > 0
Output: Tensor of shape (batch, n_classes) — calibrated probabilities.
Nothing accepted yet. When a submission passes, the code that passed shows up
here, one entry per mode.
Stuck?
PyTorch reference solution
Sign in to attempt this problem and reveal the reference solution.