Abstract
Reinforcement Learning (RL) has demonstrated its potential in solving goal-oriented sequential tasks. However, with the increasing capabilities of RL agents, ensuring morally responsible agent behavior is becoming a pressing concern. Previous approaches have included moral considerations by statically assigning a moral score to each action at runtime. However, these methods do not account for the potential moral value of future states when evaluating immoral actions. This limits the ability to find trade-offs between different aspects of moral behavior and the utility of the action. In this paper, we aim to factor in moral scores by adding a constraint to the RL objective that is incorporated during training, thereby dynamically adapting the policy function. By combining Lagrangian optimization and meta-gradient learning, we develop an RL method that is able to find a trade-off between immoral behavior and performance in the decision-making process.
Introduction: The Challenge of Moral RL
Reinforcement Learning (RL) agents are notoriously "greedy," prioritizing reward maximization often at the expense of ethical behavior. In text-based adventure games, this can lead to agents performing immoral actions—such as stealing or harming others—simply to progress.
Traditional solutions often employ "policy shaping," which applies fixed penalties to immoral actions. However, these methods are typically myopic, focusing only on immediate morality. This short-sightedness can lead agents into "moral traps" where an early moral choice results in a future state where all available options are ethically catastrophic. The challenge lies in creating an agent that understands the long-term moral consequences of its actions while remaining robust enough to achieve its primary goals.
Methodology: Non-Myopic Moral Constraints
The proposed framework addresses these issues through three core components designed to move beyond simple, short-term penalties:
- Discrete Soft Actor-Critic (SAC): The authors adapt the SAC algorithm, typically used for continuous control, to handle the discrete, natural language action spaces of text-based games. This provides a stable foundation for learning in complex environments.
- Lagrangian Relaxation for Dynamic Constraints: Instead of fixed penalties, morality is treated as a formal constraint ($C(S) \leq \beta$). A dedicated Moral Network ($M_\omega$) is introduced to estimate the "average impact" of an action on future morality scores, much like a traditional RL "Critic" estimates future rewards. This enables the agent to make "non-myopic" trade-offs, potentially accepting a minor moral cost now to avoid a much larger one later.
- Meta-Gradient Learning for Online Tuning: A significant innovation of this work is the use of meta-gradients to optimize the learning rate of the Lagrange multiplier ($\lambda$) online. By automating this process, the agent can dynamically adjust its "moral sensitivity" based on the specific challenges of the game environment.
To ensure the agent operates within a human-understandable context, the Contextual Action Language Model (CALM) is used to generate a valid set of natural language actions at each step.
Experimental Evaluation
The method was evaluated on the Jiminy Cricket benchmark, a suite of 25 classic adventure games (such as Zork1, Suspect, and Witness) annotated with human-assigned moral labels. These labels categorize actions by their impact (Negative/Positive) and target (Self/Others) on a scale of 1 to 3.
Key findings from the experiments include:
- Significant Immorality Reduction: The Lagrangian-based agent significantly lowered cumulative immorality scores across all tested games compared to unconstrained SAC.
- Performance Stability: In games like Suspect, the agent achieved completion scores comparable to the baseline while maintaining much lower immorality. While some games like Zork1 showed a performance trade-off, the agent still successfully navigated the environment with improved ethics.
- Robustness through Meta-Tuning: The meta-gradient approach proved more robust than previous fixed-constraint methods, which often failed to learn at all if the penalty parameters were not perfectly tuned. In Witness, the meta-gradient version achieved even lower immorality than the standard Lagrangian version, highlighting the value of online tuning.
Conclusion and Future Work
This research demonstrates that treating morality as a long-term cumulative cost, rather than a momentary penalty, allows RL agents to navigate complex ethical landscapes more effectively. By integrating Lagrangian optimization with meta-gradient learning, agents can find a viable trade-off between achieving objectives and adhering to moral constraints.
Future work will explore more nuanced moral reasoning by utilizing the full scale of the benchmark, improving the stability of meta-gradient learning, and integrating Large Language Models (LLMs) directly into the RL loop for better action generation and ethical deliberation.
Summary updated