steering-viz

Visualize the effect of steering on a model's activation space: project base vs steered activations relative to the positive and negative concept clusters, and optionally compare generated responses. A per-concept mode driven by zwiad results is also available.

Basic Usage
python -m wisent steering-viz --model MODEL --task TASK --layer N --strength S --output FILE [OPTIONS]

Examples

Visualize steering at a layer
python -m wisent steering-viz   --model meta-llama/Llama-3.1-8B-Instruct   --task truthfulqa_custom   --layer 15 --strength 1.5   --n-test-prompts 100 --n-response-samples 5   --prompt-format chat --extraction-strategy last_token   --space-classifier logistic   --direction-method mean_diff --steering-method linear   --device cuda   --classifier-test-size 0.2 --classifier-batch-size 32 --classifier-lr 0.001   --pacmap-neighbors-max 50 --pacmap-neighbors-divisor 10 --pacmap-num-iters 450   --output ./viz.png --output-dir ./viz
Per-concept from zwiad results
python -m wisent steering-viz   --model meta-llama/Llama-3.1-8B-Instruct   --task truthfulqa_custom   --layer 15 --strength 1.5   --per-concept --zwiad-results ./zwiad.json --multipanel   --n-test-prompts 100 --n-response-samples 5   --prompt-format chat --extraction-strategy last_token   --space-classifier logistic   --direction-method search --steering-method linear   --device cuda   --classifier-test-size 0.2 --classifier-batch-size 32 --classifier-lr 0.001   --pacmap-neighbors-max 50 --pacmap-neighbors-divisor 10 --pacmap-num-iters 450   --output ./viz.png --output-dir ./viz

Arguments

Required

ArgumentDescription
--modelModel name
--taskTask/benchmark name in database
--layerLayer to visualize
--strengthSteering strength multiplier
--outputOutput PNG file path
--output-dirOutput directory for per-concept visualizations
--deviceDevice to run the model on (cuda, mps)

Sampling & Extraction

ArgumentDefaultDescription
--n-test-promptsrequiredNumber of test prompts to run
--n-response-samplesrequiredSamples to show response comparison for
--prompt-formatrequiredchat or completion
--extraction-strategyrequiredlast_token or first_token
--max-new-tokens100Max tokens generated per response

Method & Modes

ArgumentDefaultDescription
--direction-methodrequiredmean_diff, search, behavioral or pca_0
--steering-methodrequiredlinear, clamping, projection, replacement, contrast, mlp, adaptive
--space-classifierrequiredClassifier for space location: logistic or mlp
--per-conceptoffPer-concept visualizations (needs --zwiad-results)
--multipaneloff9-panel visualization (PCA, LDA, t-SNE, UMAP...)
--interactiveoffInteractive HTML instead of static PNG
--autotuneoffTune threshold/strength/method on a validation split

Classifier and PaCMAP tuning flags (--classifier-test-size, --classifier-batch-size, --classifier-lr, --mlp-hidden-dim, --pacmap-neighbors-max, --pacmap-neighbors-divisor, --pacmap-num-iters) plus multi-layer flags (--multi-layer, --layers, --layer-strengths, --layer-methods) are also available; run wisent steering-viz --help for the full list.

Related Commands

  • zwiad - Geometry analysis that feeds --per-concept
  • verify-steering - Verify activation alignment at inference
  • multi-steer - Combine multiple steering vectors at inference

Stay in the loop. Never miss out.

Subscribe to our newsletter and unlock Wisent insights.