jasperfu/activation-steering-demo
0
Activation Steering — Live Demo
Edit what a language model is "thinking" by adding a concept vector to a middle-layer activation. No fine-tuning, no prompt engineering.
What is this
Based on Anthropic's July 2026 paper Verbalizable Representations Form a Global Workspace in Language Models, which shows that LLMs maintain a privileged set of internal representations ("workspace") that can be read via a Jacobian lens and directly manipulated via activation patching.
This Space demonstrates the manipulation side: pick a direction (via positive/negative word contrast), and edit any middle-layer activation with h_ℓ ← h_ℓ + α · direction.
Try
- Pick a preset (Sentiment / Formality / Style / Verbosity)
- Edit the positive/negative words, or write your own from scratch
- Adjust
α(0–100) and see the three columns spread from opposite direction ← baseline → steered direction
Sweet spot α is typically 20–60 for the 0.6B model.
Model
Qwen/Qwen3-0.6B — chosen because it fits on the free CPU tier. For stronger effects you'd want 4B+.
What works, what doesn't
- ✅ Sentiment on review-style prompts
- ✅ Formality on communication tasks
- ⚠️ Aesthetic on generative tasks (partial)
- ❌ Specific typography / long-form style consistency
- ❌ Prompts with strong factual anchors (product specs)
Recipe
direction = mean(embed([" amazing", " excellent", ...])) - mean(embed([" terrible", " awful", ...]))
def hook(module, input, output):
h = output[0]
h[:, :] += alpha * direction
return (h,) + output[1:]
model.model.layers[layer - 1].register_forward_hook(hook)
model.generate(...) # first forward gets steered