multi-steer

At inference time blend multiple steering vectors dynamically. With customizable weights, this lets one mix diverse traits such as helpfulness, honesty and creativity.

Basic Usage
python -m wisent multi-steer --model MODEL --vector PATH:WEIGHT [--vector PATH:WEIGHT ...] --prompt TEXT

Examples

Combine Two Vectors
python -m wisent multi-steer \
  --model meta-llama/Llama-3.1-8B-Instruct \
  --vector ./vectors/helpfulness.pt:1.0 \
  --vector ./vectors/honesty.pt:0.8 \
  --layer 15 \
  --prompt "What are the risks of investing in cryptocurrency?"
Combine Three Vectors with Normalization
python -m wisent multi-steer \
  --model meta-llama/Llama-3.1-8B-Instruct \
  --vector ./vectors/helpfulness.pt:1.0 \
  --vector ./vectors/creativity.pt:0.5 \
  --vector ./vectors/conciseness.pt:0.3 \
  --layer 15 \
  --normalize-weights \
  --prompt "Write a poem about the ocean"
Save Combined Vector
python -m wisent multi-steer \
  --model meta-llama/Llama-3.1-8B-Instruct \
  --vector ./vectors/helpful.pt:0.6 \
  --vector ./vectors/safe.pt:0.4 \
  --layer 15 \
  --save-combined ./vectors/helpful_safe_combined.pt \
  --prompt "Test prompt"
Unsteered Baseline
# Generate without any steering for comparison
python -m wisent multi-steer \
  --model meta-llama/Llama-3.1-8B-Instruct \
  --prompt "What should I do if I'm feeling stressed?"

Arguments

ArgumentRequiredDefaultDescription
--modelYes-Model name or path
--promptYes-Prompt to generate with
--vectorNo*-Vector path and weight (PATH:WEIGHT). Can be specified multiple times.
--layerNo**-Layer to apply steering (required when using vectors)
--methodNoCAASteering method
--max-new-tokensNo100Maximum tokens to generate
--normalize-weightsNofalseNormalize weights to sum to 1.0
--target-normNoNoneScale combined vector to this norm
--save-combinedNoNoneSave combined vector to this path
--deviceNoautoDevice (cuda, cpu, mps)
--verboseNofalseShow weight calculation details

Generates a baseline if no vectors are given; required for use with vectors. You are an expert in natural language processing and machine learning

How Combination Works

Vectors are combined using weighted addition:

Combination Formula
combined = w1 * v1 + w2 * v2 + w3 * v3 + ...
  • --normalize-weights: Scales weights so they sum to 1.0
  • --target-norm: Rescales the final combined vector to have a specific magnitude
  • Without normalization, weights are used as-is (allows stronger effects)

Tips

  • Start with equal weights and adjust based on results
  • Use --verbose to see how vectors are being combined
  • Save successful combinations with --save-combined for reuse
  • Vectors should all be from the same layer for best results

Stay in the loop. Never miss out.

Subscribe to our newsletter and unlock Wisent insights.