cace-env / README.md
hsr99's picture
Upload folder using huggingface_hub
d91a194 verified
|
Raw
History Blame Contribute Delete
2.9 kB
---
title: CACE Cultural Context Arbitration Environment
emoji: ⚖️
colorFrom: indigo
colorTo: purple
sdk: docker
pinned: true
license: apache-2.0
tags:
- reinforcement-learning
- openenv
- content-moderation
- multi-agent
- rlvr
- grpo
---
# Cultural Context Arbitration Environment (CACE)
**OpenEnv Hackathon 2026 | Theme 1 (Multi-Agent) + Theme 3.1 (World Modeling)**
Trains a single LLM policy via GRPO to make culturally-aware content moderation decisions — using Meta's Oversight Board rulings (200+ binding public decisions) as the **verifiable reward oracle**.
## Quick Start
```python
from cace_env import CACEEnvClient, CACEAction
import asyncio
async def main():
# Connect to HF Space
async with CACEEnvClient(base_url="ws://YOUR_USERNAME-cace-env.hf.space") as env:
# V1: single case episode
result = await env.reset()
print(result.observation.observation[:200])
# Make a moderation decision (0=ALLOW, 1=REMOVE, 2=ALLOW_WITH_LABEL, 3=ESCALATE, 4=RESTRICT)
result = await env.step(CACEAction(action_int=0))
print(f"Reward: {result.reward:.4f} | Correct: {result.observation.reward_breakdown['correct']}")
asyncio.run(main())
```
## V1 vs V2 Modes
| | V1 (Simple) | V2 (Network) |
|--|--|--|
| Episode | 1 post → 1 decision | 20 posts on social graph → pick 8 → 8 decisions |
| Observation | Enriched single case | Network batch with spread signals |
| Reward | 3-track reward | 3-track + network spread bonus |
| Use for | Quick training | Full demo |
## Three-Track Reward
| Track | Weight | Measures |
|-------|--------|---------|
| Cultural Meaning Resolution | 40% | Correct interpretation of culturally local language |
| Harm Detection Under Context | 35% | Catching real harm that looks ambiguous |
| Policy Calibration + Escalation | 25% | Right tool for right case — no lazy escalation |
Combined reward: **[-1.0, +1.0]** (normalised for GRPO)
## Architecture
```
4 Frozen Agents (Groq/Azure — inference only, no gradients):
Intake Agent → language, region, policy clause
Cultural Context → charitable cultural interpretation
Adversarial Challenge → stress-tests the cultural argument
Policy Alignment → Meta Community Standards anchor
1 Trainable Agent (GRPO via Unsloth + TRL):
Decision Agent → ALLOW | REMOVE | ALLOW_WITH_LABEL | ESCALATE | RESTRICT_DISTRIBUTION
Reward Oracle: Meta Oversight Board — 200+ binding public decisions
No LLM judge. Fully deterministic reward.
```
## Environment API
```
POST /reset → start episode (returns CACEObservation)
POST /step → apply CACEAction (returns CACEObservation with reward)
GET /state → current CACEState (for debugging)
GET /health → liveness check
GET /docs → FastAPI Swagger UI
GET /web → OpenEnv web interface
```