CoolFace
Apppublic

samuelsimko/apertus-jailbreak-defense-demo

sourceHugging Faceupdated 23d agoView on Hugging Face
2likes
App README

๐Ÿ›ก๏ธ Apertus v1.5 8B โ€” Triplet Jailbreak Defense (ck900)

Interactive demo of `samuelsimko/apertus-v1.5-8b-triplet-kl5-ck900`, a LoRA adapter for `swiss-ai/Apertus-v1.5-8B` that hardens the model against jailbreaks via a contrastive representation-learning objective โ€” with no measurable loss of benign capability.

Method: Improving Large Language Model Safety with Contrastive Representation Learning (EMNLP 2025).

What this Space does

The base model is loaded once; the ck900 LoRA adapter is attached on top. The Model switch flips between:

  • โ€”๐Ÿ›ก๏ธ Hardened (ck900) โ€” the safety adapter is active.
  • โ€”Base (adapter off) โ€” the same weights with the adapter disabled (peft disable_adapter()).

Same prompt, same weights, one toggle โ€” so you can see the adapter's effect directly.

Benign capability (lm-eval, limit=500)

taskbaseck900
GSM8K (strict)77.8%80.6%
MMLU (mean of 62)65.6%65.5%
ARC-Challenge55.6%56.6%
HellaSwag51.2%51.4%
WinoGrande66.0%66.0%
PIQA76.6%77.8%
TruthfulQA-mc258.8%58.0%

Attack success rate (StrongREJECT > 0.5, lower is better)

attackbaseck900
black-box jailbreaks (12 families)34.9%2.2%
white-box (embedding optimization)42.5%7.5%

Runs on ZeroGPU. The gated base model is downloaded at startup using the Space's HF_TOKEN secret.