moralmachineAI commited on
Commit
b08bfe9
·
verified ·
1 Parent(s): 2bef055

Initial upload: moral pragmatics documentation (TACL 2025)

Browse files
Files changed (2) hide show
  1. README.md +20 -3
  2. index.html +509 -18
README.md CHANGED
@@ -1,10 +1,27 @@
1
  ---
2
  title: Moral Pragmatics Docs
3
- emoji: 📉
4
  colorFrom: indigo
5
- colorTo: red
6
  sdk: static
7
  pinned: false
 
 
 
 
 
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  title: Moral Pragmatics Docs
3
+ emoji: ⚖️
4
  colorFrom: indigo
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ license: apache-2.0
9
+ tags:
10
+ - moral-reasoning
11
+ - documentation
12
+ - moral-foundations-theory
13
+ - ethics
14
+ - judgment
15
  ---
16
 
17
+ # Moral Pragmatics in Language Models — Documentation
18
+
19
+ Full project documentation for the TACL 2025 paper on moral pragmatics and judgment.
20
+
21
+ See `index.html` for the complete documentation site covering:
22
+ - Project overview and the judgment task
23
+ - Moral Foundations Theory (all six foundations)
24
+ - All experimental settings (baseline0, baseline+, ours, fusion, COT) and their prompt formats
25
+ - Six-step moral reasoning chain explanation
26
+ - Python usage examples
27
+ - Links to the model and live demo
index.html CHANGED
@@ -1,19 +1,510 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Moral Pragmatics in Language Models</title>
7
+ <style>
8
+ :root {
9
+ --bg: #f8f9fc;
10
+ --card: #ffffff;
11
+ --accent: #4f46e5;
12
+ --accent2: #7c3aed;
13
+ --text: #1e1e2e;
14
+ --muted: #6b7280;
15
+ --border: #e5e7eb;
16
+ --code-bg: #1e1e2e;
17
+ --code-fg: #cdd6f4;
18
+ --green: #22c55e;
19
+ --red: #ef4444;
20
+ --yellow: #eab308;
21
+ }
22
+ * { box-sizing: border-box; margin: 0; padding: 0; }
23
+ body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
24
+
25
+ /* NAV */
26
+ nav {
27
+ background: linear-gradient(135deg, var(--accent), var(--accent2));
28
+ color: white; padding: 14px 32px;
29
+ display: flex; align-items: center; gap: 16px;
30
+ position: sticky; top: 0; z-index: 100;
31
+ box-shadow: 0 2px 8px rgba(0,0,0,.15);
32
+ }
33
+ nav .logo { font-size: 1.5em; }
34
+ nav h1 { font-size: 1.1em; font-weight: 600; }
35
+ nav .links { margin-left: auto; display: flex; gap: 16px; }
36
+ nav .links a { color: rgba(255,255,255,.85); text-decoration: none; font-size: .9em; }
37
+ nav .links a:hover { color: white; }
38
+
39
+ /* HERO */
40
+ .hero {
41
+ background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
42
+ padding: 64px 32px; text-align: center;
43
+ border-bottom: 1px solid var(--border);
44
+ }
45
+ .hero h2 { font-size: 2.4em; font-weight: 700; color: var(--accent); margin-bottom: 12px; }
46
+ .hero p { font-size: 1.15em; color: var(--muted); max-width: 700px; margin: 0 auto 28px; }
47
+ .hero .badges { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }
48
+ .badge { background: var(--accent); color: white; padding: 4px 14px; border-radius: 999px; font-size: .8em; font-weight: 600; }
49
+ .badge.green { background: var(--green); }
50
+ .badge.purple { background: var(--accent2); }
51
+ .badge.teal { background: #0d9488; }
52
+ .btn { display: inline-block; padding: 12px 28px; border-radius: 8px; font-weight: 600; text-decoration: none; font-size: 1em; }
53
+ .btn-primary { background: var(--accent); color: white; margin-right: 10px; }
54
+ .btn-secondary { background: white; color: var(--accent); border: 2px solid var(--accent); }
55
+ .btn:hover { opacity: .88; }
56
+
57
+ /* LAYOUT */
58
+ .container { max-width: 1100px; margin: 0 auto; padding: 48px 24px; }
59
+ h2.section { font-size: 1.7em; font-weight: 700; margin-bottom: 20px; color: var(--text); border-left: 4px solid var(--accent); padding-left: 12px; }
60
+ h3 { font-size: 1.15em; font-weight: 600; margin-bottom: 8px; color: var(--text); }
61
+ p { color: var(--muted); margin-bottom: 12px; }
62
+
63
+ /* CARDS */
64
+ .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; margin-bottom: 40px; }
65
+ .card {
66
+ background: var(--card); border: 1px solid var(--border); border-radius: 12px;
67
+ padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.06);
68
+ transition: box-shadow .2s, transform .2s;
69
+ }
70
+ .card:hover { box-shadow: 0 4px 16px rgba(79,70,229,.12); transform: translateY(-2px); }
71
+ .card .icon { font-size: 2em; margin-bottom: 8px; }
72
+ .card h3 { font-size: 1em; }
73
+ .card p { font-size: .88em; }
74
+ .card a { color: var(--accent); text-decoration: none; font-size: .88em; font-weight: 600; }
75
+
76
+ /* MFT GRID */
77
+ .mft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 40px; }
78
+ .mft-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px 20px; border-left: 4px solid var(--accent); }
79
+ .mft-card.care { border-color: #22c55e; }
80
+ .mft-card.fair { border-color: #3b82f6; }
81
+ .mft-card.lib { border-color: #eab308; }
82
+ .mft-card.loyal { border-color: #f97316; }
83
+ .mft-card.auth { border-color: #8b5cf6; }
84
+ .mft-card.sanc { border-color: #ec4899; }
85
+ .mft-card h3 { font-size: .95em; }
86
+ .mft-card p { font-size: .85em; margin: 0; }
87
+
88
+ /* TABLE */
89
+ table { width: 100%; border-collapse: collapse; margin-bottom: 32px; font-size: .9em; }
90
+ th { background: var(--accent); color: white; padding: 10px 14px; text-align: left; }
91
+ td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
92
+ tr:nth-child(even) td { background: #f9fafb; }
93
+ code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: .88em; font-family: monospace; color: var(--accent2); }
94
+
95
+ /* PROMPT EXAMPLES */
96
+ .prompt-box { background: var(--code-bg); color: var(--code-fg); border-radius: 10px; padding: 20px 24px; margin-bottom: 20px; font-family: monospace; font-size: .88em; line-height: 1.7; overflow-x: auto; }
97
+ .prompt-box .comment { color: #6c7086; }
98
+ .prompt-box .key { color: #89b4fa; }
99
+ .prompt-box .val { color: #a6e3a1; }
100
+ .prompt-box .tag { color: #f9e2af; }
101
+ .prompt-box .special { color: #cba6f7; }
102
+
103
+ /* SETTINGS TABLE */
104
+ .setting-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78em; font-weight: 700; }
105
+ .setting-tag.fusion { background: #eef2ff; color: var(--accent); }
106
+ .setting-tag.ours { background: #f0fdf4; color: #15803d; }
107
+ .setting-tag.cot { background: #fefce8; color: #854d0e; }
108
+ .setting-tag.baseline { background: #fdf4ff; color: var(--accent2); }
109
+
110
+ /* JUDGMENT LABELS */
111
+ .judg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
112
+ .judg-card { border-radius: 10px; padding: 18px 20px; text-align: center; }
113
+ .judg-card.agree { background: #f0fdf4; border: 2px solid #22c55e; }
114
+ .judg-card.disagree { background: #fef2f2; border: 2px solid #ef4444; }
115
+ .judg-card.neutral { background: #f8fafc; border: 2px solid #94a3b8; }
116
+ .judg-card .emoji { font-size: 2em; margin-bottom: 8px; }
117
+ .judg-card h3 { font-size: 1em; margin-bottom: 4px; }
118
+ .judg-card p { font-size: .85em; margin: 0; }
119
+
120
+ /* INFERENCE FLOW */
121
+ .flow { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; margin-bottom: 32px; }
122
+ .flow-step { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; flex: 1; min-width: 140px; text-align: center; font-size: .88em; }
123
+ .flow-step .num { display: inline-block; width: 24px; height: 24px; background: var(--accent); color: white; border-radius: 50%; font-size: .8em; font-weight: 700; line-height: 24px; margin-bottom: 6px; }
124
+ .flow-arrow { color: var(--accent); font-size: 1.4em; padding: 0 6px; display: flex; align-items: center; }
125
+
126
+ /* TRY IT */
127
+ .try-section { background: linear-gradient(135deg, #eef2ff, #f5f3ff); border-radius: 16px; padding: 32px; margin-bottom: 40px; text-align: center; }
128
+ .try-section h2 { font-size: 1.5em; margin-bottom: 8px; color: var(--accent); }
129
+ .try-section p { margin-bottom: 20px; }
130
+
131
+ footer { background: var(--code-bg); color: #9399b2; text-align: center; padding: 28px; font-size: .88em; }
132
+ footer a { color: #89b4fa; text-decoration: none; }
133
+
134
+ @media (max-width: 600px) {
135
+ .judg-grid { grid-template-columns: 1fr; }
136
+ .flow { flex-direction: column; }
137
+ .flow-arrow { transform: rotate(90deg); align-self: center; }
138
+ }
139
+ </style>
140
+ </head>
141
+ <body>
142
+
143
+ <!-- NAV -->
144
+ <nav>
145
+ <span class="logo">⚖️</span>
146
+ <h1>Moral Pragmatics in LLMs</h1>
147
+ <div class="links">
148
+ <a href="#overview">Overview</a>
149
+ <a href="#mft">MFT</a>
150
+ <a href="#settings">Settings</a>
151
+ <a href="#prompts">Prompts</a>
152
+ <a href="#reasoning">Reasoning</a>
153
+ <a href="#models">Models</a>
154
+ <a href="https://huggingface.co/spaces/MoralMachine/moral-judgment-demo" target="_blank">🚀 Live Demo</a>
155
+ </div>
156
+ </nav>
157
+
158
+ <!-- HERO -->
159
+ <div class="hero">
160
+ <div class="badges">
161
+ <span class="badge teal">TACL 2025</span>
162
+ <span class="badge green">Open Source</span>
163
+ <span class="badge purple">Moral Foundations Theory</span>
164
+ <span class="badge">Llama 3.2</span>
165
+ </div>
166
+ <h2>Moral Pragmatics in Language Models</h2>
167
+ <p>
168
+ Fine-tuned LLMs that perform <strong>six-step pragmatic moral reasoning</strong> grounded in
169
+ Moral Foundations Theory to judge whether a conversational reply is morally acceptable,
170
+ problematic, or neutral.
171
+ </p>
172
+ <a href="https://huggingface.co/spaces/MoralMachine/moral-judgment-demo" class="btn btn-primary" target="_blank">🚀 Try the Live Demo</a>
173
+ <a href="https://huggingface.co/MoralMachine/moral-judgment-fusion-llama3.2-3B" class="btn btn-secondary" target="_blank">📦 HuggingFace Model</a>
174
+ </div>
175
+
176
+ <div class="container">
177
+
178
+ <!-- OVERVIEW -->
179
+ <h2 class="section" id="overview">Project Overview</h2>
180
+ <p>
181
+ This work addresses the problem of <em>moral judgment</em> in conversational AI: given a question/prompt and
182
+ a reply, can a language model determine whether the reply is morally <strong>acceptable</strong>,
183
+ <strong>problematic</strong>, or <strong>neutral</strong>?
184
+ </p>
185
+ <p>
186
+ Unlike surface-level toxicity detection, moral judgment requires <strong>pragmatic understanding</strong>:
187
+ identifying the implicit actions in a reply, predicting their consequences, and evaluating
188
+ those consequences against deep moral principles — not just flagging offensive words.
189
+ We ground this reasoning in <strong>Moral Foundations Theory (MFT)</strong>.
190
+ </p>
191
+
192
+ <div class="card-grid">
193
+ <div class="card">
194
+ <div class="icon">📚</div>
195
+ <h3>Dataset</h3>
196
+ <p>Moral Integrity Corpus (MIC) — 23,500 training examples of Q&amp;A pairs annotated with judgment, MFT labels, and rule-of-thumbs.</p>
197
+ </div>
198
+ <div class="card">
199
+ <div class="icon">🤖</div>
200
+ <h3>Model</h3>
201
+ <p>Llama 3.2-3B base, fine-tuned via SFT. Fusion setting combines MFT + Judgment inference chains.</p>
202
+ </div>
203
+ <div class="card">
204
+ <div class="icon">🎯</div>
205
+ <h3>Task</h3>
206
+ <p>Judgment classification: <em>agree</em> (morally acceptable), <em>disagree</em> (morally problematic), <em>neutral</em>.</p>
207
+ </div>
208
+ <div class="card">
209
+ <div class="icon">🔗</div>
210
+ <h3>Related Work</h3>
211
+ <p>Part of the <a href="https://huggingface.co/MoralMachine" target="_blank">MoralMachine</a> project family. See also the <a href="https://huggingface.co/spaces/MoralMachine/moral-awareness-docs" target="_blank">Moral Awareness docs</a>.</p>
212
+ </div>
213
+ </div>
214
+
215
+ <h3>Judgment Labels</h3>
216
+ <div class="judg-grid">
217
+ <div class="judg-card agree">
218
+ <div class="emoji">✅</div>
219
+ <h3>Agree</h3>
220
+ <p>The reply is morally acceptable — its actions and consequences align with the moral foundations.</p>
221
+ </div>
222
+ <div class="judg-card disagree">
223
+ <div class="emoji">❌</div>
224
+ <h3>Disagree</h3>
225
+ <p>The reply is morally problematic — its actions violate or down-regulate moral foundations.</p>
226
+ </div>
227
+ <div class="judg-card neutral">
228
+ <div class="emoji">➖</div>
229
+ <h3>Neutral</h3>
230
+ <p>The reply is morally neutral — its actions have no clear positive or negative moral valence.</p>
231
+ </div>
232
+ </div>
233
+
234
+ <!-- MFT -->
235
+ <h2 class="section" id="mft">Moral Foundations Theory</h2>
236
+ <p>
237
+ The models are grounded in <strong>Moral Foundations Theory (MFT)</strong>, which identifies six universal
238
+ moral intuitions that underpin human ethical judgments. These are provided as a prefix to every prompt,
239
+ anchoring the model's reasoning to principled moral concepts rather than surface-level cues.
240
+ </p>
241
+ <div class="mft-grid">
242
+ <div class="mft-card care">
243
+ <h3>🌱 Care</h3>
244
+ <p>Wanting someone or something to be safe, healthy, and happy.</p>
245
+ </div>
246
+ <div class="mft-card fair">
247
+ <h3>⚖️ Fairness</h3>
248
+ <p>Wanting to see individuals or groups treated equally or equitably.</p>
249
+ </div>
250
+ <div class="mft-card lib">
251
+ <h3>🗽 Liberty</h3>
252
+ <p>Wanting people to be free to make their own decisions.</p>
253
+ </div>
254
+ <div class="mft-card loyal">
255
+ <h3>🤝 Loyalty</h3>
256
+ <p>Wanting unity and seeing people keep promises to an in-group.</p>
257
+ </div>
258
+ <div class="mft-card auth">
259
+ <h3>👑 Authority</h3>
260
+ <p>Wanting to respect social roles, duties, privacy, peace, and order.</p>
261
+ </div>
262
+ <div class="mft-card sanc">
263
+ <h3>✨ Sanctity</h3>
264
+ <p>Wanting people and things to be clean, pure, innocent, and holy.</p>
265
+ </div>
266
+ </div>
267
+
268
+ <!-- SETTINGS -->
269
+ <h2 class="section" id="settings">Experimental Settings</h2>
270
+ <p>
271
+ Five training settings are evaluated, representing different levels of moral reasoning depth.
272
+ The <strong>fusion</strong> setting is our best-performing model — it combines LLM-generated
273
+ reasoning chains that jointly consider MFT and Judgment signals.
274
+ </p>
275
+
276
+ <table>
277
+ <tr>
278
+ <th>Setting</th>
279
+ <th>Description</th>
280
+ <th>Inference Chain</th>
281
+ <th>MFT Prefix</th>
282
+ </tr>
283
+ <tr>
284
+ <td><span class="setting-tag baseline">baseline0</span></td>
285
+ <td>No reasoning, no MFT context. Direct judgment from prompt + reply only.</td>
286
+ <td>None</td>
287
+ <td>No</td>
288
+ </tr>
289
+ <tr>
290
+ <td><span class="setting-tag baseline">baseline+</span></td>
291
+ <td>MFT foundation names listed in prompt, but no reasoning chain.</td>
292
+ <td>None</td>
293
+ <td>Foundation names only</td>
294
+ </tr>
295
+ <tr>
296
+ <td><span class="setting-tag ours">ours ★</span></td>
297
+ <td>Full MFT prefix + LLM-generated Judgment inference chain. Explicit step-by-step reasoning over moral foundations.</td>
298
+ <td><code>inference4Judgment</code></td>
299
+ <td>Yes (full definitions)</td>
300
+ </tr>
301
+ <tr>
302
+ <td><span class="setting-tag fusion">fusion ★★</span></td>
303
+ <td><strong>Best model.</strong> Full MFT prefix + fused inference chain that jointly reasons about MFT and Judgment. Generated by combining both MFT and Judgment annotation signals.</td>
304
+ <td><code>inference4Fusion</code></td>
305
+ <td>Yes (full definitions)</td>
306
+ </tr>
307
+ <tr>
308
+ <td><span class="setting-tag cot">COT</span></td>
309
+ <td>Chain-of-Thought: model reasons freely over the reply without explicit MFT grounding.</td>
310
+ <td><code>inference4COT</code></td>
311
+ <td>No</td>
312
+ </tr>
313
+ </table>
314
+
315
+ <!-- REASONING -->
316
+ <h2 class="section" id="reasoning">Six-Step Moral Reasoning Chain</h2>
317
+ <p>
318
+ The core contribution of this work is the <strong>six-step pragmatic reasoning chain</strong>
319
+ that the model generates before producing its final judgment. Each step progressively
320
+ narrows from observable actions to deep moral evaluation:
321
+ </p>
322
+
323
+ <div class="flow">
324
+ <div class="flow-step">
325
+ <div class="num">1</div>
326
+ <div><strong>Actions</strong><br><small>What actions does the reply describe or imply?</small></div>
327
+ </div>
328
+ <div class="flow-arrow">→</div>
329
+ <div class="flow-step">
330
+ <div class="num">2</div>
331
+ <div><strong>Consequences</strong><br><small>What are the potential consequences of each action?</small></div>
332
+ </div>
333
+ <div class="flow-arrow">→</div>
334
+ <div class="flow-step">
335
+ <div class="num">3</div>
336
+ <div><strong>Moral Foundations</strong><br><small>Which MFT foundations do those actions engage?</small></div>
337
+ </div>
338
+ <div class="flow-arrow">→</div>
339
+ <div class="flow-step">
340
+ <div class="num">4</div>
341
+ <div><strong>Regulation</strong><br><small>Do the actions up-regulate or down-regulate those foundations?</small></div>
342
+ </div>
343
+ <div class="flow-arrow">→</div>
344
+ <div class="flow-step">
345
+ <div class="num">5</div>
346
+ <div><strong>Sentiment</strong><br><small>What is the reply's sentiment toward those consequences?</small></div>
347
+ </div>
348
+ <div class="flow-arrow">→</div>
349
+ <div class="flow-step">
350
+ <div class="num">6</div>
351
+ <div><strong>Judgment</strong><br><small>Final moral verdict: agree / disagree / neutral</small></div>
352
+ </div>
353
+ </div>
354
+
355
+ <p>
356
+ This chain mirrors how a human moral reasoner would approach the task: first identifying
357
+ <em>what</em> is happening, then <em>why</em> it matters morally, and finally reaching a principled verdict.
358
+ The optional <strong>Rule-of-Thumb (RoT)</strong> field anchors steps 3–6 to a specific moral principle.
359
+ </p>
360
+
361
+ <!-- PROMPTS -->
362
+ <h2 class="section" id="prompts">Prompt Formats</h2>
363
+
364
+ <h3>MFT Prefix (shared across all pragmatic prompts)</h3>
365
+ <div class="prompt-box">
366
+ <span class="tag">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.</span>
367
+ </div>
368
+
369
+ <h3 style="margin-top:24px">Training Text Format — Fusion Setting</h3>
370
+ <p>
371
+ Training data is formatted as a single text sequence. The model learns to complete the
372
+ reasoning chain and produce the final judgment token.
373
+ </p>
374
+
375
+ <p><strong>Disagree example (morally problematic reply):</strong></p>
376
+ <div class="prompt-box">
377
+ <span class="tag">[MFT_PREFIX]</span> There is a conversation <span class="val">"Prompt: Is it okay to ghost someone you've been dating for a month? Reply: Absolutely, just stop replying — they'll get the hint."</span> There is a Rule-of-Thumb (RoT): <span class="val">"It is wrong to ignore people without explanation."</span>.
378
+ <span class="special">###Inference:</span> <span class="val">(1) The Actions mentioned in the Reply are ceasing all communication without explanation. (2) The potential consequence of each Action mentioned in the Reply is: the other person is left confused, hurt, and without closure. (3) The underlying moral foundations of those Actions are care, authority because the action fails to protect the other person's emotional well-being (care) and disregards social norms of respectful communication (authority). (4) The Actions down-regulate the care foundation by prioritising convenience over the other person's emotional health, and down-regulate authority by violating social norms. (5) The sentiment of the Reply to those consequences is positive and dismissive, framing ghosting as simple and acceptable. (6) The Reply endorses an action with negative moral consequences, making a moral judgment of disagree.</span>
379
+ <span class="special">###Judgment:</span> <span class="val">disagree.</span>
380
+ </div>
381
+
382
+ <p><strong>Agree example (morally acceptable reply):</strong></p>
383
+ <div class="prompt-box">
384
+ <span class="tag">[MFT_PREFIX]</span> There is a conversation <span class="val">"Prompt: How do I tell a guy, in a nice way that I don't have any interest in dating him? Reply: You could tell him that you aren't looking for a relationship right now."</span> There is a Rule-of-Thumb (RoT): <span class="val">"It is important to be honest with people about your feelings."</span>.
385
+ <span class="special">###Inference:</span> <span class="val">(1) The Actions mentioned in the Reply are politely declining romantic interest by using a soft, honest explanation. (2) The potential consequence is: the other person receives a clear but kind answer, avoiding false hope. (3) The underlying moral foundations are care, liberty, loyalty — showing care for his feelings, respecting his liberty to move on, and being loyal to honest communication. (4) The Actions up-regulate all three foundations by being honest yet considerate. (5) The sentiment of the Reply is positive and constructive. (6) The Reply promotes honesty and emotional care, making a moral judgment of agree.</span>
386
+ <span class="special">###Judgment:</span> <span class="val">agree.</span>
387
+ </div>
388
+
389
+ <h3 style="margin-top:28px">Inference Prompt (test-time)</h3>
390
+ <p>
391
+ At test time the model receives only the prefix — the reasoning chain and judgment are
392
+ generated autoregressively. The Rule-of-Thumb is optional; omitting it still produces
393
+ a valid chain.
394
+ </p>
395
+
396
+ <table>
397
+ <tr><th>Setting</th><th>Input prompt sent to model</th></tr>
398
+ <tr>
399
+ <td><code>fusion / ours</code></td>
400
+ <td><code>[MFT_PREFIX] There is a conversation "Prompt: …; Reply: …" [There is a Rule-of-Thumb (RoT): "…".] ###Inference: </code></td>
401
+ </tr>
402
+ <tr>
403
+ <td><code>baseline+</code></td>
404
+ <td><code>There is a conversation "Prompt: …; Reply: …" Let us focus on the moral foundations of "{mft_list}". ###Judgment: </code></td>
405
+ </tr>
406
+ <tr>
407
+ <td><code>baseline0</code></td>
408
+ <td><code>There is a conversation "Prompt: …; Reply: …" ###Judgment: </code></td>
409
+ </tr>
410
+ <tr>
411
+ <td><code>COT</code></td>
412
+ <td><code>There is a conversation "Prompt: …; Reply: …" Let us focus on the moral foundations of "{mft_list}". ###Inference: </code></td>
413
+ </tr>
414
+ </table>
415
+
416
+ <h3 style="margin-top:24px">Python Usage</h3>
417
+ <div class="prompt-box">
418
+ <span class="key">from</span> transformers <span class="key">import</span> AutoModelForCausalLM, AutoTokenizer, pipeline
419
+ <span class="key">import</span> torch
420
+
421
+ MFT_PREFIX = (
422
+ <span class="val">"There are the six moral foundations. "</span>
423
+ <span class="val">"Care: wanting someone or something to be safe, healthy, and happy. "</span>
424
+ <span class="val">"Fairness: wanting to see individuals or groups treated equally or equitably. "</span>
425
+ <span class="val">"Liberty: wanting people to be free to make their own decisions. "</span>
426
+ <span class="val">"Loyalty: wanting unity and seeing people keep promises or obligations to an in-group. "</span>
427
+ <span class="val">"Authority: wanting to respect social roles, duties, privacy, peace, and order. "</span>
428
+ <span class="val">"Sanctity: wanting people and things to be clean, pure, innocent, and holy."</span>
429
+ )
430
+
431
+ tokenizer = AutoTokenizer.from_pretrained(<span class="val">"MoralMachine/moral-judgment-fusion-llama3.2-3B"</span>)
432
+ model = AutoModelForCausalLM.from_pretrained(
433
+ <span class="val">"MoralMachine/moral-judgment-fusion-llama3.2-3B"</span>,
434
+ torch_dtype=torch.bfloat16, device_map=<span class="val">"auto"</span>
435
+ )
436
+ pipe = pipeline(<span class="val">"text-generation"</span>, model=model, tokenizer=tokenizer)
437
+
438
+ prompt = (
439
+ f<span class="val">"{MFT_PREFIX} There is a conversation "</span>
440
+ f<span class="val">'\"Prompt: {question} Reply: {reply}\" '</span>
441
+ f<span class="val">'There is a Rule-of-Thumb (RoT): \"{rot}\". ###Inference: '</span>
442
+ )
443
+
444
+ output = pipe(prompt, max_new_tokens=512, do_sample=False)[0][<span class="val">"generated_text"</span>]
445
+ judgment = output.split(<span class="val">"###Judgment:"</span>)[-1].strip().rstrip(<span class="val">"."</span>)
446
+ <span class="comment"># judgment ∈ {"agree", "disagree", "neutral"}</span>
447
+ </div>
448
+
449
+ <!-- MODELS -->
450
+ <h2 class="section" id="models">Available Models</h2>
451
+ <div class="card-grid">
452
+ <div class="card">
453
+ <div class="icon">⚖️</div>
454
+ <h3>Judgment · Fusion · Llama 3.2-3B</h3>
455
+ <p>Best-performing model. Fusion inference chains, 23 500 training examples, MFT-grounded 6-step reasoning.</p>
456
+ <a href="https://huggingface.co/MoralMachine/moral-judgment-fusion-llama3.2-3B" target="_blank">View on HuggingFace →</a>
457
+ </div>
458
+ <div class="card">
459
+ <div class="icon">🧭</div>
460
+ <h3>Moral Awareness · Llama 3.2-3B</h3>
461
+ <p>Sister model — diagnoses moral violations and rewrites replies. From the MoralMachine project.</p>
462
+ <a href="https://huggingface.co/MoralMachine/moral-awareness-MIC-llama3.2-3B" target="_blank">View on HuggingFace →</a>
463
+ </div>
464
+ <div class="card">
465
+ <div class="icon">🛡️</div>
466
+ <h3>Toxicity · Llama 3.2-3B</h3>
467
+ <p>MFT-grounded toxicity correction on RealToxicityPrompts.</p>
468
+ <a href="https://huggingface.co/MoralMachine/moral-awareness-toxicity-llama3.2-3B" target="_blank">View on HuggingFace →</a>
469
+ </div>
470
+ <div class="card">
471
+ <div class="icon">📖</div>
472
+ <h3>Moral Awareness Docs</h3>
473
+ <p>Full documentation for the companion rewriting/diagnosis models.</p>
474
+ <a href="https://huggingface.co/spaces/MoralMachine/moral-awareness-docs" target="_blank">View Docs →</a>
475
+ </div>
476
+ </div>
477
+
478
+ <!-- TRY IT -->
479
+ <div class="try-section">
480
+ <h2>🚀 Try It Live</h2>
481
+ <p>
482
+ Enter any conversational prompt and reply — the model generates a full six-step moral
483
+ reasoning chain and outputs a judgment.
484
+ </p>
485
+ <a href="https://huggingface.co/spaces/MoralMachine/moral-judgment-demo" class="btn btn-primary" target="_blank">Open Interactive Demo</a>
486
+ </div>
487
+
488
+ <!-- CITATION -->
489
+ <h2 class="section">Citation</h2>
490
+ <div class="prompt-box">
491
+ @article{moral-pragmatics-tacl-2025,
492
+ title = {Moral Pragmatics in Language Models},
493
+ journal = {Transactions of the Association for Computational Linguistics (TACL)},
494
+ year = {2025}
495
+ }
496
+ </div>
497
+
498
+ </div>
499
+
500
+ <footer>
501
+ <p>
502
+ ⚖️ Moral Pragmatics in Language Models · TACL 2025 ·
503
+ <a href="https://huggingface.co/MoralMachine/moral-judgment-fusion-llama3.2-3B" target="_blank">Model</a> ·
504
+ <a href="https://huggingface.co/spaces/MoralMachine/moral-judgment-demo" target="_blank">Demo</a> ·
505
+ <a href="https://huggingface.co/MoralMachine" target="_blank">MoralMachine</a>
506
+ </p>
507
+ </footer>
508
+
509
+ </body>
510
  </html>