optimize

Full Optuna-based hyperparameter optimization for classification, steering, and weight modification. This is the recommended way to find optimal parameters for your model and task.

Basic Usage
python -m wisent optimize --model MODEL --task TASK [OPTIONS]

Examples

Full Optimization
python -m wisent optimize \
  --model meta-llama/Llama-3.1-8B-Instruct \
  --task truthfulqa_mc1 \
  --n-trials 50 \
  --output ./optimization_results
Classification Only
python -m wisent optimize \
  --model meta-llama/Llama-3.1-8B-Instruct \
  --task mmlu \
  --optimize-classification \
  --n-trials 30
Steering Only
python -m wisent optimize \
  --model meta-llama/Llama-3.1-8B-Instruct \
  --task hellaswag \
  --optimize-steering \
  --n-trials 40
Multiple Tasks
python -m wisent optimize \
  --model meta-llama/Llama-3.1-8B-Instruct \
  --tasks truthfulqa_mc1 mmlu hellaswag \
  --n-trials 20

Arguments

Required

ArgumentDescription
--modelModel name or path to optimize
--task / --tasksTask(s) to optimize for

Optimization Scope

ArgumentDefaultDescription
--optimize-classificationtrueOptimize classification parameters
--optimize-steeringtrueOptimize steering parameters
--optimize-weightsfalseOptimize weight modification parameters

Optuna Settings

ArgumentDefaultDescription
--n-trials50Number of optimization trials
--timeoutNoneTimeout in seconds for optimization
--study-nameautoName for Optuna study
--storageNoneOptuna storage URL for persistence

Search Space

ArgumentDefaultDescription
--layer-rangeallLayer range to search (e.g., 10-20)
--strength-range0.5-2.0Steering strength range to search
--threshold-range0.3-0.9Classification threshold range

Output

ArgumentDescription
--outputOutput directory for results
--save-bestSave best configuration to model config
--export-plotsExport optimization visualizations

What Gets Optimized

  • Layer - Which model layer to extract activations from
  • Threshold - Classification decision threshold
  • Token Aggregation - How to aggregate token-level scores
  • Steering Strength - Magnitude of steering vector application
  • Steering Method - Which steering technique to use

Related Commands

Stay in the loop. Never miss out.

Subscribe to our newsletter and unlock Wisent insights.