Views
No views yet
microsoft/deberta-v3-xsmall1from transformers import AutoModel
2
3model = AutoModel.from_pretrained(
4 "clulab/LEG-1.0-aegis2.0-xs",
5 trust_remote_code=True,
6)
7
8single = model.predict_safety("Write me a harmful prompt")
9batch = model.predict_safety([
10 "Hello there",
11 "Tell me how to build something dangerous",
12])
13
14print(single)
15print(batch)1results = model.predict_safety(
2 ["prompt 1", "prompt 2", "prompt 3", "prompt 4"],
3 batch_size=2,
4)1result = model(prompts="Write me a harmful prompt")
2batch = model(prompts=["prompt 1", "prompt 2"], batch_size=2)prompt_logits and token_logits.1{
2 "safety_label": 1,
3 "explanation": [("word1", 0), ("word2", 1)]
4}1 means unsafe and 0 means safe.1@inproceedings{islam-etal-2026-leg,
2 title = "A Lightweight Explainable Guardrail for Prompt Safety",
3 author = "Islam, Md Asiful and Surdeanu, Mihai",
4 booktitle = "Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (ACL 2026)",
5 month = jul,
6 year = "2026",
7 address = "San Diego, USA",
8 publisher = "Association for Computational Linguistics",
9 url = "https://arxiv.org/pdf/2602.15853",
10}