File size: 25,379 Bytes
b08bfe9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2bef055
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Moral Pragmatics in Language Models</title>
<style>
  :root {
    --bg: #f8f9fc;
    --card: #ffffff;
    --accent: #4f46e5;
    --accent2: #7c3aed;
    --text: #1e1e2e;
    --muted: #6b7280;
    --border: #e5e7eb;
    --code-bg: #1e1e2e;
    --code-fg: #cdd6f4;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #eab308;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }

  /* NAV */
  nav {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white; padding: 14px 32px;
    display: flex; align-items: center; gap: 16px;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
  }
  nav .logo { font-size: 1.5em; }
  nav h1 { font-size: 1.1em; font-weight: 600; }
  nav .links { margin-left: auto; display: flex; gap: 16px; }
  nav .links a { color: rgba(255,255,255,.85); text-decoration: none; font-size: .9em; }
  nav .links a:hover { color: white; }

  /* HERO */
  .hero {
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    padding: 64px 32px; text-align: center;
    border-bottom: 1px solid var(--border);
  }
  .hero h2 { font-size: 2.4em; font-weight: 700; color: var(--accent); margin-bottom: 12px; }
  .hero p { font-size: 1.15em; color: var(--muted); max-width: 700px; margin: 0 auto 28px; }
  .hero .badges { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }
  .badge { background: var(--accent); color: white; padding: 4px 14px; border-radius: 999px; font-size: .8em; font-weight: 600; }
  .badge.green { background: var(--green); }
  .badge.purple { background: var(--accent2); }
  .badge.teal { background: #0d9488; }
  .btn { display: inline-block; padding: 12px 28px; border-radius: 8px; font-weight: 600; text-decoration: none; font-size: 1em; }
  .btn-primary { background: var(--accent); color: white; margin-right: 10px; }
  .btn-secondary { background: white; color: var(--accent); border: 2px solid var(--accent); }
  .btn:hover { opacity: .88; }

  /* LAYOUT */
  .container { max-width: 1100px; margin: 0 auto; padding: 48px 24px; }
  h2.section { font-size: 1.7em; font-weight: 700; margin-bottom: 20px; color: var(--text); border-left: 4px solid var(--accent); padding-left: 12px; }
  h3 { font-size: 1.15em; font-weight: 600; margin-bottom: 8px; color: var(--text); }
  p { color: var(--muted); margin-bottom: 12px; }

  /* CARDS */
  .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; margin-bottom: 40px; }
  .card {
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.06);
    transition: box-shadow .2s, transform .2s;
  }
  .card:hover { box-shadow: 0 4px 16px rgba(79,70,229,.12); transform: translateY(-2px); }
  .card .icon { font-size: 2em; margin-bottom: 8px; }
  .card h3 { font-size: 1em; }
  .card p { font-size: .88em; }
  .card a { color: var(--accent); text-decoration: none; font-size: .88em; font-weight: 600; }

  /* MFT GRID */
  .mft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 40px; }
  .mft-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px 20px; border-left: 4px solid var(--accent); }
  .mft-card.care    { border-color: #22c55e; }
  .mft-card.fair    { border-color: #3b82f6; }
  .mft-card.lib     { border-color: #eab308; }
  .mft-card.loyal   { border-color: #f97316; }
  .mft-card.auth    { border-color: #8b5cf6; }
  .mft-card.sanc    { border-color: #ec4899; }
  .mft-card h3 { font-size: .95em; }
  .mft-card p { font-size: .85em; margin: 0; }

  /* TABLE */
  table { width: 100%; border-collapse: collapse; margin-bottom: 32px; font-size: .9em; }
  th { background: var(--accent); color: white; padding: 10px 14px; text-align: left; }
  td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
  tr:nth-child(even) td { background: #f9fafb; }
  code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: .88em; font-family: monospace; color: var(--accent2); }

  /* PROMPT EXAMPLES */
  .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; }
  .prompt-box .comment { color: #6c7086; }
  .prompt-box .key { color: #89b4fa; }
  .prompt-box .val { color: #a6e3a1; }
  .prompt-box .tag { color: #f9e2af; }
  .prompt-box .special { color: #cba6f7; }

  /* SETTINGS TABLE */
  .setting-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78em; font-weight: 700; }
  .setting-tag.fusion   { background: #eef2ff; color: var(--accent); }
  .setting-tag.ours     { background: #f0fdf4; color: #15803d; }
  .setting-tag.cot      { background: #fefce8; color: #854d0e; }
  .setting-tag.baseline { background: #fdf4ff; color: var(--accent2); }

  /* JUDGMENT LABELS */
  .judg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
  .judg-card { border-radius: 10px; padding: 18px 20px; text-align: center; }
  .judg-card.agree    { background: #f0fdf4; border: 2px solid #22c55e; }
  .judg-card.disagree { background: #fef2f2; border: 2px solid #ef4444; }
  .judg-card.neutral  { background: #f8fafc; border: 2px solid #94a3b8; }
  .judg-card .emoji { font-size: 2em; margin-bottom: 8px; }
  .judg-card h3 { font-size: 1em; margin-bottom: 4px; }
  .judg-card p { font-size: .85em; margin: 0; }

  /* INFERENCE FLOW */
  .flow { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; margin-bottom: 32px; }
  .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; }
  .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; }
  .flow-arrow { color: var(--accent); font-size: 1.4em; padding: 0 6px; display: flex; align-items: center; }

  /* TRY IT */
  .try-section { background: linear-gradient(135deg, #eef2ff, #f5f3ff); border-radius: 16px; padding: 32px; margin-bottom: 40px; text-align: center; }
  .try-section h2 { font-size: 1.5em; margin-bottom: 8px; color: var(--accent); }
  .try-section p { margin-bottom: 20px; }

  footer { background: var(--code-bg); color: #9399b2; text-align: center; padding: 28px; font-size: .88em; }
  footer a { color: #89b4fa; text-decoration: none; }

  @media (max-width: 600px) {
    .judg-grid { grid-template-columns: 1fr; }
    .flow { flex-direction: column; }
    .flow-arrow { transform: rotate(90deg); align-self: center; }
  }
</style>
</head>
<body>

<!-- NAV -->
<nav>
  <span class="logo">⚖️</span>
  <h1>Moral Pragmatics in LLMs</h1>
  <div class="links">
    <a href="#overview">Overview</a>
    <a href="#mft">MFT</a>
    <a href="#settings">Settings</a>
    <a href="#prompts">Prompts</a>
    <a href="#reasoning">Reasoning</a>
    <a href="#models">Models</a>
    <a href="https://huggingface.co/spaces/MoralMachine/moral-judgment-demo" target="_blank">🚀 Live Demo</a>
  </div>
</nav>

<!-- HERO -->
<div class="hero">
  <div class="badges">
    <span class="badge teal">TACL 2025</span>
    <span class="badge green">Open Source</span>
    <span class="badge purple">Moral Foundations Theory</span>
    <span class="badge">Llama 3.2</span>
  </div>
  <h2>Moral Pragmatics in Language Models</h2>
  <p>
    Fine-tuned LLMs that perform <strong>six-step pragmatic moral reasoning</strong> grounded in
    Moral Foundations Theory to judge whether a conversational reply is morally acceptable,
    problematic, or neutral.
  </p>
  <a href="https://huggingface.co/spaces/MoralMachine/moral-judgment-demo" class="btn btn-primary" target="_blank">🚀 Try the Live Demo</a>
  <a href="https://huggingface.co/MoralMachine/moral-judgment-fusion-llama3.2-3B" class="btn btn-secondary" target="_blank">📦 HuggingFace Model</a>
</div>

<div class="container">

  <!-- OVERVIEW -->
  <h2 class="section" id="overview">Project Overview</h2>
  <p>
    This work addresses the problem of <em>moral judgment</em> in conversational AI: given a question/prompt and
    a reply, can a language model determine whether the reply is morally <strong>acceptable</strong>,
    <strong>problematic</strong>, or <strong>neutral</strong>?
  </p>
  <p>
    Unlike surface-level toxicity detection, moral judgment requires <strong>pragmatic understanding</strong>:
    identifying the implicit actions in a reply, predicting their consequences, and evaluating
    those consequences against deep moral principles — not just flagging offensive words.
    We ground this reasoning in <strong>Moral Foundations Theory (MFT)</strong>.
  </p>

  <div class="card-grid">
    <div class="card">
      <div class="icon">📚</div>
      <h3>Dataset</h3>
      <p>Moral Integrity Corpus (MIC) — 23,500 training examples of Q&amp;A pairs annotated with judgment, MFT labels, and rule-of-thumbs.</p>
    </div>
    <div class="card">
      <div class="icon">🤖</div>
      <h3>Model</h3>
      <p>Llama 3.2-3B base, fine-tuned via SFT. Fusion setting combines MFT + Judgment inference chains.</p>
    </div>
    <div class="card">
      <div class="icon">🎯</div>
      <h3>Task</h3>
      <p>Judgment classification: <em>agree</em> (morally acceptable), <em>disagree</em> (morally problematic), <em>neutral</em>.</p>
    </div>
    <div class="card">
      <div class="icon">🔗</div>
      <h3>Related Work</h3>
      <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>
    </div>
  </div>

  <h3>Judgment Labels</h3>
  <div class="judg-grid">
    <div class="judg-card agree">
      <div class="emoji"></div>
      <h3>Agree</h3>
      <p>The reply is morally acceptable — its actions and consequences align with the moral foundations.</p>
    </div>
    <div class="judg-card disagree">
      <div class="emoji"></div>
      <h3>Disagree</h3>
      <p>The reply is morally problematic — its actions violate or down-regulate moral foundations.</p>
    </div>
    <div class="judg-card neutral">
      <div class="emoji"></div>
      <h3>Neutral</h3>
      <p>The reply is morally neutral — its actions have no clear positive or negative moral valence.</p>
    </div>
  </div>

  <!-- MFT -->
  <h2 class="section" id="mft">Moral Foundations Theory</h2>
  <p>
    The models are grounded in <strong>Moral Foundations Theory (MFT)</strong>, which identifies six universal
    moral intuitions that underpin human ethical judgments. These are provided as a prefix to every prompt,
    anchoring the model's reasoning to principled moral concepts rather than surface-level cues.
  </p>
  <div class="mft-grid">
    <div class="mft-card care">
      <h3>🌱 Care</h3>
      <p>Wanting someone or something to be safe, healthy, and happy.</p>
    </div>
    <div class="mft-card fair">
      <h3>⚖️ Fairness</h3>
      <p>Wanting to see individuals or groups treated equally or equitably.</p>
    </div>
    <div class="mft-card lib">
      <h3>🗽 Liberty</h3>
      <p>Wanting people to be free to make their own decisions.</p>
    </div>
    <div class="mft-card loyal">
      <h3>🤝 Loyalty</h3>
      <p>Wanting unity and seeing people keep promises to an in-group.</p>
    </div>
    <div class="mft-card auth">
      <h3>👑 Authority</h3>
      <p>Wanting to respect social roles, duties, privacy, peace, and order.</p>
    </div>
    <div class="mft-card sanc">
      <h3>✨ Sanctity</h3>
      <p>Wanting people and things to be clean, pure, innocent, and holy.</p>
    </div>
  </div>

  <!-- SETTINGS -->
  <h2 class="section" id="settings">Experimental Settings</h2>
  <p>
    Five training settings are evaluated, representing different levels of moral reasoning depth.
    The <strong>fusion</strong> setting is our best-performing model — it combines LLM-generated
    reasoning chains that jointly consider MFT and Judgment signals.
  </p>

  <table>
    <tr>
      <th>Setting</th>
      <th>Description</th>
      <th>Inference Chain</th>
      <th>MFT Prefix</th>
    </tr>
    <tr>
      <td><span class="setting-tag baseline">baseline0</span></td>
      <td>No reasoning, no MFT context. Direct judgment from prompt + reply only.</td>
      <td>None</td>
      <td>No</td>
    </tr>
    <tr>
      <td><span class="setting-tag baseline">baseline+</span></td>
      <td>MFT foundation names listed in prompt, but no reasoning chain.</td>
      <td>None</td>
      <td>Foundation names only</td>
    </tr>
    <tr>
      <td><span class="setting-tag ours">ours ★</span></td>
      <td>Full MFT prefix + LLM-generated Judgment inference chain. Explicit step-by-step reasoning over moral foundations.</td>
      <td><code>inference4Judgment</code></td>
      <td>Yes (full definitions)</td>
    </tr>
    <tr>
      <td><span class="setting-tag fusion">fusion ★★</span></td>
      <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>
      <td><code>inference4Fusion</code></td>
      <td>Yes (full definitions)</td>
    </tr>
    <tr>
      <td><span class="setting-tag cot">COT</span></td>
      <td>Chain-of-Thought: model reasons freely over the reply without explicit MFT grounding.</td>
      <td><code>inference4COT</code></td>
      <td>No</td>
    </tr>
  </table>

  <!-- REASONING -->
  <h2 class="section" id="reasoning">Six-Step Moral Reasoning Chain</h2>
  <p>
    The core contribution of this work is the <strong>six-step pragmatic reasoning chain</strong>
    that the model generates before producing its final judgment. Each step progressively
    narrows from observable actions to deep moral evaluation:
  </p>

  <div class="flow">
    <div class="flow-step">
      <div class="num">1</div>
      <div><strong>Actions</strong><br><small>What actions does the reply describe or imply?</small></div>
    </div>
    <div class="flow-arrow"></div>
    <div class="flow-step">
      <div class="num">2</div>
      <div><strong>Consequences</strong><br><small>What are the potential consequences of each action?</small></div>
    </div>
    <div class="flow-arrow"></div>
    <div class="flow-step">
      <div class="num">3</div>
      <div><strong>Moral Foundations</strong><br><small>Which MFT foundations do those actions engage?</small></div>
    </div>
    <div class="flow-arrow"></div>
    <div class="flow-step">
      <div class="num">4</div>
      <div><strong>Regulation</strong><br><small>Do the actions up-regulate or down-regulate those foundations?</small></div>
    </div>
    <div class="flow-arrow"></div>
    <div class="flow-step">
      <div class="num">5</div>
      <div><strong>Sentiment</strong><br><small>What is the reply's sentiment toward those consequences?</small></div>
    </div>
    <div class="flow-arrow"></div>
    <div class="flow-step">
      <div class="num">6</div>
      <div><strong>Judgment</strong><br><small>Final moral verdict: agree / disagree / neutral</small></div>
    </div>
  </div>

  <p>
    This chain mirrors how a human moral reasoner would approach the task: first identifying
    <em>what</em> is happening, then <em>why</em> it matters morally, and finally reaching a principled verdict.
    The optional <strong>Rule-of-Thumb (RoT)</strong> field anchors steps 3–6 to a specific moral principle.
  </p>

  <!-- PROMPTS -->
  <h2 class="section" id="prompts">Prompt Formats</h2>

  <h3>MFT Prefix (shared across all pragmatic prompts)</h3>
  <div class="prompt-box">
<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>
  </div>

  <h3 style="margin-top:24px">Training Text Format — Fusion Setting</h3>
  <p>
    Training data is formatted as a single text sequence. The model learns to complete the
    reasoning chain and produce the final judgment token.
  </p>

  <p><strong>Disagree example (morally problematic reply):</strong></p>
  <div class="prompt-box">
<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>.
<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>
<span class="special">###Judgment:</span> <span class="val">disagree.</span>
  </div>

  <p><strong>Agree example (morally acceptable reply):</strong></p>
  <div class="prompt-box">
<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>.
<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>
<span class="special">###Judgment:</span> <span class="val">agree.</span>
  </div>

  <h3 style="margin-top:28px">Inference Prompt (test-time)</h3>
  <p>
    At test time the model receives only the prefix — the reasoning chain and judgment are
    generated autoregressively. The Rule-of-Thumb is optional; omitting it still produces
    a valid chain.
  </p>

  <table>
    <tr><th>Setting</th><th>Input prompt sent to model</th></tr>
    <tr>
      <td><code>fusion / ours</code></td>
      <td><code>[MFT_PREFIX] There is a conversation "Prompt: …; Reply: …" [There is a Rule-of-Thumb (RoT): "…".] ###Inference: </code></td>
    </tr>
    <tr>
      <td><code>baseline+</code></td>
      <td><code>There is a conversation "Prompt: …; Reply: …" Let us focus on the moral foundations of "{mft_list}". ###Judgment: </code></td>
    </tr>
    <tr>
      <td><code>baseline0</code></td>
      <td><code>There is a conversation "Prompt: …; Reply: …" ###Judgment: </code></td>
    </tr>
    <tr>
      <td><code>COT</code></td>
      <td><code>There is a conversation "Prompt: …; Reply: …" Let us focus on the moral foundations of "{mft_list}". ###Inference: </code></td>
    </tr>
  </table>

  <h3 style="margin-top:24px">Python Usage</h3>
  <div class="prompt-box">
<span class="key">from</span> transformers <span class="key">import</span> AutoModelForCausalLM, AutoTokenizer, pipeline
<span class="key">import</span> torch

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

tokenizer = AutoTokenizer.from_pretrained(<span class="val">"MoralMachine/moral-judgment-fusion-llama3.2-3B"</span>)
model = AutoModelForCausalLM.from_pretrained(
    <span class="val">"MoralMachine/moral-judgment-fusion-llama3.2-3B"</span>,
    torch_dtype=torch.bfloat16, device_map=<span class="val">"auto"</span>
)
pipe = pipeline(<span class="val">"text-generation"</span>, model=model, tokenizer=tokenizer)

prompt = (
    f<span class="val">"{MFT_PREFIX} There is a conversation "</span>
    f<span class="val">'\"Prompt: {question} Reply: {reply}\" '</span>
    f<span class="val">'There is a Rule-of-Thumb (RoT): \"{rot}\". ###Inference: '</span>
)

output = pipe(prompt, max_new_tokens=512, do_sample=False)[0][<span class="val">"generated_text"</span>]
judgment = output.split(<span class="val">"###Judgment:"</span>)[-1].strip().rstrip(<span class="val">"."</span>)
<span class="comment"># judgment ∈ {"agree", "disagree", "neutral"}</span>
  </div>

  <!-- MODELS -->
  <h2 class="section" id="models">Available Models</h2>
  <div class="card-grid">
    <div class="card">
      <div class="icon">⚖️</div>
      <h3>Judgment · Fusion · Llama 3.2-3B</h3>
      <p>Best-performing model. Fusion inference chains, 23 500 training examples, MFT-grounded 6-step reasoning.</p>
      <a href="https://huggingface.co/MoralMachine/moral-judgment-fusion-llama3.2-3B" target="_blank">View on HuggingFace →</a>
    </div>
    <div class="card">
      <div class="icon">🧭</div>
      <h3>Moral Awareness · Llama 3.2-3B</h3>
      <p>Sister model — diagnoses moral violations and rewrites replies. From the MoralMachine project.</p>
      <a href="https://huggingface.co/MoralMachine/moral-awareness-MIC-llama3.2-3B" target="_blank">View on HuggingFace →</a>
    </div>
    <div class="card">
      <div class="icon">🛡️</div>
      <h3>Toxicity · Llama 3.2-3B</h3>
      <p>MFT-grounded toxicity correction on RealToxicityPrompts.</p>
      <a href="https://huggingface.co/MoralMachine/moral-awareness-toxicity-llama3.2-3B" target="_blank">View on HuggingFace →</a>
    </div>
    <div class="card">
      <div class="icon">📖</div>
      <h3>Moral Awareness Docs</h3>
      <p>Full documentation for the companion rewriting/diagnosis models.</p>
      <a href="https://huggingface.co/spaces/MoralMachine/moral-awareness-docs" target="_blank">View Docs →</a>
    </div>
  </div>

  <!-- TRY IT -->
  <div class="try-section">
    <h2>🚀 Try It Live</h2>
    <p>
      Enter any conversational prompt and reply — the model generates a full six-step moral
      reasoning chain and outputs a judgment.
    </p>
    <a href="https://huggingface.co/spaces/MoralMachine/moral-judgment-demo" class="btn btn-primary" target="_blank">Open Interactive Demo</a>
  </div>

  <!-- CITATION -->
  <h2 class="section">Citation</h2>
  <div class="prompt-box">
@article{moral-pragmatics-tacl-2025,
  title   = {Moral Pragmatics in Language Models},
  journal = {Transactions of the Association for Computational Linguistics (TACL)},
  year    = {2025}
}
  </div>

</div>

<footer>
  <p>
    ⚖️ Moral Pragmatics in Language Models · TACL 2025 ·
    <a href="https://huggingface.co/MoralMachine/moral-judgment-fusion-llama3.2-3B" target="_blank">Model</a> ·
    <a href="https://huggingface.co/spaces/MoralMachine/moral-judgment-demo" target="_blank">Demo</a> ·
    <a href="https://huggingface.co/MoralMachine" target="_blank">MoralMachine</a>
  </p>
</footer>

</body>
</html>