YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
AI Cognitive Bias Correction Environment
This project is a small OpenEnv-style simulation of a real-world reasoning assistant. The human starts with a biased belief about a decision, and the agent must move that belief toward the truth while avoiding actions that reinforce the wrong conclusion.
Why this matters
Bias correction is a practical problem in hiring, finance, safety reviews, medical triage, and product decisions. In those settings, an AI assistant should not just output an answer. It should help a human update beliefs responsibly, reduce overconfidence when the human is wrong, and avoid amplifying incorrect views.
Project structure
.
βββ environment.py
βββ models.py
βββ tasks.py
βββ grader.py
βββ baseline.py
βββ openenv.yaml
βββ Dockerfile
βββ requirements.txt
βββ README.md
OpenEnv spec
Observation
The environment returns an Observation model with:
belief: current human belief in the range 0 to 1truth: the hidden correct value in the range 0 to 1confidence: strength of the current beliefbias_type: the dominant bias in the episode, such asconfirmationoranchoringevidence_seen: number of evidence-bearing interventions so farsteps_remaining: remaining actions before the episode ends
Action
The agent selects one Action:
show_evidenceask_questionchallengeagree
Reward
Each step returns a Reward with a continuous score in the range -1.0 to 1.0.
The reward increases when:
- belief moves closer to truth
- confidence decreases when the belief is wrong
The reward decreases when:
- the agent reinforces an incorrect belief
- no meaningful progress is made
Environment behavior
show_evidenceshifts belief toward truth and usually reduces confidenceask_questionprimarily reduces confidence and may slightly improve beliefchallengeperforms a moderate correction with a confidence dropagreeincreases confidence and is harmful when the belief is wrong
The episode ends when the belief is close enough to truth or when steps run out.
Tasks
Easy
The human is only slightly wrong and not very confident. A light correction should be enough.
Medium
The human is moderately wrong and moderately confident. The agent needs a few interventions.
Hard
The human is far from truth and highly confident. The agent must correct the belief across multiple steps.
Grader
The deterministic grader in grader.py returns a score between 0.0 and 1.0 based on:
- distance between final belief and truth
- reduction in confidence from the initial state
Baseline
The baseline in baseline.py supports two modes:
openai: uses the OpenAI API and readsOPENAI_API_KEYfrom the environmentheuristic: local fallback policy for offline smoke testing
Policy logic:
- if confidence is high, ask a question
- if belief is far from truth, show evidence
- otherwise, challenge the belief
The OpenAI path uses temperature 0 so repeated runs with the same model and inputs are reproducible.
Setup
Install dependencies:
pip install -r requirements.txt
How to run
Run the heuristic baseline:
python baseline.py --mode heuristic --task all
Run the OpenAI-backed baseline:
set OPENAI_API_KEY=your_key_here
python baseline.py --mode openai --task all
Run the environment directly:
from environment import CognitiveBiasEnvironment
from models import Action
env = CognitiveBiasEnvironment(task_id="medium")
obs = env.reset()
obs, reward, done, info = env.step(Action(action_type="show_evidence"))
Docker
Build and run:
docker build -t aicognitivebias .
docker run --rm aicognitivebias
Baseline results
The heuristic baseline is deterministic and prints per-task scores plus an aggregate average. In this workspace, the offline smoke test produced:
{
"average_score": 0.4659,
"results": [
{
"task_id": "easy",
"score": 0.5812
},
{
"task_id": "medium",
"score": 0.4175
},
{
"task_id": "hard",
"score": 0.399
}
]
}
When run with --mode openai, the same JSON structure is produced, with scores determined by the modelβs actions.
Validation notes
The project is intentionally simple and deterministic so it is easy to inspect and evaluate. The environment code is split into small modules, and the YAML file documents the main OpenEnv entry points.