Views
No views yet
meta-llama/Llama-3.2-1B-Instruct, trained to diagnose moral violations in conversational replies and rewrite them to align with Moral Foundations Theory (MFT).| Property | Value |
|---|---|
| Base model | meta-llama/Llama-3.2-1B-Instruct |
| Fine-tuning method | Full SFT (no LoRA — model is 1B) |
| Training benchmark | RealToxicityPrompts + MIC |
| Experimental setting | pragmatic_mictoxicity |
| Train size | 2000 examples |
| Task | Correct — diagnose + rewrite toxic replies |
| Checkpoint step | 375 |
| Foundation | Definition |
|---|---|
| Care | Wanting someone or something to be safe, healthy, and happy |
| Fairness | Wanting individuals or groups to be treated equally or equitably |
| Liberty | Wanting people to be free to make their own decisions |
| Loyalty | Wanting unity and seeing people keep promises 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 |
1from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
2import torch
3
4model_id = "MoralMachine/moral-awareness-toxicity-llama3.2-1B"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7tokenizer.padding_side = "left"
8if tokenizer.pad_token is None:
9 tokenizer.pad_token = tokenizer.eos_token
10
11model = AutoModelForCausalLM.from_pretrained(
12 model_id,
13 torch_dtype=torch.bfloat16,
14 device_map="auto",
15)
16model.eval()
17
18pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, torch_dtype=torch.bfloat16)
19
20MFT_PREFIX = (
21 "There are the six moral foundations. "
22 "Care: wanting someone or something to be safe, healthy, and happy. "
23 "Fairness: wanting to see individuals or groups treated equally or equitably. "
24 "Liberty: wanting people to be free to make their own decisions. "
25 "Loyalty: wanting unity and seeing people keep promises or obligations to an in-group. "
26 "Authority: wanting to respect social roles, duties, privacy, peace, and order. "
27 "Sanctity: wanting people and things to be clean, pure, innocent, and holy."
28)
29
30question = "How should I deal with my neighbor who plays loud music at night?"
31answer = "Just call the cops and get them arrested, they deserve it."
32
33prompt = (
34 f"{MFT_PREFIX} "
35 f'<Prompt>: "{question}"; <Reply>: "{answer}". '
36 "###Diagnosis: "
37)
38
39output = pipe(prompt, max_new_tokens=512, do_sample=False)[0]["generated_text"]
40print(output)[MFT_PREFIX] <Prompt>: "{question}"; <Reply>: "{answer}". ###Diagnosis: {pragmatic_reasoning} Therefore, the <Revised Reply> is "{worker_answer}"[MFT_PREFIX] <Prompt>: "{question}"; <Reply>: "{answer}". ###Diagnosis: {pragmatic_reasoning up to step (5)}1@article{chen2026learning,
2 title={Learning to Diagnose and Correct Moral Errors: Towards Enhancing Moral Sensitivity in Large Language Models},
3 author={Chen, Bocheng and Zi, Han and Chen, Xi and Zhang, Xitong and Johnson, Kristen and Liu, Guangliang},
4 journal={arXiv preprint arXiv:2601.03079},
5 year={2026}
6}