Spaces:
Sleeping
Sleeping
here2rule commited on
Commit ·
2d53df2
1
Parent(s): 4464994
feat: complete submission README with all links, results, openenv.yaml manifest
Browse files- README.md +225 -9
- openenv.yaml +79 -0
README.md
CHANGED
|
@@ -1,12 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🌊 Oceanus: Multi-Layer Ghost-Gear Recovery & Treaty Arena
|
| 2 |
+
|
| 3 |
+
> *The first multi-modal RL arena where LLM policy negotiations directly control the physics of ocean restoration.*
|
| 4 |
+
|
| 5 |
+
[](https://huggingface.co/spaces/aakarsh2007/Oceanus-AI)
|
| 6 |
+
[](https://colab.research.google.com/drive/YOUR_NOTEBOOK_ID)
|
| 7 |
+
[](https://github.com/YOUR_USERNAME/Oceanus)
|
| 8 |
+
[](https://youtube.com/YOUR_VIDEO_ID)
|
| 9 |
+
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
## 🔗 Submission Links
|
| 13 |
+
|
| 14 |
+
| Resource | Link |
|
| 15 |
+
|----------|------|
|
| 16 |
+
| 🤗 HuggingFace Space (Live Demo) | https://huggingface.co/spaces/aakarsh2007/Oceanus-AI |
|
| 17 |
+
| 📓 Colab Training Notebook | https://colab.research.google.com/drive/YOUR_NOTEBOOK_ID |
|
| 18 |
+
| 💻 GitHub Repository | https://github.com/YOUR_USERNAME/Oceanus |
|
| 19 |
+
| 🎥 Demo Video / Blog | https://youtube.com/YOUR_VIDEO_ID |
|
| 20 |
+
|
| 21 |
+
> **Update these links before submission deadline.**
|
| 22 |
+
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
## 🌊 What is Oceanus?
|
| 26 |
+
|
| 27 |
+
Oceanus is a multi-agent RL environment built on the real-world crisis of **abandoned fishing gear (ghost nets)** — 640,000 tonnes of gear lost annually, killing marine life for decades. No single agent can solve it. It requires coordination, negotiation, and long-horizon planning.
|
| 28 |
+
|
| 29 |
+
The environment operates on **three simultaneous layers**:
|
| 30 |
+
|
| 31 |
+
1. **Physical Swarm Layer** — 4 ASV drones coordinate on a 20×20 ocean grid under partial observability. Each agent sees only a 3×3 sonar window. They must broadcast coordinates, sweep sectors, and clean nets.
|
| 32 |
+
|
| 33 |
+
2. **Policy & Stakeholder Layer** — 2 policy agents (Port Authority + Fleet Manager) negotiate a gear-tagging treaty via stakeholder emails. A successful treaty reduces ghost net spawn rate from High → Low, directly helping the ASV layer.
|
| 34 |
+
|
| 35 |
+
3. **Adversary Curriculum Layer** — A chaos agent injects storms, schema drift, rogue trawlers, and policy invalidations. Difficulty scales from 1.0 → 3.0 over the episode, forcing agents to adapt.
|
| 36 |
+
|
| 37 |
+
**The key insight**: a semantic treaty negotiated in text directly alters the physics of a 2D grid. This cross-layer causality is what makes Oceanus novel.
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
## 🏆 Hackathon Theme Coverage
|
| 42 |
+
|
| 43 |
+
| Theme | How Oceanus Covers It |
|
| 44 |
+
|-------|----------------------|
|
| 45 |
+
| **#1 Multi-Agent** | 4 ASV drones cooperate + 2 policy agents negotiate. Heterogeneous agents with different obs/action spaces. |
|
| 46 |
+
| **#2 Long-Horizon** | Treaty at step 7 pays off at step 50+. Global reward only at episode end. Sparse reward forces planning. |
|
| 47 |
+
| **#3.1 Professional Tools** | Sonar API, broadcast API, schema versioning v1↔v2, stakeholder email system. |
|
| 48 |
+
| **#3.2 Personalized Tasks** | Policy agents handle mood-aware emails from angry fishers, NGOs, government officials. |
|
| 49 |
+
| **#4 Self-Improvement** | Adversary curriculum scales difficulty with episode progress. 8 chaos event types. |
|
| 50 |
+
|
| 51 |
---
|
| 52 |
+
|
| 53 |
+
## 📊 Training Results
|
| 54 |
+
|
| 55 |
+
**Algorithm**: GRPO (Group Relative Policy Optimization) — same algorithm as DeepSeek-R1
|
| 56 |
+
**Model**: `unsloth/Qwen2-0.5B-Instruct` with 4-bit LoRA (r=16), 2.1M trainable parameters
|
| 57 |
+
**Training**: 600 steps on Google Colab T4 GPU
|
| 58 |
+
|
| 59 |
+

|
| 60 |
+
|
| 61 |
+
> *Trained agent (cyan) climbs from -1.0 → +5.5 over 600 GRPO steps. Red dashed = untrained baseline (random text). Gap = +6.5 reward points.*
|
| 62 |
+
|
| 63 |
+
### Before vs After Training
|
| 64 |
+
|
| 65 |
+
| Metric | Untrained Baseline | GRPO Trained |
|
| 66 |
+
|--------|-------------------|--------------|
|
| 67 |
+
| Output format | Random text | Valid JSON ✅ |
|
| 68 |
+
| Correct intent | Never | Consistently ✅ |
|
| 69 |
+
| Step reward | -1.0 | +5.0 to +8.0 |
|
| 70 |
+
| Improvement | — | **+9.0 reward points/step** |
|
| 71 |
+
|
| 72 |
+
**Live inference proof** — given sonar showing a net, trained model outputs:
|
| 73 |
+
```json
|
| 74 |
+
{"intent": "clean", "direction": "south"}
|
| 75 |
+
```
|
| 76 |
+
Untrained model outputs: *"I think I should navigate toward the detected anomaly..."* → reward: -1.0
|
| 77 |
+
|
| 78 |
---
|
| 79 |
|
| 80 |
+
## 🚀 Quick Start
|
| 81 |
+
|
| 82 |
+
```bash
|
| 83 |
+
# Install
|
| 84 |
+
pip install -r requirements.txt
|
| 85 |
+
|
| 86 |
+
# Run demo episode (mock agents)
|
| 87 |
+
python main.py --max_steps 100
|
| 88 |
+
|
| 89 |
+
# Launch 3D Mission Control dashboard
|
| 90 |
+
python run.py
|
| 91 |
+
# Opens at http://localhost:8000
|
| 92 |
+
|
| 93 |
+
# Run test suite (59 tests)
|
| 94 |
+
python -m pytest tests/test_environment.py -q
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
---
|
| 98 |
+
|
| 99 |
+
## 🏗️ Architecture
|
| 100 |
+
|
| 101 |
+
```
|
| 102 |
+
oceanus/
|
| 103 |
+
├── physics.py # 20×20 grid, ghost net drift, ASV movement, sonar
|
| 104 |
+
├── models.py # OpenEnv wrapper: reset(), step(), CTDE reward engine
|
| 105 |
+
├── adversary.py # 8-type chaos agent, difficulty curriculum
|
| 106 |
+
├── runner.py # Episode runner, MockASVAgent, MockPolicyAgent, LLMAgent
|
| 107 |
+
└── demo_recorder.py # Records baseline + trained episodes to JSON
|
| 108 |
+
|
| 109 |
+
dashboard/
|
| 110 |
+
├── server.py # FastAPI + WebSocket backend
|
| 111 |
+
└── index.html # Three.js 3D frontend (single-page app)
|
| 112 |
+
|
| 113 |
+
train/
|
| 114 |
+
├── train_grpo.py # GRPO training (HuggingFace TRL + Unsloth)
|
| 115 |
+
└── evaluate.py # Baseline vs trained evaluation
|
| 116 |
+
|
| 117 |
+
data/
|
| 118 |
+
├── baseline_episode.json # Pre-recorded baseline (reward: -988)
|
| 119 |
+
└── trained_episode.json # Pre-recorded trained (reward: +270, 13 nets cleaned)
|
| 120 |
+
|
| 121 |
+
notebooks/
|
| 122 |
+
└── oceanus_final_submission.ipynb # Full Colab training walkthrough
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
---
|
| 126 |
+
|
| 127 |
+
## 🎯 Reward Structure (CTDE)
|
| 128 |
+
|
| 129 |
+
Centralized Training, Decentralized Execution:
|
| 130 |
+
|
| 131 |
+
```
|
| 132 |
+
R_total = α·Σ R_local_asv + β·Σ R_local_policy + γ·R_global_ecosystem
|
| 133 |
+
|
| 134 |
+
R_local_asv: +5.0 clean net
|
| 135 |
+
+0.5 useful broadcast
|
| 136 |
+
-0.1 move (energy cost)
|
| 137 |
+
-1.0 invalid JSON
|
| 138 |
+
|
| 139 |
+
R_local_policy: +10.0 treaty advance
|
| 140 |
+
+2.0 email reply
|
| 141 |
+
-5.0 ignored email (>5 steps old)
|
| 142 |
+
-1.0 invalid JSON
|
| 143 |
+
|
| 144 |
+
R_global: +100 biodiversity ≥ 75% (full recovery)
|
| 145 |
+
+40 biodiversity ≥ 50%
|
| 146 |
+
+10 biodiversity ≥ 25%
|
| 147 |
+
-20 ecosystem collapse
|
| 148 |
+
↑ awarded at episode end ONLY — forces long-horizon planning
|
| 149 |
+
```
|
| 150 |
+
|
| 151 |
+
---
|
| 152 |
+
|
| 153 |
+
## 👁️ Observation Spaces
|
| 154 |
+
|
| 155 |
+
**ASV Agent** (partial observability — 3×3 sonar only):
|
| 156 |
+
```json
|
| 157 |
+
{
|
| 158 |
+
"agent_id": "ASV-1",
|
| 159 |
+
"position": {"row": 5, "col": 8, "sector": "B2"},
|
| 160 |
+
"battery": 85,
|
| 161 |
+
"sonar_3x3": [["empty", "net", "empty"], ["empty", "self", "empty"], ["empty", "empty", "empty"]],
|
| 162 |
+
"comms_inbox": ["ASV-3: Found heavy nets in North-East quadrant."],
|
| 163 |
+
"wind_hint": "Wind direction: (0, 1)",
|
| 164 |
+
"biodiversity_index": 72.4
|
| 165 |
+
}
|
| 166 |
+
```
|
| 167 |
+
|
| 168 |
+
**Policy Agent**:
|
| 169 |
+
```json
|
| 170 |
+
{
|
| 171 |
+
"agent_id": "Port_Authority",
|
| 172 |
+
"current_policy_status": "No Tagging Mandate",
|
| 173 |
+
"net_spawn_rate": "High",
|
| 174 |
+
"inbox": [{"from": "Fisher_Bob", "mood": "Angry", "message": "I can't afford these tracker tags!"}],
|
| 175 |
+
"unanswered_emails": 3
|
| 176 |
+
}
|
| 177 |
+
```
|
| 178 |
+
|
| 179 |
+
---
|
| 180 |
+
|
| 181 |
+
## ⚡ Adversary Chaos Events
|
| 182 |
+
|
| 183 |
+
| Event | Effect | Tests |
|
| 184 |
+
|-------|--------|-------|
|
| 185 |
+
| `storm` | Shifts wind, spawns 3 nets | Physical adaptation |
|
| 186 |
+
| `policy_invalidation` | Resets treaty mid-episode | Long-horizon recovery |
|
| 187 |
+
| `equipment_failure` | Drains battery / corrupts comms | Resource management |
|
| 188 |
+
| `rogue_trawler` | Dumps 9 nets in 3×3 cluster | Emergency response |
|
| 189 |
+
| `algae_bloom` | Directly drops biodiversity | Urgency prioritization |
|
| 190 |
+
| `data_corruption` | Injects garbage into comms | Noise robustness |
|
| 191 |
+
| `emergency_email` | Urgent stakeholder message | Policy responsiveness |
|
| 192 |
+
| `schema_drift` | Flips API v1 ↔ v2 | API adaptation |
|
| 193 |
+
|
| 194 |
+
Difficulty scales 1.0 → 3.0 over episode duration.
|
| 195 |
+
|
| 196 |
+
---
|
| 197 |
+
|
| 198 |
+
## 🧠 Why This Environment Matters
|
| 199 |
+
|
| 200 |
+
Most RL environments train agents on fixed, isolated tasks. Oceanus trains agents on **emergent cross-layer causality** — a text negotiation changes physical spawn mechanics. This is the kind of reasoning that matters in real enterprise systems, policy decisions, and multi-stakeholder coordination problems.
|
| 201 |
+
|
| 202 |
+
The environment is designed to be hard to game: an agent that just outputs `{"intent": "clean"}` every step without moving toward nets will score poorly. An agent that proposes a treaty but ignores stakeholder emails will get penalized. The reward structure requires genuinely intelligent behavior.
|
| 203 |
+
|
| 204 |
+
---
|
| 205 |
+
|
| 206 |
+
## 📋 Environment API
|
| 207 |
+
|
| 208 |
+
```python
|
| 209 |
+
from oceanus.models import OceanusEnv
|
| 210 |
+
from oceanus.adversary import AdversaryAgent
|
| 211 |
+
|
| 212 |
+
env = OceanusEnv(seed=42, max_steps=120)
|
| 213 |
+
adversary = AdversaryAgent(inject_interval=20)
|
| 214 |
+
|
| 215 |
+
# Standard Gym-style API
|
| 216 |
+
obs = env.reset()
|
| 217 |
+
# obs = {agent_id: {"observation": dict, "prompt": str}, ...}
|
| 218 |
+
|
| 219 |
+
actions = {"ASV-1": '{"intent": "clean"}', "Port_Authority": '{"intent": "propose_treaty", ...}'}
|
| 220 |
+
obs, rewards, done, info = env.step(actions)
|
| 221 |
+
# rewards = {"ASV-1": 5.0, "Port_Authority": 10.0, "__total__": 18.0, ...}
|
| 222 |
+
```
|
| 223 |
+
|
| 224 |
+
---
|
| 225 |
+
|
| 226 |
+
## License
|
| 227 |
+
|
| 228 |
+
MIT
|
openenv.yaml
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: oceanus
|
| 2 |
+
version: "1.0.0"
|
| 3 |
+
description: >
|
| 4 |
+
Multi-layer ghost-gear recovery and treaty negotiation arena.
|
| 5 |
+
4 ASV drones coordinate on a 20x20 ocean grid under partial observability
|
| 6 |
+
while 2 policy agents negotiate a tagging mandate via stakeholder emails.
|
| 7 |
+
An adversary curriculum agent injects storms, schema drift, and policy
|
| 8 |
+
invalidations to force adaptive behavior.
|
| 9 |
+
|
| 10 |
+
themes:
|
| 11 |
+
- multi-agent
|
| 12 |
+
- long-horizon
|
| 13 |
+
- world-modeling
|
| 14 |
+
- self-improvement
|
| 15 |
+
|
| 16 |
+
agents:
|
| 17 |
+
- id: ASV-1
|
| 18 |
+
type: asv
|
| 19 |
+
observation: sonar_3x3 + comms_inbox + position + battery
|
| 20 |
+
actions: [move, clean, broadcast, scan]
|
| 21 |
+
- id: ASV-2
|
| 22 |
+
type: asv
|
| 23 |
+
observation: sonar_3x3 + comms_inbox + position + battery
|
| 24 |
+
actions: [move, clean, broadcast, scan]
|
| 25 |
+
- id: ASV-3
|
| 26 |
+
type: asv
|
| 27 |
+
observation: sonar_3x3 + comms_inbox + position + battery
|
| 28 |
+
actions: [move, clean, broadcast, scan]
|
| 29 |
+
- id: ASV-4
|
| 30 |
+
type: asv
|
| 31 |
+
observation: sonar_3x3 + comms_inbox + position + battery
|
| 32 |
+
actions: [move, clean, broadcast, scan]
|
| 33 |
+
- id: Port_Authority
|
| 34 |
+
type: policy
|
| 35 |
+
observation: inbox + treaty_status + spawn_rate + biodiversity
|
| 36 |
+
actions: [reply_email, propose_treaty, accept_treaty, reject_treaty]
|
| 37 |
+
- id: Fleet_Manager
|
| 38 |
+
type: policy
|
| 39 |
+
observation: inbox + treaty_status + spawn_rate + biodiversity
|
| 40 |
+
actions: [reply_email, propose_treaty, accept_treaty, reject_treaty]
|
| 41 |
+
|
| 42 |
+
reward:
|
| 43 |
+
type: ctde
|
| 44 |
+
formula: "alpha * sum(R_asv) + beta * sum(R_policy) + gamma * R_global"
|
| 45 |
+
components:
|
| 46 |
+
R_asv:
|
| 47 |
+
clean_net: +5.0
|
| 48 |
+
broadcast: +0.5
|
| 49 |
+
move: -0.1
|
| 50 |
+
invalid_json: -1.0
|
| 51 |
+
R_policy:
|
| 52 |
+
treaty_advance: +10.0
|
| 53 |
+
email_reply: +2.0
|
| 54 |
+
ignored_email: -5.0
|
| 55 |
+
invalid_json: -1.0
|
| 56 |
+
R_global:
|
| 57 |
+
biodiversity_gte_75: +100.0
|
| 58 |
+
biodiversity_gte_50: +40.0
|
| 59 |
+
biodiversity_gte_25: +10.0
|
| 60 |
+
collapse: -20.0
|
| 61 |
+
timing: episode_end_only
|
| 62 |
+
|
| 63 |
+
environment:
|
| 64 |
+
grid_size: 20x20
|
| 65 |
+
max_steps: 120
|
| 66 |
+
partial_observability: true
|
| 67 |
+
sonar_radius: 1
|
| 68 |
+
adversary: true
|
| 69 |
+
schema_versioning: true
|
| 70 |
+
|
| 71 |
+
entry_point: oceanus.models:OceanusEnv
|
| 72 |
+
api:
|
| 73 |
+
reset: "env.reset() -> Dict[agent_id, {observation, prompt}]"
|
| 74 |
+
step: "env.step(actions: Dict[agent_id, str]) -> (obs, rewards, done, info)"
|
| 75 |
+
|
| 76 |
+
links:
|
| 77 |
+
space: https://huggingface.co/spaces/aakarsh2007/Oceanus-AI
|
| 78 |
+
notebook: https://colab.research.google.com/drive/YOUR_NOTEBOOK_ID
|
| 79 |
+
repository: https://github.com/YOUR_USERNAME/Oceanus
|