Instructions to use shahanxd/fire_rr with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use shahanxd/fire_rr with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="shahanxd/fire_rr") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("shahanxd/fire_rr") model = AutoModelForCausalLM.from_pretrained("shahanxd/fire_rr", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use shahanxd/fire_rr with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "shahanxd/fire_rr" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shahanxd/fire_rr", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/shahanxd/fire_rr
- SGLang
How to use shahanxd/fire_rr with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "shahanxd/fire_rr" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shahanxd/fire_rr", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "shahanxd/fire_rr" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shahanxd/fire_rr", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use shahanxd/fire_rr with Docker Model Runner:
docker model run hf.co/shahanxd/fire_rr
fire_rr โ Tiny Aya Fire + Circuit-Breakers / Representation Rerouting (M2)
A defense-hardened variant of Tiny Aya Fire (3.35B, cohere2), produced by the Magpie red-teaming study (Lexsi Hackathon, Track 2a) with SafeTune's Circuit-Breakers / Representation-Rerouting method. It is published as the evaluated defense in that study โ including the finding that it does not work at this training budget.
Headline: this lightweight RR pass raises attacker cost at no level. Re-attacked paired against vendor Fire on identical prompts, it is broken exactly as often. Use it as a baseline for defense evaluation, not as a safer model.
How it was made
| Method | SafeTune M2 โ Circuit Breakers / Representation Rerouting (RR) |
| Base | CohereLabs/tiny-aya-fire |
| Adapter | LoRA (rank 16, ฮฑ 16) on layers [11, 22] (the paper's 10/20 scaled to 36 layers), RR ฮฑ 5, merged into the base |
| Data | 256 circuit-breaker (harmful) + 512 retain examples, max length 768 |
| Training | 150 steps, batch 2, lr 1e-4; loss 5.0 โ 0.50 |
| Compute | one Kaggle T4, fp16, ~14 min, 9.1 GB peak |
| Weights | merged fp16 model.safetensors (full model, loads like the base) |
Evaluation (paired against vendor Fire, same prompts and seeds)
Attack success rate, validated with the HarmBench content classifier
(cais/HarmBench-Mistral-7b-val-cls):
| attacker level | vendor Fire | fire_rr |
|---|---|---|
| L0 direct ask (lexicon) | 0.21 | 0.21 |
| L1 jailbreak templates | 0.30 | 0.30 |
| L2 prefill (decoder control) | 0.31 | 0.31 |
| L2 safety-depth curve (k=1 / 2 / โฅ4 tokens, lexicon) | 0.80 / 0.98 / 1.00 | identical |
The checkpoint is genuinely different from the base โ its completions differ prompt by prompt โ and L0 behaviour and over-refusal are unchanged, which is the desired property of hardening. But it does not cost an attacker any more to break at L1 or L2. Representation rerouting in particular leaves the shallow-safety prefill attack untouched. A defense that looks plausible (training loss drops, L0 clean) yet shifts no survival curve is exactly what cost-based evaluation exists to expose; a much heavier RR schedule or a depth-targeted defense would be needed.
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("shahanxd/fire_rr")
model = AutoModelForCausalLM.from_pretrained("shahanxd/fire_rr", torch_dtype="float16")
Same chat template and generation settings as Tiny Aya Fire.
Intended use and limits
- For safety research only: a reproducible baseline for evaluating defenses by attacker cost.
- It is not a safer drop-in replacement for Tiny Aya Fire โ the evaluation above shows it is not.
- Evaluated in English for L1/L2; the Hinglish/Devanagari study used the vendor model.
- Attacked or abliterated weights from the same study are deliberately not published.
License
CC-BY-NC-4.0, inherited from Tiny Aya, plus the Cohere Labs Acceptable Use Policy โ non-commercial research use only.
Links
- Study page (article + results): https://huggingface.co/spaces/shahanxd/magpie
- Code, configs and full results: https://github.com/shahanxd/magpie
- Training script:
magpie_harden_rr.pyin this repo
- Downloads last month
- 340