M134pra/compute-commons-env
Compute Commons: Multi-Team GPU Negotiation Arena
  
"What happens when an AI must choose between letting the self-driving car ship on time, or ensuring the safety team has enough compute to catch a fatal bug?"
Compute Commons puts LLMs in the hot seat of real AI infrastructure decisions โ repeated, strategic, multi-stakeholder resource allocation under uncertainty, fairness constraints, carbon caps, and political pressure from NPC teams that bluff their needs.
1) Problem & Why It Matters
Modern AI organisations routinely allocate constrained compute across competing teams. Bad allocations harm launch velocity, safety quality, or energy sustainability.
Current LLMs can discuss trade-offs. They cannot repeatedly make high-quality allocation decisions under:
- Teams that strategically overstate their requirements
- Mid-episode shocks (audits, incidents, market crises)
- Hard carbon sustainability constraints
- Competing fairness and urgency pressures simultaneously
No existing benchmark or training dataset targets this capability. Compute Commons creates the training signal.
2) Environment Architecture
Episode Flow
reset() โ Get scenario brief (partial info โ declared needs, not true needs)
โ
step() โ Propose allocation โ NPC teams counter-propose / escalate
โ (repeated up to 4 rounds, with mid-episode shocks)
done โ Final score + reward returnedEnvironment Mechanics
- 3 competing AI teams: Search + Retrieval, Robotics Planning, Safety + Evaluation
- Partial observability: Teams bluff stated needs; true minimums revealed only after persistent starvation (2+ rounds)
- NPC counter-proposals: Teams escalate legally, commercially, or operationally based on board archetype (Safety-First / Growth / Reliability)
- Dynamic shocks: Compliance audits, customer escalations, production incidents mid-episode
- Carbon cap: Energy-intensive over-allocation penalised
- 3 curriculum difficulty levels: Standard โ Elevated โ Crisis
Reward Signal (Composable Rubric)
Core Files
3) Quick Start
Install
git clone https://huggingface.co/spaces/M134pra/compute-commons-env
cd compute-commons-env
pip install -e .Run server locally
uvicorn server.app:app --host 0.0.0.0 --port 8000Health check
curl http://localhost:8000/health
# {"status": "healthy"}Interact with the environment
from compute_commons_env import ComputeCommonsEnv, ComputeCommonsAction
with ComputeCommonsEnv(base_url="http://localhost:8000").sync() as client:
obs = client.reset()
print(obs.observation.briefing)
result = client.step(ComputeCommonsAction(
search_hours=35, robotics_hours=30, safety_hours=35,
rationale="Priority-weighted equal start"
))
print(result.observation.feedback)
print(f"Reward: {result.reward}")4) Training
Colab Notebook (one-click, re-runnable end-to-end)

Command-line training
# Run from one level above compute_commons_env/
python -m compute_commons_env.training.train_grpo_trl \
--model Qwen/Qwen2.5-1.5B-Instruct \
--env-url http://localhost:8000 \
--dataset-size 500 \
--num-generations 4 \
--num-train-epochs 1 \
--gradient-accumulation-steps 16 \
--output-dir outputs/compute-commons-grpoGenerate evidence plots
python -m compute_commons_env.training.evaluate_and_plot5) Results
Reward Improvement: 2.44ร over random baseline
The trained policy reaches 90% of oracle performance vs 64.8% for random.
Curriculum Performance
The trained policy improves more at higher difficulty โ exactly where random allocation fails hardest.
Training Plots
Reward curve โ episode reward rising from random level (~0.5) toward trained plateau (~1.3+):
Reward improves consistently across 400 training episodes. Moving average (orange) shows clear upward trend with reducing variance.
Loss curve โ decreasing as policy quality improves:
Loss (1 โ score) converges from ~0.35 down toward ~0.10, confirming measurable quality improvement.
Policy share evolution โ allocation strategy convergence:
Policy converges on safety-prioritized allocation (reflecting scenario distribution), with consistent search/robotics balance.
Baseline comparison:
Trained policy achieves 94% of oracle reward; random baseline less than 40%.
Curriculum difficulty comparison:
Trained policy consistently dominates random at all difficulty levels. Relative gain increases with difficulty.
6) Submission Checklist (Hackathon)
- [x] OpenEnv-based environment with valid
openenv.yaml - [x] Proper
Environmentbase class,reset()/step()/stateproperty - [x] TRL GRPO training script: training/train_grpo_trl.py
- [x] Training evidence as image files: artifacts/
- [x]
reward_curve.png - [x]
loss_curve.png - [x]
baseline_comparison.png - [x]
policy_shares.png - [x]
curriculum_comparison.png - [x] Colab notebook: Open in Colab
- [x] HF Space: M134pra/compute-commons-env
- [x] Writeup: writeup.md
- [x] Video / Blog: YouTube
7) Deployment
HF Space (live endpoint)
https://huggingface.co/spaces/M134pra/compute-commons-envHealth check (should return {"status": "healthy"}):
curl https://M134pra-compute-commons-env.hf.space/healthPush updates
cd compute-commons-env
openenv push --repo-id M134pra/compute-commons-env8) Tests
pytest tests -q9) Judging Alignment
Built for the OpenEnv Hackathon by Scaler ร Meta PyTorch ร Hugging Face, April 2026.
