Skip to main content

Module metrics

Module metrics 

Source
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