Same under knockouts
auto_circuit.metrics.completeness_metrics.same_under_knockouts
Attributes
AlgoCompletenessScores
module-attribute
AlgoCompletenessScores = Dict[AlgoKey, CompletenessScores]
CompletenessScores
for each algorithm.
CompletenessScores
module-attribute
A list of tuples containing:
- The size of the circuit.
- The number of knockouts.
- The KL divergence between the circuit and the full model.
- The KL divergence between the circuit with knockouts and the full model with knockouts.
TaskCompletenessScores
module-attribute
TaskCompletenessScores = Dict[TaskKey, AlgoCompletenessScores]
AlgoCompletenessScores
for each task and algorithm.
Classes
Functions
measure_same_under_knockouts
measure_same_under_knockouts(circuit_ps: TaskPruneScores, knockout_ps: TaskPruneScores) -> TaskCompletenessScores
Wrapper of
same_under_knockout
for each task and algorithm in circuit_ps
and knockout_ps
.
Source code in auto_circuit/metrics/completeness_metrics/same_under_knockouts.py
same_under_knockout
same_under_knockout(task: Task, circuit_ps: PruneScores, knockout_ps: PruneScores, circuit_size: int, knockout_threshold: float = 0.0) -> CompletenessScores
Given a circuit and a set of edges to ablate, measure the difference in KL divergence between the circuit and the full model with and without the knockouts.
This is the measure of completeness introduced by Wang et al. (2022) to test the IOI circuit.
The optimization process that attempts to find the knockouts that maximize the
difference is implemented separately in
train_same_under_knockout_prune_scores
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task |
Task
|
The task to measure the completeness for. |
required |
circuit_ps |
PruneScores
|
The circuit to test. The top |
required |
knockout_ps |
PruneScores
|
The set of knockouts to test. All edges with scores greater than
|
required |
circuit_size |
int
|
The size of the circuit. |
required |
knockout_threshold |
float
|
The threshold for knockout edges. |
0.0
|
Returns:
Type | Description |
---|---|
CompletenessScores
|
Tuple of completeness information. |
Source code in auto_circuit/metrics/completeness_metrics/same_under_knockouts.py
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 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|
same_under_knockouts_fig
same_under_knockouts_fig(task_completeness_scores: TaskCompletenessScores) -> Figure
Create a plotly figure showing the difference in KL divergence between the circuit and the full model with and without knockouts for each task and algorithm.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_completeness_scores |
TaskCompletenessScores
|
The completeness scores for each task and algorithm. |
required |
Returns:
Type | Description |
---|---|
Figure
|
The plotly figure. |