From dd4cbefc977f23bf64191833a8cae013d4fcd5e0 Mon Sep 17 00:00:00 2001 From: Tyrin Todd Date: Sun, 8 Mar 2026 20:04:03 -0700 Subject: [PATCH] (no commit message) --- README.md | 2 -- config.json | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++ program.json | 56 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+), 2 deletions(-) delete mode 100644 README.md create mode 100644 config.json create mode 100644 program.json diff --git a/README.md b/README.md deleted file mode 100644 index 50b6f69..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# moral-judge - diff --git a/config.json b/config.json new file mode 100644 index 0000000..4369071 --- /dev/null +++ b/config.json @@ -0,0 +1,68 @@ +{ + "model": null, + "signature": { + "description": "Analyze the text using Moral Foundations Theory (MFT) and determine which moral foundations are expressed.\nReason step-by-step about the presence or absence of each foundation.\nIn the reasoning, note ambiguity, uncertainty, implicit moral language, and cases where multiple foundations may apply.\nA text may express multiple foundations.\nSet non_moral=True only if no MFT moral foundation is clearly expressed.", + "properties": { + "text": { + "__dspy_field_type": "input", + "desc": "The text to analyze for moral foundations.", + "prefix": "Text:", + "title": "Text", + "type": "string" + }, + "reasoning": { + "__dspy_field_type": "output", + "desc": "Step-by-step reasoning using Moral Foundations Theory (MFT), including uncertainty, ambiguity, implicitness, and why each foundation does or does not apply.", + "prefix": "Reasoning:", + "title": "Reasoning", + "type": "string" + }, + "care": { + "__dspy_field_type": "output", + "desc": "Whether the text expresses the Care/Harm moral foundation in MFT, such as concern about suffering, harm, cruelty, compassion, protection, or vulnerability.", + "prefix": "Care:", + "title": "Care", + "type": "boolean" + }, + "fairness": { + "__dspy_field_type": "output", + "desc": "Whether the text expresses the Fairness moral foundation in MFT, including fairness, justice, rights, equality, reciprocity, deservedness, or proportionality.", + "prefix": "Fairness:", + "title": "Fairness", + "type": "boolean" + }, + "loyalty": { + "__dspy_field_type": "output", + "desc": "Whether the text expresses the Loyalty/Betrayal moral foundation in MFT, such as allegiance, solidarity, patriotism, group belonging, or betrayal of a group.", + "prefix": "Loyalty:", + "title": "Loyalty", + "type": "boolean" + }, + "authority": { + "__dspy_field_type": "output", + "desc": "Whether the text expresses the Authority/Subversion moral foundation in MFT, such as respect for rules, hierarchy, duty, obedience, tradition, or legitimate institutions.", + "prefix": "Authority:", + "title": "Authority", + "type": "boolean" + }, + "non_moral": { + "__dspy_field_type": "output", + "desc": "Whether the text expresses no clear Moral Foundations Theory (MFT) moral foundation. This should be true only if care, fairness, loyalty, and authority are all false.", + "prefix": "Non Moral:", + "title": "Non Moral", + "type": "boolean" + } + }, + "required": [ + "text", + "reasoning", + "care", + "fairness", + "loyalty", + "authority", + "non_moral" + ], + "title": "MoralJudgeSig", + "type": "object" + } +} \ No newline at end of file diff --git a/program.json b/program.json new file mode 100644 index 0000000..1ee4f55 --- /dev/null +++ b/program.json @@ -0,0 +1,56 @@ +{ + "traces": [], + "train": [], + "demos": [], + "signature": { + "instructions": "You are given a single input field:\n\n- text: an arbitrary piece of natural language, often political or opinionated, sometimes short and context-poor.\n\nYour task is to analyze this text using Moral Foundations Theory (MFT) and determine which moral foundations are expressed. You must:\n\n1. **Foundations to consider and output fields**\n\n You must reason about and output booleans for the following foundations:\n\n - care (Care/Harm)\n - fairness (Fairness/Cheating)\n - loyalty (Loyalty/Betrayal)\n - authority (Authority/Subversion)\n\n Additionally, you must output:\n\n - non_moral: a boolean that is True *only if* none of the above moral foundations are clearly expressed.\n\n The required outputs are:\n\n - reasoning: a natural-language explanation of your analysis\n - care: True/False\n - fairness: True/False\n - loyalty: True/False\n - authority: True/False\n - non_moral: True/False\n\n2. **General decision rules**\n\n - A text may express **multiple** foundations. Set all applicable foundations that are clearly expressed to True.\n - Only set a foundation to True if there is a **clear and specific link** between the content of the text and that foundation, not just a topic that is *often* morally loaded in public debate.\n - Distinguish between:\n - **Explicit moral language** (e.g., \u201cunfair,\u201d \u201cbetrayal,\u201d \u201cdisrespect,\u201d \u201charm,\u201d \u201ccruel,\u201d \u201cviolate rights\u201d) \u2013 these usually justify a True label when correctly mapped.\n - **Implicit moral content** \u2013 may justify a True label if the mapping to an MFT foundation is strong and specific in the context of the sentence.\n - If a text is **purely descriptive, factual, or procedural** without clear normative evaluation or moral framing, you should generally set all foundations to False and non_moral to True.\n - If there is **significant doubt** whether a foundation is present (e.g., you are only relying on generic associations like \u201cUBI implies fairness concerns\u201d), treat that foundation as **absent** (False). You must not infer moral foundations solely from the *type of policy* or *topic* without cues that the text itself frames it as a moral issue.\n\n3. **Foundation-specific guidance, with nuances from the examples**\n\n Use the following more detailed criteria to decide presence/absence. These are tuned to avoid over-attribution observed in the examples.\n\n **Care/Harm (care)**\n\n - Present when the text clearly involves:\n - Concern about suffering, well-being, physical or emotional harm, protection of individuals or vulnerable groups.\n - Language about cruelty, violence, abuse, \u201churt,\u201d \u201cdamage\u201d to people, \u201csuffering,\u201d \u201cprotecting\u201d others, humanitarian concern.\n - Group-level harm is included *only when* it is described in terms of people\u2019s well-being, safety, or suffering (e.g., \u201cthis policy will hurt millions of families,\u201d \u201cpeople will starve\u201d).\n - Absent when:\n - The text is about power, strategy, institutions, or funding without reference to people being harmed or protected.\n - Any \u201charm\u201d is purely metaphorical, procedural, or about political disadvantage (e.g., \u201cdamage the EU,\u201d \u201charm a party\u2019s chances\u201d) without connection to human well-being.\n\n **Fairness/Cheating (fairness)**\n\n - Present when the text clearly involves:\n - Justice, rights, equality/inequality, impartiality, bias, favoritism, cheating, corruption, exploitation, proportionality (getting what one deserves).\n - Complaints about rigged systems, unfair advantages, unjust treatment, violations of rights.\n - You may treat implicit fairness concerns as present only if the text itself highlights **distribution or access as a moral problem** (e.g., \u201conly the rich get to vote,\u201d \u201cthey\u2019re denied a fair chance\u201d).\n - **Do NOT**:\n - Automatically label any mention of redistribution policies (e.g., \u201cuniversal basic income,\u201d \u201cwelfare,\u201d \u201ctaxes\u201d) as fairness. In Example 2, the mistake was inferring fairness solely from the presence of \u201cuniversal basic income\u201d without any fairness-justice language or evaluation in the text. Policy type alone is insufficient.\n - Infer fairness from political disagreement or differences in platforms unless the text itself frames it as just/unjust, fair/unfair, equal/unequal, etc.\n\n **Loyalty/Betrayal (loyalty)**\n\n - Present when the text clearly involves:\n - Allegiance or disloyalty to a group (nation, party, culture, religion, \u201cour people,\u201d \u201cthe West,\u201d etc.).\n - Patriotism, treason, betrayal, desertion, standing by or abandoning one\u2019s group.\n - Protection of an in-group\u2019s honor, cohesion, or survival.\n - It can also apply when:\n - A text invokes the well-being or preservation of a particular civilization or cultural group (e.g., \u201cdegrade Western civilization\u201d) **as a moral concern**, even if the speaker reports or mocks this concern.\n - Example: In Example 3, the phrase \u201cdegrade Western civilization\u201d reflects an in-group protection concern (Loyalty) from the quoted speaker (Le Pen). Even though the narrator dismisses it (\u201csome bullshit\u201d), the loyalty framing is still present in the content attributed to Le Pen.\n - Absent when:\n - A group identity, tradition, or party is mentioned only in a descriptive, historical, or classificatory way, without any normative praise/blame tied to loyalty, betrayal, desertion, or group preservation.\n - Example: In Example 2, citing \u201cSocialist/Social democratic parties in Europe in the last 150 years\u201d only as a historical reference to platforms, without language of betrayal or disloyalty, is not enough for Loyalty.\n\n **Authority/Subversion (authority)**\n\n - Present when the text clearly involves:\n - Respect or disrespect for legitimate authority, leaders, institutions, rules, traditions, duties, or hierarchies.\n - Concerns about undermining/overriding rightful authority or institutions, or appeals to obey/defend them.\n - This foundation includes:\n - Worries about power structures being illegitimately overruled or replaced (e.g., powerful private actors overriding nation-states).\n - Example: In Example 1, \u201cwestern bankers who feel they have more power than nation states\u201d and their influence within the EU raises a concern about subversion of legitimate political authority by financial elites. This is Authority/Subversion.\n - **Avoid overextension via mere tradition:**\n - Do *not* automatically assign Authority just because a long history or tradition is mentioned.\n - Example: In Example 2, saying a policy \u201cwas never part of the platform\u2026 in the last 150 years\u201d is primarily a descriptive historical contrast. Without explicit deference to tradition or appeals like \u201cwe must respect our party\u2019s historical platform,\u201d this should not be labeled as Authority.\n\n4. **Non-moral classification (non_moral)**\n\n - Set non_moral = True **only if**:\n - None of care, fairness, loyalty, authority is clearly expressed (all False).\n - Set non_moral = False if **any** of the four moral foundations is True.\n - Many political or descriptive statements that mention ideologies, parties, or policies are **not** necessarily moral unless evaluative, normative, or moral framing is present. When in doubt and lacking clear moral cues, prefer to mark the text as non_moral=True.\n\n5. **Using quoted or attributed speech**\n\n - If the text quotes or paraphrases someone else\u2019s moral claim, you may treat the moral foundations of that quoted content as present, even if the narrator disagrees or mocks it, as long as:\n - The quoted/paraphrased content itself clearly expresses a moral concern that maps to a foundation.\n - Example: In Example 3, the main speaker mocks Le Pen\u2019s claim, but the idea that something \u201cis helping to degrade Western civilization\u201d expresses a loyalty-related concern about an in-group (Western civilization). Therefore, loyalty=True.\n\n6. **Handling ambiguity and uncertainty**\n\n - In your **reasoning**, you must:\n - Discuss the presence or absence of each foundation (care, fairness, loyalty, authority), not only those you label True.\n - Explicitly mention where the mapping is ambiguous, where moral language is implicit, and where multiple foundations might apply.\n - Explain why you chose to mark a potentially relevant foundation as False when the connection is weak or only inferable via topic associations.\n - However, your final True/False labels must follow a **conservative** standard:\n - Only mark True when the connection is specific and supported by the actual wording and framing of the text.\n - Do not infer moral concerns purely from the general policy area or from your background knowledge of typical debates.\n\n7. **Illustrative corrections relative to the examples**\n\n Use these as concrete guides to avoid earlier mistakes:\n\n - **Example 1 (bankers, EU, party funding)**:\n - Correct labels:\n - fairness = True (complaint about a distorted political playing field; bankers \u201cwon\u2019t fund\u201d certain parties to protect the EU, implying unfair political influence)\n - authority = True (concern that bankers \u201cfeel they have more power than nation states\u201d and influence political outcomes, challenging legitimate state authority)\n - care = False (no concern about suffering or harm to individuals)\n - loyalty = False (no explicit in-group allegiance or betrayal language)\n - non_moral = False (because fairness and authority are present)\n - **Example 2 (UBI and party platforms)**:\n - Correct labels:\n - fairness = False (UBI is mentioned, but the text is purely descriptive about historical platforms; no fairness/justice evaluation in the text itself)\n - loyalty = False (no moral language about loyalty/betrayal to parties; just a historical contrast)\n - authority = False (reference to 150 years of platforms is descriptive; no explicit respect-for-tradition or duty framing)\n - care = False (no explicit concern for suffering or well-being)\n - non_moral = True (none of the four foundations is clearly expressed)\n - **Example 3 (Le Pen, \u201cdegrade Western civilization\u201d)**:\n - Correct labels:\n - loyalty = True (concern\u2014albeit mocked\u2014about \u201cdegrade Western civilization\u201d is an in-group protection concern)\n - care = False (not about suffering/physical or emotional harm to individuals)\n - fairness = False (no justice/equality framing)\n - authority = False (no duty/obedience/legitimacy framing)\n - non_moral = False (because loyalty is present via the quoted/paraphrased claim)\n\n8. **Output format**\n\n Produce your answer in the following structure (no extra commentary outside this structure):\n\n - reasoning: A concise but complete paragraph-style explanation that:\n - Interprets the text.\n - Evaluates each foundation\u2019s presence/absence.\n - Notes ambiguity, implicitness, and overlaps where relevant.\n - care: True/False\n - fairness: True/False\n - loyalty: True/False\n - authority: True/False\n - non_moral: True/False\n\n Example skeleton:\n\n reasoning\n The text [...]. \n - Care/Harm: [... present/absent and why, including ambiguity if any]. \n - Fairness/Cheating: [...]. \n - Loyalty/Betrayal: [...]. \n - Authority/Subversion: [...]. \n Overall, [...]\n\n care\n False\n\n fairness\n True\n\n loyalty\n False\n\n authority\n True\n\n non_moral\n False", + "fields": [ + { + "prefix": "Text:", + "description": "The text to analyze for moral foundations." + }, + { + "prefix": "Reasoning:", + "description": "Step-by-step reasoning using Moral Foundations Theory (MFT), including uncertainty, ambiguity, implicitness, and why each foundation does or does not apply." + }, + { + "prefix": "Care:", + "description": "Whether the text expresses the Care/Harm moral foundation in MFT, such as concern about suffering, harm, cruelty, compassion, protection, or vulnerability." + }, + { + "prefix": "Fairness:", + "description": "Whether the text expresses the Fairness moral foundation in MFT, including fairness, justice, rights, equality, reciprocity, deservedness, or proportionality." + }, + { + "prefix": "Loyalty:", + "description": "Whether the text expresses the Loyalty/Betrayal moral foundation in MFT, such as allegiance, solidarity, patriotism, group belonging, or betrayal of a group." + }, + { + "prefix": "Authority:", + "description": "Whether the text expresses the Authority/Subversion moral foundation in MFT, such as respect for rules, hierarchy, duty, obedience, tradition, or legitimate institutions." + }, + { + "prefix": "Non Moral:", + "description": "Whether the text expresses no clear Moral Foundations Theory (MFT) moral foundation. This should be true only if care, fairness, loyalty, and authority are all false." + } + ] + }, + "lm": { + "model": "gpt-5-mini", + "model_type": "chat", + "cache": true, + "num_retries": 3, + "finetuning_model": null, + "launch_kwargs": {}, + "train_kwargs": {}, + "temperature": null, + "max_completion_tokens": null + }, + "metadata": { + "dependency_versions": { + "python": "3.11", + "dspy": "3.1.3", + "cloudpickle": "3.1" + } + } +} \ No newline at end of file