CoolFace
Apppublic

22f3001825/AegisWeave-Training-A100

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

AegisWeave ๐Ÿ›ก๏ธ

Meta PyTorch ยท OpenEnv ยท Hackathon India 2026

Team: Mayank & Ali ยท Model: Qwen2.5-3B + GRPO + Unsloth

AegisWeave is an OpenEnv-compliant RL benchmark where an AI assistant manages a 72-hour executive product launch crisis across 50 decision steps. It coordinates 5 stakeholders with hidden emotional states, adapts to stochastic API schema drift detected only through indirect signals, and operates under oversight from a fine-tuned 0.5B Monitor LLM.

Hackathon Themes

ThemeTrack
Theme 2Long-Horizon Planning โ€” 50-step episodes, cascade chains requiring 20+ step lookahead
Theme 3.2Personalized Tasks โ€” Executive assistant with personal/work/family conflicts
Patronus AISchema Drift โ€” Poisson 8%/step, zero notification, online adaptation
Fleet AIScalable Oversight โ€” SFT fine-tuned 0.5B Monitor with ALLOW/VETO decisions

๐Ÿ› ๏ธ Recent Fixes for 100% Correct Training

Before executing the A100 training, we thoroughly audited and fixed the environment and training pipeline to ensure a 100% mathematically correct RL setup:

  • โ€”GRPO State-Replay (Critical): Fixed a bug where TRL's GRPOTrainer evaluated rewards from step-0 regardless of the prompt depth. Prompts now inject seed and past_actions into the dataset, and the reward function perfectly replays the exact action history.
  • โ€”Reward Shaping: Added a small, dense shaping reward (+0.1) for targeting the stakeholder with the lowest satisfaction, solving stalled learning in early Stage 1.
  • โ€”Agent Logic: Corrected suggest_break logic paradoxes and implemented dynamic pr_approved checks to gracefully handle simulated Patronus AI schema drift.
  • โ€”Curriculum Robustness: Expanded the prompt dataset size to 256 for greater diversity and fixed brittle curriculum advancement loops.

๐Ÿš€ Quick Start

1. Installation

bash
pip install -r requirements.txt

2. Local Validation (CPU โ€” No Docker)

Run a dry-run validation of the environment, agents, and curriculum:

bash
python -m training.grpo_train --dry-run

This validates the full pipeline (environment, agents, reward function, curriculum stages, trajectory generator) without GPU.

3. Run with Docker (OpenEnv Server)

bash
docker build -t aegisweave .
docker run -p 8000:8000 aegisweave

Open http://localhost:8000/web for the OpenEnv Web UI.


๐Ÿ“Š Training Pipeline (A100 Required)

Full pipeline uses Unsloth + TRL GRPO on A100 40GB (~$60 total, well within $200 budget).

Step 1: Generate Expert Trajectories

Run rule-based expert policy to generate ~10,000 labeled (state, action, harmful) pairs for Monitor SFT:

bash
python -m training.generate_trajectories --n-episodes 200

Step 2: Fine-tune Monitor Agent (Fleet AI)

Train the 0.5B Monitor on labeled trajectories (~30 mins, ~$3):

bash
python -m training.monitor_sft

Step 3: GRPO Curriculum Training

3-stage curriculum producing 3 visible reward uptrends:

StageStakeholdersDriftMonitorSteps
1 โ€” Basic Planning2โŒโŒ300
2 โ€” Drift Adaptation4โœ…โŒ300
3 โ€” Full Environment5โœ…โœ…400
bash
python -m training.grpo_train --stage 1

Step 4: Evaluate

Compare zero-shot baseline vs. trained agent:

bash
python -m training.evaluate --n-episodes 50 --trained-checkpoint outputs/stage3_checkpoint

๐Ÿ— Architecture

AegisWeave/
โ”œโ”€โ”€ environment/
โ”‚   โ”œโ”€โ”€ env.py              # Main OpenEnv + Gymnasium environment
โ”‚   โ”œโ”€โ”€ stakeholders.py     # 5 NPCs with hidden state + curriculum filtering
โ”‚   โ”œโ”€โ”€ cascades.py         # 5 consequence chains (C1-C5)
โ”‚   โ”œโ”€โ”€ schema_drift.py     # Poisson drift engine (3 corruption types)
โ”‚   โ”œโ”€โ”€ reward.py           # Dense step + sparse terminal rewards
โ”‚   โ”œโ”€โ”€ config.py           # All tunable constants centralized
โ”‚   โ”œโ”€โ”€ models.py           # Pydantic observation/action models
โ”‚   โ”œโ”€โ”€ state.py            # ExecutiveState, ObservationSpace, HiddenState
โ”‚   โ”œโ”€โ”€ actions.py          # 9 action types + validation
โ”‚   โ”œโ”€โ”€ client.py           # OpenEnv client connector
โ”‚   โ””โ”€โ”€ server/             # FastAPI server for Docker deployment
โ”œโ”€โ”€ agents/
โ”‚   โ”œโ”€โ”€ assistant_agent.py  # Qwen2.5-3B + rule-based fallback
โ”‚   โ””โ”€โ”€ monitor_agent.py    # Qwen2.5-0.5B overseer (SFT fine-tuned)
โ”œโ”€โ”€ training/
โ”‚   โ”œโ”€โ”€ grpo_train.py       # Main GRPO curriculum training script
โ”‚   โ”œโ”€โ”€ curriculum.py       # 3-stage difficulty manager
โ”‚   โ”œโ”€โ”€ generate_trajectories.py  # Expert trajectory generation
โ”‚   โ”œโ”€โ”€ monitor_sft.py      # Monitor SFT pipeline
โ”‚   โ””โ”€โ”€ evaluate.py         # Before/after metrics + reward curves
โ”œโ”€โ”€ demo/
โ”‚   โ””โ”€โ”€ episode_visualizer.py  # HTML + ASCII episode timeline for pitch
โ”œโ”€โ”€ Dockerfile              # OpenEnv container spec
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ colab_training.ipynb    # One-click training notebook

๐ŸŒ Deployment

bash
openenv push

๐Ÿ‘ฅ Team

  • โ€”Mayank โ€” Environment core, OpenEnv compliance, Docker, HuggingFace Spaces
  • โ€”Ali โ€” Monitor agent, training pipeline, GRPO curriculum, Colab notebook