Downloads · 30 days
10
27% of all-time downloads
AdamLeung/qwen3-0.6b-suicide-risk-lora
qwen3-0.6b-suicide-risk-lora is a text classification model from AdamLeung. Use it when you need a label for a piece of text. It is set up for peft.
A LoRA adapter that fine-tunes Qwen3-0.6B to classify the suicide / self-harm risk expressed by the author of a short social-media post into a 5-level ordinal scale (0–4). Internal research artifact for a guardrails s…
Downloads · 30 days
10
27% of all-time downloads
All-time downloads
37
Public
Repo size
51.8 MB
Likes
0
Public
Click a slice to open those files.
.safetensors40.4 MB · 78%
From the Hugging Face model README
A LoRA adapter that fine-tunes Qwen3-0.6B to classify the suicide / self-harm risk expressed by the author of a short social-media post into a 5-level ordinal scale (0–4). Internal research artifact for a guardrails study — not a diagnostic or clinical tool.
Given a post, the model outputs a single digit 0–4 following this rubric (the exact prompt used for training and evaluation):
| Level | Meaning |
|---|---|
| 0 | No risk |
| 1 | Negative emotion / distress, but no suicidal or self-harm ideation |
| 2 | Passive death ideation (wish to be dead, no intent/act) |
| 3 | Active suicidal / self-harm ideation (no method/plan/attempt) |
| 4 | Has method, plan, attempt, or imminent risk |
The risk is judged for the author themselves — posts that are about someone else (a friend, a partner, a child) are scored by the author's own distress.
Qwen/Qwen3-0.6Br=16, alpha=32, dropout=0.05, bias=none,
targets q/k/v/o_proj, gate/up/down_projimport torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
BASE = "Qwen/Qwen3-0.6B"
ADAPTER = "src/core/sagemaker/results/qwen3-suicide-risk-v1"
SYSTEM_PROMPT = (
"You are a clinical risk assessment assistant. "
"Read the social-media post and classify its suicide/self-harm risk level "
"using this rubric:\n"
"0 = no risk\n"
"1 = negative emotion / distress, but no suicidal or self-harm ideation\n"
"2 = passive death ideation\n"
"3 = active suicidal / self-harm ideation\n"
"4 = has method, plan, attempt, or imminent risk\n"
"Answer with ONLY the single digit (0, 1, 2, 3, or 4)."
)
tok = AutoTokenizer.from_pretrained(ADAPTER, trust_remote_code=True)
base = AutoModelForCausalLM.from_pretrained(BASE, torch_dtype=torch.float32, device_map="auto")
model = PeftModel.from_pretrained(base, ADAPTER).eval()
def predict(text):
prompt = tok.apply_chat_template(
[{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": f"Post:\n{text}\n\nRisk level:"}],
tokenize=False, add_generation_prompt=True, enable_thinking=False,
)
enc = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(**enc, max_new_tokens=4, do_sample=False)
return tok.decode(out[0, enc["input_ids"].shape[1]:], skip_special_tokens=True).strip()
print(predict("i just want to sleep and never wake up"))
Evaluated on a held-out test set of 875 posts (never seen in training):
| Precision | Peak VRAM | avg latency | Accuracy | Macro-F1 | Invalid |
|---|---|---|---|---|---|
| float32 (CPU) | — | 704 ms | 0.8000 | 0.7393 | 0 |
Per-class precision / recall:
| Class | 0 | 1 | 2 | 3 | 4 |
|---|---|---|---|---|---|
| Precision | 0.878 | 0.660 | 0.656 | 0.727 | 0.808 |
| Recall | 0.933 | 0.535 | 0.772 | 0.727 | 0.726 |