Spaces:
Running on Zero
Running on Zero
Commit ·
4676275
1
Parent(s): ffa621b
Fixed markdown in method tab
Browse files
app.py
CHANGED
|
@@ -16,6 +16,11 @@ INK_PLUM = "#786F82"
|
|
| 16 |
INK_STONE = "#82827E"
|
| 17 |
INK_BLUEGREY = "#687982"
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
STUDY = OfflineStudy()
|
| 20 |
|
| 21 |
CSS = r"""
|
|
@@ -3112,6 +3117,24 @@ with gr.Blocks(title="FeatureLens — Causal Interpretability Workbench", fill_w
|
|
| 3112 |
wrap=False,
|
| 3113 |
max_height=300,
|
| 3114 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3115 |
else:
|
| 3116 |
gr.Markdown(
|
| 3117 |
"Run the offline study to populate measured tables and figures. Until then, this tab stays intentionally empty."
|
|
@@ -3119,41 +3142,66 @@ with gr.Blocks(title="FeatureLens — Causal Interpretability Workbench", fill_w
|
|
| 3119 |
|
| 3120 |
with gr.Tab("Method"):
|
| 3121 |
gr.Markdown(
|
| 3122 |
-
|
| 3123 |
### Reconstruction-preserving intervention
|
| 3124 |
|
| 3125 |
For residual vector $h$, sparse coefficient $z_i$, decoder direction $d_i$, and scale $\alpha$:
|
| 3126 |
|
| 3127 |
- **Ablate:** $h' = h - z_i d_i$
|
| 3128 |
-
- **Scale:** $h' = h + (\alpha - 1)z_i d_i$
|
| 3129 |
- **Inject:** $h' = h + \delta d_i$
|
| 3130 |
|
| 3131 |
For a feature set $S$:
|
| 3132 |
|
| 3133 |
-
$$
|
|
|
|
|
|
|
| 3134 |
|
| 3135 |
-
FeatureLens patches the delta into the **original residual**; it
|
| 3136 |
|
| 3137 |
### Control discipline
|
| 3138 |
|
| 3139 |
-
Batched experiments include an explicit **zero-edit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3140 |
|
| 3141 |
### Evidence ladder
|
| 3142 |
|
| 3143 |
1. SAE reconstruction quality.
|
| 3144 |
2. Held-out feature/concept prediction.
|
| 3145 |
-
3.
|
| 3146 |
-
4.
|
| 3147 |
-
5.
|
| 3148 |
-
6.
|
| 3149 |
-
7.
|
| 3150 |
-
8.
|
| 3151 |
-
9.
|
| 3152 |
-
|
| 3153 |
-
|
| 3154 |
-
|
| 3155 |
-
|
| 3156 |
-
|
| 3157 |
|
| 3158 |
gr.HTML('<div class="bottom-spacer" aria-hidden="true"></div>')
|
| 3159 |
|
|
|
|
| 16 |
INK_STONE = "#82827E"
|
| 17 |
INK_BLUEGREY = "#687982"
|
| 18 |
|
| 19 |
+
LATEX_DELIMITERS = [
|
| 20 |
+
{"left": "$$", "right": "$$", "display": True},
|
| 21 |
+
{"left": "$", "right": "$", "display": False},
|
| 22 |
+
]
|
| 23 |
+
|
| 24 |
STUDY = OfflineStudy()
|
| 25 |
|
| 26 |
CSS = r"""
|
|
|
|
| 3117 |
wrap=False,
|
| 3118 |
max_height=300,
|
| 3119 |
)
|
| 3120 |
+
|
| 3121 |
+
with gr.Row(equal_height=False):
|
| 3122 |
+
with gr.Column(scale=1):
|
| 3123 |
+
gr.Image(
|
| 3124 |
+
value=STUDY.figure("feature_auroc.png"),
|
| 3125 |
+
label="Held-out sparse-feature AUROC",
|
| 3126 |
+
interactive=False,
|
| 3127 |
+
show_label=True,
|
| 3128 |
+
height=360,
|
| 3129 |
+
)
|
| 3130 |
+
with gr.Column(scale=1):
|
| 3131 |
+
gr.Image(
|
| 3132 |
+
value=STUDY.figure("feature_set_effects.png"),
|
| 3133 |
+
label="Feature-set causal effects",
|
| 3134 |
+
interactive=False,
|
| 3135 |
+
show_label=True,
|
| 3136 |
+
height=360,
|
| 3137 |
+
)
|
| 3138 |
else:
|
| 3139 |
gr.Markdown(
|
| 3140 |
"Run the offline study to populate measured tables and figures. Until then, this tab stays intentionally empty."
|
|
|
|
| 3142 |
|
| 3143 |
with gr.Tab("Method"):
|
| 3144 |
gr.Markdown(
|
| 3145 |
+
r"""
|
| 3146 |
### Reconstruction-preserving intervention
|
| 3147 |
|
| 3148 |
For residual vector $h$, sparse coefficient $z_i$, decoder direction $d_i$, and scale $\alpha$:
|
| 3149 |
|
| 3150 |
- **Ablate:** $h' = h - z_i d_i$
|
| 3151 |
+
- **Scale:** $h' = h + (\alpha - 1) z_i d_i$
|
| 3152 |
- **Inject:** $h' = h + \delta d_i$
|
| 3153 |
|
| 3154 |
For a feature set $S$:
|
| 3155 |
|
| 3156 |
+
$$
|
| 3157 |
+
h' = h + \sum_{i \in S} \Delta z_i d_i
|
| 3158 |
+
$$
|
| 3159 |
|
| 3160 |
+
FeatureLens patches the intervention delta into the **original residual**; it does not replace the residual with the full SAE reconstruction.
|
| 3161 |
|
| 3162 |
### Control discipline
|
| 3163 |
|
| 3164 |
+
Batched experiments include an explicit **zero-edit reference**. Causal effects are measured against that condition rather than against a separately executed baseline, avoiding batch-versus-single numerical drift.
|
| 3165 |
+
|
| 3166 |
+
Random specificity uses norm-matched residual directions so that SAE interventions are compared against perturbations with the same $L_2$ magnitude.
|
| 3167 |
+
|
| 3168 |
+
### Causal position
|
| 3169 |
+
|
| 3170 |
+
The offline study evaluates two intervention policies:
|
| 3171 |
+
|
| 3172 |
+
- **Final token:** intervene at the final prompt-token residual.
|
| 3173 |
+
- **Max-active token:** intervene at the prompt position where the selected SAE feature has maximum activation,
|
| 3174 |
+
|
| 3175 |
+
$$
|
| 3176 |
+
t^* = \arg\max_t z_f(t)
|
| 3177 |
+
$$
|
| 3178 |
+
|
| 3179 |
+
where $z_f(t)$ is the activation of selected feature $f$ at token position $t$.
|
| 3180 |
+
|
| 3181 |
+
The intervention location is chosen only from SAE activation; behavioral outcomes are not used to select the token.
|
| 3182 |
+
|
| 3183 |
+
### Statistical unit
|
| 3184 |
+
|
| 3185 |
+
For the offline causal study, the **causal task** is the primary statistical unit.
|
| 3186 |
+
|
| 3187 |
+
Ablation and amplification effects are first aggregated within each task before paired bootstrap and sign-flip inference. This avoids treating two interventions on the same prompt as independent observations.
|
| 3188 |
|
| 3189 |
### Evidence ladder
|
| 3190 |
|
| 3191 |
1. SAE reconstruction quality.
|
| 3192 |
2. Held-out feature/concept prediction.
|
| 3193 |
+
3. Candidate-selection stability.
|
| 3194 |
+
4. Local and prompt-wide paraphrase robustness.
|
| 3195 |
+
5. Single-feature causal intervention and dose response.
|
| 3196 |
+
6. Contrastive continuation preference.
|
| 3197 |
+
7. Joint feature-set intervention and interaction analysis.
|
| 3198 |
+
8. Specificity relative to norm-matched random controls.
|
| 3199 |
+
9. Final-token versus max-active causal-position sensitivity.
|
| 3200 |
+
|
| 3201 |
+
Association, robustness, geometry, and causal intervention are treated as distinct forms of evidence.
|
| 3202 |
+
""",
|
| 3203 |
+
latex_delimiters=LATEX_DELIMITERS,
|
| 3204 |
+
)
|
| 3205 |
|
| 3206 |
gr.HTML('<div class="bottom-spacer" aria-hidden="true"></div>')
|
| 3207 |
|