CoolFace
Apppublic

utkarsh-goel-21/misinfo-containment-env

sourceHugging Facemitupdated 6mo agoView on Hugging Face
1likes
App README

SENTINEL-9: Misinformation Containment Benchmark

![OpenEnv Compatible](https://openenv.ai) ![Python 3.11](https://python.org) ![Tests]()

An adversarial POMDP benchmark where AI agents must detect, trace, and contain misinformation spreading through simulated social networks. Built for the OpenEnv Global Hackathon.


Why This Environment?

Misinformation containment is a real-world, high-stakes problem faced by platforms, governments, and civil society. This environment simulates the core challenge: an agent operates under partial observability, limited budget, and adversarial pressure from reactive bot networks that evolve in response to the agent's actions.

What makes SENTINEL-9 genuinely hard:

  • β€”πŸ” Fog-of-war POMDP β€” Agent only sees nodes it has inspected
  • β€”πŸ“Š 5-tier deceptive content β€” From blatant ALL CAPS to nearly undetectable stealth posts
  • β€”πŸŽ― Brier calibration scoring β€” Overconfidence on wrong actions = catastrophic quadratic penalty
  • β€”πŸ€– Adversarial bot network β€” Bots evade detection when public outrage rises
  • β€”πŸ’° Resource management β€” Limited budget forces strategic action prioritization
  • β€”πŸ“ˆ SIR dynamics β€” Nodes recover, creating temporal reasoning challenges
  • β€”πŸŒ Dynamic topology β€” Network structure shifts as users migrate from quarantined nodes

Three Tasks (Easy β†’ Medium β†’ Hard)

Task 1 β€” Detection (Easy)

PropertyValue
Network40 nodes, Watts-Strogatz
Max steps10
SpreadFrozen
Allowed actionsinspect, quarantine
Key challenge~30% false positive rate in stream reports

Grading: Score = (TPR Γ— 0.50) βˆ’ (FPR Γ— 0.20) βˆ’ (Brier Γ— 0.15) + (Efficiency Γ— 0.15)


Task 2 β€” Tracing (Medium)

PropertyValue
Network80 nodes, BarabΓ‘si-Albert
Max steps15
SpreadActive (advances every 3 agent actions)
Allowed actionsinspect, trace, quarantine, submit_causal_chain
Key challengeReconstruct causal chain under time pressure

Grading: Score = (Origin Γ— 0.30) + (ChainF1 Γ— 0.30) + (Containment Γ— 0.20) + (Efficiency Γ— 0.10) βˆ’ (Brier Γ— 0.10)


Task 3 β€” Containment (Hard)

PropertyValue
Network150 nodes, Mixed topology with planted bridges
Max steps20
Actions per step5
Budget$10,000
Allowed actionsAll 7 action types
Key challengeSimultaneous containment + bot detection + chain reconstruction + budget management

Grading: Score = (Containment Γ— 0.25) + (CIB_F1 Γ— 0.20) + (Chain Γ— 0.15) + (Timing Γ— 0.15) + (Budget Γ— 0.10) + (Precision Γ— 0.05) βˆ’ (Brier Γ— 0.10)


Observation Space (POMDP)

FieldTypeDescription
task_idstringActive task
step_numberintCurrent step
max_stepsintMaximum steps
actions_remainingint?Actions left this step (Task 3)
stream_reportslist[str]Flagged node IDs (~30% false positives)
revealed_nodeslist[str]Previously inspected node IDs (fog-of-war)
inspection_resultsdict?Results from last inspect/trace
infection_ratefloatCurrent network infection rate
financial_budgetfloatRemaining budget
public_outrage_indexfloatStreisand Effect metric (0-1)
brier_score_runningfloatRunning calibration score
network_sizeintTotal nodes

Action Space

ActionCostTask 1Task 2Task 3Description
inspect$50βœ“βœ“βœ“Read post content + demographics. Reveals fog-of-war.
trace$200βœ“βœ“Get centrality + neighbor infection timeline.
quarantine$1,500βœ“βœ“βœ“Isolate node. Wrong = Streisand Effect.
remove$3,000βœ“Permanently sever. Wrong = severe outrage.
shadowban$500βœ“Reduce influence 80%. Low risk.
deploy_counter_narrative$4,000βœ“Boost community resilience.
submit_causal_chainFreeβœ“βœ“Submit infection path. Ends episode.

Action format:

json
{
  "action_type": "inspect",
  "target_node_id": "node_7",
  "confidence": 0.75,
  "reasoning": "High centrality + infected neighbors suggest early infection"
}

Quick Start

bash
# Install
pip install -r requirements.txt

# Run tests
pytest -q

# Start server
uvicorn server.app:app --port 7860

# Run baseline inference
export API_KEY=your_proxy_key
export API_BASE_URL=https://router.huggingface.co/v1
export MODEL_NAME=your_injected_model
python inference.py

Python API

python
from environment.env import MisinfoEnv
from environment.models import Action, ActionType

env = MisinfoEnv(task_id="task1_detection", seed=42)
obs = env.reset()

# Inspect a flagged node
action = Action(
    action_type=ActionType.inspect,
    target_node_id=obs.stream_reports[0],
    confidence=0.6,
    reasoning="Checking flagged node"
)
obs, reward, done, info = env.step(action)
print(f"Brier: {info['brier_this_step']:.3f}")

HTTP API

bash
curl -X POST http://localhost:7860/reset \
  -H "Content-Type: application/json" \
  -d '{"task_id": "task1_detection", "seed": 42}'

curl -X POST http://localhost:7860/step \
  -H "Content-Type: application/json" \
  -d '{"action_type": "inspect", "target_node_id": "node_0", "confidence": 0.6}'

WebSocket

javascript
const ws = new WebSocket("ws://localhost:7860/ws");
ws.send(JSON.stringify({command: "reset", task_id: "task1_detection", seed: 42}));
ws.send(JSON.stringify({command: "step", action_type: "inspect", target_node_id: "node_0", confidence: 0.6}));

Docker

bash
docker build -t sentinel-9 .
docker run -p 7860:7860 \
  -e API_KEY=proxy_key \
  -e API_BASE_URL=https://router.huggingface.co/v1 \
  -e MODEL_NAME=model_name \
  sentinel-9

Project Structure

misinfo-env/
β”œβ”€β”€ openenv.yaml              # OpenEnv specification
β”œβ”€β”€ Dockerfile                 # Multi-stage Docker build
β”œβ”€β”€ requirements.txt           # Python dependencies
β”œβ”€β”€ pyproject.toml             # Project metadata
β”œβ”€β”€ inference.py               # Baseline LLM agent
β”œβ”€β”€ baseline_policy.py         # Heuristic + proxy-reviewed baseline policy
β”œβ”€β”€ .env                       # Environment variables
β”‚
β”œβ”€β”€ server/
β”‚   β”œβ”€β”€ __main__.py            # python -m server
β”‚   └── app.py                 # FastAPI server (HTTP + WebSocket)
β”‚
β”œβ”€β”€ environment/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ env.py                 # Core environment (POMDP + Brier)
β”‚   β”œβ”€β”€ models.py              # Pydantic data models
β”‚   β”œβ”€β”€ scoring.py             # Strict (0, 1) score helpers
β”‚   β”œβ”€β”€ graph.py               # Social network engine
β”‚   β”œβ”€β”€ spread.py              # SIR + LTM spread engine
β”‚   β”œβ”€β”€ tasks/
β”‚   β”‚   β”œβ”€β”€ task1_detection.py # Easy: frozen detection
β”‚   β”‚   β”œβ”€β”€ task2_tracing.py   # Medium: active tracing
β”‚   β”‚   └── task3_containment.py # Hard: adversarial containment
β”‚   └── graders/
β”‚       β”œβ”€β”€ grader1.py         # Multi-metric detection grader
β”‚       β”œβ”€β”€ grader2.py         # GED-based tracing grader
β”‚       └── grader3.py         # 7-dimensional containment grader
β”‚
└── tests/
    β”œβ”€β”€ test_env.py            # Environment and grader behavior
    β”œβ”€β”€ test_inference.py      # Inference stdout + proxy behavior
    └── test_baseline_policy.py # Baseline policy heuristics

License

MIT License