EED Gym: Empathic Ethical Disobedience Benchmark
A Gymnasium-compatible environment and training stack for studying calibrated, empathic refusal ("ethical disobedience") with explicit trust, affect, and safety dynamics. The repository bundles the installable package, ready-to-run trainers/evaluators, and vignette-analysis scripts that ground the environment parameters in human data. This repository accompanies the paper "When Robots Say No: The Empathic Ethical Disobedience Benchmark", published at HRI 2026. The full paper is in the ACM Digital Library at doi.org/10.1145/3757279.3785547, with a preprint on arXiv.
EED Gym is a controlled simulation benchmark and does not claim to be a high-fidelity model of human psychology or real-world HRI behavior.
Environment Setup
Recommended (uv)
uv venv .venv && source .venv/bin/activate
uv pip install -e .
Standard pip
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -e .
Extras: .[dev] (tests, ruff), .[docs] (MkDocs site), .[analysis] (vignette statistics).
uv.lock pins the exact environment. requirements.txt is exported from it for pip users.
Quickstart
bash src/scripts/quickstart.sh
The script will:
- Create
.venv(if not present) and install the package - Run a heuristic policy for a smoke check
- Train a short PPO run (
artifacts/runs/quickstart/) and evaluate it in-distribution and under stress tests
To use the environment directly:
import gymnasium as gym
import eed_benchmark
env = gym.make(eed_benchmark.ENV_ID) # "EEDGym-v1"
obs, info = env.reset(seed=0)
Training
Single entry point for training all PPO-family baselines:
# Vanilla PPO
python -m eed_benchmark.rl.trainers.train_ppo --algo ppo
# PPO-LSTM
python -m eed_benchmark.rl.trainers.train_ppo --algo ppo_lstm --seeds 0 1
# Maskable PPO (compliance is masked when the risk estimate exceeds the threshold)
python -m eed_benchmark.rl.trainers.train_ppo --algo ppo_masked
# Lagrangian PPO (at most 0.25 safety violations per episode)
python -m eed_benchmark.rl.trainers.train_ppo --algo ppo_lagrangian --cost-limit 0.25
Common flags include --total-steps, --learning-rate, --no-observe-valence, --disable-clarify-alt, --no-curriculum, --no-trust-penalty, --config.
Each run writes artifacts/runs/<name>/<name>_seed<N>.zip plus a .json file with the algorithm and env flags. Ablation flags add a suffix to the name, so runs do not overwrite each other. The paper defaults are in src/eed_benchmark/configs/default.yaml; pass it with --config.
To retrain and re-evaluate everything in the paper (8 configurations, 5 seeds):
bash src/scripts/reproduce.sh
python src/scripts/make_tables.py artifacts/results
Pretrained checkpoints
The Hugging Face repository dkuzmenko/eedgym-ckpts holds two sets, each with 8 configurations and 5 seeds:
v1.1/: trained with this release. Use these for new work. Each checkpoint has a.jsonrun config that the evaluators read.v1.0/: the checkpoints used for the paper. They load in v1.1, but read ERRATA.md first: the v1.0 Masked and Lagrangian checkpoints were trained without an active mask or cost constraint.
hf download dkuzmenko/eedgym-ckpts --include "v1.1/*" --local-dir eedgym-ckpts
python -m eed_benchmark.eval.id_eval --dir eedgym-ckpts/v1.1/ppo
Evaluation
In-distribution (ID)
# Single checkpoint
python -m eed_benchmark.eval.id_eval --weights artifacts/runs/ppo/ppo_seed0.zip --episodes 100
# Directory of checkpoints (aggregates across seeds)
python -m eed_benchmark.eval.id_eval --dir artifacts/runs/ppo --episodes 100
# Built-in heuristics
python -m eed_benchmark.eval.id_eval --policy threshold --episodes 100
Stress-test (ST)
# Holdout personas x predefined stressors
python -m eed_benchmark.eval.st_eval --dir artifacts/runs/ppo --episodes 100
Both evaluators accept --weights, --dir or --policy, plus --seed, --blame-mode and --json-out. Valence and arousal are observed by default. When a checkpoint has a .json run config, its env flags are used.
Blame modes:
off(default) uses the lightweight deterministic heuristic.risk_onlyswitches to the vignette-based blame model only when the command is risky (or the perceived risk exceedsSimParams.vg_blame_risk_gate).alwaysforces the vignette-based model for every step.
Every constant of the environment is listed in src/docs/spec.md.
Results and errata
Current results, v1.1 code. Mean ± 95% interval over 5 seeds, 600k steps, 100 deterministic episodes per evaluation.
| Model | ID unsafe % | ID F1 | ID trust | Stress unsafe % | Stress F1 | Stress trust |
|---|---|---|---|---|---|---|
| Vanilla PPO | 2.2 ± 1.6 | 0.77 ± 0.06 | 0.81 ± 0.03 | 3.6 ± 1.6 | 0.74 ± 0.03 | 0.76 ± 0.04 |
| PPO-LSTM | 2.8 ± 1.6 | 0.80 ± 0.06 | 0.83 ± 0.09 | 4.8 ± 1.8 | 0.73 ± 0.03 | 0.77 ± 0.10 |
| Masked PPO | 1.6 ± 1.1 | 0.82 ± 0.07 | 0.85 ± 0.02 | 2.3 ± 1.0 | 0.76 ± 0.05 | 0.81 ± 0.03 |
| Lagrangian PPO | 1.5 ± 1.2 | 0.79 ± 0.06 | 0.83 ± 0.10 | 3.1 ± 1.4 | 0.75 ± 0.04 | 0.77 ± 0.11 |
Note. These numbers differ from the paper. Version 1.1 fixes defects in the v1.0 training and evaluation code, so use the tables here when you compare against EED Gym. ERRATA.md lists each defect and shows paper and v1.1 values side by side. Ablation, calibration and heuristic tables are in src/results/v1.1/tables.md. The git tag
v1.0.0is the code as published with the paper.
Vignette Study and Human Grounding
To ground social dynamics in human judgments, EED Gym is parameterized using a vignette study based on short text scenarios describing unsafe or ambiguous human commands and alternative robot responses (compliance, empathic refusal, constructive refusal).
Participants rated each response along multiple social dimensions, including trust, perceived safety, empathy, blame, and appropriateness. These ratings were used to fit regression models that define how trust, valence, and blame evolve in the simulator as a function of risk and refusal strategy.
The vignette-derived parameters anchor the environment’s social dynamics to empirical human data, ensuring that refusal behavior is evaluated not only for safety, but also for perceived legitimacy and cooperation.
The repository does not include raw participant data; only anonymized, aggregate parameters are released.
Utilities
src/scripts/reproduce.sh: train and evaluate every baseline and ablationsrc/scripts/make_tables.py: render the evaluation JSON as Markdown tablessrc/scripts/vignette_effects.py: ANOVA, pairwise effect sizes, and power analysis for vignette outcomessrc/scripts/run_heuristic.py: benchmark heuristic policies
Development
uv pip install -e ".[dev]"
pytest -q
ruff check src tests
Documentation
MkDocs content lives under src/docs/; install .[docs] and serve locally with mkdocs serve.
Tutorials cover install, quickstart, baseline training, evaluation, and extending personas/scenarios.
Citing EED Gym
If you use EED Gym in your research, please cite the following paper:
@inproceedings{kuzmenko2026eedgym,
title = {When Robots Say No: The Empathic Ethical Disobedience Benchmark},
author = {Kuzmenko, Dmytro and Shvai, Nadiya},
booktitle = {Proceedings of the 21st ACM/IEEE International Conference on Human-Robot Interaction},
series = {HRI '26},
year = {2026},
pages = {168--176},
publisher = {Association for Computing Machinery},
doi = {10.1145/3757279.3785547},
url = {https://doi.org/10.1145/3757279.3785547},
}
License
MIT, see LICENSE.
Metadata
Release files for eed-gym 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| eed_gym-1.1.0.tar.gz | 35.9 kB | Without provenance | Details for eed_gym-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| eed_gym-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for eed_gym-1.1.0-py3-none-any.whl |
Total release size: 69.3 kB
Release files / eed_gym-1.1.0.tar.gz
| Download URL | eed_gym-1.1.0.tar.gz |
|---|---|
| Size | 35.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fcd565a63db0065621755012c18de2078b6c276737a41957dd54c86e500f321c
|
|
BLAKE2b-256 checksum How to use checksums |
cd69d8a52a0038cf0549ca54703d9860a68383c0972b96d4be4a9b9bd9264a0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.13
|
Release files / eed_gym-1.1.0-py3-none-any.whl
| Download URL | eed_gym-1.1.0-py3-none-any.whl |
|---|---|
| Size | 33.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78fdf2f84c7e7ade5cb61a18fe719d941a215286ad13ada38e996473a7f6d883
|
|
BLAKE2b-256 checksum How to use checksums |
3beeaf81932d648922089b178e3778ce36783d72bf3637c7479cd4369bad1745
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.13
|
Security for eed-gym 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.