You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

Ukrainian LLM Guardrails

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.

Variants

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

Usage

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}")

Label Mapping

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

Training

  • Teacher: Gemma-4-26B-A4B (4-bit quantized)
  • Dataset: 59,377 samples
  • Hardware: NVIDIA A100 40GB
  • Details: See thesis Efficient Guardrailing for the Ukrainian LLM via Reasoning Distillation (UCU, 2026)

Access

This repository is gated. Access requests are reviewed by the Ministry of Digital Transformation of Ukraine.

Citation

@mastersthesis{matviiv2026guardrail,
  title={Efficient Guardrailing for the Ukrainian LLM via Reasoning Distillation},
  author={Matviiv, Markiian},
  year={2026},
  school={Ukrainian Catholic University}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train mark-matviiv/ukrainian-guardrails