-
Notifications
You must be signed in to change notification settings - Fork 0
KlepEthics
The KLEPEthics module is an experimental feature of the KLEP system, designed to introduce ethical considerations into AI decision-making. While the current implementation utilizes a utilitarian framework, the design philosophy behind KLEPEthics aims to maintain openness and flexibility. The goal is to allow developers and researchers to implement any ethical or moral system to evaluate actions, keys, or events within the KLEP ecosystem.
-
🧠 Flexibility in Moral Systems:
- While utilitarianism is currently implemented, this is not a limitation.
- The framework can be adapted to support other ethical models, such as:
- Deontology: Evaluating actions against a set of rules.
- Virtue Ethics: Considering character traits and moral development.
- Relativism: Allowing contextual morality based on game scenarios.
- Ethical Pluralism: Combining multiple ethical theories to create complex behavior patterns.
-
⚖️ Why Utilitarianism First?
- Utilitarianism is a natural fit for code, as it quantifies good and bad outcomes.
- Works well with utility-based AI agents, where actions can be ranked by their perceived benefit or harm.
- However, the infrastructure is built to allow expansion, ensuring that utilitarianism is a starting point, not a final destination.
public struct EthicalRule
{
public string Description; // Describes the ethical rule (e.g., "Harm to own team")
public float UtilityValue; // Positive for good outcomes, negative for bad ones
}
-
Description:
- Text-based representation of the ethical rule.
- Can be matched against action descriptions to evaluate behavior.
- In future implementations, could be extended to handle more complex evaluations (e.g., rule-based ethics, emergent behaviors).
-
UtilityValue:
- Represents the ethical weight of an action or event.
- Positive values indicate ethical desirability, while negative values represent ethical deterrence.
- Though currently a single float, this could evolve to handle multidimensional evaluations, such as ethical impact vs. emotional impact.
void Start()
{
ethicalRules.Add(new EthicalRule { Description = "Harm to own team", UtilityValue = -2.0f });
ethicalRules.Add(new EthicalRule { Description = "Harm to other team", UtilityValue = -1.0f });
ethicalRules.Add(new EthicalRule { Description = "Benefit to own team", UtilityValue = 2.0f });
ethicalRules.Add(new EthicalRule { Description = "Benefit to other team", UtilityValue = 1.0f });
}
-
Demonstrates a basic utilitarian approach, with positive and negative weights assigned to actions.
-
Example Rules:
- "Harm to own team": Highly undesirable (-2.0).
- "Harm to other team": Less undesirable (-1.0).
- "Benefit to own team": Highly desirable (2.0).
- "Benefit to other team": Moderately desirable (1.0).
-
Future Customization:
- The framework is open to adding new rules or switching to entirely different ethical evaluations, allowing dynamic rule sets during runtime.
public Vector2 EvaluateAction(string actionDescription)
{
Vector2 emotionImpact = Vector2.zero;
foreach (var rule in ethicalRules)
{
if (actionDescription.Contains(rule.Description))
{
emotionImpact += new Vector2(rule.UtilityValue, Mathf.Abs(rule.UtilityValue));
}
}
return emotionImpact.normalized; // Normalize to maintain consistent scale
}
-
Current Implementation:
- Matches action descriptions against ethical rules using simple string matching.
-
Generates an
emotionImpact
vector, influencing AI behavior.
-
Design Intent:
- The logic could be extended to evaluate complex scenarios, such as:
- Multiple ethical systems in parallel.
- Contextual ethics, where morality changes based on the environment or situation.
- Machine learning integrations, allowing the AI to develop its own ethical understanding through reinforcement learning.
- The logic could be extended to evaluate complex scenarios, such as:
An NPC considers the action: "Attack an enemy while in close proximity to allies."
-
Utilitarian Evaluation:
-
Evaluates both positive and negative impacts:
- Negative: "Harm to own team" (-2.0).
- Positive: "Harm to other team" (-1.0).
- Combined impact: (-3.0, 3.0) before normalization.
-
Evaluates both positive and negative impacts:
-
Alternative Ethical Approach:
- Using a deontological model, the NPC might refuse to attack if a rule prohibits friendly fire, regardless of utility.
- With virtue ethics, the NPC might choose bravery over safety, prioritizing valor over strict cost-benefit analysis.
- KLEPEthics is not bound to a single ethical framework. The utilitarian model is only one example of what is possible.
- The system is open-ended, allowing for the implementation of any moral or ethical theory.
- Designers and developers can choose or develop ethical systems that best fit their project goals, from games to research applications.
- The API will remain agnostic to the specific ethical model, focusing on evaluating actions and delivering assessments to influence agent behavior.
- Implement modular plugins for different ethical models.
- Allow runtime swapping of ethical frameworks, enabling dynamic behavior changes.
- Explore adaptive ethics, where agents learn and modify their moral compass over time.
Would you like to see specific ethical models implemented, or explore experimental approaches, such as emergent morality through AI learning? 😊