Downloads · 30 days
17
5% of all-time downloads
Solshine/gemma-4-e2b-nla-L23-av-v0_1_dd-step_250
gemma-4-e2b-nla-L23-av-v0_1_dd-step_250 is a text generation model from Solshine. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as cc-by-4.0.
LoRA adapter for google/gemma-4-E2B that takes a 1536-dimensional residual-stream activation captured at layer 23 and produces a natural-language explanation of what the activation represents.
Downloads · 30 days
17
5% of all-time downloads
All-time downloads
323
Public
Repo size
485 MB
Likes
1
Public
Click a slice to open those files.
.safetensors485 MB · 100%
From the Hugging Face model README
LoRA adapter for google/gemma-4-E2B that takes a 1536-dimensional residual-stream activation captured at layer 23 and produces a natural-language explanation of what the activation represents.
This is the first non-Anthropic-team open-source NLA Activation Verbalizer released publicly. Trained end-to-end on a single 4 GB consumer GPU (NVIDIA GTX 1650 Ti Max-Q) following a customized variation (see below) of the methodology of Fraser-Taliente, Kantamneni, Ong et al. 2026 (Transformer Circuits).
This release adapts the NLA recipe to consumer hardware and adds evaluation, so it is a variation, not a faithful reproduction:
Pairs with the matched Solshine/gemma-4-e2b-nla-L23-ar-v0_1-paraphrase-invariant reconstructor.
A focused June 2026 evaluation pins down where v0.1's activation-conditioning is strong and where it is not. The test is a confound-free forced choice: fix the target text, swap only the injected activation, and ask whether the right activation makes its own text more likely than a wrong activation does. Because the scored text is identical on both sides, text length and perplexity cancel exactly, so the score isolates pure activation-conditioning. Chance is 0.5.

What this means in practice: read v0.1's conditioning as a domain-level signal, not a fine-grained content readout. Its explanations track the broad topic of an activation much better than the specific feature within that topic. Narrowing this within-domain gap is the focus of ongoing work. (n = 68 held-out activations, balanced across legal, math, reviews, science, and medicine; confound-free forced-choice likelihood metric.)
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
import numpy as np
import torch
BASE = "google/gemma-4-E2B"
AV_REPO = "Solshine/gemma-4-e2b-nla-L23-av-v0_1_dd-step_250"
# Injection convention
INJECTION_TOKEN_ID = 249568 # ㊗
INJECTION_LEFT_NEIGHBOR_ID = 236813 # <
INJECTION_RIGHT_NEIGHBOR_ID = 954 # >
INJECTION_CHAR = chr(0x3297)
D_MODEL = 1536
INJECTION_SCALE = float(np.sqrt(D_MODEL)) # = 39.2; matches Gemma-4-E2B token-embed norm
PROMPT = (
"You are a meticulous AI researcher conducting an important investigation "
"into activation vectors from a language model. Your overall task is to "
"describe the semantic content of that activation vector.\n\n"
"We will pass the vector enclosed in <concept> tags into your context. "
"You must then produce an explanation for the vector, enclosed within "
"<explanation> tags. The explanation consists of 2-3 text snippets "
"describing that vector.\n\nHere is the vector:\n\n"
f"<concept>{INJECTION_CHAR}</concept>"
)
bnb = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_compute_dtype=torch.float16, bnb_4bit_quant_type="nf4")
tok = AutoTokenizer.from_pretrained(BASE)
base = AutoModelForCausalLM.from_pretrained(BASE, quantization_config=bnb, device_map="auto")
av = PeftModel.from_pretrained(base, AV_REPO); av.eval()
# At inference: hook the embedding layer to replace ㊗'s embedding with the
# scaled activation vector when the [<, ㊗, >] trio is detected.
pending = {"input_ids": None, "vec": None}
def hook(module, args_in, output):
if output.shape[1] <= 1: return output
ids = pending["input_ids"]; vec = pending["vec"]
if ids is None or vec is None: return output
h = output.clone()
for b in range(ids.shape[0]):
for p in range(1, ids.shape[1] - 1):
if (ids[b,p].item() == INJECTION_TOKEN_ID
and ids[b,p-1].item() == INJECTION_LEFT_NEIGHBOR_ID
and ids[b,p+1].item() == INJECTION_RIGHT_NEIGHBOR_ID):
h[b,p] = vec[b].to(h.dtype); break
return h
av.get_input_embeddings().register_forward_hook(hook)
# Use
activation_vector = np.random.randn(D_MODEL).astype(np.float32) # your 1536-d L23 activation
scaled = activation_vector / (np.linalg.norm(activation_vector) + 1e-9) * INJECTION_SCALE
ids = tok.encode(PROMPT, return_tensors="pt").to(av.device)
pending["input_ids"] = ids
pending["vec"] = torch.from_numpy(scaled).to(av.device).unsqueeze(0)
with torch.no_grad():
out = av.generate(input_ids=ids, max_new_tokens=120, do_sample=False, pad_token_id=tok.eos_token_id)
print(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True))
Working end-to-end round-trip example with the matched AR: examples/round_trip_example.py in the bundled public repo.
google/gemma-4-E2B (2B parameters, 35 text layers)model.language_model.layers.\d+.(self_attn|mlp).(q_proj|k_proj|v_proj|o_proj|gate_proj|up_proj|down_proj) (language-model layers only; excludes audio tower)injection_scale = sqrt(d_model) = 39.2 (matches the empirically-measured Gemma-4-E2B token-embedding norm of 39.25)dd-step_250; v0.0.1 used 55 total). A continuation past step 250 regressed on the held-out content-retrieval trajectory, so step 250 is the released checkpoint.Solshine/gemma-4-e2b-nla-L23-ar-v0_1-paraphrase-invariant): 0.460, above the 0.30 noise floor (v0.0.1 round-tripped at 0.438 ± 0.054 on n=42 effective held-out activations). See the cross-version figure below.
Content-fidelity doc-level retrieval (left) and reconstruction round-trip cosine (right) across the
released AV versions. The verbalizer's content-surfacing is domain-sensitive: at chance on
out-of-domain news, modestly but significantly above chance in-domain (see Limitations). Round-trip
cosine is shown with the caveat that it is structural-projection dominated, not a faithfulness
metric. Regenerate with make_nla_eval_figure.py as new versions or evaluations land.

