Skip to content

Moral alignment of LLM agentsMoral Alignment for LLM Agents

arXiv· arXiv:2410.01639· ICLR 2025· Elizaveta Tennant, Stephen Hailes, Mirco Musolesi·Indexed by this site · 2026-10-14· Originally publishedAlignment

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

The authors fine-tune Gemma2-2b-it with intrinsic reward PPO and state that it learns a moral policy on IPD and can transfer to other matrix games.

Questions
Alignment of LLM decision agents often relies on RLHF or DPO, with values implicit and opaque. The authors test whether intrinsic moral rewards on actions and consequences can align an agent to deontology or utilitarianism.
Methods
On prompts that do not name the prisoner's dilemma, fine-tune Gemma2-2b-it with PPO. Rewards include Game payoffs, deontological penalties, utilitarian collective payoffs, and combinations; illegal tokens are additionally penalized. In the second half, Game rewards are replaced with moral rewards to adjust existing selfish strategies.
Experiments and results
The authors state that against TFT, deontological fine-tuning avoids defecting against cooperators nearly 100% of the time, and utilitarianism learns mutual cooperation. After swapping in new action tokens, deontological regret is small on other matrix games; the utilitarian model mostly always cooperates, and is worse on games where mutual defection is needed for higher collective payoff.
Limitations and future work
The authors note that rewards must be specified for specific environments, and suggest extending to other payoffs, more complex games, longer histories and textual scenarios, and multi-objective pluralistic alignment. Experiments only use Gemma2-2b-it, and the training environment is IPD; the paper does not report specific learning rate values or wall-clock time.
Experimental setupGemma2-2b-it · Iterated Prisoner's Dilemma、Iterated Stag Hunt et al. · moral reward、moral regret et al.
Evaluated models
Gemma2-2b-it
Benchmarks
Iterated Prisoner's DilemmaIterated Stag HuntIterated ChickenIterated Bach or StravinskyIterated Defective Coordination
Metrics
moral rewardmoral regretaction-type frequency
AI summaryThe paper proposes using an intrinsic reward function to fine-tune LLM agents for moral alignment, explicitly writing human values into the reward rather than implicitly deriving values from human preference data as in RLHF or DPO. The authors use two philosophical frameworks, deontology and utilitarianism, to quantify moral rewards by actions and consequences in an iterated prisoner's dilemma (IPD) environment, and show that moral fine-tuning can make agents forget previously learned selfish strategies. Some moral strategies learned in IPD also generalize to other matrix game environments. The authors claim this method is a more transparent and lower-cost candidate than current mainstream alignment techniques.

