Expand description
Mathematical metrics for AI safety auditing.
Provides hot-loop implementations of Shannon Entropy, Perplexity, etc.
Functions§
- logit_
l2_ norm - Computes the L2 Norm (Euclidean Norm) of the logits. Sudden spikes (> 1e5) indicate numerical instability/overflow.
- logit_
variance - Computes the variance of the logits (measure of “flatness” vs “spikiness”). Low variance (< 0.1) often indicates an overconfident or “stuck” model.
- max_
probability_ from_ logits - Computes the maximum probability in the distribution (Confidence). Extremely high values (> 0.99) can indicate “Collapse” or loops.
- shannon_
entropy - shannon_
entropy_ from_ logits