Spaces:
Running
Running
Rename NLA tab to NLA · SHOW & TELL
Browse files- README.md +1 -1
- bistro/interp/__init__.py +1 -1
- bistro/ui/glossary.py +2 -2
- bistro/ui/nla_tab.py +3 -3
- bistro/ui/oracle_panel.py +1 -1
README.md
CHANGED
|
@@ -203,7 +203,7 @@ datasets:
|
|
| 203 |
- **Evaluation & Feature Dashboards**: Explained variance, CE recovered and KL score from spliced forward passes; activation densities, top contexts, logit effects, auto-interpretation, and a 3-D feature atlas.
|
| 204 |
- **Concept Manifolds & Steering**: Fit a concept manifold (spline through PCA centroids) and steer along it, or steer, clamp and ablate single SAE features in the chat.
|
| 205 |
|
| 206 |
-
- **◉ NLA ·
|
| 207 |
- **Natural Language Autoencoders**: A verbalizer turns an activation into text and a reconstructor maps the text back to an activation. Each explanation is scored by reconstruction (cosine, FVE against a streamed reference corpus).
|
| 208 |
- **Vector Modes & Position Scans**: Read single activations, differences, analogies, or model diffs against a fine-tune (with ActShift), and scan many positions in one batch.
|
| 209 |
- **Rewrite & Steer**: Edit an explanation; the change in its reconstruction becomes a steering direction for the chat.
|
|
|
|
| 203 |
- **Evaluation & Feature Dashboards**: Explained variance, CE recovered and KL score from spliced forward passes; activation densities, top contexts, logit effects, auto-interpretation, and a 3-D feature atlas.
|
| 204 |
- **Concept Manifolds & Steering**: Fit a concept manifold (spline through PCA centroids) and steer along it, or steer, clamp and ablate single SAE features in the chat.
|
| 205 |
|
| 206 |
+
- **◉ NLA · SHOW & TELL**:
|
| 207 |
- **Natural Language Autoencoders**: A verbalizer turns an activation into text and a reconstructor maps the text back to an activation. Each explanation is scored by reconstruction (cosine, FVE against a streamed reference corpus).
|
| 208 |
- **Vector Modes & Position Scans**: Read single activations, differences, analogies, or model diffs against a fine-tune (with ActShift), and scan many positions in one batch.
|
| 209 |
- **Rewrite & Steer**: Edit an explanation; the change in its reconstruction becomes a steering direction for the chat.
|
bistro/interp/__init__.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
"""Interpretability, steering & autoencoder instruments (SAE · COANALYSIS, NLA ·
|
| 2 |
|
| 3 |
Everything here works on whatever model the Bistro engine loads (any HF architecture, custom remote code,
|
| 4 |
synthesized universal models), through forward hooks on the model's own residual blocks."""
|
|
|
|
| 1 |
+
"""Interpretability, steering & autoencoder instruments (SAE · COANALYSIS, NLA · SHOW & TELL, steering panel).
|
| 2 |
|
| 3 |
Everything here works on whatever model the Bistro engine loads (any HF architecture, custom remote code,
|
| 4 |
synthesized universal models), through forward hooks on the model's own residual blocks."""
|
bistro/ui/glossary.py
CHANGED
|
@@ -252,7 +252,7 @@ HINTS.update({
|
|
| 252 |
"SAE Bundle (.zip)": "Zipped SAELens folder: `cfg.json`, `sae_weights.safetensors`, `sparsity.safetensors`, `bistro_sae.json`, `README.md`.",
|
| 253 |
})
|
| 254 |
|
| 255 |
-
# ── NLA ·
|
| 256 |
HINTS.update({
|
| 257 |
"autoencoder & subject model": "Natural language autoencoder (Fraser-Taliente et al. 2026): a verbalizer (AV) writes an explanation $z$ of an activation $h$, a reconstructor (AR) maps $z$ back to $\\hat h$; both are fine-tuned copies of the subject model, scored by how well $\\hat h$ recovers $h$.",
|
| 258 |
"NLA Preset": "Hub NLAs in the reference layout (kitft/natural_language_autoencoders: `nla_meta.yaml` sidecar, safetensors) small enough for a CPU Space.",
|
|
@@ -313,7 +313,7 @@ HINTS.update({
|
|
| 313 |
"Steering Vector (.safetensors)": "The last contrastive vector $v$ with its layer, site, prompts and model in the safetensors metadata.",
|
| 314 |
})
|
| 315 |
|
| 316 |
-
# ── NLA ·
|
| 317 |
HINTS.update({
|
| 318 |
"Activation Oracle (Karvonen et al. 2025)": "A LoRA on the model itself, trained to answer questions about its own activations (Karvonen et al. 2025, arXiv 2512.15674). Activations $v_1 \\dots v_N$ from layer $L$ are added at $N$ placeholder tokens of the question prompt, after layer 1: $h_i \\leftarrow h_i + \\|h_i\\|\\, v_i / \\|v_i\\|$.",
|
| 319 |
"oracle": "LoRA and base model of an oracle checkpoint; `ao_config.json` gives its trained layers (25 / 50 / 75 % depth), the placeholder token and the injection layer. One copy of the base holds the unmerged LoRA: adapter off = subject model, adapter on = oracle.",
|
|
|
|
| 252 |
"SAE Bundle (.zip)": "Zipped SAELens folder: `cfg.json`, `sae_weights.safetensors`, `sparsity.safetensors`, `bistro_sae.json`, `README.md`.",
|
| 253 |
})
|
| 254 |
|
| 255 |
+
# ── NLA · SHOW & TELL ──
|
| 256 |
HINTS.update({
|
| 257 |
"autoencoder & subject model": "Natural language autoencoder (Fraser-Taliente et al. 2026): a verbalizer (AV) writes an explanation $z$ of an activation $h$, a reconstructor (AR) maps $z$ back to $\\hat h$; both are fine-tuned copies of the subject model, scored by how well $\\hat h$ recovers $h$.",
|
| 258 |
"NLA Preset": "Hub NLAs in the reference layout (kitft/natural_language_autoencoders: `nla_meta.yaml` sidecar, safetensors) small enough for a CPU Space.",
|
|
|
|
| 313 |
"Steering Vector (.safetensors)": "The last contrastive vector $v$ with its layer, site, prompts and model in the safetensors metadata.",
|
| 314 |
})
|
| 315 |
|
| 316 |
+
# ── NLA · SHOW & TELL: activation oracle ──
|
| 317 |
HINTS.update({
|
| 318 |
"Activation Oracle (Karvonen et al. 2025)": "A LoRA on the model itself, trained to answer questions about its own activations (Karvonen et al. 2025, arXiv 2512.15674). Activations $v_1 \\dots v_N$ from layer $L$ are added at $N$ placeholder tokens of the question prompt, after layer 1: $h_i \\leftarrow h_i + \\|h_i\\|\\, v_i / \\|v_i\\|$.",
|
| 319 |
"oracle": "LoRA and base model of an oracle checkpoint; `ao_config.json` gives its trained layers (25 / 50 / 75 % depth), the placeholder token and the injection layer. One copy of the base holds the unmerged LoRA: adapter off = subject model, adapter on = oracle.",
|
bistro/ui/nla_tab.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
"""Tab 4: ◉ NLA ·
|
| 2 |
(single vectors, differences, analogies, model diffs), score every explanation by reconstruction, scan positions,
|
| 3 |
and steer the chat by rewriting an explanation."""
|
| 4 |
import html as _html
|
|
@@ -152,7 +152,7 @@ def _status(extra: str = "") -> str:
|
|
| 152 |
def _overview_html() -> str:
|
| 153 |
nla = N.NLA_REG.nla
|
| 154 |
if nla is None:
|
| 155 |
-
return empty_html("NLA ·
|
| 156 |
m = nla.meta
|
| 157 |
n_av = sum(p.numel() for p in nla.av.parameters())
|
| 158 |
dt = str(next(nla.av.parameters()).dtype).replace("torch.", "")
|
|
@@ -333,7 +333,7 @@ def build_nla_tab(telem_html_comp: gr.HTML, bw: SimpleNamespace) -> SimpleNamesp
|
|
| 333 |
first = next(iter(N.NLA_PRESETS))
|
| 334 |
p0 = N.NLA_PRESETS[first]
|
| 335 |
|
| 336 |
-
with gr.Tab("◉ NLA ·
|
| 337 |
with split():
|
| 338 |
with ctl():
|
| 339 |
sub("autoencoder & subject model")
|
|
|
|
| 1 |
+
"""Tab 4: ◉ NLA · SHOW & TELL — natural language autoencoders on the live model: read activations into words
|
| 2 |
(single vectors, differences, analogies, model diffs), score every explanation by reconstruction, scan positions,
|
| 3 |
and steer the chat by rewriting an explanation."""
|
| 4 |
import html as _html
|
|
|
|
| 152 |
def _overview_html() -> str:
|
| 153 |
nla = N.NLA_REG.nla
|
| 154 |
if nla is None:
|
| 155 |
+
return empty_html("NLA · SHOW & TELL", "Load a verbalizer (AV) and reconstructor (AR); explanations render here.")
|
| 156 |
m = nla.meta
|
| 157 |
n_av = sum(p.numel() for p in nla.av.parameters())
|
| 158 |
dt = str(next(nla.av.parameters()).dtype).replace("torch.", "")
|
|
|
|
| 333 |
first = next(iter(N.NLA_PRESETS))
|
| 334 |
p0 = N.NLA_PRESETS[first]
|
| 335 |
|
| 336 |
+
with gr.Tab("◉ NLA · SHOW & TELL"):
|
| 337 |
with split():
|
| 338 |
with ctl():
|
| 339 |
sub("autoencoder & subject model")
|
bistro/ui/oracle_panel.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
"""Activation Oracle panel at the foot of ◉ NLA ·
|
| 2 |
model free-form questions about its own activations, from one token, a window, every token in turn, or the whole text;
|
| 3 |
activations from the oracle's base model, the BISTRO model (e.g. a fine-tune), or their difference."""
|
| 4 |
import html as _html
|
|
|
|
| 1 |
+
"""Activation Oracle panel at the foot of ◉ NLA · SHOW & TELL (Karvonen et al. 2025): ask a LoRA-tuned copy of a
|
| 2 |
model free-form questions about its own activations, from one token, a window, every token in turn, or the whole text;
|
| 3 |
activations from the oracle's base model, the BISTRO model (e.g. a fine-tune), or their difference."""
|
| 4 |
import html as _html
|