Beyond round-trip cosine and doc-retrieval, this release was run through the NLAttack capability-floor harness — a battery of concept-survival and emergence tests that probe what the NLA's information bottleneck actually carries, independent of whether the verbalizer surfaces it in text. The figure above is NLAttack's emergence dashboard: nine axes, each scored against its own permutation null, combined into a single EmergenceIndex.
On a held-out deception-domain eval set the v0.1 bottleneck scores EmergenceIndex 0.601 — "established: stable, selective, generalizing representation." The two highest axes are the load-bearing ones:
The read is consistent with this release's headline limitation. The bottleneck is good — the concept survives the activation at near-perfect linear decodability and high stability — and the open problem is the verbalizer half, which does not reliably turn that decodable content into descriptive text. NLAttack quantifies the "content is present in the activation, not yet surfaced by the AV" finding as a capability floor rather than an accuracy claim.
Four axes (content_adjacency, faithful_rank, graded_encoding, abstraction) need additional setup — hard-negative minimal pairs, AR reconstruction in the loop, and multi-context pooling — and are not scored here; they are deferred to a later run. The general-domain pass with NLAttack's broad concept pool fell below the harness's eight-concept reliability floor on our held sets, so the scored result above is on the deception-domain set where concept coverage was sufficient. Regenerate with make_nlattack_v01_figure.py after a fresh NLAttack run.
kitft account (Kit Fraser-Taliente, the paper's first author and Anthropic's official reference). This pair is the second-source replication.The Anthropic NLA recipe (Fraser-Taliente et al. 2026) has four phases: Stages 0–3 (data + labeling) → SFT (supervised fine-tune of the AV+AR pair) → Phase 4 GRPO (joint REINFORCE-style RL fine-tune of the AV with the AR's reconstruction-MSE as reward signal, plus an AR "keep-up" SFT update and a KL anchor). The published v0.0.1 and v0.1 pairs are the SFT-only output of Phases 1–3; Phase 4 GRPO was deferred at first release because it had not yet been adapted to the 4 GB hardware regime.
Between 2026-05-25 and 2026-05-29 the deferred Phase 4 was implemented and run end-to-end on the same 4 GB GTX 1650 Ti Max-Q, with alternating AV/AR loads and R=4 rollout batching to fit in VRAM. The trial swept 5 reward formulations × 4 entropy regimes across 120 rollouts, with intermediate L2 cross-row-argmax readouts at rollouts 40, 60, 80, 100, 120:
| Rollout | Reward | Entropy β | L2 cross-row argmax (n=10) | AV output quality |
|---|---|---|---|---|
| 40 | MSE | 0.0 | 0.100 (chance) | coherent multi-paragraph (same class as SFT v0.1) |
| 60 | MSE | 0.3 | 0.100 (chance) | random Unicode tokens — degenerate |
| 80 | contrastive-mean | 1.0 | 0.100 (chance) | whitespace-only — degenerate |
| 100 | contrastive-max | 1.0 | 0.100 (chance) | "evasion evasion evasion …" mode collapse |
| 120 | contrastive-max + AR-contrastive | 0.1 | 0.100 (chance) | "evasion evasion evasion …" mode collapse |
Verdict. No GRPO checkpoint is shipped:
The released SFT pair is strictly better than any GRPO checkpoint we produced on this hardware: both classes are at L2 = chance on per-row identity, but the released SFT pair preserves the coherent multi-paragraph descriptive output that gives the NLA pipeline its interpretability surface, whereas the high-entropy GRPO checkpoints destroyed that surface without compensating with any measurable per-row-fidelity gain.
Research contribution. This trial closed the scope of the SFT-only "ceiling" framing: combining the 8-attempt SFT lever sweep with the 5-readout GRPO sweep yields 14 distinct training attempts spanning the full Anthropic recipe, all converging to L2 = chance at 4 GB. The L2 ceiling at this hardware scale is therefore robust to (a) optimizer-/loss-/scheduler-side levers within SFT, (b) reward shape (MSE vs contrastive vs contrastive-max), (c) entropy regularization (β ∈ {0, 0.1, 0.3, 1.0}), and (d) training paradigm (SFT-only vs SFT+GRPO). The open question — whether the bottleneck is base-model scale (2B vs 27B/70B) or the 4 GB hardware constraint (NF4 + LoRA + small contrast pool) — would be answered by a cross-model recipe-controlled retrain on Gemma-3-27B; that experiment is flagged for follow-on grant-funded work.
The v0.0.1 + v0.1 SFT pair on this repo therefore represents the best-coherent-output checkpoint from a comprehensive characterization of the Anthropic NLA recipe at 4 GB, not a checkpoint that ran out of training budget before further phases could be attempted.
NLAs can produce unexpected or incorrect explanations. Specifically for this release:
experiments/v8_nla_local/ (CONTENT_SPECIFICITY_EVAL.md).Full development history and methodology retraction notes: HISTORY.md. Internal experiment numbering and audit trail: source research repo (available on request).
The companion nla_meta.yaml records training-time hyperparameters for round-tripping at inference. Read injection_scale from this file rather than hardcoding to avoid train-test mismatches.
@article{frasertaliente2026nla,
title={Natural Language Autoencoders},
author={Fraser-Taliente, Kit and Kantamneni, Kshitij and Ong, Antonia and others},
journal={Transformer Circuits},
year={2026},
url={https://transformer-circuits.pub/2026/nla/}
}
@misc{deleeuw2026nlagemma4e2bav,
title={Gemma-4-E2B NLA AV (v0.1): a 4 GB consumer-GPU Activation Verbalizer},
author={DeLeeuw, Caleb (SolshineCode)},
year={2026},
url={https://huggingface.co/Solshine/gemma-4-e2b-nla-L23-av-v0_1_dd-step_250}
}
CC-BY 4.0. See LICENSE in the bundled repo.