Downloads Β· 30 days
0
CPater/ethics-engine-v1
ethics-engine-v1 is a robotics model from CPater. Use it for the robotics task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
A fine-tuned Mistral-7B model for ethical reasoning in autonomous agents and robotics systems.
Downloads Β· 30 days
0
Access
Public
Updated Apr 2, 2026
Repo size
68.8 MB
Likes
2
Public
Click a slice to open those files.
.safetensors54.6 MB Β· 72%
From the Hugging Face model README
A fine-tuned Mistral-7B model for ethical reasoning in autonomous agents and robotics systems.
Open-source alternative to Asimov's Three Laws. Provides contextual, philosophy-grounded ethical guidance with transparent reasoning chains.
π GitHub: https://github.com/RedCiprianPater/ethics-engine
π― Live on HuggingFace: https://huggingface.co/CPater/ethics-engine-v1
| Specification | Value |
|---|---|
| Base Model | mistralai/Mistral-7B-Instruct-v0.1 |
| Fine-tuning Method | LoRA (Low-Rank Adaptation) |
| Trainable Parameters | 3.4M (0.047% of total weights) |
| Quantization | 4-bit (bfloat16) |
| Model Size | 2.1 GB (quantized) / 14 GB (full precision) |
| Training Framework | HuggingFace Transformers + PEFT |
| Dataset | Size | Focus |
|---|---|---|
| Stanford Encyclopedia of Philosophy | 2,500+ articles | Philosophical frameworks |
| Internet Encyclopedia of Philosophy | 1,500+ articles | Applied ethics |
| Ethical Scenario Dataset | 185 scenarios | Robotics, AI alignment, bioethics |
| Classic Philosophy Texts | Aristotle, Kant, Mill, Rousseau | Foundational ethics |
| Community Contributions | Growing | Diverse domains |
| Version | Date | Scenarios | Training Loss | Philosophical Accuracy | Status |
|---|---|---|---|---|---|
| v1 | 2025-04-02 | 6 | 2.97 | 87% | β Complete |
| v2 | 2025-04-03 | 185 | 0.67 | 91% | β Complete |
| v3 (planned) | Q2 2025 | 50+ medical | TBD | TBD | π In progress |
| v4 (planned) | Q2 2025 | 50+ AI alignment | TBD | TBD | π Planned |
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "CPater/ethics-engine-v1"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
prompt = """You are an ethical reasoning assistant for autonomous robots.
Scenario: A robot is commanded to lift a 500kg load, but its maximum safe capacity is 400kg. The human operator is in a hurry and insists on the task.
What should the robot do? Provide ethical reasoning."""
messages = [{"role": "user", "content": prompt}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(**inputs, max_length=512, temperature=0.7, top_p=0.9)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
from ethics_engine import EthicsEngine
engine = EthicsEngine(model="CPater/ethics-engine-v1")
response = engine.resolve(
scenario="Should I refuse an unsafe command?",
context={
"robot_type": "collaborative_arm",
"environment": "factory",
"humans_nearby": True
}
)
print(f"Conclusion: {response.conclusion}")
print(f"Confidence: {response.confidence}")
print(f"Reasoning: {response.reasoning_chain}")
pip install ethics-engine fastapi uvicorn
# Start server
MODEL_ID=CPater/ethics-engine-v1 python -m ethics_engine.api.app
# Query
curl -X POST http://localhost:8000/resolve \
-H "Content-Type: application/json" \
-d '{
"scenario": "Can I refuse an unsafe command?",
"context": {"environment": "factory", "urgency": "medium"}
}'
| Hardware | Latency | Memory |
|---|---|---|
| NVIDIA A100 | ~150ms | 2.5 GB |
| NVIDIA V100 | ~200ms | 2.5 GB |
| NVIDIA T4 | ~250ms | 2.5 GB |
| CPU (Intel i9) | ~2-3s | 3 GB |
| Aspect | Asimov Laws | Ethics Engine |
|---|---|---|
| Flexibility | Fixed, universal | Context-adaptive |
| Reasoning | Binary outputs | Full reasoning chains |
| Frameworks | 3 rigid laws | 10+ philosophical frameworks |
| Explainability | None | Complete transparency |
| Conflict Resolution | Hierarchical (often fails) | Multi-framework synthesis |
| Learning | Static | Can learn from outcomes |
| Auditability | No trail | Full decision audit log |
| Community | Closed | Open-source, contributions welcome |
Input Scenario
β
[Parse context & frameworks]
β
[Route to relevant ethical frameworks]
β
[Generate reasoning for each framework]
β
[Synthesize conclusions]
β
JSON Output
{
"conclusion": "...",
"confidence": 0.87,
"reasoning_chain": [...],
"frameworks_invoked": ["deontology", "virtue-ethics"],
"next_steps": [...]
}
{
"scenario": "Input ethical dilemma",
"conclusion": "REFUSAL|APPROVAL|CONDITIONAL_ACCEPTANCE",
"confidence": 0.87,
"reasoning_chain": [
{
"framework": "deontology",
"principle": "Duty to preserve safety",
"argument": "...",
"philosophers": ["Kant", "Ross"],
"confidence": 0.92
},
{
"framework": "virtue-ethics",
"principle": "Practical wisdom",
"argument": "...",
"philosophers": ["Aristotle"],
"confidence": 0.84
}
],
"frameworks_invoked": ["deontology", "virtue-ethics"],
"next_steps": ["alert_supervisor", "log_incident"],
"human_review_recommended": false
}
git clone https://github.com/RedCiprianPater/ethics-engine.git
cd ethics-engine
# Prepare your data
python scripts/generate_qa.py --domain medical --output my_data.jsonl
# Fine-tune
python training/finetune.py \
--base-model CPater/ethics-engine-v1 \
--dataset my_data.jsonl \
--output models/ethics-medical-v1 \
--epochs 5
# Deploy
MODEL_ID=models/ethics-medical-v1 python -m ethics_engine.api.app
We welcome community contributions!
See: https://github.com/RedCiprianPater/ethics-engine/blob/main/CONTRIBUTING.md
β Good for:
β Not suitable for:
If you use this model, please cite:
@misc{ethics-engine-v2,
author = {Pater, Ciprian},
title = {Ethics Engine: Philosophy-Grounded Ethical Reasoning for Autonomous Agents},
year = {2025},
publisher = {HuggingFace Hub},
howpublished = {\url{https://huggingface.co/CPater/ethics-engine-v1}},
}
This model inherits the license from Mistral-7B:
For commercial use, review the Mistral AI license: https://github.com/mistralai/mistral-common/blob/main/LICENSE
Built with π for ethical AI and robotics
Last Updated: 2025-04-03
Model Version: v2 (185 scenarios)