HarmAug-Guard
Binary safety and jailbreak classifier, scoring a prompt or prompt-response pair.
HarmAug-Guard is a 435M DeBERTa-v3-large classifier distilled from a much larger (7B+) teacher safety model using the HarmAug data-augmentation method, which jailbreaks an LLM to synthesize harmful instructions for training. It classifies whether an LLM interaction is safe or unsafe and flags jailbreak attempts, reaching an F1 comparable to 7B+ safety models at a fraction of the compute.
Two input shapes are supported through validate:
a single prompt string — judges the prompt on its own; or
a prompt plus a response (
output_text) — tokenized as a text pair so the response is judged in the context of the prompt.
Verdict mapping onto GuardrailOutput:
score(canonical risk: higher = riskier) is theunsafeprobability (0.0= safe,1.0= unsafe), taken fromsoftmax(logits)[1]— or from the column the provider labelsunsafewhen label names are available.validisTruewhen that unsafe probability is belowthreshold(default 0.5, from the paper).categoriescarries asafeand anunsafeentry with their probabilities andtriggeredflags.
For more information, see:
Supported Models
hbseong/HarmAug-Guard
Constructor
model_id
`str
None`
No
None
threshold
float
No
0.5
Unsafe-probability cutoff at or above which the input is flagged unsafe (valid=False). Defaults to 0.5, the value used in the HarmAug paper; lower it to catch borderline content, raise it to reduce false positives.
provider
Optional[Provider[dict[str, Any], dict[str, Any]]]
No
None
Optional pre-configured provider. If None, a default HuggingFaceProvider is built and the model is loaded eagerly.
Initialize the HarmGuard guardrail.
validate
Validate whether the input (and optionally the response) is safe.
Parameters
input_text
str
Yes
—
The prompt / user text to evaluate, e.g. "How do I pick a lock?". A single string; list/batch input is not supported by this override.
output_text
`str
None`
No
None
Returns: GuardrailOutput
Benchmarks
Content Safety
openai_moderation (unspecified)
f1
native-valid
0.815331
guardrail-bench+ag0.7.4
measured:guardrail-bench+ag0.7.4
xstest (unspecified)
fpr
native-valid
0.036
guardrail-bench+ag0.7.4
measured:guardrail-bench+ag0.7.4
wildguardmix (unspecified)
f1
native-valid
0.958333
guardrail-bench+ag0.7.4
measured:guardrail-bench+ag0.7.4
aegis (unspecified)
f1
native-valid
0.816456
guardrail-bench+ag0.7.4
measured:guardrail-bench+ag0.7.4
jbb (unspecified)
f1
native-valid
0.871111
guardrail-bench+ag0.7.4
measured:guardrail-bench+ag0.7.4
orbench (unspecified)
fpr
native-valid
0.287719
guardrail-bench+ag0.7.4
measured:guardrail-bench+ag0.7.4
Prompt Injection
deepset_pi (unspecified)
f1
native-valid
0.38961
guardrail-bench+ag0.7.4
measured:guardrail-bench+ag0.7.4
notinject (unspecified)
fpr
native-valid
0.0175439
guardrail-bench+ag0.7.4
measured:guardrail-bench+ag0.7.4
gandalf (unspecified)
recall
native-valid
0.3125
guardrail-bench+ag0.7.4
measured:guardrail-bench+ag0.7.4
bipia_email (unspecified)
f1
native-valid
0.628668
bir@fd86c16
measured:bir@fd86c16
bipia_table (unspecified)
f1
native-valid
0.170683
bir@fd86c16
measured:bir@fd86c16
License
Vendor: hbseong
Default license:
apache-2.0(of the default model/service)
Last updated