steer-features

Steer language model behavior by selecting and amplifying internal features during generation.

75|7|Updated May 2, 2026
One-click install
npx skills add https://github.com/zjunlp/Mechanist --skill steer-features-zjunlp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: steer-features
Source: https://github.com/zjunlp/Mechanist/tree/main/skills/mechanism-skills/representation-and-parameter-analysis/steer-features
Command: npx skills add https://github.com/zjunlp/Mechanist --skill steer-features-zjunlp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, transformers, sae-lens, accelerate, numpy, and includes scripts (resource) and references (resource) components.

What problem does it solve? Controlling a language model's behavior at the feature level requires finding which internal feature drives a target behavior and intervening on it during generation. This Skill implements the feature-scoring and selection method from the paper "SAEs Are Good for Steering -- If You Select the Right Features", so you can locate effective features and amplify or shrink their activations instead of guessing. ## Core Features & Use Cases - Feature Scoring and Selection: Compute output scores (effect on model output) and input scores (activation consistency) to filter features, yielding 2-3x better steering effectiveness. - Feature Clamping Intervention: Encode residual-stream activations into feature space, amplify or diminish the target feature, and decode back during generation (the default mode; additive steering-vector injection only on explicit request). - Multi-Model Support: Works with Gemma 2B/9B/9B-IT, LLaMA 3.1, and Pythia models, with or without a Sparse Autoencoder. - Use Case: You want Gemma 9B to consistently follow a target concept. Compute output and input scores over candidate features, select high-output/moderate-input features, then sweep steering factors from 0.2 to 20.0 to find the setting that controls behavior without hurting fluency. ## Quick Start Ask the agent to compute input and output scores for your feature set and then steer the model with the best-scoring feature at a chosen steering factor.

Frequently Asked Questions about steer-features

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I steer a language model using SAE features?

Compute output and input scores for candidate features, select features with high output scores and moderate input scores, then apply feature clamping during generation. The encode, amplify target feature, decode flow is the default intervention mode.

What is the difference between input scores and output scores for SAE features?

Output scores measure how much a feature affects the model's output distribution when activated, while input scores measure how consistently a feature activates on specific input tokens. Features with high output but moderate input scores steer most effectively.

Does feature steering require a Sparse Autoencoder?

No, an SAE is optional. The method only needs to locate the feature driving the target behavior and scale its activation during generation. The bundled demo scripts use an SAE via sae-lens, but that is a property of the demo, not a requirement.

Which models support SAE feature steering?

The skill supports Gemma 2B, Gemma 9B, Gemma 9B-IT, LLaMA 3.1, and Pythia 70M. A CUDA-capable GPU is recommended for model inference, and feature data can come from Neuronpedia or local JSON files.

What steering factor should I use for feature amplification?

Test multiple factors in the 0.2 to 20.0 range, starting low for subtle steering and increasing gradually. The compare_steering_factors function sweeps values like 0.0 through 8.0 to find the balance between behavioral effect and fluency.