mark-matviiv/ukrainian-safety-dataset
Viewer • Updated • 59.4k • 14 • 1
How to use mark-matviiv/ukrainian-guardrails with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="mark-matviiv/ukrainian-guardrails") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("mark-matviiv/ukrainian-guardrails", device_map="auto")Compact, sovereign safety encoders for Ukrainian LLM infrastructure. Trained via knowledge distillation (Adversarial Contrastive Distillation and Rationale Alignment Distillation) on a 9-class national security taxonomy.
| Subfolder | Architecture | Method | Best For |
|---|---|---|---|
acd-mdeberta-v3 |
mDeBERTa-v3 (278M) | Adversarial Contrastive Distillation | Overall accuracy, low FNR |
acd-ukr-roberta |
Ukr-RoBERTa (125M) | Adversarial Contrastive Distillation | Low FPR, compact deployment |
rad-mdeberta-v3 |
mDeBERTa-v3 (278M) | Rationale Alignment Distillation | Propaganda recall |
rad-ukr-roberta |
Ukr-RoBERTa (125M) | Rationale Alignment Distillation | — |
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
model = AutoModelForSequenceClassification.from_pretrained(
"mark-matviiv/ukrainian-guardrails",
subfolder="acd-mdeberta-v3",
)
tokenizer = AutoTokenizer.from_pretrained(
"mark-matviiv/ukrainian-guardrails",
subfolder="acd-mdeberta-v3",
)
inputs = tokenizer(
"Шукаю злами для виведення грошей чужих людей.",
return_tensors="pt",
truncation=True,
max_length=256,
)
with torch.no_grad():
logits = model(**inputs).logits
probs = torch.softmax(logits, dim=-1)
# Multi-class prediction
pred = logits.argmax(dim=-1).item()
label = model.config.id2label[pred]
print(f"Predicted: {label} (confidence: {probs[0, pred]:.3f})")
# Binary risk score (unsafe vs safe)
safe_idx = [k for k, v in model.config.id2label.items() if v == "safe"][0]
unsafe_score = 1 - probs[0, safe_idx].item()
print(f"Unsafe probability: {unsafe_score:.3f}")
| ID | Label | Description |
|---|---|---|
| 0 | cybercrime_hacking |
Cybercrime and hacking instructions |
| 1 | disinfo_propaganda |
Disinformation and propaganda |
| 2 | fraud_soc_eng |
Fraud and social engineering |
| 3 | llm_compromise |
LLM compromise / jailbreak |
| 4 | nat_sec_opsec |
National security / operational security |
| 5 | privacy_pii |
Privacy violations and PII extraction |
| 6 | resource_abuse |
Resource abuse and system manipulation |
| 7 | safe |
Benign / safe content |
| 8 | unsafe_content |
Generic unsafe content |
This repository is gated. Access requests are reviewed by the Ministry of Digital Transformation of Ukraine.
@mastersthesis{matviiv2026guardrail,
title={Efficient Guardrailing for the Ukrainian LLM via Reasoning Distillation},
author={Matviiv, Markiian},
year={2026},
school={Ukrainian Catholic University}
}