Benchmark
aisteer360.evaluation.benchmark
Benchmark
Benchmark framework for comparing steering pipelines on specific use cases.
Provides a standardized way to compare different steering control configurations against a baseline model on a given evaluation task. Handles the complete benchmark workflow: model loading, generation, and evaluation.
The benchmark runs each control pipeline configuration independently, allowing for fair comparison of controls on a common task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
use_case
|
UseCase
|
The evaluation task defining prompts, generation logic, and metrics.
Must implement |
required |
base_model_name_or_path
|
str | Path
|
HuggingFace model identifier or local path to the base model. Used for all pipeline configurations and baseline. |
required |
steering_pipelines
|
dict[str, list[Any]]
|
Named configurations of steering pipelines. Keys are configuration names (e.g., "baseline", "with_activation_steering"). Values are pipelines, e.g., lists of controls (StructuralControl, StateControl, etc.). Empty list or None creates a baseline configuration without steering. |
required |
runtime_overrides
|
dict[str, dict[str, Any]]
|
Runtime parameters for specific pipeline
configurations. Outer keys match |
None
|
hf_model_kwargs
|
dict
|
Additional arguments passed to |
None
|
gen_kwargs
|
dict
|
Generation parameters passed to model.generate(). Defaults to {}. |
None
|
device_map
|
str
|
Device placement strategy for model loading. Defaults to "auto". |
'auto'
|
Source code in aisteer360/evaluation/benchmark.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
base_model_name_or_path = base_model_name_or_path
instance-attribute
device_map = device_map
instance-attribute
gen_kwargs = gen_kwargs or {}
instance-attribute
hf_model_kwargs = hf_model_kwargs or {}
instance-attribute
runtime_overrides = runtime_overrides
instance-attribute
steering_pipelines = steering_pipelines
instance-attribute
use_case = use_case
instance-attribute
export(profiles, save_dir)
Export benchmark results to disk.
Saves the benchmark profiles to the specified directory. Creates the directory if it doesn't exist. Delegates the actual export logic to the use case's export method, which handles format-specific serialization.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
profiles
|
dict[str, Any]
|
Benchmark results from |
required |
save_dir
|
str
|
Directory path where results will be saved. Will be created if it doesn't exist. |
required |
Source code in aisteer360/evaluation/benchmark.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
run()
Run benchmark on all configured steering pipelines.
Executes the benchmark by iterating through each pipeline configuration defined in control_pipelines
. For each
configuration, calls _run_pipeline()
to handle model setup, generation, and evaluation. Results from all
pipelines are collected for comparison.
Returns:
Type | Description |
---|---|
dict[str, Any]
|
Benchmark profiles for all pipeline configurations. Keys are pipeline names from
|
Source code in aisteer360/evaluation/benchmark.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|