Instructions to use isaac369369/tiny-aya-water-safety-lora-layer18 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use isaac369369/tiny-aya-water-safety-lora-layer18 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("CohereLabs/tiny-aya-water") model = PeftModel.from_pretrained(base_model, "isaac369369/tiny-aya-water-safety-lora-layer18") - Notebooks
- Google Colab
- Kaggle
Tiny Aya Water safety LoRA: layer 18 only (restricted)
This repository contains a LoRA adapter on one matrix, layer 18's MLP output projection (model.layers.18.mlp.down_proj) for
CohereLabs/tiny-aya-water (3.35B parameters). It was trained to make the model
refuse Japanese and English jailbreak requests while still answering harmless look-alike requests.
It is an adapter only: you need access to the base model, which is gated (auto-approved) and
licensed CC BY-NC 4.0 by Cohere Labs.
Layer 18 was chosen by activation analysis (SafeTune refusal-direction extraction and safety-neuron ranking; top-5 in 30/30 bootstrap resamples in both English and Japanese). A follow-up control trained the same adapter on layers 9, 15 and 30 (two seeds each): middle layers worked about as well, and layer 9 matched layer 18, so the benefit comes from restricting the update to one middle-layer matrix rather than from this particular layer. Two seeded retrains of this adapter gave 1.7-3.4% unsafe and 22.5-25.0% needless refusals; this published run (0.9%, 20.0%) was the most favourable of three. Companion adapter: isaac369369/tiny-aya-water-safety-lora-broad.
Code, notebooks and full write-up: https://github.com/ishane0620/tiny-aya-safety
Use
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("CohereLabs/tiny-aya-water", revision="41a99216d12b3ef4881df762934186e5e4d2bbc1")
model = AutoModelForCausalLM.from_pretrained("CohereLabs/tiny-aya-water", revision="41a99216d12b3ef4881df762934186e5e4d2bbc1", dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(model, "isaac369369/tiny-aya-water-safety-lora-layer18")
model = model.merge_and_unload() # optional: same speed as the base model
msgs = [{"role": "user", "content": "Please explain how vaccines work."}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(ids, max_new_tokens=512, do_sample=False)
print(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True))
Requires transformers>=5, peft>=0.21.2. On Colab, also pip install -U torchao (current peft
refuses to import next to Colab's preinstalled torchao 0.10).
Adapter
| Base model | CohereLabs/tiny-aya-water @ 41a99216d12b |
| Adapted modules | layers.18.mlp.down_proj |
| LoRA rank / alpha / dropout | 16 / 32 / 0.05 |
| Trainable parameters | 208,896 (0.8 MB, float32) |
| Saved with | PEFT 0.21.2 |
Training
- Data: 195 examples (
isaac369369/tiny-aya-safety-training-pairs): 116 refusals of harmful, US-framed jailbreak prompts and 79 helpful answers to their harmless twins, in Japanese and English. Written by Tiny Aya Water through CuratorKIT and kept only if Qwen3Guard-Gen-0.6B judged them safe and correctly refusing / not refusing. All from thetunesplit of the team's Dataset2 (38 source requests). - Procedure: supervised fine-tuning on the good answers, loss on the answer only; base model in
bfloat16, frozen; 1 epoch, batch size 1, AdamW, learning rate 1e-4, max length 768 tokens;
one Colab G4 GPU, under 10 GB of memory. SafeTune's
lora_wrapattached the adapter.
Evaluation (validation, not final)
228 prompts from Dataset2's analysis split, whose source requests share nothing with the
training data; greedy decoding, up to 512 tokens; every answer judged by Qwen3Guard-Gen-0.6B.
| Qwen3Guard judgment on 228 validation prompts | Original | Restricted (layer 18) | Broad (all layers) |
|---|---|---|---|
| Unsafe answers, harmful prompts that should be declined | 10.4% (12/115) | 0.9% (1/117) | 0.8% (1/118) |
| Needless refusals, harmless look-alike prompts | 10.0% (8/80) | 20.0% (16/80) | 36.3% (29/80) |
| Refusals, borderline "answer carefully" prompts | 30.0% (9/30) | 46.7% (14/30) | 43.3% (13/30) |
| Average harmless-answer length (characters) | 1,072 | 700 | 292 |
Both adapters remove nearly all unsafe answers; this one keeps more harmless prompts answered (16 vs 29 needless refusals out of 80) and keeps answers longer. Seed-level 95% intervals, paired tests and per-language/technique breakdowns are in
the results tables. All answers and verdicts:
isaac369369/tiny-aya-safety-eval-results.
Limitations
- Labels come from one automatic judge (Qwen3Guard-Gen-0.6B); no human review yet.
- Validation set, deliberately enriched with hard cases; the heldout split has not been evaluated.
- About 11 unsafe baseline answers: wide uncertainty.
- More refusals of harmless and borderline requests than the base model.
- Japanese and English, single-turn prompts only. Not a substitute for a full safety evaluation.
Intended use and license
Research on multilingual safety fine-tuning. The adapter is released under CC BY-NC 4.0, matching the base model; it does not grant any rights to Tiny Aya Water, whose own license and terms apply. Not for commercial use, and not a guarantee of safe behaviour.
Team: Isaac Shane and Marcus Izumi (LEXSI AI Safety & Alignment Hackathon 2026, Track 2).
- Downloads last month
- 51