File size: 2,904 Bytes
0a7dc76
7e24fa5
 
 
 
0a7dc76
7e24fa5
 
 
 
 
 
 
 
 
0a7dc76
 
7e24fa5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
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
```