jb1999/lap-steering-demo
LAP Steering Demo — Entity Redirect
Interactive demo for the paper Linear Accessibility Profile: Predicting Steering Vector Effectiveness.
The core claim: A_lin (logit lens accuracy at each layer) predicts which layer a steering vector will be effective at — with no training required.
This demo: steer London-answer prompts toward a target city on OLMo-2-1B-Instruct.
What you see
Three completions side-by-side for any prompt:
Alin is computed by applying the model's own unembedding matrix to intermediate hidden states (the logit lens). Where Alin = 0, the concept is not yet linearly decodable — steering at that layer does nothing regardless of strength. This is the paper's key finding.
Steering quality varies by target city. Paris has the strongest signal (A_lin = 0.45 at L13), matching the paper exactly. Other cities are weaker (0.05–0.30) and may steer less reliably — which is precisely what the metric predicts.
Technical details
Model: allenai/OLMo-2-0425-1B-Instruct
Steering vectors: Difference-of-means (CAA). For each target city:
sv[l] = mean(city_activations[l]) - mean(London_activations[l])A_lin (logit lens accuracy):
A_lin(l) = fraction of prompts where argmax(W_U · LayerNorm(h_l)) == target tokenApplied to hidden states at each layer using the model's own final norm and LM head. No training, no probes — one forward pass.
Steering injection:
hidden_states[l] += α × steering_vector[l]Via register_forward_hook. Hook is registered, used for one generation, immediately removed.
Run locally
git clone https://huggingface.co/spaces/YOUR_USERNAME/lap-steering-demo
cd lap-steering-demo
pip install -r requirements.txt
# Precompute steering vectors + A_lin for all cities (~2 min on GPU, ~15 min on CPU)
python precompute.py
python app.pyLinks
Run locally
Or with uv:
uv sync
uv run python precompute.py
uv run python app.py