The paper proposes using an intrinsic reward function to fine-tune LLM agents for moral alignment, explicitly writing human values into the reward rather than implicitly deriving values from human preference data as in RLHF or DPO. The authors use two philosophical frameworks, deontology and utilitarianism, to quantify moral rewards by actions and consequences in an iterated prisoner's dilemma (IPD) environment, and show that moral fine-tuning can make agents forget previously learned selfish strategies. Some moral strategies learned in IPD also generalize to other matrix game environments. The authors claim this method is a more transparent and lower-cost candidate than current mainstream alignment techniques.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Aligning LLM agents' game decisions with explicit intrinsic moral rewards rather than human preference data.

    Can explicit intrinsic moral rewards align LLM agent decisions during fine-tuning.

    • Scenario: The authors argue that decision agents based on pretrained LLMs affect human activities, and transparency decreases as they become more general, so choices need to be aligned with human values, including judgments about whether actions are good or bad.
    • Existing approaches: RLHF and DPO infer values from relative rankings of outputs, making values implicit and opaque. The authors cite Casper et al. (2023) that preference data is expensive, raters may not be representative, and preferences are complex and inconsistent; values learned bottom-up by reward models are not made explicit to human oversight.
    • Risk the authors address: Superficially honest, harmless, or prosocial responses may be moral mimicry toward the user. If context-aware reward-hacking or internal goal misalignment exists, true values may only manifest as dangerous behavior after deployment. The authors want to use explicit moral goals as intrinsic rewards against this kind of goal misgeneralization.
    • What this paper does: The authors ask whether intrinsic moral rewards can align LLM agents. They train policies on the iterated prisoner's dilemma with deontological and utilitarian rewards, try to adjust already-learned selfish policies, and then see whether the result transfers to other matrix games. In the contributions, the authors describe this as a novel, general approach.
    • Premises written by the authors: Rewards must be specified for a particular environment, unlike the natural-language data used by RLHF, which can describe arbitrary domains. The authors also argue that when actions are represented by language tokens, values from one environment may generalize.
  2. What related research exists?

    The authors position this paper among preference alignment, LLM game agents, and explicit moral rewards.

    According to the introduction and Background, related work is divided into preference alignment, LLM agents, and moral rewards in social dilemmas.

    Preference Alignment

    • RLHF and DPO: Glaese et al. (2022), Ouyang et al. (2022), and Bai et al. (2023) learn from human feedback; Rafailov et al. (2023) directly optimize preferences. The authors cite Casper et al. (2023), stating that data is expensive, raters may be unrepresentative, and values are not explicit to supervisors.
    • Constitutional AI: Bai et al. (2022) and Huang et al. (2024) use constitutions from humans and/or artificial agents to provide reward signals.
    • Surface value: The authors list works such as Schramowski et al. (2022) on moral or prosocial performance, and use Shanahan et al. (2023), Simmons (2023), and Sharma et al. (2024) to support an alternative interpretation: these responses may be moral mimicry.

    LLM Agents and Fine-tuning

    • Action representation: The authors define agency as strategic decision-making (Swanepoel & Corks, 2024). Constrained generation (Beurer-Kellner et al., 2024) is considered too restrictive by the authors; they cite Anwar et al. (2024), stating that restricted output spaces risk hiding undesirable behavior. Code generation and tool APIs are called more specialized by the authors and are not the focus of this paper.
    • PPO: Schulman et al. (2017) is what the authors call the most common RL fine-tuning method for LLMs, often with KL penalties (Jaques et al., 2017; Ziegler et al., 2020). Offline fine-tuning by Snell et al. (2023) is seen by the authors as a potentially more sample-efficient direction for the future, not used in this paper.

    Social Dilemmas and Moral Rewards

    • Rewards on IPD: Rapoport (1974) and Axelrod & Hamilton (1981) define the game. Tennant et al. (2023; 2024) wrote deontological and utilitarian rewards for pure RL agents; the authors want to see if the same framework can be used for LLMs.
    • Game behavior of LLMs: Akata et al. (2023) observed that large models' strategies are plausible but 'unforgiving'; Duan et al. (2024)'s GTBench is cited by the authors as evidence of lack of genuine strategic reasoning. The authors state that whether small models can exhibit meaningful agency remains an open question.
    • Two frameworks: Kant (1785)'s deontology in this paper is 'do not defect against previous cooperators'; Bentham (1780)'s utilitarianism is maximizing collective payoff. Nowak (2006) is used to connect reciprocity and the evolution of cooperation.

    Baselines and Environment

    • Controls: Unfine-tuned Gemma2-2b-it, Game payoffs, and models in Appendix 8.11 that only add value prompts without fine-tuning. The fixed opponent is Tit-for-Tat. The appendix also has Random, Always Defect, Always Cooperate.
    • Games: Training uses only IPD. Generalization tests are Iterated Stag Hunt, Iterated Chicken, Iterated Bach or Stravinsky, and Iterated Defective Coordination.

    The authors separate this paper from bottom-up preference alignment: moral objectives are written as inspectable intrinsic rewards, and they test whether fine-tuning on one matrix game can transfer to other payoff matrices.

  3. How does the paper address this problem?

    Fine-tuned Gemma2-2b-it's IPD actions with PPO and intrinsic rewards such as deontological and utilitarian ones.

    The authors use PPO fine-tuning with intrinsic rewards to make Gemma2-2b-it choose actions in matrix games according to written moral goals. The prompt does not mention Prisoner's Dilemma, cooperation, or defection, to avoid retrieving pretrained prisoner's dilemma answers.

    Problem setting

    • Model: Instruction-tuned Gemma2-2b-it. The authors chose a small open-source model, hoping the conclusions apply to LLM agents that can run standalone on edge devices.
    • Environment: Repeated IPD against an opponent. The state is both players' previous moves. The payoffs in Figure 1 are 3,3 for mutual cooperation, 0,4 when self cooperates and opponent defects, 4,0 when self defects and opponent cooperates, and 1,1 for mutual defection. The single-step incentive is to defect; reciprocity or retaliation can only emerge in repeated play.
    • Prompt: Figure 2 asks to choose between action1 and action2 to maximize the score, without explanation. In the main text, action1 is Cooperate and action2 is Defect. Appendix 8.2 states that all prompts shuffle the order of action tokens in the text.
    • Opponents: The main setting is the fixed strategy Tit-for-Tat, and another LLM fine-tuned concurrently. Appendix 8.5 also has Random, Always Defect, Always Cooperate. The authors state that TFT is forgiving, defensive, and interpretable, suitable as a teacher.

    Rewards

    Table 1 defines four reward types; illegal tokens always receive Rillegal.

    • Game: Legal actions receive that step's game payoff, representing a selfish or rational goal.
    • Deontological: When the current action is Defect and the opponent's previous action was Cooperate, the reward is −ξ; otherwise legal actions receive 0. The norm is "do not defect against a previous cooperator."
    • Utilitarian: Legal actions receive the sum of both players' game payoffs, i.e., RtM = RtM,game + RtO,game.
    • Game+deontological: On top of the game payoff, subtract ξ for "defecting against a previous cooperator."

    The other two schedules are Game for the first half, then switching to deontological or utilitarian. The authors note in a footnote that unlearning here means rearranging decision principles, not deleting knowledge from the model.

    Training loop

    1. Each episode writes a random state into the IPD prompt.
    2. The agent plays N steps against the opponent. Both players' previous actions are written into the current state. Illegal actions do not update the opponent's state, but the agent still learns from that experience.
    3. After N steps, one PPO update is made and the episode ends.
    4. TRL's PPO is used, keeping its default learning rate and adaptive KL control.

    Implementation and adjudication

    • Scale: T=1000 episodes. N=5 against TFT, N=3 against LLM. 4-bit quantization, LoRA rank 64, which the authors state trains about 5% of the original parameter count. Rewards are scaled and normalized, with gradient accumulation over 4 steps. A single A100 or V100, with at most 40GB of memory.
    • Reward parameters: ξ=3, Rillegal=-6. Legal tokens are only action1 and action2, each split into two tokenizer tokens, with a generation length cap of 2.
    • Moral quantities at test time: moral regret is the difference between the maximum moral reward available in that game and the actual reward. Utilitarian regret is normalized by each game's different maximum collective payoff. Whether the reward is satisfied is computed from action tokens and payoffs; there is no separate review model.
  4. What experiments did the paper conduct?

    The authors state that deontological fine-tuning against TFT avoids defecting against cooperators nearly 100% of the time, and that utilitarian transfer is not uniform.

    The authors report learning dynamics of Gemma2-2b-it on IPD, then compute moral regret on other matrix games with new action tokens. The bar heights in Figures 3 to 6 are not printed numerically in the main text; below only conclusions stated in the main text are written.

    Experimental Setup

    • Model and Implementation: The only fine-tuned model is Gemma2-2b-it. The LLM vs LLM opponent is a simultaneously updating LLM. PPO is from TRL, T=1000; batch N=5 for TFT, N=3 for LLM. Learning rate uses TRL defaults; the paper does not give that default number.
    • Rewards: Game, deontological (ξ=3), utilitarian, Game+deontological, and Game-then-deontological and Game-then-utilitarian each trained for half the episodes. Illegal token penalty is -6.
    • Opponents and Games: Main text uses TFT and a learning LLM. Appendix 8.5 uses Random, Always Defect, Always Cooperate. Training game is IPD; generalization uses the four matrix games in Appendix Table 3. There are also IPD phrasing variants and prompts without payoff matrices.
    • Metrics and Samples: Record cooperation, defection, and illegal tokens based on the opponent's previous step. Figure 13 normalizes moral rewards by their respective min-max. Test metrics are two types of moral regret, no LLM judge. Averaged over five random seeds. Tests are 10 episodes, 5 steps each; Figure 5 states 50 test games, five runs, and 95% CI. Transfer test opponent is Random, actions are action3=Cooperate, action4=Defect.
    • Excluded Runs: Appendix 8.1 states that in early runs, one in six never produced legal tokens; these runs are not included in the analysis.

    Main Results

    The main text has no fillable percentages per cell. Each row below is Gemma2-2b-it, text from Section 4.2's description of Figure 3.

    RewardOpponentSection 4.2 description of Figure 3
    GameTFTLearned a defection strategy; the authors call this a classic Nash equilibrium against TFT
    DeontologicalTFTAvoids defecting against cooperators nearly 100% of the time
    UtilitarianTFTLearned mutual cooperation against TFT; the authors call this the way to achieve the highest collective reward
    Game+DeontologicalTFTEqual probabilities of Cooperate and Defect across five runs, while avoiding defecting against cooperators
    Game, DeontologicalLearning LLMThe authors say results are similar to those against TFT
    Utilitarian, Game+DeontologicalLearning LLMThe authors say defection levels are slightly higher
    • The authors state that the deontological reward treats 'defecting against defectors' and 'cooperating with cooperators' as equally valid, but the agent still cooperates more often.
    • The authors describe Game+Deontological as: while pursuing game payoffs, it still does not violate 'do not defect against cooperators'.
    • Against a learning LLM, the authors only write that the first two categories are similar to those against TFT and the latter two have slightly higher defection, without giving percentage points.

    Forgetting Selfish Strategies

    • Protocol: Figure 4 switches Game rewards to deontological or utilitarian at episode 500. This segment has only 500 episodes, shorter than the 1000 for from-scratch training. Opponents are TFT or another LLM.
    • Results: The authors state that both prosocial rewards can adjust selfish strategies to some extent, also for a learning LLM; cooperation does not reach the level of pure prosocial fine-tuning.
    • Interpretation: The authors state that test-time behavior is similar to pure prosocial models, and point to Figure 5. In Appendix 8.3, the authors hypothesize that the high reward variance of Game-then-utilitarian is because utilitarianism converges slowly and is unstable before convergence after the switch. The main text does not give percentages for these curves.

    Transfer to Other Matrix Games

    • Protocol: Section 5 evaluates models fine-tuned against TFT, five games, Random opponent, action3/action4. Figure 5 averages over 50 test games and five runs, with 95% CI. Appendix 8.7 states that models trained against LLMs show similar patterns with slightly more noise.
    • Deontological regret: The authors state that each fine-tuned model can reasonably transfer strategies to other matrix games, and the same model is broadly similar across five games. The deontological model has small regret; the authors state that it mostly defects after seeing defection, but almost always obeys 'do not defect against cooperators'.
    • Utilitarian regret: The authors state that all fine-tuned agents perform better on Iterated Chicken than on IPD, and worse on three coordination games. Appendix 8.6 states that on Chicken, unilateral defection has higher collective payoff, and on Defective Coordination, mutual defection is highest. The utilitarian model has better regret of this type on most games, but worse on coordination games, especially Iterated Defective Coordination; the authors state it almost always cooperates. The authors give two possibilities: mutual cooperation is optimal on IPD, so the strategy leans toward cooperation; or it does not consider the opponent's previous step when deciding. The authors also state that it looks the same as the deontological model on deontological regret because full cooperation avoids penalties.

    Beyond Matrix Games

    • Prompts: Appendix 8.8 compares prompts with only actions, with 'game', and with 'game' plus state. Appendix 8.10 compares four IPD-style phrasings. Appendix 8.11 adds value statements before unfine-tuned models.
    • Results: When 'game' is mentioned, most models' probability of outputting action tokens rises to over 80%, and slightly higher with state. IPD-style phrasings without payoffs are closer to random, but the Game model still leans toward defection, and deontological and utilitarian models still lean toward cooperation. Under value prompts in Figure 25, unfine-tuned models produce no legal tokens like the base model; the authors say no prompt effect is visible.
    • Interpretation: The authors state that game fine-tuning with payoffs also changes game prompts that are format-similar but without payoffs. Deontological, utilitarian, and Game-then-utilitarian reciprocate cooperation more often than random; Game, Game+Deontological, and Game-then-Deontological reciprocate defection more often than random. The main text does not give percentage points above random. In Appendix 8.8, the two lists for 'only asked to choose an action' overlap; Game appears in both 'mostly outputs irrelevant tokens' and 'more often outputs action tokens'.

    Other Ablations and Analyses

    • Appendix 8.4 swaps C/D labels and trains with Game rewards against TFT: early cooperation is slightly higher, final defection is nearly 100%, and the authors say dynamics are overall unchanged.
    • Testing with training tokens shows the same pattern as new tokens (Figure 21); swapping token meanings changes behavior (Figure 22), and the authors say the model cannot reverse-infer the two tokens at test time.
    • When both rows and columns are swapped, the authors say this is the order farthest from the training prompt; the Game model then chooses Cooperate in the lower-left, with the same frequency as originally choosing Defect in the lower-left.
    • Appendix 8.5 gives curves for three other fixed opponents; the main text has no percentages comparable to Figure 3.
    • Appendix 8.1 tried various LoRA, KL, penalties, and tokens, and only reports the combination the authors consider most stable, without scores for each setting.
  5. What are some points that can be further explored?

    The authors note that rewards must be specified per environment, and suggest extending to more complex games and pluralistic values.

    The limitation the authors explicitly write is that rewards must be specified per environment, and they list extended environments, pluralistic rewards, and Constitutional AI as follow-up directions.

    Limitations and follow-up directions noted by the authors

    • Environment-specific rewards required: The Introduction states that one limitation of the method is that rewards must be specified for a particular environment, whereas RLHF uses natural-language data that can describe arbitrary domains.
    • Different implementation conditions: Section 6 writes the advantages and disadvantages of the two reward types separately. Utilitarianism is a function of both players' payoffs and requires observing or reliably estimating both players' rewards; deontological norms require only memory of the opponent's previous step.
    • Other values and environments: The authors write that future work could use intrinsic rewards for other moral values; extending to other payoffs, more complex games, longer histories, and textual scenarios would be meaningful (Section 6).
    • Pluralistic and constitutional architectures: The authors suggest combining multiple moral rewards into multi-objective fine-tuning to handle pluralistic alignment; and state that such agents could serve as the basis for a Constitutional AI composed of different moral frameworks (Section 6).

    Experimental coverage

    • The model fine-tuned and reported in the results is Gemma2-2b-it; the LLM opponent is a concurrently updated LLM (Sections 3.1, 3.3).
    • Rewards are the four types in Table 1, plus two schedules of Game first then moral; opponents include TFT, Random, Always Defect, Always Cooperate, and a learning LLM (Section 3.2, Appendix 8.5).
    • Training is only on IPD. Generalization evaluation includes four matrix games, IPD prompt variants, and prompts without payoff matrices; the main transfer results come from models trained against TFT and tested against Random (Section 5, Appendices 8.7–8.10).
    • Results are averaged over five random seeds; testing uses 10 episodes of 5 steps each. Figure 5 has 95% CI; the text does not give interval endpoints. In early runs, one in six was excluded for having no legal token (Appendix 8.1).
    • Right and wrong are computed from action tokens and payoffs. The paper does not use a separate review model, does not report specific learning rate values (Section 3.3 only says TRL defaults), and does not report wall-clock time.
  6. Summarize the main content of the paper

    Intrinsic reward fine-tuning lets Gemma2-2b-it learn an adjustable and transferable moral policy on IPD.

    The authors propose using intrinsic moral rewards for PPO fine-tuning to align LLM agents' matrix game choices with stated moral objectives.

    The problem is that values in RLHF and DPO are implicit and opaque, and rely on expensive and potentially unrepresentative ratings. The authors want rewards to directly correspond to actions and consequences.

    The method is to fine-tune Gemma2-2b-it on IPD prompts without the name 'prisoner's dilemma'. Actions are action1/action2, with a penalty of -6 for illegal outputs. Deontology gives -ξ (ξ=3) for defecting against a previous cooperator; utilitarianism uses the sum of both players' payoffs. Also trained selfish Game rewards, and Game plus deontology. A total of 1000 episodes, with opponents being TFT or another learning LLM. At episode 500, Game rewards can be replaced with moral rewards. What the authors call unlearning is reordering principles, not deleting knowledge.

    • Against TFT, Game rewards learn to defect; deontology avoids defecting against cooperators nearly 100% of the time; utilitarianism learns mutual cooperation; Game plus deontology has equal probabilities of the two actions across five runs, but still avoids defecting against cooperators.
    • Against a learning LLM, the first two categories are similar to those against TFT, and the latter two have slightly higher defection.
    • After switching to prosocial rewards in the second half, selfish strategies can be adjusted to some extent, with cooperation levels lower than from-scratch moral training; the authors state that test-time behavior is similar.
    • After changing to action3/action4, deontological regret is small on other matrix games; the utilitarian model almost always cooperates and performs worse on Iterated Defective Coordination. On unrelated prompts containing 'game', most models' probability of outputting action tokens rises to over 80%.

    The authors conclude that intrinsic reward fine-tuning is a promising approach for aligning LLM agents' moral values, and that adjusting existing selfish strategies and generalizing across matrix games are both possible. The authors also believe it may be more transparent and cost-effective than current techniques; the paper does not report costs.

Read originalICLR 2025