A Field Guide to Logs in AI
Logs appear in many places, but for different reasons:
- Cross-entropy loss — PyTorch classification loss combines log-softmax with negative log-likelihood.
- Information and entropy — Shannon entropy is ; the log base determines the unit.
- KL divergence — compares distributions in distillation, variational inference, and some preference-training objectives.
- Logit transformation — maps probabilities in (0,1) to the real line and appears in logistic models.
- Plotting and schedules — log axes reveal multiplicative changes across wide ranges.
- Quantization and dynamic range — some formats use logarithmic or other nonuniform spacing, while many common integer quantizers use linear affine scales. Inspect the actual scheme.
- Boltzmann distributions and softmax — , so energy relates to negative log probability up to normalization and temperature.
Probability code often moves into log space when it multiplies many small terms or computes likelihood-based losses. Look for the numerical or modeling reason, not just the word “log.”
Track Reward
Logs turn products into sums, compress multiplicative ranges, and expose information units. When you seelog_softmax,cross_entropy, orlogsumexp, you can now ask which identity and which numerical failure the function is handling.
로봇의 뇌(코드) 속에는 cross_entropy라는 공식이 있다. 그 껍질을 까보면 그 속에는 항상 로그가 숨어 있다. 로그는 사라질 뻔한 작은 숫자들을 안전하게 지켜주고, 복잡한 계산을 길찾기 쉬운 지도로 바꾸어준다. 인공지능의 학습은 로그가 만들어준 공간 위에서 정답이라는 보물을 찾아가는 여정이다.