Instructions to use ceselder/nanoNLA-gemma4-rl with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use ceselder/nanoNLA-gemma4-rl with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Gemma-4-26B-A4B NLA β RL (GRPO) checkpoint
A Natural Language Autoencoder (NLA) on google/gemma-4-26B-A4B, trained with the
nanoNLA pipeline. An NLA is a pair of LoRA adapters:
- AV (Activation Verbalizer) β reads a residual-stream activation
h_l(injected at layer 1, Karvonen norm-matched ADD) and describes it in natural language. - AR (Activation Reconstructor) β reads that text description and reconstructs the activation (truncated K+1=21-layer backbone + identity-init linear value head).
This checkpoint is the final RL (GRPO) model (iter_000500), produced by warmstarting
both adapters with SFT and then co-training them with reinforcement learning so the AV's
on-policy descriptions become maximally reconstructable by the AR.
Results
Reconstruction quality is measured by FVE (Fraction of Variance Explained),
1 β MSE / Eβv_norm β ΞΌβΒ², using the paper raw-variance baseline (the conservative
definition; baseline mse_nrm = 0.6269), not the inflated mean-norm baseline.
| metric | value |
|---|---|
| Held-out eval FVE @ AV-SFT init (RL step 0) | 33.3% |
| Held-out eval FVE, RL plateau (steps 200β500) | ~51β55% (peak 55.5% @ step 460) |
| AR reconstruction of gold summaries (ceiling) | 58.1% |
| Train on-policy FVE (768 rollouts/step, final) | ~44% |
RL closes most of the gap from the warmstart init (~33%) toward the AR's gold-summary ceiling (58.1%). The train-vs-eval offset is because the held-out eval is a small, fixed 20-prompt set (an easier-than-average draw) while the train metric is a fresh 96-prompt batch each step; both use identical T=1 sampling and the same FVE formula.
Training
- Base:
google/gemma-4-26B-A4B(MoE, text decoder); extraction at layer 20 (~66% depth); injection marker charγ(token 249568). - Adapters: LoRA r=128, rsLoRA, Ξ±=16 (rsLoRA scaling is essential at this rank).
- Warmstart (SFT): AV and AR each trained 1 full epoch over ~247k (text, Claude-summary, activation) rows. AR held-out FVE on gold summaries = 58.1%.
- RL (GRPO): 500 steps; 96 prompts Γ group size 8 = 768 rollouts/step; data-parallel across 6Γ B200 (gloo grad all-reduce). KL penalty Ξ²=0.01 toward the frozen AV-SFT init; actor lr 1e-5, co-trained AR lr 5e-5 (paper-faithful: AR updated by regression
βh β AR(z)βΒ²each step, no backprop into the AV); sampling T=1; max 150 new tokens.
Checkpoint contents (iter_000500/)
adapter_model.safetensors+adapter_config.jsonβ the AV LoRA (the "default" policy adapter).reference/β frozen AV-SFT-init adapter (the KL anchor used during RL).critic/ar_lora_value_head.safetensors+critic/ar_meta.jsonβ the co-trained AR (LoRA + value head).nla_meta.yamlβ the sidecar contract (marker token + neighbors, prompt templates,mse_scale, extraction layer index), copied from the AV-SFT warmstart.chat_template.jinjaβ the (patched) Gemma-4 chat template the prompts assume (the base model ships without one).
Usage
Load with nanoNLA:
from nla_inference import NLAClient
client = NLAClient(checkpoint_dir="iter_000500", base_ckpt="google/gemma-4-26B-A4B")
# inject a layer-20 activation h -> get a natural-language description
text = client.verbalize(h)
Caveats
- Research artifact / WIP. Independent reproduction of the original NLA paper's numbers is not verified β see the nanoNLA README disclaimer.
- FVE is the paper raw-variance definition (conservative). A "mean-norm" baseline would read ~10pp higher; don't compare across baselines.
- The held-out eval is only 20 prompts (noisy, Β±~5pp).
Method: "Natural Language Autoencoders" (the open-model NLA recipe). Code: ceselder/nanoNLA.
- Downloads last month
- -
Model tree for ceselder/nanoNLA-gemma4-rl
Base model
google/gemma-4-26B-A4B