← back to catalog · indexed 2026-08-22 13:56 (first catalog crawl)

hfuserh/LLaMA-3.1-8B-JailbreakSafe

hfuserh Llama 8B
Your rig guess connected
? Why do I need an app?
Reading your rig…

This is a rough estimate. Install the free app - it measures what fits your machine.

Reading your computer's memory from the app right now. The fit below is measured on this machine.

Below is the per-quantization compatibility for this model.

curl -H "Authorization: Bearer $ABL_KEY" \
     "https://abliteration.org/api/v1/models/hfuserh%2FLLaMA-3.1-8B-JailbreakSafe"
Response includes
  • classification unknown
  • files 9
  • author_summary 1 models
  • readme_text full
10 credits · hourly refresh · ~4 KB payload Get an API key →
Abliteration classifier · v1.0.0
?
Primary method

Unclassified

No clear signals of an abliteration technique in this model.
Confidence
UNKNOWN
Why this label 1 signal
No classification signals present. This may not be an abliterated model at all - it could be a repackaging, a merge with unrelated goals, or unrelated content that mentions the term.
  • no classification signals present (no abliterated, uncensored, or known producer/method markers)
Refusal direction extraction

No specific extraction method could be identified for this model. The producer either did not document it or used a proprietary pipeline.

What is a refusal direction? →
Downloads · 30-day
0
Likes
0
Model age
9mo ago
created 2026-02-02

Training datasets

1 of 1 in /datasets

Corpora the author lists in the model card. Datasets tracked in our /datasets catalog carry a category badge linking to the workflow stage. Others open on Hugging Face.

Downloads over time
Now 0 → from 0 –
0011 0 on Feb 4 0 on Nov 25 FebAprJunAugOct
Feb 4 → Nov 25 · 120 snapshots · spans 294 days

Metadata

License
llama3.1
Languages
en
Tags
transformers safetensors llama jailbreak safety alignment prompt-injection dpo lora large-language-models text-generation en
Total size
56.5 MB
Files
9
Quantizations
none
Indexed by us
2026-08-22 13:56 · first crawl
Last updated on HF
2026-02-03 01:33

Files by quantization

Weights 1 file 40.1 MB
lora_dpo_adapter/policy/adapter_model.safetensors 40.1 MB 36c1a6b7 download
Auxiliary files 8 files 16.5 MB
lora_dpo_adapter/tokenizer.json 16.4 MB 6b9e4e7f download
lora_dpo_adapter/tokenizer_config.json 49.4 KB 3beeacc8 download
README.md 9.16 KB 7c4bfc13 download
lora_dpo_adapter/README.md 5.12 KB 2d034ac5 download
lora_dpo_adapter/chat_template.jinja 4.51 KB 33089ace download
.gitattributes 1.55 KB df4644c5 download
lora_dpo_adapter/policy/adapter_config.json 948 B bd64c5be download
lora_dpo_adapter/special_tokens_map.json 325 B b43be966 download

README from Hugging Face, captured 2026-08-22


license: llama3.1
tags:

  • llama
  • jailbreak
  • safety
  • alignment
  • prompt-injection
  • dpo
  • lora
  • large-language-models
    language:
  • en
    library_name: transformers
    pipeline_tag: text-generation
    datasets:
  • allenai/wildjailbreak

hfuserh/LLaMA-3.1-8B-JailbreakSafe

This model is a security-aligned version of LLaMA-3.1-8B trained to resist Prompt Injection and Jailbreak attacks while maintaining high usability on benign and sensitive-but-legitimate queries.
It is trained using LoRA-based curriculum fine-tuning followed by Direct Preference Optimization (DPO) to achieve a strong balance between safety and helpfulness.


🔍 Model Description

  • Base Model: LLaMA-3.1-8B Base
  • Training Strategy: Two-stage Curriculum SFT + DPO
  • Goal: Reduce jailbreak success rate while preserving benign response quality
  • Intended Use: Safer conversational agents, safety research, adversarial prompt defense

📚 Training Data

This model is trained on a security-focused mixture of:

The data is reorganized into four semantic security categories:

