A dictionary is judged by inspecting its latents. Build the pieces of a feature dashboard from cached SAE activations and the token stream they came from.
top_activations(Z, j, k)
Z is (N, n) latent activations over N token positions. Return the k positions with the largest activation of latent j as a list of (index, value) tuples, descending by value, ties by lower index; values as floats.activation_frequency(Z, j)
j is positive, as a float.activation_histogram(Z, j, bins)
np.histogram counts of the positive activations of latent j over bins equal-width bins between 0 and their maximum; return (counts, edges) as lists. If the latent never fires return ([0] * bins, [0.0] * (bins + 1)).context_window(tokens, idx, radius)
idx - radius to idx + radius inclusive, clipped to the sequence bounds.dashboard(Z, tokens, j, k, radius, bins)
"frequency", "top" (list of dicts with "index", "value", "context"), and "histogram" (the (counts, edges) pair), built from the functions above.(-value, index) to get the tie rule.np.histogram(values, bins=bins, range=(0, values.max())) gives the fixed-range binning.