Controls LLM **creativity vs determinism**. Temperature is applied before softmax during token sampling.
temperature_scale(logits, T) = softmax(logits / T)- T = 1.0 → standard softmax (no change)
- T → 0 → argmax (always picks highest logit)
- T → ∞ → uniform distribution
temperature_scale([1.0, 2.0, 3.0], 1.0) → [0.09003, 0.24473, 0.66524] temperature_scale([1.0, 2.0, 3.0], 2.0) → [0.18632, 0.30720, 0.50648]
Round to **5 decimal places**.
Similar Problems
Test Cases (2 visible · 1 hidden)
Case 1: T=1 same as softmax
Input: temperature_scale([1.0,2.0,3.0], 1.0)
Expected: [0.09003, 0.24473, 0.66524]
Case 2: T=2 more uniform
Input: temperature_scale([1.0,2.0,3.0], 2.0)
Expected: [0.18632, 0.3072, 0.50648]
⌘↵ Run · ⌘⇧↵ Submit