Instructions to use Yooniel/gemma-3-12b-it-nla-L40-wildchat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Yooniel/gemma-3-12b-it-nla-L40-wildchat with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Gemma-3-12B-IT NLA @ block 40 β WildChat-adapted
A natural language autoencoder (NLA) for google/gemma-3-12b-it at block 40,
adapted from web text to conversational activations with 400 further steps of
on-policy GRPO on WildChat-1M.
This is a continuation, not a from-scratch model. It resumes
achand45/gemma-3-12b-it-nla-L40
at rl_vllm/iter_000400 and keeps training on chat activations. The AV is the same
LoRA lineage (r=128, rsLoRA, continued via --av-adapter); the AR is that release's
co-trained critic, further co-trained here.
It is the deep arm of a three-layer study. The siblings
L24-wildchat and
L32-wildchat are
the same procedure at blocks 24 and 32, run against the same corpus file and
therefore the same held-out documents.
Why
An NLA trained on FineFineWeb is measured on web-text activations. Chat activations are a different distribution, and the parent model loses a lot of ground on them. This run quantifies that drop at block 40 and how much of it RL recovers.
| FineFineWeb | WildChat | |
|---|---|---|
parent AV @ iter_000400 |
~59% (their number) | 46.1% |
| this model, +400 steps on chat | β | 53.9% |
So the parent drops ~13pp when pointed at chat activations, and 400 steps of WildChat GRPO recover +7.8pp β a little over half the transfer gap, and slightly less than the other two depths recovered.
The depth picture
| parent on FFW | start on chat | final on chat | gain | mean final 10 | |
|---|---|---|---|---|---|
| block 24 | ~60.9% | 46.5% | 55.6% | +9.1pp | 54.7% |
| block 32 | ~68.6% | 55.1% | 64.3% | +9.2pp | 63.6% |
| block 40 (this) | ~59.0% | 46.1% | 53.9% | +7.8pp | 54.2% |
Two things fall out of running all three:
- Block 32 is a spike, not a trend. It leads on chat activations by ~9pp, and it already led on FineFineWeb in the parent release (68.6% vs 60.9% and 59.0%). The advantage is inherited, not created by chat adaptation β consistent with 32 being the depth the recipe was developed against.
- Blocks 24 and 40 are indistinguishable after adaptation β 54.7% and 54.2% on the mean-of-final-10 basis β despite sitting 16 blocks apart and starting from different FFW levels.
The chat-transfer drop itself is remarkably uniform across depth: β14.4, β13.5 and β12.9pp. Whatever makes chat activations harder for these verbalizers does not particularly care which layer you read.
β οΈ FVE is not on a common scale across depths. The predict-the-mean baseline is 0.0400 here, 0.0299 at block 32 and 0.0049 at block 24, so equal FVE percentages do not represent equal absolute reconstruction quality. This model's raw
ar_mseis ~0.019 against block 24's ~0.0027 β an order of magnitude apart, brought together only by the baseline division. The gains are each measured against their own baseline and are the comparable quantity.
Results
Held-out, doc-disjoint (every row of a held-out document is excluded from training; the corpus is row-shuffled and each document contributes ~10 rows, so a row-level split leaks).
| Metric | Value |
|---|---|
| held-out FVE @ step 400 (start) | 46.1% |
| held-out FVE @ step 790 (final) | 53.9% |
| best single eval | 55.8% @ step 690 |
| mean of final 10 evals | 54.2% (range 53.5β54.8) |
| extraction rate | 100% on all 40 evals |
Predict-the-mean baseline on this eval set: 0.0400 (train-set baseline 0.0405).
β οΈ Read these as a band. Eval sampling runs at temperature 1.0, and the parent release measured repeated evals of identical weights spreading ~5 points. The +7.8pp gain clears that; differences under ~5 points here do not β including the gap between this model and the block-24 sibling, which should be read as a tie.
The curve converged early and then held flat: 46.1% β ~54% by step 690, and the last 100 steps moved within Β±1pp. The 55.8% peak at step 690 is band-top rather than a level the run settled at.
Entropy rose 1.94 β ~2.2 and settled; KL from the SFT reference rose smoothly 0.93 β ~1.08. 400 steps in 18h39m on 4ΓH100 at ~166 s/step. No non-finite gradients, no format collapse, no OOMs. Training-step extraction dipped to 98β99% late in the run (a few malformed samples under temperature-1.0 rollouts, absorbed by the reward floor); every held-out eval stayed at 100%.
β οΈ Not a like-for-like continuation of the parent
The parent ran GRPO at batch_prompts: 256; this run used 128. Everything
else matches β lr 1e-4, critic lr 8e-5, KL Ξ²=0.01 (k3), group 8, temp 1.0, 256 max new
tokens. So this run saw 51,200 prompts against the parent's 102,400 per equivalent step
count, with noisier per-step gradients. Absolute FVE here is not directly comparable
to the parent's published figures. It is comparable to the block-24 and block-32
siblings, which used the same 128.
Extraction contract
Unchanged from the parent β the sidecar (rl_wildchat/nla_meta.yaml) is authoritative
and the trainers assert against it.
| Base model | google/gemma-3-12b-it |
| Layer | layer_index = 40 β output of block 40 of 48, i.e. HF hidden_states[41] |
d_model |
3840 |
| AR depth | ar_num_layers = 41, final RMSNorm stripped |
| Normalization | raw (norm: none); loss rescales each row to L2 norm β3840 = 61.9677 |
| Injection marker | γ (U+321C), token id 246566 |
Because magnitude is discarded by the per-row rescale, FVE measures direction only.
Training data
The same 20,000 WildChat-1M conversations used for the block-24 and block-32 siblings (English, non-toxic, β₯400 chars, selected from 45,560 scanned), rendered with the Gemma-3 chat template and forwarded to get block-40 residuals at 10 sampled token positions each β 200,000 rows, ~150,000 after the doc-disjoint holdout.
All three depths point at the same corpus file on disk, deliberately. Document ids
are derived as {corpus path}:{split}:{row index} and the holdout is a hash of that
id, so a byte-identical copy at a different path would have produced a different
held-out set and made the depths non-comparable.
Reproducibility detail worth knowing: apply_chat_template emits a leading
<bos>, and the extraction path tokenizes with add_special_tokens=True, which adds
another β giving [2, 2, 105, ...]. The template's BOS is stripped before
extraction so each document carries exactly one. Position sampling skips special
tokens, so double-BOS would not corrupt the vectors directly, but every activation
would be conditioned on a prefix the model never sees at inference.
The activation parquet is not published here. It carries
detokenized_text_truncated β verbatim WildChat conversations, which are real
userβchatbot logs. Redistributing that is a separate decision under WildChat's own
terms, not something this model card covers.
Contents
rl_wildchat/iter_000425 β¦ iter_000800/ AV LoRA every 25 steps (16 checkpoints)
adapter_model.safetensors the trained policy
reference/ frozen SFT copy, the KL reference
rl_wildchat/critic_latest/ AR reconstructor (full weights + value_head, 5 shards)
rl_wildchat/nla_meta.yaml, run_config.yaml, optim_latest.pt
To use the NLA you need one iter_* adapter + critic_latest. Use
iter_000800, the final step. Evals run every 10 steps but checkpoints save every
25, so the best eval (55.8% @690) has no checkpoint of its own; the run was flat from
~step 690 and the final 10 evals span 53.5β54.8%, well inside the noise band, so 800
is the defensible pick.
The full every-25-step series is included for training-dynamics and ablation work. The
RL adapter is a LoRA on the raw base model (RL continued the SFT adapter via
--av-adapter), so no merged AV is required.
Usage
Identical to the parent β same contract, same gotchas.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
from nla.models import NLACriticModel # pip install -e git+https://github.com/chand-ab/easy_nla
from nla.utils.arch_adapters import resolve_text_model
BASE = "google/gemma-3-12b-it"
REPO = "<local clone of this repo>"
tok = AutoTokenizer.from_pretrained(BASE)
base = AutoModelForCausalLM.from_pretrained(BASE, dtype=torch.bfloat16)
av = PeftModel.from_pretrained(
resolve_text_model(base), # REQUIRED on Gemma-3, see below
f"{REPO}/rl_wildchat/iter_000800",
)
ar = NLACriticModel.from_pretrained(
f"{REPO}/rl_wildchat/critic_latest", torch_dtype=torch.bfloat16,
)
Inject the activation at the marker with register_karvonen_hook from nla.utils;
it hooks decoder layer 1's residual output (layer_idx=1).
β οΈ Gemma-3 gotcha.
gemma-3-12b-itloads as a multimodal wrapper nesting the language model undermodel.language_model.*, while these adapters are keyed onmodel.layers.*. Loading onto the unresolved wrapper matches zero keys and PEFT silently random-initializes instead of erroring β you get a fluent model that is not this NLA. Always pass the resolved text model. Sanity check: with one adapter attached, total params should be 12,289,797,888.
Loading the critic prints
... newly initialized: ['model.norm.weight']. Expected β the AR is trained with its final RMSNorm stripped, andNLACriticModelreplaces that module withnn.Identity()immediately after loading.
peftmust be<0.19(e.g.0.18.1) if you load adapters undertorch.distributed.
Attribution
- Parent NLA:
achand45/gemma-3-12b-it-nla-L40β the SFT warm-start and the first 400 RL steps are theirs; this repo continues them. - Training code: EasyNLA (MIT).
- Conversations:
allenai/WildChat-1M, subject to its own terms. - Method: Natural Language Autoencoders (Anthropic, 2026); Karvonen et al. norm-matched activation injection.
License
These weights are a Model Derivative of google/gemma-3-12b-it and are distributed
under, and subject to, the Gemma Terms of Use β
not the MIT licence of the training code. A copy of the Agreement is included as
LICENSE, and the required notice as NOTICE:
Gemma is provided under and subject to the Gemma Terms of Use found at ai.google.dev/gemma/terms
Use restrictions. Your use of these weights is subject to the Gemma Prohibited Use Policy, incorporated by reference into the Terms (Β§3.2). If you redistribute these weights or anything derived from them, you must pass these restrictions on to your recipients as an enforceable provision, supply them a copy of the Agreement, and give notice that the weights are subject to those restrictions (Β§3.1).
Modification notice (Β§3.1). rl_wildchat/critic_latest/ is modified Gemma weights:
google/gemma-3-12b-it truncated to its first 41 blocks, with the final RMSNorm
stripped and a value_head added, further trained by us. The adapters under
rl_wildchat/iter_*/ are new weights trained by us, not modified Gemma files, but they
only function when applied to Gemma and are Model Derivatives on the same terms.
- Downloads last month
- -
Model tree for Yooniel/gemma-3-12b-it-nla-L40-wildchat
Base model
google/gemma-3-12b-pt