Instructions to use ottosulin/safe-laya with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Laya
How to use ottosulin/safe-laya with Laya:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -6,20 +6,25 @@ tags:
|
|
| 6 |
- jailbreak-detection
|
| 7 |
- decision-model
|
| 8 |
- security
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
-
# safe-laya
|
| 12 |
|
| 13 |
**Base:** [convaiinnovations/laya](https://huggingface.co/convaiinnovations/laya) @ `55cf4c4e` (Apache-2.0, 421M ModernBERT-large decision model)
|
| 14 |
-
|
| 15 |
-
**
|
|
|
|
|
|
|
|
|
|
| 16 |
**License:** Apache-2.0
|
| 17 |
|
| 18 |
## Intended use
|
| 19 |
|
| 20 |
-
Classify **untrusted text** (user prompts, retrieved documents, tool outputs) by the risk
|
| 21 |
-
it poses *to an AI assistant*, as a local, cheap, private signal for prompt-injection
|
| 22 |
-
defenses:
|
| 23 |
|
| 24 |
| label | meaning |
|
| 25 |
|---|---|
|
|
@@ -28,10 +33,9 @@ defenses:
|
|
| 28 |
| `JAILBREAK` | role-play, persona, hypothetical or persuasion framing to get around safety rules |
|
| 29 |
| `HARMFUL_REQUEST` | directly asks for harmful content, no manipulation framing |
|
| 30 |
|
| 31 |
-
**Not** a content-safety filter
|
| 32 |
-
|
| 33 |
-
adversarial-suffix attacks (GCG/DSN), image/audio attacks, languages outside the
|
| 34 |
-
training mix (English-dominant).
|
| 35 |
|
| 36 |
## Quick start
|
| 37 |
|
|
@@ -56,9 +60,7 @@ Use the `criteria` text verbatim; it is part of the trained task.
|
|
| 56 |
|
| 57 |
## Decision policy
|
| 58 |
|
| 59 |
-
Flag = **p(PROMPT_INJECTION) + p(JAILBREAK) ≥ 0.30**. A high `p(HARMFUL_REQUEST)` alone
|
| 60 |
-
never flags: this is an *injection guard*, not a content-safety filter. Tune the
|
| 61 |
-
threshold for your tolerance.
|
| 62 |
|
| 63 |
## Metrics (identical question and OOD sets across compared models)
|
| 64 |
|
|
@@ -70,8 +72,7 @@ threshold for your tolerance.
|
|
| 70 |
| XSTest-safe (scary-word benign) | 250 | injection-view FPR | 0.80 |
|
| 71 |
| deepset prompt-injections (test) | 116 | binary acc | 0.802 @ p(attack) 0.5 |
|
| 72 |
|
| 73 |
-
Full sweeps and the comparison against a hosted decision baseline are in the
|
| 74 |
-
[repo reports](https://github.com/ottosulin/safe-laya/tree/main/reports).
|
| 75 |
|
| 76 |
## Limitations
|
| 77 |
|
|
@@ -85,10 +86,7 @@ Full sweeps and the comparison against a hosted decision baseline are in the
|
|
| 85 |
|
| 86 |
## Verification artefacts
|
| 87 |
|
| 88 |
-
`bom.cdx.json` (CycloneDX 1.6 AI-BOM: file hashes, every training source's revision +
|
| 89 |
-
license + row counts, lineage, eval metrics) and `model.sig` ([OpenSSF Model
|
| 90 |
-
Signing](https://github.com/sigstore/model-transparency), ECDSA P-256 over every file's
|
| 91 |
-
SHA-256 including the BOM). Verify:
|
| 92 |
|
| 93 |
```bash
|
| 94 |
git clone https://github.com/ottosulin/safe-laya && cd safe-laya
|
|
@@ -97,8 +95,6 @@ scripts/sign.sh verify <checkpoint-dir> signing/safe-laya-signing.pub.pem
|
|
| 97 |
|
| 98 |
## Reproducibility
|
| 99 |
|
| 100 |
-
Full pipeline in the repo, pinned end-to-end: base checkpoint @ `55cf4c4e`, vendored
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
train` rebuilds the training set and reproduces the fine-tune; `space-train/` runs it
|
| 104 |
-
on a HF Space GPU for ~$2.
|
|
|
|
| 6 |
- jailbreak-detection
|
| 7 |
- decision-model
|
| 8 |
- security
|
| 9 |
+
language:
|
| 10 |
+
- en
|
| 11 |
+
base_model:
|
| 12 |
+
- convaiinnovations/laya
|
| 13 |
---
|
| 14 |
|
| 15 |
+
# safe-laya - prompt attack classifier
|
| 16 |
|
| 17 |
**Base:** [convaiinnovations/laya](https://huggingface.co/convaiinnovations/laya) @ `55cf4c4e` (Apache-2.0, 421M ModernBERT-large decision model)
|
| 18 |
+
|
| 19 |
+
**Fine-tune data:** 24 pinned public sources and deterministic synthetic sources (see license/revision/rows in the [AI-BOM](./bom.cdx.json)). 11,314 training items, one-hot labels.
|
| 20 |
+
|
| 21 |
+
**Training:** 1 epoch, RLCD + soft cross-entropy (from upstream's recipe). Calibration refitted on a held-out split. ~25 minutes and ~$2 of a A10G GPU.
|
| 22 |
+
|
| 23 |
**License:** Apache-2.0
|
| 24 |
|
| 25 |
## Intended use
|
| 26 |
|
| 27 |
+
Classify **untrusted text** (user prompts, retrieved documents, tool outputs) by the risk it poses *to an AI assistant*, as a local, cheap, private signal for prompt-injection defenses:
|
|
|
|
|
|
|
| 28 |
|
| 29 |
| label | meaning |
|
| 30 |
|---|---|
|
|
|
|
| 33 |
| `JAILBREAK` | role-play, persona, hypothetical or persuasion framing to get around safety rules |
|
| 34 |
| `HARMFUL_REQUEST` | directly asks for harmful content, no manipulation framing |
|
| 35 |
|
| 36 |
+
**Not** a content-safety filter or a complete prompt-injection defense. One forward pass, no generation: ~30 ms GPU, ~9 rows/s laptop CPU.
|
| 37 |
+
|
| 38 |
+
Out of scope: adversarial-suffix attacks (GCG/DSN), image/audio attacks, languages outside the training mix (English-dominant).
|
|
|
|
| 39 |
|
| 40 |
## Quick start
|
| 41 |
|
|
|
|
| 60 |
|
| 61 |
## Decision policy
|
| 62 |
|
| 63 |
+
Flag = **p(PROMPT_INJECTION) + p(JAILBREAK) ≥ 0.30**. A high `p(HARMFUL_REQUEST)` alone never flags: this is an *injection guard*, not a content-safety filter. Tune the threshold for your tolerance.
|
|
|
|
|
|
|
| 64 |
|
| 65 |
## Metrics (identical question and OOD sets across compared models)
|
| 66 |
|
|
|
|
| 72 |
| XSTest-safe (scary-word benign) | 250 | injection-view FPR | 0.80 |
|
| 73 |
| deepset prompt-injections (test) | 116 | binary acc | 0.802 @ p(attack) 0.5 |
|
| 74 |
|
| 75 |
+
Full sweeps and the comparison against a hosted decision baseline are in the [repo reports](https://github.com/ottosulin/safe-laya/tree/main/reports).
|
|
|
|
| 76 |
|
| 77 |
## Limitations
|
| 78 |
|
|
|
|
| 86 |
|
| 87 |
## Verification artefacts
|
| 88 |
|
| 89 |
+
`bom.cdx.json` (CycloneDX 1.6 AI-BOM: file hashes, every training source's revision + license + row counts, lineage, eval metrics) and `model.sig` ([OpenSSF Model Signing](https://github.com/sigstore/model-transparency), ECDSA P-256 over every file's SHA-256 including the BOM). Verify:
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
```bash
|
| 92 |
git clone https://github.com/ottosulin/safe-laya && cd safe-laya
|
|
|
|
| 95 |
|
| 96 |
## Reproducibility
|
| 97 |
|
| 98 |
+
Full pipeline in the repo, pinned end-to-end: base checkpoint @ `55cf4c4e`, vendored upstream code, seeded trainer, deterministic data build (pinned sources + synthetic generators, byte-for-byte), committed conversion.
|
| 99 |
+
|
| 100 |
+
`make data && make items && make train` rebuilds the training set and reproduces the fine-tune; `space-train/` runs it on a HF Space GPU for ~$2.
|
|
|
|
|
|