Once a dictionary latent has a name, the test of that name is to set it to a chosen value and push the change back into the residual stream. Implement the clamp and its effect on the logits.
feature_activation(x, W_enc, b_enc, j)
j on a single residual x (d,): max(x @ W_enc[:, j] + b_enc[j], 0) as a float.steer_feature(x, W_enc, b_enc, W_dec, j, target)
x + (target - z_j) * W_dec[j] where z_j is the current activation: the residual with latent j clamped to target, every other latent untouched.steer_batch(X, W_enc, b_enc, W_dec, j, target)
X (N, d).feature_logit_effect(W_dec, W_U, j, k)
j is W_dec[j] @ W_U. Return the k tokens with the largest positive change and the k with the most negative, as (top, bottom) lists of (token_index, value) with values rounded to 4 decimals; ties by lower index.steering_delta_logits(x, W_enc, b_enc, W_dec, W_U, j, target)
W_U.T @ (steered - x) for a single residual, the change in every logit, as a (V,) array.(target - z_j) times the per-unit effect.