CoolFace
Apppublic

M134pra/compute-commons-env

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
App README

Compute Commons: Multi-Team GPU Negotiation Arena

![Open in Colab](https://colab.research.google.com/#fileId=https%3A//huggingface.co/spaces/M134pra/compute-commons-env/blob/main/computecommonstraining.ipynb) ![HF Space](https://huggingface.co/spaces/M134pra/compute-commons-env) ![OpenEnv](https://github.com/meta-pytorch/OpenEnv)

"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 returned

Environment 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)

ComponentWeightWhat it rewards
Utility alignment34%Matching priority-weighted demand targets
Fairness (Gini)20%Equitable distribution
Floor coverage18%All teams above true service minimums
Carbon health11%Staying within sustainability cap
Budget feasibility7%Exact total budget usage
Coalition alignment5%Strategy consistency
Trust signal5%Round-over-round coherence
Anti-starvation guardโ€”Penalises reward hacking via team starvation

Core Files

FileDescription
server/compute_commons_environment.pyFull environment logic, NPC agents, partial observability
models.pyTyped Action / Observation models
client.pyEnvClient wrapper for training
openenv.yamlOpenEnv manifest
training/train_grpo_trl.pyTRL GRPO training script

3) Quick Start

Install

bash
git clone https://huggingface.co/spaces/M134pra/compute-commons-env
cd compute-commons-env
pip install -e .

Run server locally

bash
uvicorn server.app:app --host 0.0.0.0 --port 8000

Health check

bash
curl http://localhost:8000/health
# {"status": "healthy"}

Interact with the environment

python
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)

![Open in Colab](https://colab.research.google.com/#fileId=https%3A//huggingface.co/spaces/M134pra/compute-commons-env/blob/main/computecommonstraining.ipynb)

Command-line training

bash
# 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-grpo

Generate evidence plots

bash
python -m compute_commons_env.training.evaluate_and_plot

5) Results

Reward Improvement: 2.44ร— over random baseline

PolicyAvg RewardAvg Score
Random baseline0.54 ยฑ 0.510.65
Trained policy1.33 ยฑ 0.180.90
Oracle upper bound1.41 ยฑ 0.130.92

The trained policy reaches 90% of oracle performance vs 64.8% for random.

Curriculum Performance

DifficultyRandomTrainedGain
1 โ€” Standard0.541.29+2.39ร—
2 โ€” Elevated0.441.22+2.79ร—
3 โ€” Crisis0.301.08+3.60ร—

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+):

[image] Reward improves consistently across 400 training episodes. Moving average (orange) shows clear upward trend with reducing variance.

Loss curve โ€” decreasing as policy quality improves:

[image] Loss (1 โˆ’ score) converges from ~0.35 down toward ~0.10, confirming measurable quality improvement.

Policy share evolution โ€” allocation strategy convergence:

[image] Policy converges on safety-prioritized allocation (reflecting scenario distribution), with consistent search/robotics balance.

Baseline comparison:

[image] Trained policy achieves 94% of oracle reward; random baseline less than 40%.

Curriculum difficulty comparison:

[image] 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 Environment base class, reset() / step() / state property
  • โ€”[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-env

Health check (should return {"status": "healthy"}):

bash
curl https://M134pra-compute-commons-env.hf.space/health

Push updates

bash
cd compute-commons-env
openenv push --repo-id M134pra/compute-commons-env

8) Tests

bash
pytest tests -q

9) Judging Alignment

CriterionWeightThis Project
Environment Innovation40%Compute negotiation + NPC stakeholders + partial observability + curriculum โ€” underexplored domain, not a game clone
Storytelling30%Narrative from real-world problem โ†’ mechanics โ†’ results โ†’ why it matters
Reward Improvement20%2.44ร— gain, 90% oracle performance, curriculum comparison across 3 levels
Pipeline Quality10%TRL GRPO, composable rubric, anti-starvation guard, anti-gaming penalties

Built for the OpenEnv Hackathon by Scaler ร— Meta PyTorch ร— Hugging Face, April 2026.