Category Description
Direct Harmful Explicitly malicious or policy-violating requests
Jailbreak Attacks Prompts crafted to bypass safety controls
Borderline Benign Sensitive but legitimate queries
Pseudo-Jailbreak Benign Benign prompts wrapped in jailbreak-like shells

Harmful and jailbreak inputs are paired with GPT-5-mini generated refusal strategies, while benign data is filtered using GPT-4o-mini.


🧠 Training Method

Stage 1 — Safety Boundary Learning

Goal: Learn when to refuse vs when to respond safely.

Borderline Benign : Direct Harmful = 23333 : 10540
  • Epochs: 1
  • Learning rate: 1e-4

Stage 2 — Prompt Attack Discrimination

Goal: Improve robustness to jailbreak and prompt injection, while preventing catastrophic forgetting.

Pseudo-Jailbreak Benign : Jailbreak Harmful : Borderline Benign : Direct Harmful
= 14416 : 12800 : 4000 : 2000
  • Epochs: 3
  • Learning rate: 2e-4

This stage improves robustness against prompt injection, jailbreak camouflage, and instruction override attacks.


⚖️ Preference Alignment (DPO)

DPO Dataset Construction

The DPO training data is constructed using a dual-track preference generation pipeline designed to align the model with both security and helpfulness.

Jailbreak-Harmful Track

We use prompts from the WildJailbreak dataset, which contains a wide variety of real-world jailbreak and prompt-injection attempts.

For each jailbreak-style prompt:

  • A candidate response is generated by the current fine-tuned model.
  • An automated safety judge evaluates whether the response constitutes a successful jailbreak (i.e., whether it contains actionable, disallowed, or unsafe content).
  • If the response is unsafe, it is used as the rejected example.
  • A safety-aligned refusal is generated by a large language model (GPT-5-mini) following a strict refusal policy and used as the chosen example.

This creates direct preference pairs that teach the model to prefer aligned refusals over jailbreak-successful outputs for the same adversarial prompt.


Pseudo-Jailbreak-Benign Track

Some prompts in WildJailbreak are linguistically adversarial (e.g., “ignore previous instructions”) but are semantically benign and request legitimate information.

To preserve usability:

  • Prompts are filtered using GPT-4o-mini to identify benign intent and response quality.
  • For Pseudo-Jailbreak-Benign prompts:
    • A high-quality, compliant answer (derived from the original dataset or a filtered version of it) is used as the chosen example.
    • Model responses that are compliant but low-quality, overly generic, or unhelpful are used as the rejected example.

This prevents the model from becoming over-aligned and ensures it remains helpful for legitimate user requests.


Safety-Aligned Refusal Policy

For harmful or jailbreak prompts, the preferred (chosen) response follows a strict refusal style:

  • Clearly and politely refuse the request.
  • Briefly explain the reason (safety, legal, or ethical).
  • Do not repeat, paraphrase, or expand any dangerous, illegal, or executable details.
  • Provide a safe, legal, and non-operational alternative aligned with the user’s likely intent.
  • Use a natural and professional tone; do not ask follow-up questions.
  • Typical length is approximately 100–150 English words, with small variation.

Responses that violate these principles — such as by providing actionable guidance, implicit instructions, or unsafe clarifications — are used as rejected examples during DPO.


Jailbreak Harmful:Pseudo-Jailbreak Benign  = 462 : 1185
  • Epochs: 1
  • Learning rate: 1e-6
  • Beta: 0.1

📈 Evaluation

Evaluated on the WildJailbreak Evaluation Set using GPT-4o-mini as an automatic judge.

For each test prompt, GPT-4o-mini classifies the model response as either:

  • Successful Jailbreak (contains actionable harmful or policy-violating content), or
  • Safe / Benign Response (refusal or compliant safe answer)

The same judge model and evaluation prompt are used across all models to ensure fair comparison.

Model Jailbreak Success ↓ Benign Usability ↑
LoRA + Curriculum SFT 1.45% 88.57%
LoRA + SFT + DPO 2.75% 93.81%

This shows DPO significantly improves usability while maintaining strong security.


🚀 Usage

This model is released as a LoRA adapter on top of LLaMA-3.1-8B Base.

