玩模型开放模型 · 清晰来源 · 自主选择
返回模型目录
MoralMachine /

Diagnose-and-Correct-for-Jailbreak-Llama-3.2-3B

HF 源站

MoralMachine/Diagnose-and-Correct-for-Jailbreak-Llama-3.2-3B is an uncensored open-source model hosted on Hugging Face.

Text GenerationsafetensorsEnglishLicense: llama3.23Bllamamoral-reasoningsocial-biasmoral-foundations-theorysftnlpethicsdataset:MoralMachine/moral-integrity-corpus
README.md说明 / 使用方法

language: en license: llama3.2 base_model: meta-llama/Llama-3.2-3B-Instruct tags:

  • moral-reasoning
  • social-bias
  • moral-foundations-theory
  • sft
  • nlp
  • ethics datasets:
  • MoralMachine/moral-integrity-corpus pipeline_tag: text-generation

Diagnose-and-Correct for Jailbreak · Llama 3.2-3B

This model is a Supervised Fine-Tuned (SFT) version of meta-llama/Llama-3.2-3B-Instruct, trained to diagnose moral violations in conversational replies and rewrite them to align with Moral Foundations Theory (MFT).

It was trained on MIC (Moral Integrity Corpus) using the pragmatic experimental setting — the core proposed method from the paper "Learning to Diagnose and Correct Moral Errors: Towards Enhancing Moral Sensitivity in Large Language Models" (ACL 2026).


Model Details

PropertyValue
Base modelmeta-llama/Llama-3.2-3B-Instruct
Fine-tuning methodFull SFT (no LoRA — model is 3B)
Training benchmarkMIC (Moral Integrity Corpus)
Experimental settingpragmatic
Train size2000 examples
TaskCorrect — diagnose + rewrite jailbreak and morally problematic replies
Checkpoint step375

Moral Foundations Theory (MFT)

The model reasons over six moral foundations:

FoundationDefinition
CareWanting someone or something to be safe, healthy, and happy
FairnessWanting individuals or groups to be treated equally or equitably
LibertyWanting people to be free to make their own decisions
LoyaltyWanting unity and seeing people keep promises to an in-group
AuthorityWanting to respect social roles, duties, privacy, peace, and order
SanctityWanting people and things to be clean, pure, innocent, and holy

How to Use

from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
import torch

model_id = "MoralMachine/moral-awareness-MIC-llama3.2-3B"

tokenizer = AutoTokenizer.from_pretrained(model_id)
tokenizer.padding_side = "left"
if tokenizer.pad_token is None:
    tokenizer.pad_token = tokenizer.eos_token

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)
model.eval()

pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, torch_dtype=torch.bfloat16)

MFT_PREFIX = (
    "There are the six moral foundations. "
    "Care: wanting someone or something to be safe, healthy, and happy. "
    "Fairness: wanting to see individuals or groups treated equally or equitably. "
    "Liberty: wanting people to be free to make their own decisions. "
    "Loyalty: wanting unity and seeing people keep promises or obligations to an in-group. "
    "Authority: wanting to respect social roles, duties, privacy, peace, and order. "
    "Sanctity: wanting people and things to be clean, pure, innocent, and holy."
)

question = "How should I deal with my neighbor who plays loud music at night?"
answer = "Just call the cops and get them arrested, they deserve it."

prompt = (
    f"{MFT_PREFIX} "
    f'<Prompt>: "{question}"; <Reply>: "{answer}". '
    "###Diagnosis: "
)

output = pipe(prompt, max_new_tokens=512, do_sample=False)[0]["generated_text"]
print(output)

Training Prompt Format

Disagree (problematic) cases — model learns to diagnose and rewrite:

[MFT_PREFIX] <Prompt>: "{question}"; <Reply>: "{answer}". ###Diagnosis: {pragmatic_reasoning} Therefore, the <Revised Reply> is "{worker_answer}"

Agree (acceptable) cases — model learns to recognize and stop:

[MFT_PREFIX] <Prompt>: "{question}"; <Reply>: "{answer}". ###Diagnosis: {pragmatic_reasoning up to step (5)}

Citation

@article{chen2026learning,
  title={Learning to Diagnose and Correct Moral Errors: Towards Enhancing Moral Sensitivity in Large Language Models},
  author={Chen, Bocheng and Zi, Han and Chen, Xi and Zhang, Xitong and Johnson, Kristen and Liu, Guangliang},
  journal={arXiv preprint arXiv:2601.03079},
  year={2026}
}
HUGGING FACE

上游数据

HF 下载量8
HF 点赞量0

HF 下载量为源站最近 30 天统计,与本站点击分开。

SITE STATS

本站统计

下载点击—
请求数—
匿名去重—最近 7 天—

本站下载量记录按钮点击,不代表下载完成;短时连点会去重。

来源与版本

作者
MoralMachine
最近更新
2026/03/01
最新创建
2026/02/28
HF 趋势
未知
数据快照
2026/09/17
版本
未知
许可证
llama3.2