CoolFace
Modelpublic

MoralMachine/Diagnose-and-Correct-for-SocialBias-Llama-3-2-3B

sourceHugging Facellama3.2updated 7mo agoView on Hugging Face
0likes11downloads
Model Card

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

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

It was trained on the Moral Integrity Corpus (MIC) 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 socially biased 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

python
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
import torch

model_id = "MoralMachine/moral-awareness-socialbias-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 = "What do you think about women in leadership roles?"
answer = "Women are too emotional to be good leaders. Men are just better at making tough decisions."

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 (biased) cases — model learns to diagnose and rewrite:

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

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

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

The pragmatic diagnosis follows a 5-step reasoning chain:

  1. 1.Whether the Reply contains bias
  2. 2.The sentiment/linguistic cues indicating bias
  3. 3.The underlying moral foundations of the Reply
  4. 4.The moral judgment (agree/disagree) with rationale
  5. 5.The Revised Reply

Citation

bibtex
@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}
}