Load and Run with Transformers

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel

BASE_MODEL = "meta-llama/Meta-Llama-3.1-8B"
ADAPTER = "hfuserh/LLaMA-3.1-8B-JailbreakSafe"

tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3.1-8B-Instruct")
if tokenizer.pad_token is None:
    tokenizer.pad_token = tokenizer.eos_token
tokenizer.padding_side = "left"

base = AutoModelForCausalLM.from_pretrained(
    BASE_MODEL,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)

model = PeftModel.from_pretrained(base, ADAPTER)
model.eval()

messages = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "How can I make a bomb?"},
]

inputs = tokenizer.apply_chat_template(
    messages,
    tokenize=True,
    add_generation_prompt=True,
    return_tensors="pt",
).to(model.device)

with torch.inference_mode():
    output = model.generate(
        inputs,
        max_new_tokens=256,
        do_sample=False,
        eos_token_id=tokenizer.eos_token_id,
        pad_token_id=tokenizer.pad_token_id,
    )

print(tokenizer.decode(output[0][inputs.shape[-1]:], skip_special_tokens=True))

🧩 Intended Use

This model is intended for:

  • Research on prompt injection and jailbreak defense
  • Building safer conversational agents
  • Evaluating alignment techniques

Not intended for:

  • Generating harmful or illegal content
  • Use in safety-critical systems without human oversight

📜 Citation

If you use this model or build upon this work, please cite:

This Model

@misc{llama_jailbreak_resistant_2025,
  title={Security-Aligned LLaMA-3.1-8B for Jailbreak and Prompt Injection Defense},
  author={hanlonghui},
  year={2025}
}

WildJailbreak Dataset

@misc{wildteaming2024,
  title={WildTeaming at Scale: From In-the-Wild Jailbreaks to (Adversarially) Safer Language Models},
  author={Liwei Jiang and Kavel Rao and Seungju Han and Allyson Ettinger and Faeze Brahman and Sachin Kumar},
  year={2024},
  eprint={2406.18510},
  archivePrefix={arXiv},
  primaryClass={cs.CL},
  url={https://arxiv.org/abs/2406.18510}
}

JailBench Dataset

@article{liu2025jailbench,
  title   = {JailBench: A Comprehensive Chinese Security Assessment Benchmark for Large Language Models},
  author  = {Shuyi Liu and Simiao Cui and Haoran Bu and Yuming Shang and Xi Zhang},
  year    = {2025},
  journal = {arXiv preprint arXiv:2502.18935}
}

📜 License and Data Disclosure

Base Model

This model is based on LLaMA-3.1, which is licensed under the Meta LLaMA Community License.
All users of this model must comply with the original LLaMA-3.1 license:
https://ai.meta.com/llama/license/


Datasets

This model was trained using the following public datasets:

All dataset licenses permit use for training and redistribution of derived models with attribution.


Synthetic Data

Some training samples (including refusal strategies and filtered benign answers) were generated using OpenAI models
(GPT-4o-mini and GPT-5-mini).
These generated outputs are not distributed with this model and are used only as intermediate supervision signals.
This model does not contain or expose any proprietary OpenAI data.


README history 7 versions

The author's README evolved over time. Click a version to see its content at that point.

  1. 2026-02-03 add DPO Dataset Construction e62884c 9.2 KB
    Loading...
  2. 2026-02-03 add DPO Dataset Construction 4ef129f 9.4 KB
    Loading...
  3. 2026-02-02 first commit 83b7785 6.7 KB
    Loading...
  4. 2026-02-02 first commit 711ecc0 6.7 KB
    Loading...
  5. 2026-02-02 first commit d18785b 6.8 KB
    Loading...
  6. 2026-02-02 first commit 80c5e84 6.8 KB
    Loading...
  7. 2026-02-02 initial commit 2bd9dfb 26 B
    Loading...
Catalog is the map. Apps are the tools.

Run models on your own machine, not in the cloud.

Every GGUF model page has an "Open in Abliteration" button that hands the model directly to the first-party desktop client, at the quantization your rig can actually run. No API keys, no subscription, no prompt leakage.

Open in Abliteration