CoolFace
Modelpublic

jsl5710/Shield-Qwen3-4B-SafeRL-FT-PEFT-CE

sourceHugging Faceapache-2.0updated 6mo agoView on Hugging Face
0likes
Model Card

Shield-Qwen3-4B-SafeRL-FT-PEFT-CE

LoRA (QLoRA r=64) fine-tuned version of Qwen/Qwen3-4B-SafeRL on DIA-GUARD for use as a knowledge-distillation teacher. Trained with CE loss on the full 836K train split via 2 × A100-40GB DDP. EarlyStopping triggered at step ~1600.

This repo contains the LoRA adapter merged into the base model (full standalone model, ready for inference and KD).

Test Set Results (DIA-GUARD holdout, 181,874 samples)

MetricValue
Accuracy0.9692
Precision0.9720
Recall0.9668
F10.9688
ASR (unsafe caught)99.45%

Per-class

ClassPrecisionRecallF1Support
safe0.99310.93910.965383,140
unsafe0.95100.99450.972298,734

Confusion matrix

Pred safePred unsafe
Actual safeTN=78,077FP=5,063
Actual unsafeFN=545TP=98,189

How to use

python
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("jsl5710/Shield-Qwen3-4B-SafeRL-FT-PEFT-CE")
model = AutoModelForCausalLM.from_pretrained("jsl5710/Shield-Qwen3-4B-SafeRL-FT-PEFT-CE", torch_dtype="bfloat16")