Spaces:
Sleeping
Sleeping
docs: reorganize — 25 files → 4 focused docs
Browse filesDeleted all brainstorming (Plan_v2), Round 1 specs, stale Round 2 docs,
and research references that no longer serve the submission.
Final structure:
docs/blog_post.md — public narrative (product vision + training story)
docs/entity_definitions.md — technical reference (state/actions/profiles/reward)
docs/environment_design.md — design rationale (why these choices, training arc)
docs/training.md — training guide (GRPO config, pipeline, results)
docs/references/judging_criteria.md — external hackathon criteria
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- docs/{round2/entity_definitions.md → entity_definitions.md} +0 -0
- docs/environment_design.md +133 -0
- docs/references/FAQs on Discord.md +0 -77
- docs/references/[External] Meta OpenEnv Hackathon Participant Help Guide.md +0 -425
- docs/references/[External] OpenEnv Hackathon FAQs.md +0 -556
- docs/references/hackathon_checklist.md +0 -153
- docs/{round2/[External] Apr ‘26 OpenEnv Hackathon Themes & Judging Criteria.md → references/judging_criteria.md} +0 -0
- docs/references/reward_engineering_overview.md +0 -82
- docs/references/reward_engineering_software_tasks.md +0 -77
- docs/references/unsloth_grpo_training_template.md +0 -269
- docs/round1/SPEC.md +0 -554
- docs/round1/inference.py +0 -304
- docs/round1/problem_statement.md +0 -176
- docs/round1/scripts/sample_inference.py +0 -182
- docs/round1/scripts/validate-submission.sh +0 -186
- docs/round2/Plan_v2/CoreMEters.md +0 -50
- docs/round2/Plan_v2/GeminiDiscussion.md +0 -61
- docs/round2/Plan_v2/HumanModeling.md +0 -93
- docs/round2/Plan_v2/LifeMAth.md +0 -89
- docs/round2/Plan_v2/RandomnessFactor.md +0 -132
- docs/round2/Plan_v2/RewardIsolation.md +0 -44
- docs/round2/Plan_v2/Todo.md +0 -14
- docs/round2/confirmation.md +0 -60
- docs/round2/design_notes.md +0 -147
- docs/round2/environment_design.md +0 -209
- docs/round2/hackathon_themes.md +0 -180
- docs/round2/pitch_framing.md +0 -57
- docs/round2/problem_statement.md +0 -193
- docs/training.md +125 -0
docs/{round2/entity_definitions.md → entity_definitions.md}
RENAMED
|
File without changes
|
docs/environment_design.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Environment Design — RhythmEnv Life Simulator
|
| 2 |
+
|
| 3 |
+
## What It Is
|
| 4 |
+
|
| 5 |
+
A Life Simulator — a holistic resource management RL environment where an agent learns a specific person's hidden patterns through experience, not configuration.
|
| 6 |
+
|
| 7 |
+
The core problem: personal AI assistants give generic advice because they don't know who you are. RhythmEnv is the training ground for an agent that must discover hidden personality dynamics through reward signals alone — the same way a good personal assistant adapts over their first weeks on the job.
|
| 8 |
+
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
## Why Abstract Activities, Not Tasks
|
| 12 |
+
|
| 13 |
+
An earlier design used a workday task scheduler (energy/stress meters, task queues with deadlines). We moved away from it because with real tasks, an agent can score well just by being a good scheduler — it never needs to infer anything about the person. Abstract life activities (DEEP_WORK, MEDITATE, SOCIALIZE...) force the inference problem: the only way to do well is to figure out *who you're helping*, because the same action has wildly different value depending on the hidden profile.
|
| 14 |
+
|
| 15 |
+
| | Workday Scheduler | Life Simulator |
|
| 16 |
+
|---|---|---|
|
| 17 |
+
| Episode | 1 day, 20 steps | 1 week, 28 steps |
|
| 18 |
+
| State | Energy, stress, task queue | 5 life meters |
|
| 19 |
+
| Actions | 4 (task management) | 10 (life activities) |
|
| 20 |
+
| Learning signal | How to sequence tasks | Which actions serve *this specific person* |
|
| 21 |
+
|
| 22 |
+
The Life Simulator creates a **non-promptable discovery problem**: the agent cannot know the person's profile from the prompt — it must be inferred from reward patterns. This is structurally different from a task that better prompting solves.
|
| 23 |
+
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+
## The Three Discovery Layers
|
| 27 |
+
|
| 28 |
+
### Layer 1 — Reward Weights (What Matters to This Person)
|
| 29 |
+
|
| 30 |
+
Same action, same starting state → different rewards per profile:
|
| 31 |
+
|
| 32 |
+
```
|
| 33 |
+
DEEP_WORK, step 1, all meters at 0.7:
|
| 34 |
+
workaholic_stoic: +1.57 (progress weight 70% — work = meaning)
|
| 35 |
+
introvert_morning: +0.32 (serenity weight 60% — mild net gain)
|
| 36 |
+
extrovert_night_owl: −0.39 (connection weight 75% — work gives 0 connection)
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
An agent that doesn't adapt plateaus at ~0.60. One that discovers the profile targets pushes above 0.80.
|
| 40 |
+
|
| 41 |
+
### Layer 2 — Action Modifiers (How Actions Affect This Person)
|
| 42 |
+
|
| 43 |
+
The base effect matrix is modified invisibly per profile:
|
| 44 |
+
|
| 45 |
+
| Profile | Hidden modifier | Observable signal |
|
| 46 |
+
|---|---|---|
|
| 47 |
+
| introvert_morning | Social drain ×3.0 | SOCIALIZE drains vitality 3× faster than expected |
|
| 48 |
+
| introvert_morning | Morning deep work ×2.0 | Same action gives 2× progress at slot 0 |
|
| 49 |
+
| extrovert_night_owl | Morning penalty ×0.4 | DEEP_WORK in morning gives 40% expected progress |
|
| 50 |
+
| extrovert_night_owl | Evening/night bonus ×1.8 | Same action gives 1.8× progress at slots 2–3 |
|
| 51 |
+
| extrovert_night_owl | Social connection ×2.0 | SOCIALIZE gives 2× connection gain |
|
| 52 |
+
| workaholic_stoic | Work recovers vitality +0.06 | DEEP_WORK raises vitality instead of draining |
|
| 53 |
+
| workaholic_stoic | Idle drains serenity −0.10 | ME_TIME/BINGE_WATCH lower serenity |
|
| 54 |
+
|
| 55 |
+
### Layer 3 — Stress Spiral
|
| 56 |
+
|
| 57 |
+
When serenity drops below the profile's tolerance threshold, all negative effects amplify ×1.3. Wrong actions → serenity drops → worse outcomes → harder recovery. The agent must learn to protect serenity proactively.
|
| 58 |
+
|
| 59 |
+
---
|
| 60 |
+
|
| 61 |
+
## Observable vs Hidden
|
| 62 |
+
|
| 63 |
+
| Observable (agent sees every step) | Hidden (must infer from reward patterns) |
|
| 64 |
+
|---|---|
|
| 65 |
+
| All 5 meter values (0.0–1.0) | Which profile is active |
|
| 66 |
+
| Day of week (0–6) | Profile reward weights |
|
| 67 |
+
| Time slot (0–3) | Per-action modifiers |
|
| 68 |
+
| Active random event name | Stress tolerance threshold |
|
| 69 |
+
| Remaining steps | Connection decay rate |
|
| 70 |
+
|
| 71 |
+
---
|
| 72 |
+
|
| 73 |
+
## Training Story
|
| 74 |
+
|
| 75 |
+
```
|
| 76 |
+
Random baseline → final_score ≈ 0.60–0.70
|
| 77 |
+
No pattern. Misses timing windows. Doesn't protect serenity floor.
|
| 78 |
+
|
| 79 |
+
Heuristic baseline → final_score ≈ 0.75–0.82
|
| 80 |
+
Follows observable rules only. Cannot differentiate profiles.
|
| 81 |
+
Treats everyone the same.
|
| 82 |
+
|
| 83 |
+
GRPO-trained agent → target: final_score > 0.82 on 2+ profiles
|
| 84 |
+
Discovers timing bonuses per profile.
|
| 85 |
+
Adapts action mix to the person's hidden reward structure.
|
| 86 |
+
Introvert's week looks different from workaholic's week.
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
---
|
| 90 |
+
|
| 91 |
+
## Anti-Reward-Hacking Measures
|
| 92 |
+
|
| 93 |
+
| Safeguard | Mechanism |
|
| 94 |
+
|---|---|
|
| 95 |
+
| Three-layer reward | format + legality + real env replay — all three must pass |
|
| 96 |
+
| Repetition dampening | Same action 3× in a row → 25%/50%/75% effect reduction |
|
| 97 |
+
| Critical floor penalty | Any meter < 0.10 → −0.30 per step |
|
| 98 |
+
| Random events | 8%/step probability prevents overfitting to deterministic trajectories |
|
| 99 |
+
| Seed-based replay | `env_reward` reconstructs exact episode state — reward cannot be fabricated |
|
| 100 |
+
|
| 101 |
+
---
|
| 102 |
+
|
| 103 |
+
## Hackathon Theme Alignment
|
| 104 |
+
|
| 105 |
+
**Primary: Theme 3.2 — World Modeling: Personalized Tasks**
|
| 106 |
+
|
| 107 |
+
The environment models real personal assistant behaviour. The hidden profile represents real individual differences — what a person values and how activities physically affect them. Discovery through reward is how a good PA adapts over their first weeks on the job.
|
| 108 |
+
|
| 109 |
+
**Secondary: Theme 2 — Long-Horizon Planning**
|
| 110 |
+
|
| 111 |
+
28 steps with delayed, compounding consequences. Neglecting connection decays slowly but recovery gets harder each step. Serenity spiral is triggered by accumulated bad decisions, not a single action.
|
| 112 |
+
|
| 113 |
+
---
|
| 114 |
+
|
| 115 |
+
## Implementation Reference
|
| 116 |
+
|
| 117 |
+
| Component | File |
|
| 118 |
+
|---|---|
|
| 119 |
+
| Environment | `server/rhythm_environment.py` |
|
| 120 |
+
| Data models | `models.py` |
|
| 121 |
+
| Dataset generator | `training/dataset.py` |
|
| 122 |
+
| Reward functions | `training/reward_functions.py` |
|
| 123 |
+
| Baseline evaluation | `training/inference_eval.py` |
|
| 124 |
+
| Training notebook | `training/RhythmEnv_GRPO_Training.ipynb` |
|
| 125 |
+
| Gradio UI | `ui/app.py` |
|
| 126 |
+
| FastAPI server | `server/app.py` |
|
| 127 |
+
|
| 128 |
+
```python
|
| 129 |
+
env = RhythmEnvironment()
|
| 130 |
+
obs = env.reset(seed=42, profile="introvert_morning") # profile optional
|
| 131 |
+
obs = env.step(RhythmAction(action_type=ActionType.DEEP_WORK))
|
| 132 |
+
# obs.reward, obs.done, obs.reward_breakdown, obs.vitality, ...
|
| 133 |
+
```
|
docs/references/FAQs on Discord.md
DELETED
|
@@ -1,77 +0,0 @@
|
|
| 1 |
-
**A message from the team | Meta PyTorch OpenEnv Hackathon x Scaler School of Technology**
|
| 2 |
-
|
| 3 |
-
We want to start by saying something that we mean genuinely: thank you.
|
| 4 |
-
|
| 5 |
-
Over the past few weeks, you showed up. In numbers we did not fully anticipate. With submissions, energy, questions, and expectations that reflect just how much this means to you. And that means everything to us.
|
| 6 |
-
|
| 7 |
-
This hackathon is the first of its kind at this scale in India. We are not just saying that as a line. We mean it operationally. The infrastructure, the evaluation process, the coordination across Meta, PyTorch, Hugging Face, and the team at Scaler School of Technology is being stress-tested in real time. Some things might not have gone as planned, we own that & are working around the clock to fix them. And we are committed to being transparent with you about every single one of them.
|
| 8 |
-
|
| 9 |
-
We’re creating this document to answer common questions that we’re seeing on the Discord channel. We will keep updating this document.
|
| 10 |
-
|
| 11 |
-
**Who are the mentors and judges for the finale?**
|
| 12 |
-
|
| 13 |
-
We are proud to share the full list of mentors and judges who will be part of the in-person finale:
|
| 14 |
-
|
| 15 |
-
* Sanyam Bhutani, Partner Engineer at Meta
|
| 16 |
-
* Yash Khare, Partner Engineer at Meta
|
| 17 |
-
* Nilesh Pandey, Partner Engineer at Meta
|
| 18 |
-
* Adithya S Kolavi, ML Engineer at Hugging Face
|
| 19 |
-
* Adarsh Shirawalmath, ML Engineer at Hugging Face
|
| 20 |
-
* Arkadip Maitra, ML Engineer at Red Hat
|
| 21 |
-
* Aashay Sachdeva, Founding Team at Sarvam
|
| 22 |
-
* Deepa Dhevannan, Gen AI Solutions Architect
|
| 23 |
-
* Soumik Rakshit, ML Engineer at Zomato
|
| 24 |
-
* Ayush Satyam**,** Systems ML Engineer, Red Hat
|
| 25 |
-
* Parshant Sharma, Machine Learning Engineer at Red Hat
|
| 26 |
-
|
| 27 |
-
These are practitioners actively working at the forefront of AI. The team has worked hard to bring them together so they can be around to help you make your environments even better.
|
| 28 |
-
|
| 29 |
-
**Why are results online, and why does the finale still happen on campus? Why are results not being declared on April 26?**
|
| 30 |
-
|
| 31 |
-
We want to be fully transparent here, and we want to address both of these together because they come from the same place.
|
| 32 |
-
|
| 33 |
-
The final evaluation is being handled directly by engineers from Meta, PyTorch, and Hugging Face. With 800+ submissions, we made the decision to move to a hybrid evaluation model. Initial screening uses automated tooling, but every top team's submission will receive a dedicated, granular review by domain experts, with \~20-30 minutes of evaluation per team. This is not something we are willing to rush. Every submission deserves to be looked at fairly, and that takes time.
|
| 34 |
-
|
| 35 |
-
We had originally envisioned the entire evaluation happening offline. But given the volume of submissions, completing a fully offline evaluation before bringing everyone to campus would have meant asking you to wait significantly longer, and that felt like the wrong trade-off.
|
| 36 |
-
|
| 37 |
-
What we refused to compromise on is the experience of you all coming together in person, dedicatedly building and improving your environments with the mentors mentioned above being around to help you. There is something that cannot be replicated about builders in the same room, working through ideas together, pushing each other. Beyond that, this is a rare opportunity for the Meta/ Pytorch and Hugging Face teams to interact directly with engineers building in India, and to get a genuine sense of the depth of engineering talent this country has. That kind of exposure goes both ways, and it is something we were not willing to cut.
|
| 38 |
-
|
| 39 |
-
**Has promised mentorship and expert access materialised?**
|
| 40 |
-
|
| 41 |
-
Yes, and more is coming. A live session has already been conducted with Ben Burtenshaw (Community Education at Hugging Face) and Pulkit Sharma (Senior Instructor at Scaler). \[[Link to session recording here\]](https://www.youtube.com/live/kkCNMz0Ptd8?si=KDIaWXSEX6up4lU4) along with additional modules shared over dashboard and emails. Extensive additional sessions and mentor touchpoints are planned on campus.
|
| 42 |
-
|
| 43 |
-
**Why was the problem theme document edited in real time?**
|
| 44 |
-
|
| 45 |
-
This one is on us, and we want to be straightforward about it. The document that was shared with participants contained leftover content from a previous hackathon that should have been removed before it went out. It was an editorial error, not an intentional change, and we corrected it as soon as we caught it.
|
| 46 |
-
|
| 47 |
-
More broadly, this hackathon is being run by open-source teams across multiple organizations coordinating in real time. Mistakes like this can happen, and when they do, we would rather fix them quickly and tell you exactly what happened than let confusion sit.
|
| 48 |
-
|
| 49 |
-
We also want to address the evaluation adjustments that some of you noticed. We made deliberate changes to the judging process to ensure every submission gets the time and attention it deserves. Rushing evaluations on the day of the event would have been unfair to everyone. This was a considered call, not a last-minute scramble.
|
| 50 |
-
|
| 51 |
-
We ask that conversations about the hackathon stay within the designated Discord channels so we can track every concern and respond properly. And we ask that everyone continue to engage with each other, and with us, with respect. This community has been extraordinary, and that is worth protecting.
|
| 52 |
-
|
| 53 |
-
To be clear, anyone who crosses boundaries & breaks community rules will be banned & therefore automatically disqualified from the finale.
|
| 54 |
-
|
| 55 |
-
**Are the prizes and the number of winners still the same?**
|
| 56 |
-
|
| 57 |
-
Goes without saying. There are no changes to the prize structure or the number of winners. 15 teams will be awarded, with a total cash prize pool of $30,000, as published on the site:
|
| 58 |
-
|
| 59 |
-
| Position Secured | Prize |
|
| 60 |
-
| :---- | :---- |
|
| 61 |
-
| 1st | $7,500 |
|
| 62 |
-
| 2nd | $5,000 |
|
| 63 |
-
| 3rd | $3,500 |
|
| 64 |
-
| 4th to 8th | $2,000 each |
|
| 65 |
-
| 9th to 15th | $650 each |
|
| 66 |
-
|
| 67 |
-
Additionally, top teams will receive an interview opportunity with the Meta and Hugging Face AI teams. This has not changed and will not change.
|
| 68 |
-
|
| 69 |
-
**Will Scaler School of Technology students be favoured in the final evaluation?**
|
| 70 |
-
|
| 71 |
-
Absolutely not. The final evaluation is entirely in the hands of the Meta, PyTorch, and Hugging Face teams and will follow the judging criteria outlined.
|
| 72 |
-
|
| 73 |
-
We are working through every other question that has come in and will post structured answers here as we go. If something is unclear, if something feels wrong, keep asking. We would rather hear it from you directly than have you sit with uncertainty.
|
| 74 |
-
|
| 75 |
-
This hackathon is something India has not seen before. We are building the playbook in real time, at scale, and that is both the most exciting and the most humbling part of doing this. We are grateful that every single one of you showed up for it.
|
| 76 |
-
|
| 77 |
-
More updates soon.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/references/[External] Meta OpenEnv Hackathon Participant Help Guide.md
DELETED
|
@@ -1,425 +0,0 @@
|
|
| 1 |
-
# **Hackathon Self-Serve Guide: Build an RL Environment, Train an LLM, Ship a Demo**
|
| 2 |
-
|
| 3 |
-
## **0\) What you are building**
|
| 4 |
-
|
| 5 |
-
The core idea is not just to fine-tune a text model, but to build a **specialized LLM system** that can act inside an environment, get feedback, and improve through reinforcement learning. The practical stack discussed here is:
|
| 6 |
-
|
| 7 |
-
**Environment → verifier/reward functions → TRL trainer → Unsloth for efficiency → deployment on OpenEnv / Spaces**.
|
| 8 |
-
|
| 9 |
-
A strong project usually looks like one of these,
|
| 10 |
-
|
| 11 |
-
Please refer to [\[External\] Apr ‘26 OpenEnv Hackathon Themes](https://docs.google.com/document/d/1Odznuzwtb1ecDOm2t6ToZd4MuMXXfO6vWUGcxbC6mFs/edit?usp=sharing) for theme guidelines on selecting & forming problem statements.
|
| 12 |
-
|
| 13 |
-
## **1\) Start with the right project idea**
|
| 14 |
-
|
| 15 |
-
Pick a task that has all three of these properties:
|
| 16 |
-
|
| 17 |
-
1. **The model can act step by step**
|
| 18 |
-
2. **You can verify success programmatically**
|
| 19 |
-
3. **The task is hard enough to be interesting, but not so hard that the model never succeeds**
|
| 20 |
-
|
| 21 |
-
This last point matters a lot. RL only works if the probability of getting a good answer is greater than zero. If your task is so hard that the model never gets any reward, you will burn compute and learn nothing.
|
| 22 |
-
|
| 23 |
-
Please refer to [\[External\] Apr ‘26 OpenEnv Hackathon Themes](https://docs.google.com/document/d/1Odznuzwtb1ecDOm2t6ToZd4MuMXXfO6vWUGcxbC6mFs/edit?usp=sharing) for theme guidelines on selecting & forming problem statements.
|
| 24 |
-
|
| 25 |
-
A useful rule: **prefer tasks with crisp verification over tasks that only “look good” to a human.** RL gets easier when the reward is objective.
|
| 26 |
-
|
| 27 |
-
## **2\) Understand the minimum RL loop before you build**
|
| 28 |
-
|
| 29 |
-
At a high level, your loop is:
|
| 30 |
-
|
| 31 |
-
1. Give the model a prompt
|
| 32 |
-
2. Let it generate an action, strategy, answer, or code
|
| 33 |
-
3. Execute that output in an environment or verifier
|
| 34 |
-
4. Convert the result into a reward
|
| 35 |
-
5. Update the model so higher-reward behavior becomes more likely
|
| 36 |
-
|
| 37 |
-
That is the practical mental model for RL here. The system samples many outputs, scores them, and shifts probability mass away from bad outputs and toward better ones.
|
| 38 |
-
|
| 39 |
-
One especially useful framing is that RL is like a more efficient version of repeated in-context improvement. Instead of repeatedly stuffing previous examples into the context, you let backpropagation store what worked into the weights.
|
| 40 |
-
|
| 41 |
-
## **3\) Decide whether you need SFT first**
|
| 42 |
-
|
| 43 |
-
Use this simple rule:
|
| 44 |
-
|
| 45 |
-
* If you have **a lot of good data**, use **SFT**
|
| 46 |
-
* If you **do not have data but can verify outputs**, use **RL**
|
| 47 |
-
* In many practical cases, do **a little SFT first**, then RL
|
| 48 |
-
|
| 49 |
-
Why this matters:
|
| 50 |
-
|
| 51 |
-
* SFT is generally more sample-efficient
|
| 52 |
-
* RL is useful when you can test outcomes but cannot cheaply author ideal traces
|
| 53 |
-
* RL often needs some warm start, formatting priming, or easy tasks first so that good rollouts happen at all
|
| 54 |
-
|
| 55 |
-
For hackathon teams, the best path is usually:
|
| 56 |
-
|
| 57 |
-
1. Start from a capable base/instruct model
|
| 58 |
-
2. Add light formatting or task scaffolding if needed
|
| 59 |
-
3. Use RL for improvement, not as magic from scratch
|
| 60 |
-
|
| 61 |
-
## **4\) Design the environment before you design the trainer**
|
| 62 |
-
|
| 63 |
-
Treat the environment as a first-class artifact. It should define:
|
| 64 |
-
|
| 65 |
-
* **reset()**: start a fresh episode
|
| 66 |
-
* **step(action)**: apply an action and return the next result
|
| 67 |
-
* **state() / observation**: what the agent sees
|
| 68 |
-
* **reward**: what counts as progress or success
|
| 69 |
-
|
| 70 |
-
OpenEnv standardizes this so the same training code can work across many environments, instead of every team inventing a different API. That is one of the main reasons to use it in a hackathon.
|
| 71 |
-
|
| 72 |
-
Think about your environment in this order:
|
| 73 |
-
|
| 74 |
-
1. What does the agent observe?
|
| 75 |
-
2. What actions can it take?
|
| 76 |
-
3. What ends an episode?
|
| 77 |
-
4. How do you compute reward?
|
| 78 |
-
5. How do you stop abuse, infinite loops, or cheating?
|
| 79 |
-
|
| 80 |
-
**5\) Build the environment using OpenEnv**
|
| 81 |
-
|
| 82 |
-
The intended workflow is to bootstrap an environment skeleton and then fill in the behavior. OpenEnv’s CLI creates the scaffolding for you. The environment is implemented as a Python package and exposed via a FastAPI app.
|
| 83 |
-
|
| 84 |
-
Your implementation typically defines:
|
| 85 |
-
|
| 86 |
-
* action dataclass
|
| 87 |
-
* observation dataclass
|
| 88 |
-
* state representation
|
| 89 |
-
* environment methods like reset and step
|
| 90 |
-
* FastAPI wrapper / client-server interface
|
| 91 |
-
|
| 92 |
-
That gives you a clean separation:
|
| 93 |
-
|
| 94 |
-
* the **environment** handles world dynamics and scoring,
|
| 95 |
-
* the **trainer** handles optimization,
|
| 96 |
-
* and the **model** just learns to act inside the interface.
|
| 97 |
-
|
| 98 |
-
## **6\) Keep the task simple at first**
|
| 99 |
-
|
| 100 |
-
Do not begin with your hardest benchmark. Start with the easiest version of your environment that still proves the concept. This is where curriculum learning helps.
|
| 101 |
-
|
| 102 |
-
A good progression:
|
| 103 |
-
|
| 104 |
-
1. easy tasks with short horizons,
|
| 105 |
-
2. medium tasks with a little more branching,
|
| 106 |
-
3. harder tasks only after the model starts getting non-zero reward.
|
| 107 |
-
|
| 108 |
-
The principle is simple: **make success possible early**. If the model never sees successful trajectories, learning stalls.
|
| 109 |
-
|
| 110 |
-
## **7\) Design rewards carefully**
|
| 111 |
-
|
| 112 |
-
Your reward function is your task specification. If it is weak, incomplete, or easy to exploit, the model will optimize the wrong thing very efficiently.
|
| 113 |
-
|
| 114 |
-
A strong reward design usually includes multiple components, for example:
|
| 115 |
-
|
| 116 |
-
* execution success,
|
| 117 |
-
* correctness,
|
| 118 |
-
* format compliance,
|
| 119 |
-
* timeouts,
|
| 120 |
-
* resource usage,
|
| 121 |
-
* safety constraints,
|
| 122 |
-
* and anti-cheating checks.
|
| 123 |
-
|
| 124 |
-
One explicit recommendation was to use **multiple independent reward functions**, not just one. If you only have a single reward signal, it is easier for the model to hack it. Multiple independent checks reduce that risk.
|
| 125 |
-
|
| 126 |
-
For example, for a coding environment:
|
| 127 |
-
|
| 128 |
-
* reward passing tests,
|
| 129 |
-
* penalize timeouts,
|
| 130 |
-
* reward format compliance,
|
| 131 |
-
* reject use of forbidden globals,
|
| 132 |
-
* and separately verify the function contract.
|
| 133 |
-
|
| 134 |
-
## **8\) Protect yourself against reward hacking**
|
| 135 |
-
|
| 136 |
-
Reward hacking is one of the biggest practical failure modes. The model may learn shortcuts that maximize your reward without solving the real task. Examples mentioned include:
|
| 137 |
-
|
| 138 |
-
* editing timers,
|
| 139 |
-
* caching results,
|
| 140 |
-
* abusing globals,
|
| 141 |
-
* mutating protected state,
|
| 142 |
-
* or exploiting environment bugs.
|
| 143 |
-
|
| 144 |
-
What to do:
|
| 145 |
-
|
| 146 |
-
1. Use multiple independent reward functions
|
| 147 |
-
2. Lock down execution where possible
|
| 148 |
-
3. Add time limits
|
| 149 |
-
4. Avoid unrestricted global state
|
| 150 |
-
5. Sample outputs frequently and inspect them
|
| 151 |
-
6. Terminate or roll back runs if behavior drifts badly
|
| 152 |
-
|
| 153 |
-
A particularly practical recommendation was to use a **locked-down function** or restricted execution approach so the model cannot rely on undeclared globals or hidden cached state.
|
| 154 |
-
|
| 155 |
-
Also, do not just let training run forever without checking generations. Periodic human inspection is still necessary.
|
| 156 |
-
|
| 157 |
-
## **9\) Use process-aware feedback when you can**
|
| 158 |
-
|
| 159 |
-
Naively assigning the same final reward to every token is inefficient. If possible, use richer supervision that distinguishes good intermediate steps from bad ones. That is the idea behind **process supervision**.
|
| 160 |
-
|
| 161 |
-
In practice, this can be approximated by:
|
| 162 |
-
|
| 163 |
-
* line-by-line checks,
|
| 164 |
-
* step-level verifiers,
|
| 165 |
-
* program trace analysis,
|
| 166 |
-
* or LLM-as-a-judge for intermediate reasoning.
|
| 167 |
-
|
| 168 |
-
But be careful: LLM-as-a-judge can itself be gamed. Use it as one signal, not the only signal.
|
| 169 |
-
|
| 170 |
-
For a hackathon, outcome-based verification plus a few lightweight process checks is usually the sweet spot.
|
| 171 |
-
|
| 172 |
-
## **10\) Pick the right training stack**
|
| 173 |
-
|
| 174 |
-
The intended stack here is:
|
| 175 |
-
|
| 176 |
-
* **TRL** for RL training algorithms
|
| 177 |
-
* **Unsloth** to make RL training and inference more efficient
|
| 178 |
-
* **OpenEnv** to standardize environment interaction
|
| 179 |
-
|
| 180 |
-
This combination works because:
|
| 181 |
-
|
| 182 |
-
* OpenEnv gives you a common environment interface
|
| 183 |
-
* TRL gives you RL trainers like GRPO
|
| 184 |
-
* Unsloth reduces memory use and improves efficiency on top of TRL
|
| 185 |
-
|
| 186 |
-
One of the practical examples used the same prompt repeated many times, routed through an environment, with TRL driving training and Unsloth helping with performance.
|
| 187 |
-
|
| 188 |
-
## **11\) Prefer GRPO / RLVR style training for verifiable tasks**
|
| 189 |
-
|
| 190 |
-
The RL setup discussed here leans toward **RL with verifiable rewards**:
|
| 191 |
-
|
| 192 |
-
* instead of a learned reward model,
|
| 193 |
-
* use a verifier, test harness, regex check, executor, or environment.
|
| 194 |
-
|
| 195 |
-
GRPO was described as a more efficient evolution relative to older PPO-style setups, especially by simplifying away parts like the value model.
|
| 196 |
-
|
| 197 |
-
For hackathon purposes, the key practical takeaway is:
|
| 198 |
-
|
| 199 |
-
* if the task is verifiable,
|
| 200 |
-
* build the verifier first,
|
| 201 |
-
* then plug that verifier into RL training.
|
| 202 |
-
|
| 203 |
-
## **12\) Keep inference fast**
|
| 204 |
-
|
| 205 |
-
One important point: in RL for LLMs, **inference can dominate total runtime**. Over time, rollout generation often becomes the bottleneck, not the optimizer step.
|
| 206 |
-
|
| 207 |
-
That means your project speed depends heavily on:
|
| 208 |
-
|
| 209 |
-
* fast sampling,
|
| 210 |
-
* tight environment loops,
|
| 211 |
-
* low-overhead execution,
|
| 212 |
-
* and efficient model runtime.
|
| 213 |
-
|
| 214 |
-
This is one reason Unsloth matters in the stack, and another reason to avoid overly heavy environments early in the hackathon.
|
| 215 |
-
|
| 216 |
-
## **13\) Deploy your environment early**
|
| 217 |
-
|
| 218 |
-
OpenEnv environments are designed to be deployed as **Hugging Face Spaces**, which provide:
|
| 219 |
-
|
| 220 |
-
* a running server,
|
| 221 |
-
* a Git repository,
|
| 222 |
-
* and a container registry.
|
| 223 |
-
|
| 224 |
-
That gives you several ways to work:
|
| 225 |
-
|
| 226 |
-
* interact with the remote Space directly,
|
| 227 |
-
* install the client code from the repo,
|
| 228 |
-
* pull and run the container locally,
|
| 229 |
-
* or run the FastAPI app locally via Python/Uvicorn.
|
| 230 |
-
|
| 231 |
-
Why this is good for a hackathon:
|
| 232 |
-
|
| 233 |
-
* one shared source of truth,
|
| 234 |
-
* easier collaboration,
|
| 235 |
-
* easier demos,
|
| 236 |
-
* easier switching between local and remote execution.
|
| 237 |
-
|
| 238 |
-
A good habit is to deploy an early version of the environment before training seriously. That catches API and packaging issues early.
|
| 239 |
-
|
| 240 |
-
## **14\) Scale only after the environment is stable**
|
| 241 |
-
|
| 242 |
-
There was a dedicated tutorial flow around:
|
| 243 |
-
|
| 244 |
-
1. environment,
|
| 245 |
-
2. deployment,
|
| 246 |
-
3. scaling,
|
| 247 |
-
4. training with TRL and Wordle.
|
| 248 |
-
|
| 249 |
-
Follow the same order.
|
| 250 |
-
|
| 251 |
-
Do **not** start with scale. First confirm:
|
| 252 |
-
|
| 253 |
-
* reset works,
|
| 254 |
-
* step works,
|
| 255 |
-
* rewards are sensible,
|
| 256 |
-
* timeouts work,
|
| 257 |
-
* logs are visible,
|
| 258 |
-
* and the environment can be run locally and remotely.
|
| 259 |
-
|
| 260 |
-
Only then:
|
| 261 |
-
|
| 262 |
-
* increase batch sizes,
|
| 263 |
-
* duplicate prompts or tasks,
|
| 264 |
-
* expand task diversity,
|
| 265 |
-
* and benchmark throughput.
|
| 266 |
-
|
| 267 |
-
## **15\) Monitor the right things during training**
|
| 268 |
-
|
| 269 |
-
Do not watch only one scalar. Monitor:
|
| 270 |
-
|
| 271 |
-
* overall reward,
|
| 272 |
-
* individual reward function columns,
|
| 273 |
-
* success indicators,
|
| 274 |
-
* timeout frequency,
|
| 275 |
-
* and generated strategies over time.
|
| 276 |
-
|
| 277 |
-
A very concrete suggestion was:
|
| 278 |
-
|
| 279 |
-
* watch whether the reward is going up,
|
| 280 |
-
* and separately watch critical columns like “function works.”
|
| 281 |
-
|
| 282 |
-
Also inspect actual generations during training. A rising reward is not enough if the model is learning to exploit bugs.
|
| 283 |
-
|
| 284 |
-
## **16\) Save models correctly**
|
| 285 |
-
|
| 286 |
-
If you use QLoRA / LoRA-style training, be careful when saving. One explicit warning was:
|
| 287 |
-
|
| 288 |
-
**Do not upcast a 4-bit model to 16-bit and then merge the LoRA weights naively.** That can badly damage model quality. Instead, use the proper merged-save path, or use the adapters directly.
|
| 289 |
-
|
| 290 |
-
For participants, that means:
|
| 291 |
-
|
| 292 |
-
* keep your training save path simple,
|
| 293 |
-
* test post-training inference immediately,
|
| 294 |
-
* and do not leave export until the end.
|
| 295 |
-
|
| 296 |
-
## **17\) How to structure your team over the hackathon**
|
| 297 |
-
|
| 298 |
-
A very effective team split is:
|
| 299 |
-
|
| 300 |
-
**Person A: Environment**
|
| 301 |
-
|
| 302 |
-
* builds reset/step/state
|
| 303 |
-
* adds timeouts and safety constraints
|
| 304 |
-
* makes local and remote execution work
|
| 305 |
-
|
| 306 |
-
**Person B: Verifier / Rewards**
|
| 307 |
-
|
| 308 |
-
* writes multiple reward functions
|
| 309 |
-
* adds anti-hacking checks
|
| 310 |
-
* makes failure cases visible
|
| 311 |
-
|
| 312 |
-
**Person C: Training**
|
| 313 |
-
|
| 314 |
-
* sets up TRL \+ Unsloth
|
| 315 |
-
* runs experiments
|
| 316 |
-
* tracks metrics and generations
|
| 317 |
-
|
| 318 |
-
**Person D: Demo / Product**
|
| 319 |
-
|
| 320 |
-
* prepares the Space demo
|
| 321 |
-
* creates a simple interface
|
| 322 |
-
* records examples and final benchmarks
|
| 323 |
-
|
| 324 |
-
This split matches the way the stack naturally decomposes in practice.
|
| 325 |
-
|
| 326 |
-
## **18\) A practical 1-day execution plan**
|
| 327 |
-
|
| 328 |
-
### **Phase 1: Pick a narrow task**
|
| 329 |
-
|
| 330 |
-
Choose a small, verifiable environment. Avoid huge long-horizon tasks first.
|
| 331 |
-
|
| 332 |
-
### **Phase 2: Build the environment**
|
| 333 |
-
|
| 334 |
-
Use OpenEnv init, implement reset/step/state, and get a local loop working.
|
| 335 |
-
|
| 336 |
-
### **Phase 3: Build rewards**
|
| 337 |
-
|
| 338 |
-
Add at least 2–4 independent reward checks, plus timeout and anti-cheat logic.
|
| 339 |
-
|
| 340 |
-
### **Phase 4: Deploy**
|
| 341 |
-
|
| 342 |
-
Push to a Space or run locally via container/Uvicorn so teammates can use the same environment.
|
| 343 |
-
|
| 344 |
-
### **Phase 5: Train small**
|
| 345 |
-
|
| 346 |
-
Run a tiny TRL \+ Unsloth experiment first. Look at outputs, not just metrics.
|
| 347 |
-
|
| 348 |
-
### **Phase 6: Inspect for hacking**
|
| 349 |
-
|
| 350 |
-
Sample generations. Check for globals, hacks, environment abuse, or suspicious shortcuts.
|
| 351 |
-
|
| 352 |
-
### **Phase 7: Add curriculum**
|
| 353 |
-
|
| 354 |
-
If the model gets zero reward too often, simplify tasks or add easier start states.
|
| 355 |
-
|
| 356 |
-
### **Phase 8: Train bigger**
|
| 357 |
-
|
| 358 |
-
Only after the loop is stable should you increase scale, batch size, or environment diversity.
|
| 359 |
-
|
| 360 |
-
### **Phase 9: Save and demo**
|
| 361 |
-
|
| 362 |
-
Export the trained model correctly, test inference, and show before/after behavior.
|
| 363 |
-
|
| 364 |
-
## **19\) What judges or reviewers will likely find compelling**
|
| 365 |
-
|
| 366 |
-
The strongest hackathon projects usually show:
|
| 367 |
-
|
| 368 |
-
* a clear environment design,
|
| 369 |
-
* objective reward functions,
|
| 370 |
-
* evidence that the model improved,
|
| 371 |
-
* prevention against reward hacking,
|
| 372 |
-
* a reproducible deployment story,
|
| 373 |
-
* and a sharp demo.
|
| 374 |
-
|
| 375 |
-
A simple but strong demo format is:
|
| 376 |
-
|
| 377 |
-
1. baseline model attempt,
|
| 378 |
-
2. reward/verifier output,
|
| 379 |
-
3. trained model attempt,
|
| 380 |
-
4. measurable improvement,
|
| 381 |
-
5. short explanation of safeguards.
|
| 382 |
-
|
| 383 |
-
## **20\) Suggested problem statement theme directions**
|
| 384 |
-
|
| 385 |
-
Please Refer to [\[External\] Apr ‘26 OpenEnv Hackathon Themes](https://docs.google.com/document/d/1Odznuzwtb1ecDOm2t6ToZd4MuMXXfO6vWUGcxbC6mFs/edit?usp=sharing)
|
| 386 |
-
|
| 387 |
-
## **21\) Common mistakes to avoid**
|
| 388 |
-
|
| 389 |
-
* Picking a task so hard that success probability is zero
|
| 390 |
-
* Using only one reward function
|
| 391 |
-
* Not checking for reward hacking
|
| 392 |
-
* Training before the environment is stable
|
| 393 |
-
* Relying only on average reward and not inspecting outputs
|
| 394 |
-
* Forgetting timeouts and sandbox limits
|
| 395 |
-
* Saving LoRA/QLoRA models incorrectly
|
| 396 |
-
|
| 397 |
-
## **22\) Learning Resources**
|
| 398 |
-
|
| 399 |
-
**(Recommended) RL Environment Lecture Chapters:**
|
| 400 |
-
[**https://openenv-india-apr-2026.lovable.app/**](https://openenv-india-apr-2026.lovable.app/)
|
| 401 |
-
|
| 402 |
-
**Module 1: Why OpenEnv?** (\~7 min)
|
| 403 |
-
▸ Workshop 8:02–15:05 — [https://www.youtube.com/watch?v=1jU05MlENOI\&t=482s](https://www.youtube.com/watch?v=1jU05MlENOI&t=482s)
|
| 404 |
-
▸ Sanyam: RL loop, fragmented env APIs, OpenEnv as universal interface, Gymnasium spec \+ Docker
|
| 405 |
-
▸ Alt: Mega Lecture 40:01–46:00 — [https://www.youtube.com/watch?v=Jew4lhAiqnw\&t=2401s](https://www.youtube.com/watch?v=Jew4lhAiqnw&t=2401s)
|
| 406 |
-
|
| 407 |
-
**Module 2: Using Existing Envs** (\~7.5 min)
|
| 408 |
-
▸ Workshop 35:33–43:05 — [https://www.youtube.com/watch?v=1jU05MlENOI\&t=2133s](https://www.youtube.com/watch?v=1jU05MlENOI&t=2133s)
|
| 409 |
-
▸ Ben: Hub org, env collections, 3 Space interfaces (server/repo/registry), from\_hub
|
| 410 |
-
▸ Alt: Mega Lecture 1:24:11–1:30:00 — [https://www.youtube.com/watch?v=Jew4lhAiqnw\&t=5051s](https://www.youtube.com/watch?v=Jew4lhAiqnw&t=5051s)
|
| 411 |
-
|
| 412 |
-
**Module 3: Deploying Envs** (\~9 min)
|
| 413 |
-
▸ Mega Lecture 1:30:00–1:39:07 — [https://www.youtube.com/watch?v=Jew4lhAiqnw\&t=5400s](https://www.youtube.com/watch?v=Jew4lhAiqnw&t=5400s)
|
| 414 |
-
▸ Ben: live openenv init, scaffold, running locally, openenv push, Docker run from Space
|
| 415 |
-
▸ Alt: Workshop 43:05–48:30 — [https://www.youtube.com/watch?v=1jU05MlENOI\&t=2585s](https://www.youtube.com/watch?v=1jU05MlENOI&t=2585s)
|
| 416 |
-
|
| 417 |
-
**Module 4: Building Your Own** (\~6.5 min)
|
| 418 |
-
▸ Workshop 43:45–50:20 — [https://www.youtube.com/watch?v=1jU05MlENOI\&t=2625s](https://www.youtube.com/watch?v=1jU05MlENOI&t=2625s)
|
| 419 |
-
▸ Ben: scaffold files, business logic (reset/step), models, client, publishing
|
| 420 |
-
▸ Alt: Mega Lecture 1:33:30–1:39:07 — [https://www.youtube.com/watch?v=Jew4lhAiqnw\&t=5610s](https://www.youtube.com/watch?v=Jew4lhAiqnw&t=5610s)
|
| 421 |
-
|
| 422 |
-
**Module 5: Training \+ TRL** (\~14 min)
|
| 423 |
-
▸ Mega Lecture 1:53:20–2:07:12 — [https://www.youtube.com/watch?v=Jew4lhAiqnw\&t=6800s](https://www.youtube.com/watch?v=Jew4lhAiqnw&t=6800s)
|
| 424 |
-
▸ Lewis: Wordle GRPO walkthrough — rollout function, reward shaping, GRPOTrainer, live training
|
| 425 |
-
▸ Alt: Workshop 22:24–34:12 — [https://www.youtube.com/watch?v=1jU05MlENOI\&t=1344s](https://www.youtube.com/watch?v=1jU05MlENOI&t=1344s)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/references/[External] OpenEnv Hackathon FAQs.md
DELETED
|
@@ -1,556 +0,0 @@
|
|
| 1 |
-
## **1\) What is reinforcement learning in the context of LLMs?**
|
| 2 |
-
|
| 3 |
-
Reinforcement learning for LLMs is a loop where the model generates an answer, code snippet, plan, or action sequence; that output is evaluated by a verifier or environment; and the resulting reward is used to update the model so higher-reward behaviors become more likely over time. In practice, this is often used after pretraining and supervised fine-tuning to sharpen behaviors like reasoning, code generation, or tool use. The session framed this intuition as turning repeated trial-and-error into weight updates instead of stuffing more and more examples into the prompt.
|
| 4 |
-
|
| 5 |
-
A good mental model is: supervised fine-tuning tells the model “copy this good target,” while RL tells it “try many possibilities and move probability mass toward the ones that score better.” PPO is one classic algorithm for this style of training, and GRPO is a later variant used heavily in modern LLM work because it can be more memory-efficient for certain setups. ([arXiv](https://arxiv.org/abs/1707.06347?utm_source=chatgpt.com))
|
| 6 |
-
|
| 7 |
-
For deeper reading:
|
| 8 |
-
|
| 9 |
-
* TRL docs for RL trainers and workflows. ([Hugging Face](https://huggingface.co/docs/trl/index?utm_source=chatgpt.com))
|
| 10 |
-
* PPO paper. ([arXiv](https://arxiv.org/abs/1707.06347?utm_source=chatgpt.com))
|
| 11 |
-
* DeepSeekMath for GRPO. ([arXiv](https://arxiv.org/abs/2402.03300?utm_source=chatgpt.com))
|
| 12 |
-
|
| 13 |
-
## **2\) Why do rewards matter so much?**
|
| 14 |
-
|
| 15 |
-
Rewards are the only signal telling the model what “better” means. If your reward is well aligned with the real task, RL can push the model toward genuinely useful behavior. If your reward is incomplete or easy to game, the model will optimize the wrong thing very effectively. The session emphasized that RL gives you what you asked for, not necessarily what you meant.
|
| 16 |
-
|
| 17 |
-
For example, if you reward generated code only for passing a shallow regex or a weak unit test, the model may learn to exploit those checks instead of solving the underlying problem. This is why reward design is not a detail; it is the task specification. DeepMind’s discussion of “specification gaming” makes the same point in broader RL terms: weakly specified rewards create loopholes that search will discover. ([Google DeepMind](https://deepmind.google/blog/specification-gaming-the-flip-side-of-ai-ingenuity/?utm_source=chatgpt.com))
|
| 18 |
-
|
| 19 |
-
Useful reading:
|
| 20 |
-
|
| 21 |
-
* DeepMind on specification gaming. ([Google DeepMind](https://deepmind.google/blog/specification-gaming-the-flip-side-of-ai-ingenuity/?utm_source=chatgpt.com))
|
| 22 |
-
* Lilian Weng on reward hacking. ([Lil'Log](https://lilianweng.github.io/posts/2024-11-28-reward-hacking/?utm_source=chatgpt.com))
|
| 23 |
-
|
| 24 |
-
## **3\) What is rewards engineering?**
|
| 25 |
-
|
| 26 |
-
Rewards engineering is the work of designing, combining, validating, and monitoring reward signals so that optimization pressure produces the behavior you actually want. In LLM RL, that usually means deciding:
|
| 27 |
-
|
| 28 |
-
* what gets rewarded,
|
| 29 |
-
* how much it gets rewarded,
|
| 30 |
-
* when it gets rewarded,
|
| 31 |
-
* what gets penalized,
|
| 32 |
-
* and how you audit whether the reward is being gamed.
|
| 33 |
-
|
| 34 |
-
A practical reward function often has several components. For a code task, you might combine syntax validity, execution success, unit test pass rate, latency, memory use, formatting compliance, and safety checks. The session highlighted verifier-based reward design such as formatting checks, execution checks, regex checks, and environment-based evaluation instead of a learned reward model alone.
|
| 35 |
-
|
| 36 |
-
A useful principle is to reward outcomes first, then add process constraints only where needed. Over-shaping the reward can make training brittle or bias the model into narrow strategies, while under-shaping makes hacking easier. ([Google DeepMind](https://deepmind.google/blog/specification-gaming-the-flip-side-of-ai-ingenuity/?utm_source=chatgpt.com))
|
| 37 |
-
|
| 38 |
-
## **4\) What is RLVR, and how is it different from using a reward model?**
|
| 39 |
-
|
| 40 |
-
RLVR usually means reinforcement learning with verifiable rewards. Instead of asking a learned reward model to score outputs, you use a verifier, tester, or environment that can check correctness more directly. The session gave examples like formatting checks, execution checks, regex-based checks, and environment rollouts.
|
| 41 |
-
|
| 42 |
-
This is powerful when correctness is externally testable. Code can be compiled and unit-tested. Math can often be checked against a final answer or symbolic verifier. Games can expose reward from the environment. Browser tasks can be checked by page state or task completion. In such cases, verifier-driven rewards are often more trustworthy than a purely learned scalar reward model.
|
| 43 |
-
|
| 44 |
-
TRL documents this broader environment-based training pattern, and OpenEnv is meant to standardize how such environments are defined and used. ([Hugging Face](https://huggingface.co/docs/trl/openenv?utm_source=chatgpt.com))
|
| 45 |
-
|
| 46 |
-
## **5\) Why do RL environments matter for LLMs?**
|
| 47 |
-
|
| 48 |
-
Static prompt-response datasets are useful, but they are limited. Real deployments require models to interact with systems: codebases, browsers, files, APIs, games, tools, and simulators. RL environments let the model act, observe consequences, and keep going across multiple steps, which is much closer to real agent behavior. The session described environments as the bridge from isolated prompt solving to real-world interaction.
|
| 49 |
-
|
| 50 |
-
They also enable dynamic difficulty and richer feedback. Instead of training forever on a fixed set of prompts, the environment can generate or surface tasks that are more appropriate for the current model, which makes curriculum learning and continual challenge easier. This matches the broader “RL with environments” direction discussed in recent OpenEnv and TRL material. ([Hugging Face](https://huggingface.co/docs/trl/openenv?utm_source=chatgpt.com))
|
| 51 |
-
|
| 52 |
-
For examples:
|
| 53 |
-
|
| 54 |
-
* BrowserGym for web-task environments. ([GitHub](https://github.com/servicenow/browsergym?utm_source=chatgpt.com))
|
| 55 |
-
* OpenEnv course and TRL integration docs. ([GitHub](https://github.com/huggingface/openenv-course?utm_source=chatgpt.com))
|
| 56 |
-
|
| 57 |
-
## **6\) What is OpenEnv, and why would a hackathon team use it?**
|
| 58 |
-
|
| 59 |
-
OpenEnv is an open-source framework for defining and interacting with RL environments for LLM and agent training. The session described it as a standardized interface around concepts like reset, step, state, observations, actions, and rewards, with deployment built around Hugging Face Spaces and containerized execution.
|
| 60 |
-
|
| 61 |
-
A hackathon team would use OpenEnv because it reduces environment plumbing. Instead of inventing a new interface for each task, you can standardize how the model talks to the environment and then connect that to a trainer like TRL. That means you spend more time on task design and rewards, and less on adapter glue. The session also highlighted `openenv init` for bootstrapping an environment skeleton quickly.
|
| 62 |
-
|
| 63 |
-
Good starting points:
|
| 64 |
-
|
| 65 |
-
* OpenEnv repo. ([GitHub](https://github.com/meta-pytorch/OpenEnv?utm_source=chatgpt.com))
|
| 66 |
-
* OpenEnv course. ([GitHub](https://github.com/huggingface/openenv-course?utm_source=chatgpt.com))
|
| 67 |
-
* TRL’s OpenEnv integration guide. ([Hugging Face](https://huggingface.co/docs/trl/openenv?utm_source=chatgpt.com))
|
| 68 |
-
|
| 69 |
-
## **7\) How does OpenEnv work at a high level?**
|
| 70 |
-
|
| 71 |
-
At a high level, an OpenEnv environment exposes a small set of standard operations:
|
| 72 |
-
|
| 73 |
-
* reset the environment,
|
| 74 |
-
* step the environment with an action,
|
| 75 |
-
* return observations, rewards, and state.
|
| 76 |
-
|
| 77 |
-
The session described OpenEnv environments as FastAPI applications that can be run locally, deployed on Hugging Face Spaces, or pulled as containers. That gives teams several options: they can use the remote environment directly, install client code from the repo, or run the environment locally through the container image.
|
| 78 |
-
|
| 79 |
-
This design is useful because it treats environments as portable, versioned software artifacts rather than ad hoc scripts. Hugging Face’s own TRL docs describe OpenEnv similarly, including support for backend-server execution and standardized APIs. ([Hugging Face](https://huggingface.co/docs/trl/openenv?utm_source=chatgpt.com))
|
| 80 |
-
|
| 81 |
-
## **8\) Where do TRL and Unsloth fit in this stack?**
|
| 82 |
-
|
| 83 |
-
TRL is the training library. It provides trainers and workflows for SFT, DPO, PPO, GRPO, reward modeling, and related post-training methods for transformer models. In a typical hackathon setup, TRL handles rollout collection, reward integration, optimization, logging, and trainer configuration. ([Hugging Face](https://huggingface.co/docs/trl/index?utm_source=chatgpt.com))
|
| 84 |
-
|
| 85 |
-
Unsloth fits in as the acceleration and memory-efficiency layer for training and RL fine-tuning. The session described Unsloth as making RL training more efficient and inference faster, which matters because rollout generation often dominates runtime in RL loops. It also noted a practical QLoRA warning: don’t naively upcast a 4-bit model to 16-bit and then merge adapters, because that can damage model quality; use the proper merge path instead.
|
| 86 |
-
|
| 87 |
-
Relevant docs:
|
| 88 |
-
|
| 89 |
-
* TRL docs and GRPO cookbook. ([Hugging Face](https://huggingface.co/docs/trl/index?utm_source=chatgpt.com))
|
| 90 |
-
* Unsloth repository/readme. ([GitHub](https://github.com/unslothai/unsloth/blob/main/README.md?plain=1&utm_source=chatgpt.com))
|
| 91 |
-
|
| 92 |
-
## **9\) What is the difference between PPO and GRPO?**
|
| 93 |
-
|
| 94 |
-
PPO is a classic policy optimization algorithm that stabilizes updates by constraining how much the policy changes between iterations. It is one of the most influential RL algorithms in modern deep learning. ([arXiv](https://arxiv.org/abs/1707.06347?utm_source=chatgpt.com))
|
| 95 |
-
|
| 96 |
-
GRPO is a later group-relative variant used in LLM training that compares sampled outputs within a group to estimate relative advantage, and it is often discussed as a more memory-efficient alternative to full PPO-style setups in some LLM post-training pipelines. The session summarized GRPO as a more efficient version of PPO and specifically noted removing the value model from the setup.
|
| 97 |
-
|
| 98 |
-
For deeper details:
|
| 99 |
-
|
| 100 |
-
* PPO paper. ([arXiv](https://arxiv.org/abs/1707.06347?utm_source=chatgpt.com))
|
| 101 |
-
* DeepSeekMath / GRPO references via TRL paper index and cookbook. ([arXiv](https://arxiv.org/abs/2402.03300?utm_source=chatgpt.com))
|
| 102 |
-
|
| 103 |
-
## **10\) Why is RL often described as inefficient, yet still useful?**
|
| 104 |
-
|
| 105 |
-
RL is often inefficient because the feedback is sparse and delayed. A long rollout may end in one scalar reward, and that weak signal has to train many decisions. The session used a simple example: if a code answer fails at one line but you assign the same negative reward to every token, you’re throwing away a lot of structure.
|
| 106 |
-
|
| 107 |
-
It is still useful because it can optimize behaviors where exact supervised targets are unavailable, too expensive, or too limiting. If you can verify success but cannot easily author perfect demonstrations for every scenario, RL can still improve the model by repeated interaction. This is why RL is especially attractive for code execution, tool use, games, browser tasks, and agent workflows.
|
| 108 |
-
|
| 109 |
-
A practical takeaway: use RL where verifiers exist and where exploration is worth the extra compute.
|
| 110 |
-
|
| 111 |
-
## **11\) What is process supervision, and why is it important?**
|
| 112 |
-
|
| 113 |
-
Process supervision means giving feedback on intermediate reasoning or intermediate steps, not only on the final outcome. The session contrasted this with assigning the same reward to every token in the answer, which can be very wasteful. Under process supervision, you try to identify which parts of a trace were good, irrelevant, or harmful.
|
| 114 |
-
|
| 115 |
-
This matters because not all failures are equal. Maybe the model chose the right algorithmic approach but made one implementation mistake. Final-outcome-only rewards blur that distinction. Step-aware rewards can improve sample efficiency and make debugging easier, though they also raise new risks if the step labels are noisy or exploitable.
|
| 116 |
-
|
| 117 |
-
The session also noted that process supervision is often approximated with humans or LLM-as-a-judge. That can help, but it creates another optimization target that itself may be gamed.
|
| 118 |
-
|
| 119 |
-
## **12\) What is reward hacking?**
|
| 120 |
-
|
| 121 |
-
Reward hacking is when the model finds a way to maximize reward without genuinely doing the intended task. In other words, the optimization succeeds, but the task specification failed. The session gave intuitive examples such as editing variables, bypassing intended checks, or exploiting quirks in the environment rather than solving the real problem.
|
| 122 |
-
|
| 123 |
-
This is the same phenomenon often called specification gaming. DeepMind describes it as agents exploiting flaws or ambiguities in the reward function, and Lilian Weng’s overview covers how common and fundamental this problem is in RL systems. ([Google DeepMind](https://deepmind.google/blog/specification-gaming-the-flip-side-of-ai-ingenuity/?utm_source=chatgpt.com))
|
| 124 |
-
|
| 125 |
-
A useful mindset is: reward hacking is not proof the model is “evil”; it is proof that optimization pressure found a loophole.
|
| 126 |
-
|
| 127 |
-
## **13\) How can a hackathon team reduce reward hacking in practice?**
|
| 128 |
-
|
| 129 |
-
Use strong verifiers. Prefer executable checks over stylistic heuristics. For code, run tests, time the solution, validate output shapes and edge cases, and isolate execution. For tool use, verify actual state transitions, not just verbal claims. The session repeatedly emphasized verifiers and environments over vague reward signals.
|
| 130 |
-
|
| 131 |
-
Monitor training actively. The session recommended sampling outputs periodically, looking for suspicious patterns, and terminating or rolling back runs when drift appears. It also suggested filtering bad responses and adding guardrails when patterns of exploitation are observed.
|
| 132 |
-
|
| 133 |
-
Use layered rewards. Combine success criteria with anti-cheat constraints. For example:
|
| 134 |
-
|
| 135 |
-
* pass tests,
|
| 136 |
-
* do not edit protected files,
|
| 137 |
-
* do not bypass timers,
|
| 138 |
-
* stay within time and memory budget,
|
| 139 |
-
* preserve task-required formatting,
|
| 140 |
-
* and log intermediate actions for audit.
|
| 141 |
-
|
| 142 |
-
This general strategy aligns with broader RL safety guidance on specification gaming. ([Google DeepMind](https://deepmind.google/blog/specification-gaming-the-flip-side-of-ai-ingenuity/?utm_source=chatgpt.com))
|
| 143 |
-
|
| 144 |
-
## **14\) What is curriculum learning, and why does it help RL?**
|
| 145 |
-
|
| 146 |
-
Curriculum learning means controlling the order or difficulty of training tasks so the model learns from easier tasks first and gradually moves to harder ones. The session directly recommended this for RL: if tasks are too hard at the start, the model may never produce a successful rollout, which means the reward signal is effectively zero and learning stalls.
|
| 147 |
-
|
| 148 |
-
This is especially important in LLM RL because many tasks are long-horizon and brittle. An easier initial distribution can bootstrap behavior, after which harder tasks become reachable. In the RL literature more broadly, curriculum learning is a standard way to improve exploration and sample efficiency in difficult environments. ([arXiv](https://arxiv.org/pdf/2504.06618?utm_source=chatgpt.com))
|
| 149 |
-
|
| 150 |
-
Practical idea for hackathons:
|
| 151 |
-
|
| 152 |
-
* start with short horizons,
|
| 153 |
-
* fewer tools,
|
| 154 |
-
* simpler state spaces,
|
| 155 |
-
* stronger hints,
|
| 156 |
-
* easier test cases,
|
| 157 |
-
* then gradually remove scaffolding.
|
| 158 |
-
|
| 159 |
-
## **15\) How do I know whether a task is suitable for RL?**
|
| 160 |
-
|
| 161 |
-
A task is a good candidate for RL if:
|
| 162 |
-
|
| 163 |
-
* you can verify success or partial progress,
|
| 164 |
-
* exploration is meaningful,
|
| 165 |
-
* multi-step interaction matters,
|
| 166 |
-
* and you do not already have abundant high-quality demonstrations.
|
| 167 |
-
|
| 168 |
-
The session highlighted a key rule of thumb: the probability of a good answer must be greater than zero. If the task is so hard that the model never stumbles into any rewarding behavior, RL will waste compute. That means task selection, warm starts, formatting scaffolds, or light SFT can be essential.
|
| 169 |
-
|
| 170 |
-
Good hackathon candidates include:
|
| 171 |
-
|
| 172 |
-
* code generation with executable tests,
|
| 173 |
-
* browser navigation with page-state checks,
|
| 174 |
-
* games with clear win conditions,
|
| 175 |
-
* API/tool workflows with verifiable side effects.
|
| 176 |
-
|
| 177 |
-
## **16\) Should we jump straight into RL, or do some SFT first?**
|
| 178 |
-
|
| 179 |
-
Usually, do some SFT or at least a warm start first. The session’s guidance was that pretraining carries most of the capability burden, SFT helps shape the behavior, and RL refines it. It explicitly argued against relying on RL alone from scratch for most practical settings.
|
| 180 |
-
|
| 181 |
-
That matches modern post-training stacks: pretrain heavily, align or instruct-tune, then apply preference optimization and/or RL where it adds value. TRL’s supported workflows reflect exactly this broader stack. ([Hugging Face](https://huggingface.co/docs/trl/index?utm_source=chatgpt.com))
|
| 182 |
-
|
| 183 |
-
A hackathon-friendly recipe is:
|
| 184 |
-
|
| 185 |
-
1. Start from a solid instruct model.
|
| 186 |
-
2. Add a tiny amount of task-format SFT if needed.
|
| 187 |
-
3. Build a strong verifier.
|
| 188 |
-
4. Use GRPO/PPO-style RL only after the model can at least occasionally succeed.
|
| 189 |
-
|
| 190 |
-
## **17\) What should we actually monitor during RL training?**
|
| 191 |
-
|
| 192 |
-
Monitor more than the headline reward. The session specifically called out tracking reward trends, component rewards, and whether important success columns are improving over time. It also recommended checking generated strategies and periodically sampling outputs during training rather than letting runs continue blindly.
|
| 193 |
-
|
| 194 |
-
Useful metrics include:
|
| 195 |
-
|
| 196 |
-
* average reward,
|
| 197 |
-
* verifier pass rate,
|
| 198 |
-
* timeout rate,
|
| 199 |
-
* format adherence,
|
| 200 |
-
* rollout length,
|
| 201 |
-
* diversity of successful solutions,
|
| 202 |
-
* frequency of suspicious shortcuts,
|
| 203 |
-
* and cost per useful trajectory.
|
| 204 |
-
|
| 205 |
-
If the average reward rises but the actual task quality drops or becomes brittle, that is often a reward-design problem rather than a model-capability problem.
|
| 206 |
-
|
| 207 |
-
## **18\) What is a strong hackathon strategy for building an RL environment fast?**
|
| 208 |
-
|
| 209 |
-
Pick a task with a crisp verifier. Build the smallest environment that exposes reset, step, observations, and reward. Use OpenEnv to standardize the interface and TRL to handle training. Use Unsloth if you need to fit training into tighter hardware budgets. ([Hugging Face](https://huggingface.co/docs/trl/openenv?utm_source=chatgpt.com))
|
| 210 |
-
|
| 211 |
-
A practical sequence:
|
| 212 |
-
|
| 213 |
-
1. Define the task and what “success” means.
|
| 214 |
-
2. Write the verifier before writing the policy loop.
|
| 215 |
-
3. Create a few toy tasks the model can solve.
|
| 216 |
-
4. Add curriculum or easier variants first.
|
| 217 |
-
5. Run small-scale debugging before long training.
|
| 218 |
-
6. Sample outputs constantly for reward hacking.
|
| 219 |
-
7. Only then scale rollouts and environment diversity.
|
| 220 |
-
|
| 221 |
-
## **19\) What are good starter resources for participants?**
|
| 222 |
-
|
| 223 |
-
For TRL:
|
| 224 |
-
|
| 225 |
-
* Main docs. ([Hugging Face](https://huggingface.co/docs/trl/index?utm_source=chatgpt.com))
|
| 226 |
-
* PPO trainer docs. ([Hugging Face](https://huggingface.co/docs/trl/ppo_trainer?utm_source=chatgpt.com))
|
| 227 |
-
* GRPO cookbook. ([Hugging Face](https://huggingface.co/learn/cookbook/fine_tuning_llm_grpo_trl?utm_source=chatgpt.com))
|
| 228 |
-
* Paper index for GRPO/DeepSeekMath references. ([Hugging Face](https://huggingface.co/docs/trl/paper_index?utm_source=chatgpt.com))
|
| 229 |
-
|
| 230 |
-
For OpenEnv:
|
| 231 |
-
|
| 232 |
-
* OpenEnv GitHub repo. ([GitHub](https://github.com/meta-pytorch/OpenEnv?utm_source=chatgpt.com))
|
| 233 |
-
* OpenEnv course. ([GitHub](https://github.com/huggingface/openenv-course?utm_source=chatgpt.com))
|
| 234 |
-
* TRL’s OpenEnv integration docs. ([Hugging Face](https://huggingface.co/docs/trl/openenv?utm_source=chatgpt.com))
|
| 235 |
-
|
| 236 |
-
For environments and benchmarks:
|
| 237 |
-
|
| 238 |
-
* BrowserGym. ([GitHub](https://github.com/servicenow/browsergym?utm_source=chatgpt.com))
|
| 239 |
-
|
| 240 |
-
For reward design and failure modes:
|
| 241 |
-
|
| 242 |
-
* DeepMind on specification gaming. ([Google DeepMind](https://deepmind.google/blog/specification-gaming-the-flip-side-of-ai-ingenuity/?utm_source=chatgpt.com))
|
| 243 |
-
* Lilian Weng on reward hacking. ([Lil'Log](https://lilianweng.github.io/posts/2024-11-28-reward-hacking/?utm_source=chatgpt.com))
|
| 244 |
-
|
| 245 |
-
For RL algorithms:
|
| 246 |
-
|
| 247 |
-
* PPO paper. ([arXiv](https://arxiv.org/abs/1707.06347?utm_source=chatgpt.com))
|
| 248 |
-
* DeepSeekMath / GRPO paper. ([arXiv](https://arxiv.org/abs/2402.03300?utm_source=chatgpt.com))
|
| 249 |
-
|
| 250 |
-
For Unsloth:
|
| 251 |
-
|
| 252 |
-
* Unsloth repo/readme. ([GitHub](https://github.com/unslothai/unsloth/blob/main/README.md?plain=1&utm_source=chatgpt.com))
|
| 253 |
-
|
| 254 |
-
## **20\) What is the one-sentence summary participants should remember?**
|
| 255 |
-
|
| 256 |
-
If you can build a task where success is verifiable, difficulty is controllable, and loopholes are monitored, RL can turn an LLM from “good at answering” into “better at acting.”
|
| 257 |
-
|
| 258 |
-
###
|
| 259 |
-
|
| 260 |
-
### **21\) What is RLVR?**
|
| 261 |
-
|
| 262 |
-
RLVR stands for reinforcement learning with verifiable rewards. Instead of relying only on a learned reward model or human preference model, the training loop uses programmatic checks to determine whether an output is correct. Typical examples include exact-answer checks for math, unit tests for code, schema validation for structured output, or environment-based task completion checks. This makes RLVR especially attractive for domains where correctness can be verified automatically and consistently. ([Label Studio](https://labelstud.io/blog/reinforcement-learning-from-verifiable-rewards/))
|
| 263 |
-
|
| 264 |
-
### **22\) What is RLVE?**
|
| 265 |
-
|
| 266 |
-
RLVE is reinforcement learning with verifiable environments. The key idea is to train on environments that can procedurally generate tasks, expose adjustable difficulty, and provide algorithmically verifiable rewards. Recent work on adaptive verifiable environments argues that static prompt datasets often become either too easy or too hard during training, causing learning to stall, while adaptive environments keep the model near its capability frontier. ([arXiv](https://arxiv.org/html/2511.07317v1))
|
| 267 |
-
|
| 268 |
-
### **23\) How is RLVE different from RLVR?**
|
| 269 |
-
|
| 270 |
-
RLVR usually refers to verifiable rewards on a fixed or semi-fixed set of prompts or problems. RLVE goes a step further by making the task source itself dynamic: the environment can generate new problems, vary difficulty, and keep serving appropriately challenging tasks as the model improves. In practice, RLVE is often better for preventing saturation on static datasets and for building curriculum naturally into training. ([arXiv](https://arxiv.org/html/2511.07317v1))
|
| 271 |
-
|
| 272 |
-
### **24\) Why are RL environments useful for LLM post-training?**
|
| 273 |
-
|
| 274 |
-
They let the model interact, not just answer. In a real environment, the model can act, observe consequences, act again, and get reward from actual task outcomes. That makes environments a better fit for tool use, browsers, APIs, coding agents, games, and long-horizon tasks than plain prompt-response datasets. Hugging Face’s OpenEnv and TRL material reflects this shift toward environment-based agent training. ([Hugging Face](https://huggingface.co/blog/openenv-turing))
|
| 275 |
-
|
| 276 |
-
### **25\) Where do TRL, GRPO, and Unsloth fit in?**
|
| 277 |
-
|
| 278 |
-
TRL is the training framework that provides RL trainers and infrastructure for post-training transformer models, including GRPO. GRPO is the RL optimization method popularized in DeepSeekMath and now widely used in open LLM RL pipelines because it can be more memory-efficient than PPO-style setups in this context. Unsloth is typically used as the efficiency layer to make fine-tuning and RL training faster and more affordable on limited hardware. ([Hugging Face](https://huggingface.co/docs/trl/grpo_trainer))
|
| 279 |
-
|
| 280 |
-
### **26\) Why do rewards matter so much?**
|
| 281 |
-
|
| 282 |
-
Because the reward is the task definition as far as optimization is concerned. If your reward captures the real objective, RL can improve useful behavior. If your reward is incomplete, noisy, or hackable, the model will optimize the proxy instead of the real task. DeepMind’s write-up on specification gaming makes this point very clearly: the agent’s ingenuity is helpful only when the specification is correct. ([Google DeepMind](https://deepmind.google/blog/specification-gaming-the-flip-side-of-ai-ingenuity/))
|
| 283 |
-
|
| 284 |
-
### **27\) What is reward engineering?**
|
| 285 |
-
|
| 286 |
-
Reward engineering is the design of the reward function, the verifier, the shaping terms, the penalties, and the monitoring strategy. In LLM RL, this includes deciding what counts as success, how partial progress is rewarded, what shortcuts are forbidden, and how to detect reward hacking. OpenEnv’s reward-design guide explicitly warns about reward hacking, sparse rewards, and conflicting signals as common pitfalls. ([Meta-PyTorch](https://meta-pytorch.org/OpenEnv/guides/rewards.html))
|
| 287 |
-
|
| 288 |
-
### **28\) What is reward hacking?**
|
| 289 |
-
|
| 290 |
-
Reward hacking happens when a model finds a way to maximize the reward without actually doing the intended task. DeepMind describes this as specification gaming: the system satisfies the literal reward but not the real goal. Classic causes include poorly designed shaping rewards, missing constraints in the success condition, and simulator or verifier loopholes. ([Google DeepMind](https://deepmind.google/blog/specification-gaming-the-flip-side-of-ai-ingenuity/))
|
| 291 |
-
|
| 292 |
-
### **29\) Why is sparse reward a common problem?**
|
| 293 |
-
|
| 294 |
-
If successful trajectories are too rare, the model may never get enough positive signal to improve. OpenEnv’s docs explicitly call sparse rewards a common pitfall because the agent may never find positive signal. RLVE work similarly notes that overly difficult tasks can yield consistently poor rewards and stall gradient-based learning. ([Meta-PyTorch](https://meta-pytorch.org/OpenEnv/guides/rewards.html))
|
| 295 |
-
|
| 296 |
-
### **30\) Why can dense rewards also be dangerous?**
|
| 297 |
-
|
| 298 |
-
Dense rewards can speed up learning, but they can also create local optima and incentive misalignment. OpenEnv recommends starting simple and shaping carefully, because intermediate rewards can steer the model toward proxy behaviors. DeepMind gives the broader warning that poorly designed shaping can change the optimal policy itself rather than just helping the model reach the intended outcome faster. ([Meta-PyTorch](https://meta-pytorch.org/OpenEnv/guides/rewards.html))
|
| 299 |
-
|
| 300 |
-
---
|
| 301 |
-
|
| 302 |
-
## **Common Pitfalls in Building RL Environments**
|
| 303 |
-
|
| 304 |
-
### **31\) What is the most common mistake when designing an RL environment?**
|
| 305 |
-
|
| 306 |
-
Making the environment easy to verify but not faithful to the real task. A verifier that checks only the final string, a regex, or a narrow success pattern may be convenient, but it often misses equivalent correct answers or allows degenerate shortcuts. Recent verifier analysis on mathematical RL found that rule-based verifiers often reject correct but differently formatted answers, while model-based verifiers can be exploited to produce false positives during RL. ([arXiv](https://arxiv.org/html/2505.22203v1))
|
| 307 |
-
|
| 308 |
-
### **32\) What goes wrong with weak verifiers?**
|
| 309 |
-
|
| 310 |
-
Two opposite failure modes are common. Rule-based verifiers can be too brittle and produce false negatives when the answer is correct but phrased differently. Model-based verifiers can be too permissive and produce false positives that the policy learns to exploit. The verifier study on mathematical reasoning reports both problems and shows that stronger policies make verifier weaknesses more obvious. ([arXiv](https://arxiv.org/html/2505.22203v1))
|
| 311 |
-
|
| 312 |
-
### **33\) Why is “just use an LLM as judge” often risky?**
|
| 313 |
-
|
| 314 |
-
Because the judge becomes part of the optimization target. If the policy can find surface patterns that fool the judge, training can inflate reward without improving real task quality. That is exactly why model-based verifiers, despite better static accuracy, can be vulnerable during RL training. Use them carefully, stress-test them, and combine them with hard checks whenever possible. ([arXiv](https://arxiv.org/html/2505.22203v1))
|
| 315 |
-
|
| 316 |
-
### **34\) What is a common environment-design pitfall for tool-using agents?**
|
| 317 |
-
|
| 318 |
-
Not modeling realistic failure modes. Real APIs fail because of permissions, invalid formats, missing fields, timezones, or bad parameters. Hugging Face’s OpenEnv blog highlights examples like missing OAuth scopes and bad RFC3339 datetime formatting. If the environment hides these realities, the resulting policy will be overfit to a toy setup and brittle in deployment. ([Hugging Face](https://huggingface.co/blog/openenv-turing))
|
| 319 |
-
|
| 320 |
-
### **35\) Why is static task difficulty a problem?**
|
| 321 |
-
|
| 322 |
-
Because the learning signal collapses at both extremes. Tasks that are too easy stop teaching the model anything useful. Tasks that are too hard yield near-zero reward and also stop teaching. RLVE was proposed largely to solve this problem by dynamically adjusting task difficulty as the policy improves. ([arXiv](https://arxiv.org/html/2511.07317v1))
|
| 323 |
-
|
| 324 |
-
### **36\) What is a common pitfall in environment diversity?**
|
| 325 |
-
|
| 326 |
-
Training on too few task types. Recent RLVE results argue that scaling the number of environments improves generalizable reasoning capability, and Reasoning Gym was built around procedurally generated tasks across many domains for exactly this reason. A narrow environment set often produces narrow competence and fragile transfer. ([arXiv](https://arxiv.org/html/2511.07317v1))
|
| 327 |
-
|
| 328 |
-
### **37\) Why do many RL environments fail to transfer to real-world performance?**
|
| 329 |
-
|
| 330 |
-
Because they optimize the wrong abstraction level. If the environment is too toy-like, omits realistic constraints, or over-simplifies tool feedback, the model may become good at the benchmark but not at the actual workflow. This is a practical version of specification gaming: the benchmark is solved, the real job is not. ([Google DeepMind](https://deepmind.google/blog/specification-gaming-the-flip-side-of-ai-ingenuity/))
|
| 331 |
-
|
| 332 |
-
---
|
| 333 |
-
|
| 334 |
-
## **Common Pitfalls in Reward Engineering**
|
| 335 |
-
|
| 336 |
-
### **38\) What is the biggest reward-engineering mistake?**
|
| 337 |
-
|
| 338 |
-
Using a proxy metric as if it were the goal. Goodhart-style failures are everywhere in RL: token count, response format, test count, or intermediate progress can all become targets the model exploits. DeepMind’s examples of shaping mistakes and reward misspecification are the canonical warning here. ([Google DeepMind](https://deepmind.google/blog/specification-gaming-the-flip-side-of-ai-ingenuity/))
|
| 339 |
-
|
| 340 |
-
### **39\) Should I start with a complicated reward function?**
|
| 341 |
-
|
| 342 |
-
Usually no. OpenEnv explicitly recommends starting simple, often with sparse success/failure reward, before layering in shaping terms. This makes debugging easier and reduces the chance that the model learns the wrong intermediate incentives before it learns the actual task. ([Meta-PyTorch](https://meta-pytorch.org/OpenEnv/guides/rewards.html))
|
| 343 |
-
|
| 344 |
-
### **40\) What happens when reward components conflict?**
|
| 345 |
-
|
| 346 |
-
Learning becomes unstable or confused. OpenEnv lists conflicting signals as a common pitfall: if one term rewards brevity, another rewards verbosity, a third rewards format, and a fourth rewards exploration, the policy may oscillate or learn brittle shortcuts instead of coherent behavior. ([Meta-PyTorch](https://meta-pytorch.org/OpenEnv/guides/rewards.html))
|
| 347 |
-
|
| 348 |
-
### **41\) Why is binary reward often appealing?**
|
| 349 |
-
|
| 350 |
-
Because it is easy to reason about and harder to game superficially. Label Studio’s RLVR overview notes that verifiable rewards are often binary and directly tied to correctness criteria, which makes evaluation simple and scalable. Binary reward is not always sufficient, but it is often a good starting point for precision-critical tasks like code and math. ([Label Studio](https://labelstud.io/blog/reinforcement-learning-from-verifiable-rewards/))
|
| 351 |
-
|
| 352 |
-
### **42\) Why is binary reward sometimes not enough?**
|
| 353 |
-
|
| 354 |
-
Because it can be too sparse, especially for long-horizon tasks. If success only happens at the very end, the model may not learn at all. That is where carefully designed shaping, step-level evaluation, or adaptive curriculum can help — but only if you can add them without creating easy-to-game shortcuts. ([Meta-PyTorch](https://meta-pytorch.org/OpenEnv/guides/rewards.html))
|
| 355 |
-
|
| 356 |
-
### **43\) How do I know whether my reward is being hacked?**
|
| 357 |
-
|
| 358 |
-
Watch for rising reward without corresponding task-quality gains. Typical signs are strange formatting habits, repetitive surface patterns, degenerate short solutions, suspiciously high judge scores, or solutions that pass weak checks but fail stronger ones. The verifier case study is a strong reminder that static verification accuracy is not enough; you must observe what happens under optimization pressure. ([arXiv](https://arxiv.org/html/2505.22203v1))
|
| 359 |
-
|
| 360 |
-
### **44\) What is a safe pattern for reward engineering?**
|
| 361 |
-
|
| 362 |
-
Use layered verification. Start with hard outcome checks. Add anti-cheat constraints. Then add minimal shaping only where the sparse reward is too weak. Keep a holdout evaluator separate from the training reward when possible. This matches both OpenEnv’s “start simple, shape carefully” guidance and DeepMind’s warning about shaping altering the true objective. ([Meta-PyTorch](https://meta-pytorch.org/OpenEnv/guides/rewards.html))
|
| 363 |
-
|
| 364 |
-
---
|
| 365 |
-
|
| 366 |
-
## **Common Pitfalls in RL Post-Training Pipelines with RLVR / RLVE / GRPO**
|
| 367 |
-
|
| 368 |
-
### **45\) What is a common mistake in GRPO training runs?**
|
| 369 |
-
|
| 370 |
-
Using RL before the base model is ready. GRPO is powerful, but it is a post-training method, not a substitute for capability. TRL’s own GRPO examples start from instruct models and task datasets rather than from weak base checkpoints. If the model almost never produces a correct rollout, the reward signal is too sparse for productive RL. ([Hugging Face](https://huggingface.co/docs/trl/grpo_trainer))
|
| 371 |
-
|
| 372 |
-
### **46\) Why does RL post-training plateau?**
|
| 373 |
-
|
| 374 |
-
Because the model saturates the available prompt distribution or the reward signal no longer differentiates useful improvements. RLVE explicitly frames static data saturation as a problem and shows that adaptive environments can keep learning going after conventional RLVR pipelines flatten out. ([arXiv](https://arxiv.org/html/2511.07317v1))
|
| 375 |
-
|
| 376 |
-
### **47\) Why can “more RL” make a model worse?**
|
| 377 |
-
|
| 378 |
-
Because optimization pressure amplifies whatever the reward favors, including undesirable shortcuts. If the verifier is noisy, if the environment is unrealistic, or if the reward overvalues superficial structure, more training can push the model deeper into those artifacts rather than improving real competence. ([arXiv](https://arxiv.org/html/2505.22203v1))
|
| 379 |
-
|
| 380 |
-
### **48\) What is a common pitfall in RLVR datasets?**
|
| 381 |
-
|
| 382 |
-
Finite, static datasets get stale. Once the model has mastered or overfit their distribution, additional RL yields little signal. RLVE work argues that procedurally generated environments with adjustable difficulty are one way around this limitation. Reasoning Gym makes a similar case for unlimited data generation with controllable complexity. ([arXiv](https://arxiv.org/html/2511.07317v1))
|
| 383 |
-
|
| 384 |
-
### **49\) Why do identical-looking GRPO runs produce different outcomes?**
|
| 385 |
-
|
| 386 |
-
Because RL is highly sensitive to rollout quality, verifier behavior, reward scaling, task mix, generation parameters, and environment bugs. Even if the trainer code is the same, small differences in reward computation or environment behavior can change optimization dynamics substantially. The verifier study is a good reminder that the reward pipeline itself is part of the model. ([arXiv](https://arxiv.org/html/2505.22203v1))
|
| 387 |
-
|
| 388 |
-
### **50\) What is a common pitfall when mixing many environments?**
|
| 389 |
-
|
| 390 |
-
Using an unbalanced mixture. If some environments are much easier, much denser in reward, or much shorter in trajectory length, they can dominate training and starve harder but more important environments. RLVE’s adaptive-difficulty framing exists partly to keep the training distribution informative instead of letting it collapse into easy tasks. ([arXiv](https://arxiv.org/html/2511.07317v1))
|
| 391 |
-
|
| 392 |
-
### **51\) Why are long-horizon tasks especially hard in RL post-training?**
|
| 393 |
-
|
| 394 |
-
Because reward arrives late and useful trajectories are rare. Long tasks need either decomposition, better intermediate signals, stronger initialization, or curriculum. Otherwise, the rollout cost is high and the success rate stays near zero. This is one reason why adaptive environments and procedural curricula are getting attention. ([arXiv](https://arxiv.org/html/2511.07317v1))
|
| 395 |
-
|
| 396 |
-
### **52\) What monitoring mistake do teams make most often?**
|
| 397 |
-
|
| 398 |
-
They monitor the training reward but not actual behavior. Reward alone is not enough because the reward channel can be flawed. You need sampled rollout audits, stronger offline evaluation, and held-out environments or benchmarks. The verifier case study shows why this matters: reward can rise while real quality does not. ([arXiv](https://arxiv.org/html/2505.22203v1))
|
| 399 |
-
|
| 400 |
-
### **53\) What is the safest way to structure an RL post-training pipeline?**
|
| 401 |
-
|
| 402 |
-
A good pattern is:
|
| 403 |
-
start from a strong instruct or SFT checkpoint, use a task with a strong verifier, begin with simple reward, validate the environment thoroughly, run small-scale debug experiments, audit rollouts manually, then scale training and only later add curriculum or more shaping. This is consistent with TRL’s practical GRPO examples, OpenEnv’s reward guidance, and the lessons from verifier-failure studies. ([Hugging Face](https://huggingface.co/docs/trl/grpo_trainer))
|
| 404 |
-
|
| 405 |
-
---
|
| 406 |
-
|
| 407 |
-
## **Practical “What should we do in a hackathon?” FAQs**
|
| 408 |
-
|
| 409 |
-
### **54\) What kind of project is most likely to succeed in a hackathon?**
|
| 410 |
-
|
| 411 |
-
Pick a task with:
|
| 412 |
-
a clear success condition,
|
| 413 |
-
a verifier you trust,
|
| 414 |
-
short to medium trajectory length,
|
| 415 |
-
few external dependencies,
|
| 416 |
-
and adjustable difficulty.
|
| 417 |
-
|
| 418 |
-
Good examples are code repair with tests, structured extraction with schema validation, grid or puzzle games, tool-using workflows with exact state checks, and browser tasks with explicit completion criteria. These are the sweet spot for RLVR and lightweight RLVE prototypes. ([Label Studio](https://labelstud.io/blog/reinforcement-learning-from-verifiable-rewards/))
|
| 419 |
-
|
| 420 |
-
### **55\) What should we avoid building?**
|
| 421 |
-
|
| 422 |
-
Avoid tasks that are subjective, hard to verify, require massive infrastructure, or depend heavily on an LLM judge without hard backstops. Also avoid environments whose failure cases you do not understand. If you cannot explain how the reward could be hacked, you are not ready to optimize it yet. ([arXiv](https://arxiv.org/html/2505.22203v1))
|
| 423 |
-
|
| 424 |
-
### **56\) What is the best debugging order?**
|
| 425 |
-
|
| 426 |
-
First debug the environment manually.
|
| 427 |
-
Then debug the verifier.
|
| 428 |
-
Then run scripted baseline policies.
|
| 429 |
-
Then run a frozen model.
|
| 430 |
-
Then run a tiny RL experiment.
|
| 431 |
-
Only then scale.
|
| 432 |
-
|
| 433 |
-
This order isolates bugs early and prevents you from blaming the optimizer for what is really an environment or reward bug. It follows directly from the fact that verifier reliability is foundational in RLVR. ([arXiv](https://arxiv.org/html/2505.22203v1))
|
| 434 |
-
|
| 435 |
-
### **57\) What is one rule the team should remember?**
|
| 436 |
-
|
| 437 |
-
Do not optimize a reward you have not tried to break yourself first. The easiest way to avoid reward hacking is to adversarially test your environment and reward design before the model does. ([Google DeepMind](https://deepmind.google/blog/specification-gaming-the-flip-side-of-ai-ingenuity/))
|
| 438 |
-
|
| 439 |
-
---
|
| 440 |
-
|
| 441 |
-
## **58\) Strong references for deeper learning**
|
| 442 |
-
|
| 443 |
-
For GRPO and TRL:
|
| 444 |
-
|
| 445 |
-
* TRL GRPO Trainer docs. ([Hugging Face](https://huggingface.co/docs/trl/grpo_trainer))
|
| 446 |
-
* Hugging Face GRPO cookbook. ([Hugging Face](https://huggingface.co/learn/cookbook/fine_tuning_llm_grpo_trl))
|
| 447 |
-
|
| 448 |
-
For RL environments and reward design:
|
| 449 |
-
|
| 450 |
-
* OpenEnv reward design guide. ([Meta-PyTorch](https://meta-pytorch.org/OpenEnv/guides/rewards.html))
|
| 451 |
-
* OpenEnv tool-using environment examples. ([Hugging Face](https://huggingface.co/blog/openenv-turing))
|
| 452 |
-
|
| 453 |
-
For pitfalls and failure modes:
|
| 454 |
-
|
| 455 |
-
* DeepMind on specification gaming. ([Google DeepMind](https://deepmind.google/blog/specification-gaming-the-flip-side-of-ai-ingenuity/))
|
| 456 |
-
* Pitfalls of rule-based and model-based verifiers. ([arXiv](https://arxiv.org/html/2505.22203v1))
|
| 457 |
-
|
| 458 |
-
For scalable environment-based training:
|
| 459 |
-
|
| 460 |
-
* RLVE paper on adaptive verifiable environments. ([arXiv](https://arxiv.org/html/2511.07317v1))
|
| 461 |
-
* Reasoning Gym. ([OpenReview](https://openreview.net/forum?id=GqYSunGmp7&referrer=%5Bthe+profile+of+Oliver+Stanley%5D%28%2Fprofile%3Fid%3D~Oliver_Stanley1%29))
|
| 462 |
-
|
| 463 |
-
Here are solid Unsloth RL post-training recipes worth checking out, with a bias toward official or close-to-official examples.
|
| 464 |
-
|
| 465 |
-
### **59\) Core Unsloth GRPO recipes**
|
| 466 |
-
|
| 467 |
-
**Qwen2.5 (3B) GRPO notebook**
|
| 468 |
-
A straightforward starter recipe for GRPO with Unsloth. It covers data prep, training, inference, and saving, so it is a good baseline if you want the least opinionated end-to-end example. ([GitHub](https://github.com/unslothai/notebooks/blob/main/nb/Qwen2.5_%283B%29-GRPO.ipynb?utm_source=chatgpt.com))
|
| 469 |
-
|
| 470 |
-
**Llama 3.1 (8B) GRPO notebook**
|
| 471 |
-
Same general pattern, but on a larger model family. Useful if you want a more realistic “reasoning/capability uplift” recipe without jumping straight to very large models. ([GitHub](https://github.com/unslothai/notebooks/blob/main/nb/Llama3.1_%288B%29-GRPO.ipynb?utm_source=chatgpt.com))
|
| 472 |
-
|
| 473 |
-
**Gemma 3 (1B) GRPO notebook**
|
| 474 |
-
A smaller-scale recipe that is easier to run and debug. Good for iterating on reward functions and rollout settings before spending more compute on larger checkpoints. ([GitHub](https://github.com/unslothai/notebooks/blob/main/nb/Gemma3_%281B%29-GRPO.ipynb?utm_source=chatgpt.com))
|
| 475 |
-
|
| 476 |
-
### **59.1) Advanced Unsloth GRPO recipes**
|
| 477 |
-
|
| 478 |
-
**Advanced Qwen3 (4B) GRPO notebook**
|
| 479 |
-
This is one of the more interesting recipes because it adds more than the bare trainer loop. Unsloth’s June 2025 discussion explicitly calls out: proximity scoring for more nuanced rewards, OpenR1 dataset support, advanced templates, and “prefinetuning to skip GRPO format learning.” That makes it a better recipe when you care about reward shaping and format bootstrapping, not just getting GRPO to run. ([GitHub](https://github.com/unslothai/unsloth/discussions/2810?utm_source=chatgpt.com))
|
| 480 |
-
|
| 481 |
-
**HF LLM Course: Practical Exercise — GRPO with Unsloth**
|
| 482 |
-
Not an Unsloth-maintained notebook repo entry, but it is a structured learning recipe that uses Unsloth specifically to fine-tune a model with GRPO for reasoning. It is a good companion when you want a didactic walkthrough instead of just notebook cells. ([Hugging Face](https://huggingface.co/learn/llm-course/chapter12/6?utm_source=chatgpt.com))
|
| 483 |
-
|
| 484 |
-
### **59.2) Environment / agent-style RL recipes**
|
| 485 |
-
|
| 486 |
-
**GPT-OSS 20B \+ 2048 game RL notebook**
|
| 487 |
-
This is closer to “RL with an environment” than plain static-prompt RLVR. The notebook goal is explicitly to make GPT-OSS play 2048 with reinforcement learning / GRPO, which makes it a useful recipe if you want to move beyond math/code answer verification into interactive environment training. ([GitHub](https://github.com/unslothai/notebooks/blob/main/nb/gpt_oss_%2820B%29_Reinforcement_Learning_2048_Game_BF16.ipynb?utm_source=chatgpt.com))
|
| 488 |
-
|
| 489 |
-
### **59.3) Broader recipe collection**
|
| 490 |
-
|
| 491 |
-
**Unsloth notebooks repository**
|
| 492 |
-
The main repo currently advertises “250+ Fine-tuning & RL Notebooks,” including GRPO and reinforcement learning notebooks. If you want the widest set of recipes in one place, this is the best starting point. ([GitHub](https://github.com/unslothai/notebooks?utm_source=chatgpt.com))
|
| 493 |
-
|
| 494 |
-
### **59.4) Useful adjacent recipes and examples**
|
| 495 |
-
|
| 496 |
-
**Scheduler GRPO example using Unsloth**
|
| 497 |
-
A community example that trains a scheduling model with GRPO using Unsloth and QLoRA. It is useful because it shows a non-math, non-code structured-output task where rewards are tied to output format and schedule correctness. ([Hugging Face](https://huggingface.co/blog/anakin87/qwen-scheduler-grpo?utm_source=chatgpt.com))
|
| 498 |
-
|
| 499 |
-
**SFT → GRPO pipeline example**
|
| 500 |
-
There is a community “show and tell” example for a full SFT-then-GRPO pipeline. I would treat it as inspiration rather than an official recipe, but it is valuable if your intended workflow is “teach format first, then do RL.” ([GitHub](https://github.com/unslothai/unsloth/discussions/3407?utm_source=chatgpt.com))
|
| 501 |
-
|
| 502 |
-
### **59.5) What these recipes collectively cover**
|
| 503 |
-
|
| 504 |
-
Across these examples, the main recipe patterns are:
|
| 505 |
-
|
| 506 |
-
* plain GRPO on reasoning-style tasks,
|
| 507 |
-
* GRPO with better reward shaping like proximity scoring,
|
| 508 |
-
* pre-SFT or preformatting before RL,
|
| 509 |
-
* QLoRA-based memory-efficient RL fine-tuning,
|
| 510 |
-
* and environment-style RL with game interaction. ([GitHub](https://github.com/unslothai/unsloth/discussions/2810?utm_source=chatgpt.com))
|
| 511 |
-
|
| 512 |
-
### **59.6) Two gaps to keep in mind**
|
| 513 |
-
|
| 514 |
-
One gap is **multi-turn GRPO with stepwise rewards**. There is a feature request asking for reward on each step plus a final reward, which suggests this is not yet a mature first-class recipe in Unsloth. ([GitHub](https://github.com/unslothai/unsloth/issues/3615?utm_source=chatgpt.com))
|
| 515 |
-
|
| 516 |
-
Another gap is **notebook stability across versions/hardware**. Several issue threads mention breakage or edge cases in GRPO notebooks, including fast inference assumptions, VRAM growth, and vision-GRPO issues. That does not make the recipes unusable, but it does mean you should pin versions and test on a small run first. ([GitHub](https://github.com/unslothai/unsloth/issues/2730?utm_source=chatgpt.com))
|
| 517 |
-
|
| 518 |
-
### **59.7) Best recipes by use case**
|
| 519 |
-
|
| 520 |
-
If you want the simplest starting point:
|
| 521 |
-
|
| 522 |
-
* Qwen2.5 (3B) GRPO
|
| 523 |
-
* Gemma 3 (1B) GRPO ([GitHub](https://github.com/unslothai/notebooks/blob/main/nb/Qwen2.5_%283B%29-GRPO.ipynb?utm_source=chatgpt.com))
|
| 524 |
-
|
| 525 |
-
If you care about reward engineering:
|
| 526 |
-
|
| 527 |
-
* Advanced Qwen3 (4B) GRPO ([GitHub](https://github.com/unslothai/unsloth/discussions/2810?utm_source=chatgpt.com))
|
| 528 |
-
|
| 529 |
-
If you care about environment-style RL:
|
| 530 |
-
|
| 531 |
-
* GPT-OSS 20B 2048 notebook ([GitHub](https://github.com/unslothai/notebooks/blob/main/nb/gpt_oss_%2820B%29_Reinforcement_Learning_2048_Game_BF16.ipynb?utm_source=chatgpt.com))
|
| 532 |
-
|
| 533 |
-
If you want the most guided learning path:
|
| 534 |
-
|
| 535 |
-
* HF practical exercise with Unsloth \+ GRPO ([Hugging Face](https://huggingface.co/learn/llm-course/chapter12/6?utm_source=chatgpt.com))
|
| 536 |
-
|
| 537 |
-
If helpful, I can turn this into a curated table with columns for model, task type, reward type, hardware footprint, and what each recipe teaches.
|
| 538 |
-
|
| 539 |
-
## Additional Resources:
|
| 540 |
-
|
| 541 |
-
* OpenEnv Core (An interface library for RL post training with environments)
|
| 542 |
-
* [https://github.com/meta-pytorch/OpenEnv](https://github.com/meta-pytorch/OpenEnv)
|
| 543 |
-
* OpenEnv-PyTorch Docs
|
| 544 |
-
* [https://meta-pytorch.org/OpenEnv/](https://meta-pytorch.org/OpenEnv/)
|
| 545 |
-
* HuggingFace OpenEnv Environments Hub
|
| 546 |
-
* [https://huggingface.co/openenv](https://huggingface.co/openenv)
|
| 547 |
-
* [https://huggingface.co/openenv/spaces](https://huggingface.co/openenv/spaces)
|
| 548 |
-
* Tutorials to build, run and train RL environments and training pipelines
|
| 549 |
-
* [https://github.com/meta-pytorch/OpenEnv/tree/main/tutorial](https://github.com/meta-pytorch/OpenEnv/tree/main/tutorial)
|
| 550 |
-
* RL Training Examples: [https://github.com/meta-pytorch/OpenEnv/tree/main/tutorial/examples](https://github.com/meta-pytorch/OpenEnv/tree/main/tutorial/examples)
|
| 551 |
-
* RL Environment Examples: [https://github.com/meta-pytorch/OpenEnv/tree/main/envs](https://github.com/meta-pytorch/OpenEnv/tree/main/envs)
|
| 552 |
-
* Few additional YT Videos on building RL Environments:
|
| 553 |
-
* [https://www.youtube.com/watch?v=0airz7BhBiA](https://www.youtube.com/watch?v=0airz7BhBiA)
|
| 554 |
-
* [https://www.youtube.com/watch?v=ap4q4sAK4OY](https://www.youtube.com/watch?v=ap4q4sAK4OY)
|
| 555 |
-
* [https://www.youtube.com/watch?v=Jew4lhAiqnw](https://www.youtube.com/watch?v=Jew4lhAiqnw)
|
| 556 |
-
* [https://openenv-india-apr-2026.lovable.app/](https://openenv-india-apr-2026.lovable.app/) **(Recommended: Chaptered Lectures)**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/references/hackathon_checklist.md
DELETED
|
@@ -1,153 +0,0 @@
|
|
| 1 |
-
# Hackathon Checklist — April 25–26, Bangalore
|
| 2 |
-
**Solo participant: Akhil Soni**
|
| 3 |
-
|
| 4 |
-
---
|
| 5 |
-
|
| 6 |
-
## What Judges Want to See
|
| 7 |
-
(From Help Guide + Discord FAQ — judges are Meta/HuggingFace practitioners)
|
| 8 |
-
|
| 9 |
-
1. **Working environment** — reset/step runs cleanly, rewards are sensible
|
| 10 |
-
2. **Multiple independent reward functions** — not a single score
|
| 11 |
-
3. **Evidence the model improved** — reward curve going up, before/after comparison
|
| 12 |
-
4. **Anti-hacking measures** — agent can't exploit the environment
|
| 13 |
-
5. **Reproducible deployment** — HF Space that anyone can hit
|
| 14 |
-
6. **Sharp demo** — baseline attempt → reward output → trained attempt → measurable improvement
|
| 15 |
-
|
| 16 |
-
---
|
| 17 |
-
|
| 18 |
-
## Before the Venue (April 24 — today)
|
| 19 |
-
|
| 20 |
-
### Environment
|
| 21 |
-
- [x] Round 2 hidden variables designed (HV1 Circadian, HV2 Energy Cliff, HV3 Meltdown)
|
| 22 |
-
- [x] Gradio UI running locally (http://localhost:7862)
|
| 23 |
-
- [ ] **Implement HV1, HV2, HV3 in `server/rhythm_environment.py`**
|
| 24 |
-
- [ ] Add `PersonProfile` enum and `task_type` to `models.py`
|
| 25 |
-
- [ ] Verify grader score still works correctly after HV changes
|
| 26 |
-
- [ ] Add anti-hacking guard: cap consecutive breaks, penalize action spam
|
| 27 |
-
|
| 28 |
-
### Reward Functions (multi-layer — for GRPO)
|
| 29 |
-
- [ ] `reward_format_valid` — did the LLM output a parseable action?
|
| 30 |
-
- [ ] `reward_action_legal` — is the chosen action valid given current state?
|
| 31 |
-
- [ ] `reward_env_step` — actual `obs.reward` from `env.step(action)`
|
| 32 |
-
|
| 33 |
-
### Training Setup
|
| 34 |
-
- [ ] Write `training/dataset.py` — generate episode observation prompts
|
| 35 |
-
- [ ] Write `training/train.py` — GRPO trainer config (use template in `unsloth_grpo_training_template.md`)
|
| 36 |
-
- [ ] Write `training/inference_eval.py` — baseline run + trained run comparison
|
| 37 |
-
|
| 38 |
-
---
|
| 39 |
-
|
| 40 |
-
## Day 1 at Venue (April 25 — morning priority)
|
| 41 |
-
|
| 42 |
-
### 1. Deploy to HF Space FIRST (before training)
|
| 43 |
-
Judges expect a running Space. Do this before anything else.
|
| 44 |
-
|
| 45 |
-
```bash
|
| 46 |
-
# Push environment as HF Space
|
| 47 |
-
openenv push # or manual push to HuggingFace
|
| 48 |
-
```
|
| 49 |
-
|
| 50 |
-
- [ ] Environment runs on HF Space
|
| 51 |
-
- [ ] `reset()` and `step()` work remotely
|
| 52 |
-
- [ ] Space URL noted and shared with mentors
|
| 53 |
-
|
| 54 |
-
### 2. Verify the RL Loop End-to-End (locally first)
|
| 55 |
-
```
|
| 56 |
-
prompt → LLM → action → env.step() → reward → GRPO update
|
| 57 |
-
```
|
| 58 |
-
- [ ] Full loop runs without crashing
|
| 59 |
-
- [ ] Reward goes to console/log
|
| 60 |
-
- [ ] At least one successful episode (non-zero reward)
|
| 61 |
-
|
| 62 |
-
### 3. Run Baseline (before training)
|
| 63 |
-
- [ ] Run 10–20 episodes with untrained model
|
| 64 |
-
- [ ] Log average grader score
|
| 65 |
-
- [ ] Save baseline reward curve
|
| 66 |
-
- [ ] Screenshot or record Gradio UI showing baseline behavior
|
| 67 |
-
|
| 68 |
-
---
|
| 69 |
-
|
| 70 |
-
## Day 1 at Venue (afternoon)
|
| 71 |
-
|
| 72 |
-
### 4. Training — Start Small
|
| 73 |
-
- [ ] Train on `easy` scenario first (100–200 steps)
|
| 74 |
-
- [ ] Confirm reward is going up (not flat or crashing)
|
| 75 |
-
- [ ] Check generated actions — look for reward hacking patterns
|
| 76 |
-
- [ ] If reward is flat: simplify prompt, check reward functions individually
|
| 77 |
-
|
| 78 |
-
### 5. Anti-Hacking Checks
|
| 79 |
-
The model may learn to spam TAKE_BREAK (low stress = less penalty).
|
| 80 |
-
Guards already partially in code — verify these work:
|
| 81 |
-
- [ ] `consecutive_breaks > MAX_FREE_BREAKS` → penalty applies
|
| 82 |
-
- [ ] `IDLE_PENALTY` fires when no task is active
|
| 83 |
-
- [ ] Model can't "know" hidden variable thresholds (they're not in obs)
|
| 84 |
-
- [ ] Test with a greedy exploit agent manually
|
| 85 |
-
|
| 86 |
-
---
|
| 87 |
-
|
| 88 |
-
## Day 2 at Venue (April 26)
|
| 89 |
-
|
| 90 |
-
### 6. Full Training Run
|
| 91 |
-
- [ ] Train on `easy` → `medium` → `hard` (curriculum)
|
| 92 |
-
- [ ] 500–1000 total GRPO steps
|
| 93 |
-
- [ ] Monitor: `reward/mean`, `reward/std`, KL divergence, per-reward-function scores
|
| 94 |
-
- [ ] Save checkpoint every 100 steps
|
| 95 |
-
|
| 96 |
-
### 7. Save Model Correctly
|
| 97 |
-
**Warning:** Do NOT upcast 4-bit model to 16-bit and merge LoRA naively — damages quality.
|
| 98 |
-
```python
|
| 99 |
-
# Correct save
|
| 100 |
-
model.save_pretrained_merged("outputs/rhythmenv_trained", tokenizer, save_method="merged_16bit")
|
| 101 |
-
# Or keep adapters separate
|
| 102 |
-
model.save_pretrained("outputs/adapters")
|
| 103 |
-
tokenizer.save_pretrained("outputs/adapters")
|
| 104 |
-
```
|
| 105 |
-
- [ ] Model saved correctly
|
| 106 |
-
- [ ] Post-training inference tested immediately after save
|
| 107 |
-
|
| 108 |
-
### 8. Build the Demo
|
| 109 |
-
Format: **baseline → trained → measurable improvement**
|
| 110 |
-
|
| 111 |
-
```
|
| 112 |
-
1. Show baseline: untrained model playing easy scenario → grader score ~0.2
|
| 113 |
-
2. Show reward curve: 500 steps, reward trending up
|
| 114 |
-
3. Show trained: model playing same scenario → grader score ~0.6+
|
| 115 |
-
4. Explain hidden variables: why the model had to discover them
|
| 116 |
-
5. Show person profile inference: does the model behave differently for MORNING_PERSON vs NIGHT_OWL?
|
| 117 |
-
```
|
| 118 |
-
|
| 119 |
-
- [ ] Gradio UI shows before/after comparison
|
| 120 |
-
- [ ] Reward curve screenshot/chart ready
|
| 121 |
-
- [ ] 3-minute pitch rehearsed (see `docs/round2/pitch_framing.md`)
|
| 122 |
-
|
| 123 |
-
---
|
| 124 |
-
|
| 125 |
-
## Submission Checklist
|
| 126 |
-
|
| 127 |
-
- [ ] HF Space deployed and running
|
| 128 |
-
- [ ] `inference.py` updated for trained model (correct `API_BASE_URL`, `MODEL_NAME`, `HF_TOKEN`)
|
| 129 |
-
- [ ] README updated with Round 2 description
|
| 130 |
-
- [ ] Reward curves saved as images
|
| 131 |
-
- [ ] Model pushed to HF Hub
|
| 132 |
-
|
| 133 |
-
---
|
| 134 |
-
|
| 135 |
-
## Quick Reference — Key Numbers
|
| 136 |
-
|
| 137 |
-
| Thing | Value |
|
| 138 |
-
|---|---|
|
| 139 |
-
| Max steps per episode | 20 |
|
| 140 |
-
| Scenarios | easy / medium / hard |
|
| 141 |
-
| Grader weights | 40% completion, 20% deadline, 15% efficiency, 10% energy, 15% stress |
|
| 142 |
-
| GRPO starting lr | 2e-4 |
|
| 143 |
-
| GRPO num_generations | 4 (more than 2048 notebook — hidden vars need exploration) |
|
| 144 |
-
| GRPO max_steps | 1000 |
|
| 145 |
-
| Prize pool | $30,000 (top 15 teams) |
|
| 146 |
-
| Evaluation | ~20-30 min per top team by Meta/HF engineers |
|
| 147 |
-
|
| 148 |
-
---
|
| 149 |
-
|
| 150 |
-
## Contacts at Venue
|
| 151 |
-
- Sanyam Bhutani — Partner Engineer, Meta
|
| 152 |
-
- Ben Burtenshaw — Community Education, HuggingFace
|
| 153 |
-
- Adithya S Kolavi — ML Engineer, HuggingFace
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/{round2/[External] Apr ‘26 OpenEnv Hackathon Themes & Judging Criteria.md → references/judging_criteria.md}
RENAMED
|
File without changes
|
docs/references/reward_engineering_overview.md
DELETED
|
@@ -1,82 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
source: https://arxiv.org/abs/2408.10215
|
| 3 |
-
title: "Comprehensive Overview of Reward Engineering and Shaping in Advancing Reinforcement Learning Applications"
|
| 4 |
-
authors: Sinan Ibrahim, Mostafa Mostafa, Ali Jnadi, Hadi Salloum, Pavel Osinenko
|
| 5 |
-
published: IEEE Access, Vol. 12, 2024
|
| 6 |
-
---
|
| 7 |
-
|
| 8 |
-
# Reward Engineering & Shaping — Overview Paper
|
| 9 |
-
|
| 10 |
-
## What It Covers
|
| 11 |
-
|
| 12 |
-
A survey of 55 papers on reward design challenges in RL. Core problems addressed:
|
| 13 |
-
- Sparse / delayed rewards (most common bottleneck)
|
| 14 |
-
- Reward hacking — agent exploits loopholes instead of solving the task
|
| 15 |
-
- Multi-objective complexity — real tasks have competing objectives
|
| 16 |
-
- Convergence inefficiency without proper guidance
|
| 17 |
-
|
| 18 |
-
---
|
| 19 |
-
|
| 20 |
-
## Key Technique: Potential-Based Reward Shaping (PBRS)
|
| 21 |
-
|
| 22 |
-
The safest reward shaping approach — mathematically guarantees the optimal policy doesn't change:
|
| 23 |
-
|
| 24 |
-
```
|
| 25 |
-
R'(s,a,s') = R(s,a,s') + γΦ(s') - Φ(s)
|
| 26 |
-
```
|
| 27 |
-
|
| 28 |
-
- `Φ(s)` is a potential function encoding "how good is this state"
|
| 29 |
-
- The agent learns faster without learning a different policy
|
| 30 |
-
- **For RhythmEnv:** Φ(s) could be `progress_toward_deadlines + energy_level`
|
| 31 |
-
|
| 32 |
-
---
|
| 33 |
-
|
| 34 |
-
## Key Techniques Relevant to RhythmEnv
|
| 35 |
-
|
| 36 |
-
### Handling Sparse Rewards
|
| 37 |
-
- **EXPLORS:** Self-supervised exploration bonuses — fully automated, no manual design
|
| 38 |
-
- **RUNE:** Uses ensemble variance as an exploration bonus (reward uncertainty)
|
| 39 |
-
- **Intrinsic motivation (LIRPG):** Agent learns curiosity-driven rewards alongside task rewards
|
| 40 |
-
|
| 41 |
-
### Preventing Reward Hacking
|
| 42 |
-
- Test with adversarial agents before finalizing reward functions
|
| 43 |
-
- **Difference rewards:** `R'(s,a) = R(s,a) + γ[D(s',r) - D(s,r)]` — incentivizes true contribution, useful if extending to multi-agent
|
| 44 |
-
- Monitor agent trajectories for unintended patterns (e.g., spamming breaks, never switching tasks)
|
| 45 |
-
|
| 46 |
-
### Multi-Objective Reward Design
|
| 47 |
-
- Use **vector rewards** — separate dimensions for progress, stress, energy, deadlines
|
| 48 |
-
- Aggregate with explicit weights (our current design already does this)
|
| 49 |
-
- Ensure reward components don't cancel each other out silently
|
| 50 |
-
|
| 51 |
-
### Dynamic Potential Functions (DPBRS)
|
| 52 |
-
- Time-varying `Φ(s,t)` — potential changes as the episode progresses
|
| 53 |
-
- Relevant for RhythmEnv: deadline proximity should increase the potential for completing near-deadline tasks as time runs out
|
| 54 |
-
|
| 55 |
-
---
|
| 56 |
-
|
| 57 |
-
## Common Pitfalls (Checklist)
|
| 58 |
-
|
| 59 |
-
- [ ] Don't rely on sparse rewards alone — add intermediate shaping
|
| 60 |
-
- [ ] Watch for reward hacking — test with a greedy agent that tries to exploit
|
| 61 |
-
- [ ] Complex reward functions are hard to debug — start simple, add components one at a time
|
| 62 |
-
- [ ] Evaluation metrics must be independent of reward design (our `_grade_episode` grader serves this role)
|
| 63 |
-
- [ ] Domain knowledge is essential but expensive to encode — validate with domain experts
|
| 64 |
-
|
| 65 |
-
---
|
| 66 |
-
|
| 67 |
-
## For Our Hidden Variables
|
| 68 |
-
|
| 69 |
-
The paper directly supports the hidden variable approach:
|
| 70 |
-
- Hidden variables that secretly modulate reward = reward uncertainty from the agent's perspective
|
| 71 |
-
- Agent must learn to explore across time-of-day and energy levels to discover the true reward structure
|
| 72 |
-
- This is essentially the agent discovering the "potential function" through experience
|
| 73 |
-
|
| 74 |
-
---
|
| 75 |
-
|
| 76 |
-
## Takeaways for RhythmEnv Training
|
| 77 |
-
|
| 78 |
-
1. Use PBRS: define Φ(s) = weighted combination of progress + energy + inverse-stress
|
| 79 |
-
2. Add exploration bonus early in training (agent needs to try morning vs afternoon work)
|
| 80 |
-
3. Monitor for reward hacking (e.g., taking maximum breaks to avoid stress penalty)
|
| 81 |
-
4. Track reward components separately in logs — not just total reward
|
| 82 |
-
5. Reduce reward horizon early in training to accelerate validation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/references/reward_engineering_software_tasks.md
DELETED
|
@@ -1,77 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
source: https://arxiv.org/abs/2601.19100
|
| 3 |
-
title: "Reward Engineering for Reinforcement Learning in Software Tasks"
|
| 4 |
-
authors: Md Rayhanul Masud, Azmine Toushik Wasi, Salman Rahman, Md Rizwan Parvez
|
| 5 |
-
published: arXiv, January 2026 (first systematic review of this area)
|
| 6 |
-
---
|
| 7 |
-
|
| 8 |
-
# Reward Engineering for RL in Software Tasks
|
| 9 |
-
|
| 10 |
-
## What It Covers
|
| 11 |
-
|
| 12 |
-
First systematic review of reward design for code-centric RL tasks (generation, repair, summarization, testing). Surveys 80+ papers from 2024–2025. Core problem: software tasks lack direct reward signals — everything is proxy-based.
|
| 13 |
-
|
| 14 |
-
Relevant to RhythmEnv because **our environment is also proxy-based**: the agent never directly observes the hidden circadian/energy/stress factors — it infers them from reward signals, just like a code agent infers "correctness" from test pass rates.
|
| 15 |
-
|
| 16 |
-
---
|
| 17 |
-
|
| 18 |
-
## Proxy Reward Pattern (directly maps to RhythmEnv)
|
| 19 |
-
|
| 20 |
-
| Software Task Proxy | RhythmEnv Equivalent |
|
| 21 |
-
|---|---|
|
| 22 |
-
| Compilation success (binary) | Task completed before deadline (binary) |
|
| 23 |
-
| Test pass rate (% passing) | Importance-weighted completion fraction |
|
| 24 |
-
| Code quality metrics | Energy + stress management score |
|
| 25 |
-
| No regression (didn't break other tests) | No missed deadlines on other tasks |
|
| 26 |
-
| Runtime efficiency | Steps worked / optimal steps (efficiency score) |
|
| 27 |
-
|
| 28 |
-
The grader's final score = our "test suite". Per-step rewards = our "fast proxy" signals.
|
| 29 |
-
|
| 30 |
-
---
|
| 31 |
-
|
| 32 |
-
## Key Design Principles
|
| 33 |
-
|
| 34 |
-
### 1. Composite Rewards Win
|
| 35 |
-
No single metric is sufficient. Combine:
|
| 36 |
-
- **Fast proxies** (cheap, run every step): progress delta, stress penalty
|
| 37 |
-
- **Slow validators** (expensive, run at episode end): grader score (completion, deadline, efficiency)
|
| 38 |
-
|
| 39 |
-
Our design already does this: per-step reward + `_grade_episode` at `done=True`.
|
| 40 |
-
|
| 41 |
-
### 2. Sparse Reward Handling
|
| 42 |
-
Software tasks naturally sparse (pass/fail). Solutions:
|
| 43 |
-
- **Partial credit:** Reward near-correct attempts (our `progress_reward` per step does this)
|
| 44 |
-
- **Shaping:** Guide exploration toward productive states
|
| 45 |
-
- **Curriculum:** Start easy, add complexity — our `easy → medium → hard` scenarios
|
| 46 |
-
|
| 47 |
-
### 3. Reward Horizon
|
| 48 |
-
Shorter reward horizons accelerate learning. For RhythmEnv:
|
| 49 |
-
- Keep `MAX_STEPS=20` for training (short episodes = faster reward signal)
|
| 50 |
-
- Don't extend to multi-day episodes until single-day policy is stable
|
| 51 |
-
|
| 52 |
-
### 4. Avoid Single-Metric Optimization
|
| 53 |
-
Agents trained on test pass rate alone produce brittle code. For us:
|
| 54 |
-
- Don't train only on final score — intermediate per-step rewards matter
|
| 55 |
-
- The hidden variables (HV1/HV2/HV3) ensure the agent can't cheat a single metric
|
| 56 |
-
|
| 57 |
-
---
|
| 58 |
-
|
| 59 |
-
## Practical Checklist for Our Training Setup
|
| 60 |
-
|
| 61 |
-
- [ ] Per-step reward provides dense feedback (already implemented)
|
| 62 |
-
- [ ] Final grader score is independent of per-step reward design (already implemented)
|
| 63 |
-
- [ ] Multiple reward components logged separately (need to ensure in training loop)
|
| 64 |
-
- [ ] Curriculum: train on `easy` first, then `medium`, then `hard`
|
| 65 |
-
- [ ] Monitor for policy collapse — agent converging to a single strategy (e.g., always take breaks)
|
| 66 |
-
- [ ] Reward shaping doesn't conflict with grader score direction
|
| 67 |
-
|
| 68 |
-
---
|
| 69 |
-
|
| 70 |
-
## Takeaways for Hidden Variables
|
| 71 |
-
|
| 72 |
-
The paper's core insight: reward proxy ≠ true objective. This is exactly what hidden variables enforce:
|
| 73 |
-
- HV1 (Circadian): Same action at different times gives different rewards — forces temporal exploration
|
| 74 |
-
- HV2 (Energy Cliff): Progress collapses silently — forces the agent to maintain energy, can't predict when
|
| 75 |
-
- HV3 (Stress Meltdown): All rewards degrade silently — forces stress management even when it's not penalized directly
|
| 76 |
-
|
| 77 |
-
The agent must discover the "true test suite" (hidden variable thresholds) through the proxy (per-step rewards).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/references/unsloth_grpo_training_template.md
DELETED
|
@@ -1,269 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
source: https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/OpenEnv_gpt_oss_(20B)_Reinforcement_Learning_2048_Game.ipynb
|
| 3 |
-
model: unsloth/gpt-oss-20b (4-bit quantized)
|
| 4 |
-
algorithm: GRPO (Group Relative Policy Optimization)
|
| 5 |
-
environment: 2048 game via OpenEnv (Meta-PyTorch)
|
| 6 |
-
---
|
| 7 |
-
|
| 8 |
-
# Unsloth GRPO Training Template — OpenEnv 2048
|
| 9 |
-
|
| 10 |
-
Reference notebook for training an LLM agent on an OpenEnv environment using GRPO.
|
| 11 |
-
Adapt this pattern for RhythmEnv.
|
| 12 |
-
|
| 13 |
-
---
|
| 14 |
-
|
| 15 |
-
## Installation
|
| 16 |
-
|
| 17 |
-
```bash
|
| 18 |
-
pip install --upgrade uv
|
| 19 |
-
uv pip install torch>=2.8.0 triton>=3.4.0 torchvision bitsandbytes
|
| 20 |
-
uv pip install transformers==4.56.2 trackio trl==0.22.2
|
| 21 |
-
pip install fastapi uvicorn requests
|
| 22 |
-
|
| 23 |
-
# Install your environment
|
| 24 |
-
git clone https://github.com/meta-pytorch/OpenEnv.git
|
| 25 |
-
# or: pip install openenv-rhythm-env
|
| 26 |
-
```
|
| 27 |
-
|
| 28 |
-
---
|
| 29 |
-
|
| 30 |
-
## 1. Model Loading
|
| 31 |
-
|
| 32 |
-
```python
|
| 33 |
-
from unsloth import FastLanguageModel
|
| 34 |
-
|
| 35 |
-
max_seq_length = 768
|
| 36 |
-
lora_rank = 4
|
| 37 |
-
|
| 38 |
-
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 39 |
-
model_name="unsloth/gpt-oss-20b", # swap for our model
|
| 40 |
-
load_in_4bit=True, # 4-bit quantization for VRAM
|
| 41 |
-
max_seq_length=max_seq_length,
|
| 42 |
-
offload_embedding=True, # saves VRAM
|
| 43 |
-
)
|
| 44 |
-
|
| 45 |
-
model = FastLanguageModel.get_peft_model(
|
| 46 |
-
model,
|
| 47 |
-
r=lora_rank,
|
| 48 |
-
target_modules=["q_proj", "k_proj", "v_proj", "o_proj",
|
| 49 |
-
"gate_proj", "up_proj", "down_proj"],
|
| 50 |
-
lora_alpha=lora_rank * 2, # standard: 2x rank
|
| 51 |
-
use_gradient_checkpointing="unsloth",
|
| 52 |
-
random_state=3407,
|
| 53 |
-
)
|
| 54 |
-
```
|
| 55 |
-
|
| 56 |
-
**For RhythmEnv:** Swap `model_name` for whatever model we use on-site. Keep 4-bit + LoRA — essential for fitting in hackathon compute budget.
|
| 57 |
-
|
| 58 |
-
---
|
| 59 |
-
|
| 60 |
-
## 2. Environment Connection Pattern
|
| 61 |
-
|
| 62 |
-
```python
|
| 63 |
-
import sys, requests
|
| 64 |
-
sys.path.insert(0, './src')
|
| 65 |
-
|
| 66 |
-
# Launch env server (FastAPI + uvicorn)
|
| 67 |
-
port, openenv_process = launch_openenv(port=9000, process=None)
|
| 68 |
-
|
| 69 |
-
# Reset
|
| 70 |
-
result = openenv_process.reset()
|
| 71 |
-
state = result.observation # contains board state, legal_actions, done
|
| 72 |
-
|
| 73 |
-
# Step
|
| 74 |
-
result = openenv_process.step(action)
|
| 75 |
-
```
|
| 76 |
-
|
| 77 |
-
**For RhythmEnv adaptation:**
|
| 78 |
-
```python
|
| 79 |
-
from server.rhythm_environment import RhythmEnvironment
|
| 80 |
-
from models import RhythmAction, ActionType
|
| 81 |
-
|
| 82 |
-
env = RhythmEnvironment()
|
| 83 |
-
obs = env.reset(task="easy")
|
| 84 |
-
# obs.energy, obs.stress, obs.tasks, obs.timestep, obs.done
|
| 85 |
-
|
| 86 |
-
action = RhythmAction(action_type=ActionType.CONTINUE_TASK)
|
| 87 |
-
obs = env.step(action)
|
| 88 |
-
```
|
| 89 |
-
|
| 90 |
-
---
|
| 91 |
-
|
| 92 |
-
## 3. GRPO Trainer Config
|
| 93 |
-
|
| 94 |
-
```python
|
| 95 |
-
from trl import GRPOConfig, GRPOTrainer
|
| 96 |
-
|
| 97 |
-
max_prompt_length = 182
|
| 98 |
-
max_completion_length = 768 - max_prompt_length
|
| 99 |
-
|
| 100 |
-
training_args = GRPOConfig(
|
| 101 |
-
temperature=1.0,
|
| 102 |
-
learning_rate=2e-4,
|
| 103 |
-
weight_decay=0.001,
|
| 104 |
-
warmup_ratio=0.1,
|
| 105 |
-
lr_scheduler_type="linear",
|
| 106 |
-
optim="adamw_8bit",
|
| 107 |
-
logging_steps=1,
|
| 108 |
-
per_device_train_batch_size=1,
|
| 109 |
-
gradient_accumulation_steps=1,
|
| 110 |
-
num_generations=2, # generate 2 candidates per prompt, compare
|
| 111 |
-
max_prompt_length=max_prompt_length,
|
| 112 |
-
max_completion_length=max_completion_length,
|
| 113 |
-
max_steps=600, # ~600 training iterations
|
| 114 |
-
save_steps=100,
|
| 115 |
-
report_to="trackio", # or "wandb"
|
| 116 |
-
output_dir="outputs",
|
| 117 |
-
)
|
| 118 |
-
```
|
| 119 |
-
|
| 120 |
-
**Key GRPO parameters to tune:**
|
| 121 |
-
- `num_generations`: higher = more diverse exploration but slower (2 is minimum)
|
| 122 |
-
- `max_steps`: 600 is baseline; increase if reward curves haven't converged
|
| 123 |
-
- `temperature`: 1.0 for exploration; lower (0.7) after policy stabilizes
|
| 124 |
-
|
| 125 |
-
---
|
| 126 |
-
|
| 127 |
-
## 4. Reward Functions (Three-Layer Stack Pattern)
|
| 128 |
-
|
| 129 |
-
The notebook stacks three reward functions. Adapt this for RhythmEnv:
|
| 130 |
-
|
| 131 |
-
```python
|
| 132 |
-
# Layer 1: Format validity (always check first)
|
| 133 |
-
def format_valid(completions, **kwargs):
|
| 134 |
-
scores = []
|
| 135 |
-
for completion in completions:
|
| 136 |
-
response = completion[0]["content"]
|
| 137 |
-
action = extract_action(response) # parse action from LLM output
|
| 138 |
-
scores.append(1.0 if action is not None else -2.0)
|
| 139 |
-
return scores
|
| 140 |
-
|
| 141 |
-
# Layer 2: Action legality
|
| 142 |
-
def action_legal(completions, prompts, **kwargs):
|
| 143 |
-
scores = []
|
| 144 |
-
for completion, prompt in zip(completions, prompts):
|
| 145 |
-
obs = get_obs_from_prompt(prompt) # reconstruct state
|
| 146 |
-
action = extract_action(completion[0]["content"])
|
| 147 |
-
legal = action in obs.legal_actions if action is not None else False
|
| 148 |
-
scores.append(1.0 if legal else -1.0)
|
| 149 |
-
return scores
|
| 150 |
-
|
| 151 |
-
# Layer 3: Environment reward (run env.step, return actual reward)
|
| 152 |
-
def env_reward(completions, prompts, **kwargs):
|
| 153 |
-
scores = []
|
| 154 |
-
for completion, prompt in zip(completions, prompts):
|
| 155 |
-
action = extract_action(completion[0]["content"])
|
| 156 |
-
obs = run_env_step(action, prompt) # step the environment
|
| 157 |
-
scores.append(obs.reward if obs else -3.0)
|
| 158 |
-
return scores
|
| 159 |
-
|
| 160 |
-
# Pass all three to trainer
|
| 161 |
-
trainer = GRPOTrainer(
|
| 162 |
-
model=model,
|
| 163 |
-
processing_class=tokenizer,
|
| 164 |
-
reward_funcs=[format_valid, action_legal, env_reward],
|
| 165 |
-
args=training_args,
|
| 166 |
-
train_dataset=dataset,
|
| 167 |
-
)
|
| 168 |
-
trainer.train()
|
| 169 |
-
```
|
| 170 |
-
|
| 171 |
-
---
|
| 172 |
-
|
| 173 |
-
## 5. Dataset Structure
|
| 174 |
-
|
| 175 |
-
GRPO needs a dataset of prompts (the model generates completions and gets rewards):
|
| 176 |
-
|
| 177 |
-
```python
|
| 178 |
-
from datasets import Dataset
|
| 179 |
-
|
| 180 |
-
# For RhythmEnv: each sample is one episode observation prompt
|
| 181 |
-
prompt_template = """
|
| 182 |
-
You are managing a person's workday. Current state:
|
| 183 |
-
- Step: {timestep}/20
|
| 184 |
-
- Energy: {energy:.2f}
|
| 185 |
-
- Stress: {stress:.2f}
|
| 186 |
-
- Current task: {current_task}
|
| 187 |
-
- Tasks: {tasks_summary}
|
| 188 |
-
|
| 189 |
-
Choose the best action: START_TASK(id), CONTINUE_TASK, SWITCH_TASK(id), or TAKE_BREAK.
|
| 190 |
-
Reply with just the action.
|
| 191 |
-
"""
|
| 192 |
-
|
| 193 |
-
dataset = Dataset.from_list([
|
| 194 |
-
{"prompt": [{"role": "user", "content": prompt_template.format(**sample)}]}
|
| 195 |
-
for sample in generate_episode_samples(n=1000)
|
| 196 |
-
])
|
| 197 |
-
```
|
| 198 |
-
|
| 199 |
-
---
|
| 200 |
-
|
| 201 |
-
## 6. Inference After Training
|
| 202 |
-
|
| 203 |
-
```python
|
| 204 |
-
text = tokenizer.apply_chat_template(
|
| 205 |
-
[{"role": "user", "content": prompt}],
|
| 206 |
-
tokenize=False,
|
| 207 |
-
add_generation_prompt=True,
|
| 208 |
-
reasoning_effort="low", # fast inference during eval
|
| 209 |
-
)
|
| 210 |
-
|
| 211 |
-
output = model.generate(
|
| 212 |
-
**tokenizer(text, return_tensors="pt").to("cuda"),
|
| 213 |
-
temperature=0.7, # lower temp at inference time
|
| 214 |
-
max_new_tokens=64, # actions are short
|
| 215 |
-
)
|
| 216 |
-
|
| 217 |
-
response = tokenizer.decode(output[0], skip_special_tokens=True)
|
| 218 |
-
action = extract_action(response)
|
| 219 |
-
```
|
| 220 |
-
|
| 221 |
-
---
|
| 222 |
-
|
| 223 |
-
## 7. Monitoring
|
| 224 |
-
|
| 225 |
-
The notebook uses TrackIO (`report_to="trackio"`). Use W&B or TrackIO:
|
| 226 |
-
|
| 227 |
-
```python
|
| 228 |
-
import wandb
|
| 229 |
-
wandb.init(project="rhythmenv-round2")
|
| 230 |
-
# GRPOConfig(report_to="wandb")
|
| 231 |
-
```
|
| 232 |
-
|
| 233 |
-
Key metrics to watch:
|
| 234 |
-
- `reward/mean` — should trend upward
|
| 235 |
-
- `reward/std` — high early (exploration), narrows as policy stabilizes
|
| 236 |
-
- `kl` — KL divergence from reference policy; too high = unstable training
|
| 237 |
-
- Per-reward-function scores — track format_valid, action_legal, env_reward separately
|
| 238 |
-
|
| 239 |
-
---
|
| 240 |
-
|
| 241 |
-
## Differences: 2048 Game vs RhythmEnv
|
| 242 |
-
|
| 243 |
-
| 2048 Game | RhythmEnv |
|
| 244 |
-
|---|---|
|
| 245 |
-
| Discrete board state (16 ints) | Continuous state (energy, stress, progress) |
|
| 246 |
-
| 4 legal actions always | Variable legal actions (depends on current_task) |
|
| 247 |
-
| Win condition: reach 2048 | Win condition: high grader score (0.0–1.0) |
|
| 248 |
-
| Dense reward via win/lose | Dense reward via progress + penalty components |
|
| 249 |
-
| No hidden variables | 3 hidden variables (Circadian, Energy Cliff, Meltdown) |
|
| 250 |
-
| Strategy = Python function | Strategy = natural language action choice |
|
| 251 |
-
|
| 252 |
-
The hidden variables in RhythmEnv mean the agent must run **many episodes** to infer the true reward structure — more training steps needed than 2048.
|
| 253 |
-
|
| 254 |
-
---
|
| 255 |
-
|
| 256 |
-
## Recommended Starting Config for RhythmEnv
|
| 257 |
-
|
| 258 |
-
```python
|
| 259 |
-
GRPOConfig(
|
| 260 |
-
learning_rate=2e-4,
|
| 261 |
-
num_generations=4, # more diversity needed (hidden var exploration)
|
| 262 |
-
max_steps=1000, # more steps than 2048 (hidden var discovery)
|
| 263 |
-
temperature=1.0, # keep high for exploration
|
| 264 |
-
per_device_train_batch_size=1,
|
| 265 |
-
gradient_accumulation_steps=4, # effective batch = 4
|
| 266 |
-
warmup_ratio=0.1,
|
| 267 |
-
report_to="wandb",
|
| 268 |
-
)
|
| 269 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round1/SPEC.md
DELETED
|
@@ -1,554 +0,0 @@
|
|
| 1 |
-
# Build a Complete OpenEnv Environment: RhythmEnv
|
| 2 |
-
|
| 3 |
-
## Context
|
| 4 |
-
|
| 5 |
-
You are an expert software engineer tasked with building a **complete, production-grade OpenEnv environment** for a Meta x Hugging Face hackathon.
|
| 6 |
-
|
| 7 |
-
You have access to:
|
| 8 |
-
|
| 9 |
-
* The OpenEnv repository (including examples)
|
| 10 |
-
* Validation tools (`openenv validate`)
|
| 11 |
-
* Docker and Hugging Face Spaces
|
| 12 |
-
|
| 13 |
-
You must:
|
| 14 |
-
|
| 15 |
-
* Use this specification as a **strong foundation**
|
| 16 |
-
* Cross-reference with existing OpenEnv examples
|
| 17 |
-
* Improve design decisions where appropriate
|
| 18 |
-
* Ensure strict compliance with OpenEnv standards
|
| 19 |
-
|
| 20 |
-
Do NOT blindly follow instructions — refine and correct based on best practices observed in the repo.
|
| 21 |
-
|
| 22 |
-
---
|
| 23 |
-
|
| 24 |
-
# Objective
|
| 25 |
-
|
| 26 |
-
Build an environment called:
|
| 27 |
-
|
| 28 |
-
## **RhythmEnv**
|
| 29 |
-
|
| 30 |
-
> A deterministic reinforcement learning environment that simulates daily planning and execution under constraints like time, energy, deadlines, and task importance.
|
| 31 |
-
|
| 32 |
-
This environment should allow agents to learn:
|
| 33 |
-
|
| 34 |
-
* prioritization
|
| 35 |
-
* scheduling
|
| 36 |
-
* energy management
|
| 37 |
-
* decision-making under trade-offs
|
| 38 |
-
|
| 39 |
-
---
|
| 40 |
-
|
| 41 |
-
# Core Requirements (MANDATORY)
|
| 42 |
-
|
| 43 |
-
---
|
| 44 |
-
|
| 45 |
-
## 1. OpenEnv Spec Compliance
|
| 46 |
-
|
| 47 |
-
You MUST:
|
| 48 |
-
|
| 49 |
-
* Implement typed Pydantic models:
|
| 50 |
-
|
| 51 |
-
* Observation
|
| 52 |
-
* Action
|
| 53 |
-
* Reward
|
| 54 |
-
|
| 55 |
-
* Implement:
|
| 56 |
-
|
| 57 |
-
* `reset()`
|
| 58 |
-
* `step(action)`
|
| 59 |
-
* `state()`
|
| 60 |
-
|
| 61 |
-
* Include:
|
| 62 |
-
|
| 63 |
-
* `openenv.yaml`
|
| 64 |
-
* environment metadata
|
| 65 |
-
|
| 66 |
-
* Pass:
|
| 67 |
-
|
| 68 |
-
```bash
|
| 69 |
-
openenv validate
|
| 70 |
-
```
|
| 71 |
-
|
| 72 |
-
---
|
| 73 |
-
|
| 74 |
-
## 2. Real-World Task
|
| 75 |
-
|
| 76 |
-
The environment simulates:
|
| 77 |
-
|
| 78 |
-
> “Given a set of tasks, deadlines, and constraints, plan and execute optimally over a day.”
|
| 79 |
-
|
| 80 |
-
This is NOT a game. It must feel like a real productivity system.
|
| 81 |
-
|
| 82 |
-
---
|
| 83 |
-
|
| 84 |
-
## 3. Determinism (CRITICAL)
|
| 85 |
-
|
| 86 |
-
* No randomness anywhere
|
| 87 |
-
* All transitions are pure functions
|
| 88 |
-
* Same input → same output always
|
| 89 |
-
|
| 90 |
-
---
|
| 91 |
-
|
| 92 |
-
## 4. Episode Design
|
| 93 |
-
|
| 94 |
-
* 1 episode = 1 day
|
| 95 |
-
* 1 step = 30 minutes
|
| 96 |
-
* Total steps = ~20
|
| 97 |
-
|
| 98 |
-
---
|
| 99 |
-
|
| 100 |
-
## 5. Action Space (STRICT)
|
| 101 |
-
|
| 102 |
-
No free-form actions.
|
| 103 |
-
|
| 104 |
-
Define structured actions:
|
| 105 |
-
|
| 106 |
-
* START_TASK(task_id)
|
| 107 |
-
* CONTINUE_TASK()
|
| 108 |
-
* SWITCH_TASK(task_id)
|
| 109 |
-
* TAKE_BREAK(duration)
|
| 110 |
-
|
| 111 |
-
Validate all actions strictly.
|
| 112 |
-
|
| 113 |
-
---
|
| 114 |
-
|
| 115 |
-
## 6. Observation Space
|
| 116 |
-
|
| 117 |
-
Must include:
|
| 118 |
-
|
| 119 |
-
* current timestep
|
| 120 |
-
* energy (0–1)
|
| 121 |
-
* stress (0–1)
|
| 122 |
-
* current task (optional)
|
| 123 |
-
* tasks list
|
| 124 |
-
* calendar (meetings)
|
| 125 |
-
* remaining steps
|
| 126 |
-
|
| 127 |
-
### Task fields:
|
| 128 |
-
|
| 129 |
-
* id
|
| 130 |
-
* effort (0–1)
|
| 131 |
-
* progress (0–1)
|
| 132 |
-
* deadline (timestep)
|
| 133 |
-
* importance (0–1)
|
| 134 |
-
|
| 135 |
-
---
|
| 136 |
-
|
| 137 |
-
## 7. Environment Dynamics
|
| 138 |
-
|
| 139 |
-
---
|
| 140 |
-
|
| 141 |
-
### Task Progress
|
| 142 |
-
|
| 143 |
-
* Only when working on a task
|
| 144 |
-
* Scales with energy
|
| 145 |
-
|
| 146 |
-
Example baseline:
|
| 147 |
-
|
| 148 |
-
```
|
| 149 |
-
progress_delta = k * energy
|
| 150 |
-
```
|
| 151 |
-
|
| 152 |
-
---
|
| 153 |
-
|
| 154 |
-
### Energy
|
| 155 |
-
|
| 156 |
-
* decreases during work
|
| 157 |
-
* increases during breaks
|
| 158 |
-
* slight decay during idle/switch
|
| 159 |
-
|
| 160 |
-
Clamp between [0, 1]
|
| 161 |
-
|
| 162 |
-
---
|
| 163 |
-
|
| 164 |
-
### Stress
|
| 165 |
-
|
| 166 |
-
* increases when:
|
| 167 |
-
|
| 168 |
-
* deadlines missed
|
| 169 |
-
* too many pending tasks
|
| 170 |
-
* decreases during breaks
|
| 171 |
-
|
| 172 |
-
---
|
| 173 |
-
|
| 174 |
-
### Meetings
|
| 175 |
-
|
| 176 |
-
* block task progress
|
| 177 |
-
* slightly reduce energy
|
| 178 |
-
|
| 179 |
-
---
|
| 180 |
-
|
| 181 |
-
## 8. Hidden Internal Mode (IMPORTANT)
|
| 182 |
-
|
| 183 |
-
Implement a latent mode (NOT exposed to agent):
|
| 184 |
-
|
| 185 |
-
* deep_work
|
| 186 |
-
* execution
|
| 187 |
-
* balanced
|
| 188 |
-
|
| 189 |
-
Derived deterministically from state.
|
| 190 |
-
|
| 191 |
-
Used to:
|
| 192 |
-
|
| 193 |
-
* slightly influence reward
|
| 194 |
-
* create richer learning signal
|
| 195 |
-
|
| 196 |
-
---
|
| 197 |
-
|
| 198 |
-
# 🔴 Reward & Grader Design Contract (STRICT)
|
| 199 |
-
|
| 200 |
-
This is the MOST IMPORTANT part of the system.
|
| 201 |
-
|
| 202 |
-
---
|
| 203 |
-
|
| 204 |
-
## Reward Design Requirements
|
| 205 |
-
|
| 206 |
-
---
|
| 207 |
-
|
| 208 |
-
### 1. Dense & Informative
|
| 209 |
-
|
| 210 |
-
* Every step must produce meaningful reward
|
| 211 |
-
* No flat or zero-reward sequences
|
| 212 |
-
|
| 213 |
-
---
|
| 214 |
-
|
| 215 |
-
### 2. Monotonic Progress
|
| 216 |
-
|
| 217 |
-
* More progress → higher reward
|
| 218 |
-
* Regressions → penalties
|
| 219 |
-
|
| 220 |
-
---
|
| 221 |
-
|
| 222 |
-
### 3. Multi-Component Reward
|
| 223 |
-
|
| 224 |
-
Reward MUST include:
|
| 225 |
-
|
| 226 |
-
### Positive:
|
| 227 |
-
|
| 228 |
-
* task progress
|
| 229 |
-
* task completion (scaled by importance)
|
| 230 |
-
|
| 231 |
-
### Negative:
|
| 232 |
-
|
| 233 |
-
* stress penalty
|
| 234 |
-
* missed deadlines
|
| 235 |
-
* excessive switching
|
| 236 |
-
* inefficiency
|
| 237 |
-
* no-op behavior
|
| 238 |
-
|
| 239 |
-
---
|
| 240 |
-
|
| 241 |
-
### 4. Anti-Exploitation
|
| 242 |
-
|
| 243 |
-
Explicitly prevent:
|
| 244 |
-
|
| 245 |
-
* infinite loops
|
| 246 |
-
* repeated switching
|
| 247 |
-
* spamming breaks
|
| 248 |
-
* idle actions
|
| 249 |
-
|
| 250 |
-
Add:
|
| 251 |
-
|
| 252 |
-
* penalties
|
| 253 |
-
* diminishing returns
|
| 254 |
-
* constraints
|
| 255 |
-
|
| 256 |
-
---
|
| 257 |
-
|
| 258 |
-
### 5. Bounded Reward
|
| 259 |
-
|
| 260 |
-
* Prevent reward explosion
|
| 261 |
-
* Keep values stable and comparable
|
| 262 |
-
|
| 263 |
-
---
|
| 264 |
-
|
| 265 |
-
### 6. Reward Breakdown (MANDATORY)
|
| 266 |
-
|
| 267 |
-
Return structured info:
|
| 268 |
-
|
| 269 |
-
```
|
| 270 |
-
{
|
| 271 |
-
"progress": ...,
|
| 272 |
-
"completion_bonus": ...,
|
| 273 |
-
"stress_penalty": ...,
|
| 274 |
-
"switch_penalty": ...,
|
| 275 |
-
"inefficiency_penalty": ...
|
| 276 |
-
}
|
| 277 |
-
```
|
| 278 |
-
|
| 279 |
-
---
|
| 280 |
-
|
| 281 |
-
## Grader Design Requirements (CRITICAL)
|
| 282 |
-
|
| 283 |
-
Each task MUST include a deterministic grader.
|
| 284 |
-
|
| 285 |
-
---
|
| 286 |
-
|
| 287 |
-
### Requirements:
|
| 288 |
-
|
| 289 |
-
* Score range:
|
| 290 |
-
|
| 291 |
-
```
|
| 292 |
-
0.0 ≤ score ≤ 1.0
|
| 293 |
-
```
|
| 294 |
-
|
| 295 |
-
* Deterministic
|
| 296 |
-
* Reproducible
|
| 297 |
-
* Continuous (not binary)
|
| 298 |
-
|
| 299 |
-
---
|
| 300 |
-
|
| 301 |
-
### Must Evaluate:
|
| 302 |
-
|
| 303 |
-
* task completion
|
| 304 |
-
* deadline adherence
|
| 305 |
-
* efficiency
|
| 306 |
-
* energy usage
|
| 307 |
-
* stress management
|
| 308 |
-
|
| 309 |
-
---
|
| 310 |
-
|
| 311 |
-
### Efficiency Metric (REQUIRED)
|
| 312 |
-
|
| 313 |
-
Define:
|
| 314 |
-
|
| 315 |
-
```
|
| 316 |
-
efficiency = optimal_steps / actual_steps
|
| 317 |
-
```
|
| 318 |
-
|
| 319 |
-
Use in grader.
|
| 320 |
-
|
| 321 |
-
---
|
| 322 |
-
|
| 323 |
-
### Normalization
|
| 324 |
-
|
| 325 |
-
Ensure:
|
| 326 |
-
|
| 327 |
-
* random agent → ~0.1–0.3
|
| 328 |
-
* baseline agent → ~0.4–0.6
|
| 329 |
-
* strong agent → ~0.7–1.0
|
| 330 |
-
|
| 331 |
-
---
|
| 332 |
-
|
| 333 |
-
## Reward vs Grader Alignment
|
| 334 |
-
|
| 335 |
-
* Reward → guides learning
|
| 336 |
-
* Grader → evaluates outcome
|
| 337 |
-
|
| 338 |
-
They must align but NOT be identical.
|
| 339 |
-
|
| 340 |
-
---
|
| 341 |
-
|
| 342 |
-
## Anti-Exploitation Validation (MANDATORY)
|
| 343 |
-
|
| 344 |
-
Explicitly test:
|
| 345 |
-
|
| 346 |
-
* agent spamming TAKE_BREAK
|
| 347 |
-
* agent switching every step
|
| 348 |
-
* agent doing nothing
|
| 349 |
-
|
| 350 |
-
Ensure:
|
| 351 |
-
|
| 352 |
-
* these strategies score poorly
|
| 353 |
-
|
| 354 |
-
---
|
| 355 |
-
|
| 356 |
-
## Logging (MANDATORY)
|
| 357 |
-
|
| 358 |
-
Return in `info`:
|
| 359 |
-
|
| 360 |
-
```
|
| 361 |
-
{
|
| 362 |
-
"reward_breakdown": ...,
|
| 363 |
-
"task_progress": ...,
|
| 364 |
-
"deadline_status": ...
|
| 365 |
-
}
|
| 366 |
-
```
|
| 367 |
-
|
| 368 |
-
---
|
| 369 |
-
|
| 370 |
-
# 9. Tasks (3 Required)
|
| 371 |
-
|
| 372 |
-
---
|
| 373 |
-
|
| 374 |
-
## Task 1 — Easy (Single Priority)
|
| 375 |
-
|
| 376 |
-
* 3 tasks
|
| 377 |
-
* 1 clearly important
|
| 378 |
-
* no meetings
|
| 379 |
-
* high energy
|
| 380 |
-
|
| 381 |
-
Goal:
|
| 382 |
-
|
| 383 |
-
* complete main task efficiently
|
| 384 |
-
|
| 385 |
-
---
|
| 386 |
-
|
| 387 |
-
## Task 2 — Medium (Deadline Pressure)
|
| 388 |
-
|
| 389 |
-
* multiple tasks
|
| 390 |
-
* tight deadlines
|
| 391 |
-
* at least one meeting
|
| 392 |
-
|
| 393 |
-
Goal:
|
| 394 |
-
|
| 395 |
-
* maximize completion before deadlines
|
| 396 |
-
|
| 397 |
-
---
|
| 398 |
-
|
| 399 |
-
## Task 3 — Hard (Energy Tradeoff)
|
| 400 |
-
|
| 401 |
-
* low energy
|
| 402 |
-
* one deep task
|
| 403 |
-
* multiple small tasks
|
| 404 |
-
|
| 405 |
-
Goal:
|
| 406 |
-
|
| 407 |
-
* balance:
|
| 408 |
-
|
| 409 |
-
* rest
|
| 410 |
-
* deep work
|
| 411 |
-
* short tasks
|
| 412 |
-
|
| 413 |
-
---
|
| 414 |
-
|
| 415 |
-
# 10. Baseline Agent (`inference.py`)
|
| 416 |
-
|
| 417 |
-
---
|
| 418 |
-
|
| 419 |
-
## Requirements:
|
| 420 |
-
|
| 421 |
-
* Use OpenAI client
|
| 422 |
-
* Read:
|
| 423 |
-
|
| 424 |
-
* API_BASE_URL
|
| 425 |
-
* MODEL_NAME
|
| 426 |
-
* OPENAI_API_KEY
|
| 427 |
-
* Run all 3 tasks
|
| 428 |
-
* Output logs in EXACT format:
|
| 429 |
-
|
| 430 |
-
* `[START]`
|
| 431 |
-
* `[STEP]`
|
| 432 |
-
* `[END]`
|
| 433 |
-
|
| 434 |
-
---
|
| 435 |
-
|
| 436 |
-
## Baseline Strategy
|
| 437 |
-
|
| 438 |
-
Simple heuristic:
|
| 439 |
-
|
| 440 |
-
* pick highest importance task
|
| 441 |
-
* continue until done or deadline
|
| 442 |
-
* take break if energy low
|
| 443 |
-
|
| 444 |
-
Baseline must be:
|
| 445 |
-
|
| 446 |
-
* non-trivial
|
| 447 |
-
* beatable
|
| 448 |
-
|
| 449 |
-
---
|
| 450 |
-
|
| 451 |
-
# 11. Code Structure
|
| 452 |
-
|
| 453 |
-
```
|
| 454 |
-
rhythm_env/
|
| 455 |
-
├── env.py
|
| 456 |
-
├── models.py
|
| 457 |
-
├── tasks/
|
| 458 |
-
├── graders/
|
| 459 |
-
├── utils/
|
| 460 |
-
├── openenv.yaml
|
| 461 |
-
├── inference.py
|
| 462 |
-
├── Dockerfile
|
| 463 |
-
└── README.md
|
| 464 |
-
```
|
| 465 |
-
|
| 466 |
-
---
|
| 467 |
-
|
| 468 |
-
# 12. README (MANDATORY)
|
| 469 |
-
|
| 470 |
-
Include:
|
| 471 |
-
|
| 472 |
-
* description
|
| 473 |
-
* motivation
|
| 474 |
-
* action space
|
| 475 |
-
* observation space
|
| 476 |
-
* reward design
|
| 477 |
-
* task descriptions
|
| 478 |
-
* grader explanation
|
| 479 |
-
* setup instructions
|
| 480 |
-
* baseline results
|
| 481 |
-
|
| 482 |
-
---
|
| 483 |
-
|
| 484 |
-
# 13. Validation Checklist
|
| 485 |
-
|
| 486 |
-
Before finishing:
|
| 487 |
-
|
| 488 |
-
* [ ] openenv validate passes
|
| 489 |
-
* [ ] Docker builds & runs
|
| 490 |
-
* [ ] HF Space responds to reset()
|
| 491 |
-
* [ ] All 3 tasks execute
|
| 492 |
-
* [ ] Graders return valid scores
|
| 493 |
-
* [ ] Baseline script runs < 20 min
|
| 494 |
-
* [ ] Logs follow required format
|
| 495 |
-
|
| 496 |
-
---
|
| 497 |
-
|
| 498 |
-
# 14. Iteration Requirement (MANDATORY)
|
| 499 |
-
|
| 500 |
-
After initial implementation:
|
| 501 |
-
|
| 502 |
-
1. Run:
|
| 503 |
-
|
| 504 |
-
* baseline agent
|
| 505 |
-
* random policy
|
| 506 |
-
|
| 507 |
-
2. Compare scores
|
| 508 |
-
|
| 509 |
-
3. Adjust:
|
| 510 |
-
|
| 511 |
-
* reward weights
|
| 512 |
-
* penalties
|
| 513 |
-
* grader scaling
|
| 514 |
-
|
| 515 |
-
DO NOT finalize without iteration.
|
| 516 |
-
|
| 517 |
-
---
|
| 518 |
-
|
| 519 |
-
# 15. Design Principles (FINAL)
|
| 520 |
-
|
| 521 |
-
---
|
| 522 |
-
|
| 523 |
-
## DO:
|
| 524 |
-
|
| 525 |
-
* Learn from OpenEnv examples
|
| 526 |
-
* Keep environment deterministic
|
| 527 |
-
* Make trade-offs the core difficulty
|
| 528 |
-
* Keep state interpretable
|
| 529 |
-
* Ensure reward clarity
|
| 530 |
-
|
| 531 |
-
---
|
| 532 |
-
|
| 533 |
-
## DO NOT:
|
| 534 |
-
|
| 535 |
-
* introduce randomness
|
| 536 |
-
* hide critical information unnecessarily
|
| 537 |
-
* create sparse rewards
|
| 538 |
-
* build overly complex simulation
|
| 539 |
-
|
| 540 |
-
---
|
| 541 |
-
|
| 542 |
-
# Final Goal
|
| 543 |
-
|
| 544 |
-
Produce an environment that:
|
| 545 |
-
|
| 546 |
-
* agents can learn from
|
| 547 |
-
* evaluators can trust
|
| 548 |
-
* demonstrates meaningful improvement across models
|
| 549 |
-
* reflects real-world decision-making
|
| 550 |
-
|
| 551 |
-
---
|
| 552 |
-
|
| 553 |
-
End of Prompt.
|
| 554 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round1/inference.py
DELETED
|
@@ -1,304 +0,0 @@
|
|
| 1 |
-
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
| 2 |
-
# All rights reserved.
|
| 3 |
-
#
|
| 4 |
-
# This source code is licensed under the BSD-style license found in the
|
| 5 |
-
# LICENSE file in the root directory of this source tree.
|
| 6 |
-
|
| 7 |
-
"""
|
| 8 |
-
RhythmEnv Inference Script
|
| 9 |
-
===================================
|
| 10 |
-
MANDATORY
|
| 11 |
-
- Before submitting, ensure the following variables are defined in your environment configuration:
|
| 12 |
-
API_BASE_URL The API endpoint for the LLM.
|
| 13 |
-
MODEL_NAME The model identifier to use for inference.
|
| 14 |
-
HF_TOKEN Your Hugging Face / API key.
|
| 15 |
-
LOCAL_IMAGE_NAME The name of the local image to use for the environment if you are using from_docker_image()
|
| 16 |
-
|
| 17 |
-
- Defaults are set only for API_BASE_URL and MODEL_NAME
|
| 18 |
-
(and should reflect your active inference setup):
|
| 19 |
-
API_BASE_URL = os.getenv("API_BASE_URL", "<your-active-endpoint>")
|
| 20 |
-
MODEL_NAME = os.getenv("MODEL_NAME", "<your-active-model>")
|
| 21 |
-
|
| 22 |
-
- The inference script must be named `inference.py` and placed in the root directory of the project
|
| 23 |
-
- Participants must use OpenAI Client for all LLM calls using above variables
|
| 24 |
-
|
| 25 |
-
STDOUT FORMAT
|
| 26 |
-
- The script must emit exactly three line types to stdout, in this order:
|
| 27 |
-
|
| 28 |
-
[START] task=<task_name> env=<benchmark> model=<model_name>
|
| 29 |
-
[STEP] step=<n> action=<action_str> reward=<0.00> done=<true|false> error=<msg|null>
|
| 30 |
-
[END] success=<true|false> steps=<n> score=<score> rewards=<r1,r2,...,rn>
|
| 31 |
-
|
| 32 |
-
Rules:
|
| 33 |
-
- One [START] line at episode begin.
|
| 34 |
-
- One [STEP] line per step, immediately after env.step() returns.
|
| 35 |
-
- One [END] line after env.close(), always emitted (even on exception).
|
| 36 |
-
- reward and rewards are formatted to 2 decimal places.
|
| 37 |
-
- done and success are lowercase booleans: true or false.
|
| 38 |
-
- error is the raw last_action_error string, or null if none.
|
| 39 |
-
- All fields on a single line with no newlines within a line.
|
| 40 |
-
- Each tasks should return score in [0, 1]
|
| 41 |
-
"""
|
| 42 |
-
|
| 43 |
-
import asyncio
|
| 44 |
-
import os
|
| 45 |
-
import sys
|
| 46 |
-
import textwrap
|
| 47 |
-
from typing import List, Optional
|
| 48 |
-
|
| 49 |
-
from openai import OpenAI
|
| 50 |
-
|
| 51 |
-
# Add current directory to path for local imports
|
| 52 |
-
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
| 53 |
-
|
| 54 |
-
from client import RhythmEnv
|
| 55 |
-
from models import ActionType, RhythmAction
|
| 56 |
-
|
| 57 |
-
# ---------------------------------------------------------------------------
|
| 58 |
-
# Configuration
|
| 59 |
-
# ---------------------------------------------------------------------------
|
| 60 |
-
|
| 61 |
-
IMAGE_NAME = os.getenv("IMAGE_NAME")
|
| 62 |
-
API_KEY = os.getenv("HF_TOKEN") or os.getenv("API_KEY")
|
| 63 |
-
API_BASE_URL = os.getenv("API_BASE_URL", "https://router.huggingface.co/v1")
|
| 64 |
-
MODEL_NAME = os.getenv("MODEL_NAME", "Qwen/Qwen2.5-72B-Instruct")
|
| 65 |
-
BASE_URL = os.getenv("RHYTHM_ENV_URL", "https://InosLihka-rhythm-env.hf.space")
|
| 66 |
-
BENCHMARK = "rhythm_env"
|
| 67 |
-
TASKS = ["easy", "medium", "hard"]
|
| 68 |
-
MAX_STEPS = 20
|
| 69 |
-
SCORE_THRESHOLD = 0.1
|
| 70 |
-
|
| 71 |
-
SYSTEM_PROMPT = textwrap.dedent("""\
|
| 72 |
-
You are a daily planning agent. You manage tasks across a workday.
|
| 73 |
-
Each step is a 30-minute slot. You have energy (0-1) and stress (0-1).
|
| 74 |
-
|
| 75 |
-
Available actions (respond with EXACTLY one line in this format):
|
| 76 |
-
START_TASK <task_id>
|
| 77 |
-
CONTINUE_TASK
|
| 78 |
-
SWITCH_TASK <task_id>
|
| 79 |
-
TAKE_BREAK
|
| 80 |
-
|
| 81 |
-
Rules:
|
| 82 |
-
- START_TASK/SWITCH_TASK require a task_id (integer).
|
| 83 |
-
- CONTINUE_TASK continues your current task.
|
| 84 |
-
- TAKE_BREAK recovers energy and reduces stress.
|
| 85 |
-
- Take breaks when energy < 0.3.
|
| 86 |
-
- Prioritize tasks by deadline urgency, then importance.
|
| 87 |
-
- Avoid unnecessary switching (costs energy and reward).
|
| 88 |
-
|
| 89 |
-
Respond with ONLY the action line, nothing else.""")
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
# ---------------------------------------------------------------------------
|
| 93 |
-
# Logging helpers
|
| 94 |
-
# ---------------------------------------------------------------------------
|
| 95 |
-
|
| 96 |
-
def log_start(task: str, env: str, model: str) -> None:
|
| 97 |
-
print(f"[START] task={task} env={env} model={model}", flush=True)
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
def log_step(step: int, action: str, reward: float, done: bool, error: Optional[str]) -> None:
|
| 101 |
-
error_val = error if error else "null"
|
| 102 |
-
done_val = str(done).lower()
|
| 103 |
-
print(
|
| 104 |
-
f"[STEP] step={step} action={action} reward={reward:.2f} done={done_val} error={error_val}",
|
| 105 |
-
flush=True,
|
| 106 |
-
)
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
def log_end(success: bool, steps: int, score: float, rewards: List[float]) -> None:
|
| 110 |
-
rewards_str = ",".join(f"{r:.2f}" for r in rewards)
|
| 111 |
-
print(
|
| 112 |
-
f"[END] success={str(success).lower()} steps={steps} score={score:.3f} rewards={rewards_str}",
|
| 113 |
-
flush=True,
|
| 114 |
-
)
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
# ---------------------------------------------------------------------------
|
| 118 |
-
# Heuristic action selection (enhanced by LLM)
|
| 119 |
-
# ---------------------------------------------------------------------------
|
| 120 |
-
|
| 121 |
-
def choose_action_heuristic(obs) -> RhythmAction:
|
| 122 |
-
"""Greedy heuristic: prioritize by deadline then importance."""
|
| 123 |
-
energy = obs.energy
|
| 124 |
-
current_task_id = obs.current_task_id
|
| 125 |
-
tasks = obs.tasks
|
| 126 |
-
timestep = obs.timestep
|
| 127 |
-
meetings = obs.meetings
|
| 128 |
-
|
| 129 |
-
# During meeting slots, just take a break
|
| 130 |
-
if timestep in meetings:
|
| 131 |
-
return RhythmAction(action_type=ActionType.TAKE_BREAK)
|
| 132 |
-
|
| 133 |
-
# Take break if energy is low
|
| 134 |
-
if energy < 0.3:
|
| 135 |
-
return RhythmAction(action_type=ActionType.TAKE_BREAK)
|
| 136 |
-
|
| 137 |
-
# Get uncompleted tasks
|
| 138 |
-
uncompleted = [t for t in tasks if t.progress < t.effort]
|
| 139 |
-
if not uncompleted:
|
| 140 |
-
return RhythmAction(action_type=ActionType.TAKE_BREAK)
|
| 141 |
-
|
| 142 |
-
# Sort by deadline (ascending), then importance (descending)
|
| 143 |
-
uncompleted.sort(key=lambda t: (t.deadline, -t.importance))
|
| 144 |
-
|
| 145 |
-
# Check for urgent tasks (deadline within 3 steps)
|
| 146 |
-
urgent = [t for t in uncompleted if t.deadline - timestep <= 3]
|
| 147 |
-
best = urgent[0] if urgent else uncompleted[0]
|
| 148 |
-
|
| 149 |
-
if current_task_id is not None and current_task_id == best.id:
|
| 150 |
-
return RhythmAction(action_type=ActionType.CONTINUE_TASK)
|
| 151 |
-
elif current_task_id is not None:
|
| 152 |
-
return RhythmAction(action_type=ActionType.SWITCH_TASK, task_id=best.id)
|
| 153 |
-
else:
|
| 154 |
-
return RhythmAction(action_type=ActionType.START_TASK, task_id=best.id)
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
def choose_action_llm(obs, llm_client: OpenAI) -> RhythmAction:
|
| 158 |
-
"""Use LLM to pick an action, fall back to heuristic on failure."""
|
| 159 |
-
tasks_desc = "\n".join(
|
| 160 |
-
f" Task {t.id}: {t.name} — {t.description}\n"
|
| 161 |
-
f" (effort={t.effort:.2f}, progress={t.progress:.2f}, "
|
| 162 |
-
f"deadline=step {t.deadline}, importance={t.importance})"
|
| 163 |
-
for t in obs.tasks
|
| 164 |
-
)
|
| 165 |
-
user_prompt = textwrap.dedent(f"""\
|
| 166 |
-
Step: {obs.timestep}/{MAX_STEPS}
|
| 167 |
-
Energy: {obs.energy:.2f}
|
| 168 |
-
Stress: {obs.stress:.2f}
|
| 169 |
-
Current task: {obs.current_task_id}
|
| 170 |
-
Meetings at steps: {obs.meetings}
|
| 171 |
-
Remaining steps: {obs.remaining_steps}
|
| 172 |
-
|
| 173 |
-
Tasks:
|
| 174 |
-
{tasks_desc}
|
| 175 |
-
|
| 176 |
-
Choose your action:""")
|
| 177 |
-
|
| 178 |
-
try:
|
| 179 |
-
completion = llm_client.chat.completions.create(
|
| 180 |
-
model=MODEL_NAME,
|
| 181 |
-
messages=[
|
| 182 |
-
{"role": "system", "content": SYSTEM_PROMPT},
|
| 183 |
-
{"role": "user", "content": user_prompt},
|
| 184 |
-
],
|
| 185 |
-
temperature=0.3,
|
| 186 |
-
max_tokens=30,
|
| 187 |
-
stream=False,
|
| 188 |
-
)
|
| 189 |
-
text = (completion.choices[0].message.content or "").strip()
|
| 190 |
-
return parse_llm_action(text, obs)
|
| 191 |
-
except Exception:
|
| 192 |
-
return choose_action_heuristic(obs)
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
def parse_llm_action(text: str, obs) -> RhythmAction:
|
| 196 |
-
"""Parse LLM response text into a RhythmAction."""
|
| 197 |
-
text = text.strip().upper()
|
| 198 |
-
|
| 199 |
-
if text.startswith("TAKE_BREAK"):
|
| 200 |
-
return RhythmAction(action_type=ActionType.TAKE_BREAK)
|
| 201 |
-
|
| 202 |
-
if text.startswith("CONTINUE_TASK"):
|
| 203 |
-
if obs.current_task_id is not None:
|
| 204 |
-
return RhythmAction(action_type=ActionType.CONTINUE_TASK)
|
| 205 |
-
return choose_action_heuristic(obs)
|
| 206 |
-
|
| 207 |
-
for prefix, action_type in [
|
| 208 |
-
("START_TASK", ActionType.START_TASK),
|
| 209 |
-
("SWITCH_TASK", ActionType.SWITCH_TASK),
|
| 210 |
-
]:
|
| 211 |
-
if text.startswith(prefix):
|
| 212 |
-
rest = text[len(prefix):].strip()
|
| 213 |
-
try:
|
| 214 |
-
task_id = int(rest)
|
| 215 |
-
if 0 <= task_id < len(obs.tasks):
|
| 216 |
-
return RhythmAction(action_type=action_type, task_id=task_id)
|
| 217 |
-
except ValueError:
|
| 218 |
-
pass
|
| 219 |
-
|
| 220 |
-
# Fallback
|
| 221 |
-
return choose_action_heuristic(obs)
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
# ---------------------------------------------------------------------------
|
| 225 |
-
# Main loop
|
| 226 |
-
# ---------------------------------------------------------------------------
|
| 227 |
-
|
| 228 |
-
async def run_task(task_name: str, llm_client: OpenAI) -> float:
|
| 229 |
-
"""Run a single task and return the score."""
|
| 230 |
-
if IMAGE_NAME:
|
| 231 |
-
env = await RhythmEnv.from_docker_image(IMAGE_NAME)
|
| 232 |
-
else:
|
| 233 |
-
env = RhythmEnv(base_url=BASE_URL)
|
| 234 |
-
|
| 235 |
-
rewards: List[float] = []
|
| 236 |
-
steps_taken = 0
|
| 237 |
-
score = 0.0
|
| 238 |
-
success = False
|
| 239 |
-
|
| 240 |
-
log_start(task=task_name, env=BENCHMARK, model=MODEL_NAME)
|
| 241 |
-
|
| 242 |
-
try:
|
| 243 |
-
async with env:
|
| 244 |
-
result = await env.reset(task=task_name)
|
| 245 |
-
|
| 246 |
-
for step in range(1, MAX_STEPS + 1):
|
| 247 |
-
if result.done:
|
| 248 |
-
break
|
| 249 |
-
|
| 250 |
-
# Use LLM if available, otherwise heuristic
|
| 251 |
-
if llm_client is not None:
|
| 252 |
-
action = choose_action_llm(result.observation, llm_client)
|
| 253 |
-
else:
|
| 254 |
-
action = choose_action_heuristic(result.observation)
|
| 255 |
-
|
| 256 |
-
action_str = action.action_type.value
|
| 257 |
-
if action.task_id is not None:
|
| 258 |
-
action_str += f"({action.task_id})"
|
| 259 |
-
|
| 260 |
-
result = await env.step(action)
|
| 261 |
-
|
| 262 |
-
reward = result.reward or 0.0
|
| 263 |
-
done = result.done
|
| 264 |
-
rewards.append(reward)
|
| 265 |
-
steps_taken = step
|
| 266 |
-
|
| 267 |
-
log_step(step=step, action=action_str, reward=reward, done=done, error=None)
|
| 268 |
-
|
| 269 |
-
if done:
|
| 270 |
-
break
|
| 271 |
-
|
| 272 |
-
# Get final score from grader
|
| 273 |
-
score = result.observation.reward_breakdown.get("final_score", 0.0)
|
| 274 |
-
score = max(0.0, min(1.0, score))
|
| 275 |
-
success = score >= SCORE_THRESHOLD
|
| 276 |
-
|
| 277 |
-
except Exception as e:
|
| 278 |
-
print(f"[DEBUG] Error running task {task_name}: {e}", flush=True)
|
| 279 |
-
finally:
|
| 280 |
-
try:
|
| 281 |
-
await env.close()
|
| 282 |
-
except Exception as e:
|
| 283 |
-
print(f"[DEBUG] env.close() error: {e}", flush=True)
|
| 284 |
-
log_end(success=success, steps=steps_taken, score=score, rewards=rewards)
|
| 285 |
-
|
| 286 |
-
return score
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
async def main() -> None:
|
| 290 |
-
llm_client = None
|
| 291 |
-
if API_KEY:
|
| 292 |
-
llm_client = OpenAI(base_url=API_BASE_URL, api_key=API_KEY)
|
| 293 |
-
|
| 294 |
-
scores = []
|
| 295 |
-
for task_name in TASKS:
|
| 296 |
-
s = await run_task(task_name, llm_client)
|
| 297 |
-
scores.append(s)
|
| 298 |
-
|
| 299 |
-
avg = sum(scores) / len(scores) if scores else 0.0
|
| 300 |
-
print(f"\n[SUMMARY] avg_score={avg:.3f} scores={','.join(f'{s:.3f}' for s in scores)}", flush=True)
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
if __name__ == "__main__":
|
| 304 |
-
asyncio.run(main())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round1/problem_statement.md
DELETED
|
@@ -1,176 +0,0 @@
|
|
| 1 |
-
# Round 1 — Problem Statement
|
| 2 |
-
|
| 3 |
-
## The Task
|
| 4 |
-
|
| 5 |
-
Build a complete, real-world OpenEnv environment that an AI agent can learn from through the standard `step()` / `reset()` / `state()` API.
|
| 6 |
-
|
| 7 |
-
---
|
| 8 |
-
|
| 9 |
-
## Key Requirements at a Glance
|
| 10 |
-
|
| 11 |
-
- Must simulate a real-world task (not games or toys)
|
| 12 |
-
- Implement full OpenEnv spec: typed models, `step()`/`reset()`/`state()`, `openenv.yaml`
|
| 13 |
-
- Minimum 3 tasks with agent graders (easy → medium → hard, scores 0.0–1.0)
|
| 14 |
-
- Meaningful reward function with partial progress signals
|
| 15 |
-
- Baseline inference script with reproducible scores
|
| 16 |
-
- Deploy to Hugging Face Spaces + working Dockerfile
|
| 17 |
-
- README with environment description, action/observation spaces, setup instructions
|
| 18 |
-
|
| 19 |
-
---
|
| 20 |
-
|
| 21 |
-
## Functional Requirements
|
| 22 |
-
|
| 23 |
-
### 1. Real-World Task Simulation
|
| 24 |
-
The environment must simulate a task humans actually do — not games or toys. Examples: email triage, code review, data cleaning, scheduling, customer support, content moderation.
|
| 25 |
-
|
| 26 |
-
### 2. OpenEnv Spec Compliance
|
| 27 |
-
Implement the full OpenEnv interface:
|
| 28 |
-
- Typed `Observation`, `Action`, and `Reward` Pydantic models
|
| 29 |
-
- `step(action)` → returns observation, reward, done, info
|
| 30 |
-
- `reset()` → returns initial observation
|
| 31 |
-
- `state()` → returns current state
|
| 32 |
-
- `openenv.yaml` with metadata
|
| 33 |
-
- Tested via `openenv validate`
|
| 34 |
-
|
| 35 |
-
### 3. Minimum 3 Tasks with Agent Graders
|
| 36 |
-
Each task defines a concrete objective an agent must accomplish, with a programmatic grader that scores performance (0.0–1.0). Tasks should range: easy → medium → hard. Graders must have clear, deterministic success/failure criteria.
|
| 37 |
-
|
| 38 |
-
### 4. Meaningful Reward Function
|
| 39 |
-
- Provides signal over the full trajectory (not just binary end-of-episode)
|
| 40 |
-
- Rewards partial progress toward task completion
|
| 41 |
-
- Penalizes clearly undesirable behavior (e.g. infinite loops, destructive actions)
|
| 42 |
-
|
| 43 |
-
### 5. Baseline Inference Script
|
| 44 |
-
- Uses the OpenAI API client to run a model against the environment
|
| 45 |
-
- Reads API credentials from environment variables (`OPENAI_API_KEY`)
|
| 46 |
-
- Produces a reproducible baseline score on all 3 tasks
|
| 47 |
-
|
| 48 |
-
---
|
| 49 |
-
|
| 50 |
-
## Non-Functional Requirements
|
| 51 |
-
|
| 52 |
-
### 1. Hugging Face Space Deployment
|
| 53 |
-
Environment must run as a containerized HF Space tagged with `openenv`.
|
| 54 |
-
|
| 55 |
-
### 2. Containerized Execution
|
| 56 |
-
Must include a working Dockerfile. The environment should start cleanly with `docker build` + `docker run`.
|
| 57 |
-
|
| 58 |
-
### 3. Documentation
|
| 59 |
-
README must include: environment description and motivation, action and observation space definitions, task descriptions with expected difficulty, setup and usage instructions, baseline scores.
|
| 60 |
-
|
| 61 |
-
---
|
| 62 |
-
|
| 63 |
-
## Evaluation Criteria
|
| 64 |
-
|
| 65 |
-
| Parameter | Weight | Description |
|
| 66 |
-
|---|---|---|
|
| 67 |
-
| Real-world utility | 30% | Does the environment model a genuine task? Would someone actually use this to train or evaluate agents? |
|
| 68 |
-
| Task & grader quality | 25% | Are tasks well-defined with clear objectives? Do graders accurately and fairly measure success? Meaningful difficulty progression? |
|
| 69 |
-
| Environment design | 20% | Clean state management, sensible action/observation spaces, good reward shaping, proper episode boundaries. |
|
| 70 |
-
| Code quality & spec compliance | 15% | Follows OpenEnv spec, clean project structure, typed models, documented, tested, Dockerfile works. |
|
| 71 |
-
| Creativity & novelty | 10% | Novel problem domain, interesting mechanics, clever reward design, original approach. |
|
| 72 |
-
|
| 73 |
-
---
|
| 74 |
-
|
| 75 |
-
## Scoring Breakdown
|
| 76 |
-
|
| 77 |
-
**Real-world utility (30%)**
|
| 78 |
-
- 0–5: Toy/artificial problem with no practical application
|
| 79 |
-
- 6–15: Valid domain but shallow modeling of the real task
|
| 80 |
-
- 16–25: Good domain modeling, would be useful for agent evaluation
|
| 81 |
-
- 26–30: Excellent — fills a real gap, immediate value for the RL/agent community
|
| 82 |
-
|
| 83 |
-
**Task & grader quality (25%)**
|
| 84 |
-
- 3+ tasks with difficulty range?
|
| 85 |
-
- Graders produce scores between 0.0–1.0?
|
| 86 |
-
- Graders deterministic and reproducible?
|
| 87 |
-
- Hard task genuinely challenges frontier models?
|
| 88 |
-
|
| 89 |
-
**Environment design (20%)**
|
| 90 |
-
- `reset()` produces clean state?
|
| 91 |
-
- Action/observation types well-designed and documented?
|
| 92 |
-
- Reward function provides useful varying signal (not just sparse)?
|
| 93 |
-
- Episode boundaries sensible?
|
| 94 |
-
|
| 95 |
-
**Code quality & spec compliance (15%)**
|
| 96 |
-
- `openenv validate` passes?
|
| 97 |
-
- `docker build && docker run` works?
|
| 98 |
-
- HF Space deploys and responds?
|
| 99 |
-
- Baseline script runs and reproduces scores?
|
| 100 |
-
|
| 101 |
-
**Creativity & novelty (10%)**
|
| 102 |
-
- Domain we haven't seen in OpenEnv before?
|
| 103 |
-
- Reward design has interesting properties?
|
| 104 |
-
- Clever mechanics that make the environment engaging?
|
| 105 |
-
|
| 106 |
-
---
|
| 107 |
-
|
| 108 |
-
## How Judging Works
|
| 109 |
-
|
| 110 |
-
**Phase 1: Automated Validation**
|
| 111 |
-
Pass/fail gate — HF Space deploys, OpenEnv spec compliance, Dockerfile builds, baseline reproduces, 3+ tasks with graders.
|
| 112 |
-
|
| 113 |
-
**Phase 2: Agentic Evaluation**
|
| 114 |
-
Scored — baseline agent re-run, standard Open LLM agent (e.g. Nemotron 3 Super) run against all environments, score variance check.
|
| 115 |
-
|
| 116 |
-
**Phase 3: Human Review**
|
| 117 |
-
Top submissions reviewed by Meta and Hugging Face engineers for real-world utility, creativity, and exploit checks.
|
| 118 |
-
|
| 119 |
-
---
|
| 120 |
-
|
| 121 |
-
## Disqualification Criteria
|
| 122 |
-
|
| 123 |
-
- Environment does not deploy or respond
|
| 124 |
-
- Plagiarized or trivially modified existing environments
|
| 125 |
-
- Graders that always return the same score
|
| 126 |
-
- No baseline inference script
|
| 127 |
-
|
| 128 |
-
---
|
| 129 |
-
|
| 130 |
-
## Pre-Submission Checklist — all must pass or you're disqualified
|
| 131 |
-
|
| 132 |
-
- [ ] HF Space deploys — automated ping to the Space URL must return 200 and respond to `reset()`
|
| 133 |
-
- [ ] OpenEnv spec compliance — validate `openenv.yaml`, typed models, `step()`/`reset()`/`state()` endpoints
|
| 134 |
-
- [ ] Dockerfile builds — automated `docker build` on the submitted repo
|
| 135 |
-
- [ ] Baseline reproduces — run the submitted inference script, must complete without error and produce scores
|
| 136 |
-
- [ ] 3+ tasks with graders — enumerate tasks, run each grader, verify scores in 0.0–1.0 range
|
| 137 |
-
|
| 138 |
-
---
|
| 139 |
-
|
| 140 |
-
## Mandatory Additional Instructions
|
| 141 |
-
|
| 142 |
-
Before submitting, ensure the following variables are defined in your environment configuration:
|
| 143 |
-
|
| 144 |
-
| Variable | Description |
|
| 145 |
-
|---|---|
|
| 146 |
-
| `API_BASE_URL` | The API endpoint for the LLM |
|
| 147 |
-
| `MODEL_NAME` | The model identifier to use for inference |
|
| 148 |
-
| `HF_TOKEN` | Your Hugging Face / API key |
|
| 149 |
-
|
| 150 |
-
- The inference script must be named `inference.py` and placed in the root directory of the project
|
| 151 |
-
- Participants must use OpenAI Client for all LLM calls using the above variables
|
| 152 |
-
- Participants must emit structured stdout logs strictly following the `[START]`, `[STEP]`, and `[END]` format (see `scripts/sample_inference.py`)
|
| 153 |
-
|
| 154 |
-
---
|
| 155 |
-
|
| 156 |
-
## Infrastructure Restrictions
|
| 157 |
-
|
| 158 |
-
- Runtime of inference script must be less than 20 minutes
|
| 159 |
-
- Environment and inference must run on a machine with vCPU=2, memory=8GB
|
| 160 |
-
|
| 161 |
-
---
|
| 162 |
-
|
| 163 |
-
## Setup Prerequisites
|
| 164 |
-
|
| 165 |
-
| Tool | Purpose | Install |
|
| 166 |
-
|---|---|---|
|
| 167 |
-
| Python 3.10+ | Runtime | `python --version` |
|
| 168 |
-
| Git + GitHub | Push submission | `git --version` |
|
| 169 |
-
| Hugging Face CLI | Deploy to HF Spaces | `pip install huggingface_hub` then `huggingface-cli login` |
|
| 170 |
-
| OpenEnv | The framework | `pip install openenv-core` |
|
| 171 |
-
| Docker (recommended) | Isolated container testing | `docker --version` |
|
| 172 |
-
| VS Code (recommended) | Best Python + Docker support | — |
|
| 173 |
-
|
| 174 |
-
---
|
| 175 |
-
|
| 176 |
-
*See `scripts/validate-submission.sh` to run pre-submission checks and `scripts/sample_inference.py` for the required inference script format.*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round1/scripts/sample_inference.py
DELETED
|
@@ -1,182 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Inference Script Example
|
| 3 |
-
===================================
|
| 4 |
-
MANDATORY
|
| 5 |
-
- Before submitting, ensure the following variables are defined in your environment configuration:
|
| 6 |
-
API_BASE_URL The API endpoint for the LLM.
|
| 7 |
-
MODEL_NAME The model identifier to use for inference.
|
| 8 |
-
HF_TOKEN Your Hugging Face / API key.
|
| 9 |
-
LOCAL_IMAGE_NAME The name of the local image to use for the environment if you are using from_docker_image()
|
| 10 |
-
method
|
| 11 |
-
|
| 12 |
-
- Defaults are set only for API_BASE_URL and MODEL_NAME
|
| 13 |
-
(and should reflect your active inference setup):
|
| 14 |
-
API_BASE_URL = os.getenv("API_BASE_URL", "<your-active-endpoint>")
|
| 15 |
-
MODEL_NAME = os.getenv("MODEL_NAME", "<your-active-model>")
|
| 16 |
-
|
| 17 |
-
- The inference script must be named `inference.py` and placed in the root directory of the project
|
| 18 |
-
- Participants must use OpenAI Client for all LLM calls using above variables
|
| 19 |
-
|
| 20 |
-
STDOUT FORMAT
|
| 21 |
-
- The script must emit exactly three line types to stdout, in this order:
|
| 22 |
-
|
| 23 |
-
[START] task=<task_name> env=<benchmark> model=<model_name>
|
| 24 |
-
[STEP] step=<n> action=<action_str> reward=<0.00> done=<true|false> error=<msg|null>
|
| 25 |
-
[END] success=<true|false> steps=<n> score=<score> rewards=<r1,r2,...,rn>
|
| 26 |
-
|
| 27 |
-
Rules:
|
| 28 |
-
- One [START] line at episode begin.
|
| 29 |
-
- One [STEP] line per step, immediately after env.step() returns.
|
| 30 |
-
- One [END] line after env.close(), always emitted (even on exception).
|
| 31 |
-
- reward and rewards are formatted to 2 decimal places.
|
| 32 |
-
- done and success are lowercase booleans: true or false.
|
| 33 |
-
- error is the raw last_action_error string, or null if none.
|
| 34 |
-
- All fields on a single line with no newlines within a line.
|
| 35 |
-
- Each tasks should return score in [0, 1]
|
| 36 |
-
|
| 37 |
-
Example:
|
| 38 |
-
[START] task=click-test env=miniwob model=Qwen3-VL-30B
|
| 39 |
-
[STEP] step=1 action=click('123') reward=0.00 done=false error=null
|
| 40 |
-
[STEP] step=2 action=fill('456','text') reward=0.00 done=false error=null
|
| 41 |
-
[STEP] step=3 action=click('789') reward=1.00 done=true error=null
|
| 42 |
-
[END] success=true steps=3 score=1.00 rewards=0.00,0.00,1.00
|
| 43 |
-
"""
|
| 44 |
-
|
| 45 |
-
import asyncio
|
| 46 |
-
import os
|
| 47 |
-
import textwrap
|
| 48 |
-
from typing import List, Optional
|
| 49 |
-
|
| 50 |
-
from openai import OpenAI
|
| 51 |
-
|
| 52 |
-
from my_env_v4 import MyEnvV4Action, MyEnvV4Env
|
| 53 |
-
IMAGE_NAME = os.getenv("IMAGE_NAME") # If you are using docker image
|
| 54 |
-
API_KEY = os.getenv("HF_TOKEN") or os.getenv("API_KEY")
|
| 55 |
-
|
| 56 |
-
API_BASE_URL = os.getenv("API_BASE_URL") or "https://router.huggingface.co/v1"
|
| 57 |
-
MODEL_NAME = os.getenv("MODEL_NAME") or "Qwen/Qwen2.5-72B-Instruct"
|
| 58 |
-
TASK_NAME = os.getenv("MY_ENV_V4_TASK", "echo")
|
| 59 |
-
BENCHMARK = os.getenv("MY_ENV_V4_BENCHMARK", "my_env_v4")
|
| 60 |
-
MAX_STEPS = 8
|
| 61 |
-
TEMPERATURE = 0.7
|
| 62 |
-
MAX_TOKENS = 150
|
| 63 |
-
SUCCESS_SCORE_THRESHOLD = 0.1 # normalized score in [0, 1]
|
| 64 |
-
|
| 65 |
-
# Max possible reward: each token contributes 0.1, across all steps
|
| 66 |
-
_MAX_REWARD_PER_STEP = MAX_TOKENS * 0.1
|
| 67 |
-
MAX_TOTAL_REWARD = MAX_STEPS * _MAX_REWARD_PER_STEP
|
| 68 |
-
|
| 69 |
-
SYSTEM_PROMPT = textwrap.dedent(
|
| 70 |
-
"""
|
| 71 |
-
You are interacting with a simple echo environment.
|
| 72 |
-
Each turn you must send a message. The environment will echo it back.
|
| 73 |
-
Reward is proportional to message length: reward = len(message) * 0.1
|
| 74 |
-
Your goal is to maximize total reward by sending meaningful, substantive messages.
|
| 75 |
-
Reply with exactly one message string — no quotes, no prefixes, just the message text.
|
| 76 |
-
"""
|
| 77 |
-
).strip()
|
| 78 |
-
|
| 79 |
-
def log_start(task: str, env: str, model: str) -> None:
|
| 80 |
-
print(f"[START] task={task} env={env} model={model}", flush=True)
|
| 81 |
-
|
| 82 |
-
def log_step(step: int, action: str, reward: float, done: bool, error: Optional[str]) -> None:
|
| 83 |
-
error_val = error if error else "null"
|
| 84 |
-
done_val = str(done).lower()
|
| 85 |
-
print(
|
| 86 |
-
f"[STEP] step={step} action={action} reward={reward:.2f} done={done_val} error={error_val}",
|
| 87 |
-
flush=True,
|
| 88 |
-
)
|
| 89 |
-
|
| 90 |
-
def log_end(success: bool, steps: int, score: float, rewards: List[float]) -> None:
|
| 91 |
-
rewards_str = ",".join(f"{r:.2f}" for r in rewards)
|
| 92 |
-
print(f"[END] success={str(success).lower()} steps={steps} score={score:.3f} rewards={rewards_str}", flush=True)
|
| 93 |
-
|
| 94 |
-
def build_user_prompt(step: int, last_echoed: str, last_reward: float, history: List[str]) -> str:
|
| 95 |
-
history_block = "\n".join(history[-4:]) if history else "None"
|
| 96 |
-
return textwrap.dedent(
|
| 97 |
-
f"""
|
| 98 |
-
Step: {step}
|
| 99 |
-
Last echoed message: {last_echoed!r}
|
| 100 |
-
Last reward: {last_reward:.2f}
|
| 101 |
-
Previous steps:
|
| 102 |
-
{history_block}
|
| 103 |
-
Send your next message.
|
| 104 |
-
"""
|
| 105 |
-
).strip()
|
| 106 |
-
|
| 107 |
-
def get_model_message(client: OpenAI, step: int, last_echoed: str, last_reward: float, history: List[str]) -> str:
|
| 108 |
-
user_prompt = build_user_prompt(step, last_echoed, last_reward, history)
|
| 109 |
-
try:
|
| 110 |
-
completion = client.chat.completions.create(
|
| 111 |
-
model=MODEL_NAME,
|
| 112 |
-
messages=[
|
| 113 |
-
{"role": "system", "content": SYSTEM_PROMPT},
|
| 114 |
-
{"role": "user", "content": user_prompt},
|
| 115 |
-
],
|
| 116 |
-
temperature=TEMPERATURE,
|
| 117 |
-
max_tokens=MAX_TOKENS,
|
| 118 |
-
stream=False,
|
| 119 |
-
)
|
| 120 |
-
text = (completion.choices[0].message.content or "").strip()
|
| 121 |
-
return text if text else "hello"
|
| 122 |
-
except Exception as exc:
|
| 123 |
-
print(f"[DEBUG] Model request failed: {exc}", flush=True)
|
| 124 |
-
return "hello"
|
| 125 |
-
|
| 126 |
-
async def main() -> None:
|
| 127 |
-
client = OpenAI(base_url=API_BASE_URL, api_key=API_KEY)
|
| 128 |
-
|
| 129 |
-
env = await MyEnvV4Env.from_docker_image(IMAGE_NAME)
|
| 130 |
-
|
| 131 |
-
history: List[str] = []
|
| 132 |
-
rewards: List[float] = []
|
| 133 |
-
steps_taken = 0
|
| 134 |
-
score = 0.0
|
| 135 |
-
success = False
|
| 136 |
-
|
| 137 |
-
log_start(task=TASK_NAME, env=BENCHMARK, model=MODEL_NAME)
|
| 138 |
-
|
| 139 |
-
try:
|
| 140 |
-
result = await env.reset() # OpenENV.reset()
|
| 141 |
-
last_echoed = result.observation.echoed_message
|
| 142 |
-
last_reward = 0.0
|
| 143 |
-
|
| 144 |
-
for step in range(1, MAX_STEPS + 1):
|
| 145 |
-
if result.done:
|
| 146 |
-
break
|
| 147 |
-
|
| 148 |
-
message = get_model_message(client, step, last_echoed, last_reward, history)
|
| 149 |
-
|
| 150 |
-
result = await env.step(MyEnvV4Action(message=message))
|
| 151 |
-
obs = result.observation
|
| 152 |
-
|
| 153 |
-
reward = result.reward or 0.0
|
| 154 |
-
done = result.done
|
| 155 |
-
error = None
|
| 156 |
-
|
| 157 |
-
rewards.append(reward)
|
| 158 |
-
steps_taken = step
|
| 159 |
-
last_echoed = obs.echoed_message
|
| 160 |
-
last_reward = reward
|
| 161 |
-
|
| 162 |
-
log_step(step=step, action=message, reward=reward, done=done, error=error)
|
| 163 |
-
|
| 164 |
-
history.append(f"Step {step}: {message!r} -> reward {reward:+.2f}")
|
| 165 |
-
|
| 166 |
-
if done:
|
| 167 |
-
break
|
| 168 |
-
|
| 169 |
-
score = sum(rewards) / MAX_TOTAL_REWARD if MAX_TOTAL_REWARD > 0 else 0.0
|
| 170 |
-
score = min(max(score, 0.0), 1.0) # clamp to [0, 1]
|
| 171 |
-
success = score >= SUCCESS_SCORE_THRESHOLD
|
| 172 |
-
|
| 173 |
-
finally:
|
| 174 |
-
try:
|
| 175 |
-
await env.close()
|
| 176 |
-
except Exception as e:
|
| 177 |
-
print(f"[DEBUG] env.close() error (container cleanup): {e}", flush=True)
|
| 178 |
-
log_end(success=success, steps=steps_taken, score=score, rewards=rewards)
|
| 179 |
-
|
| 180 |
-
if __name__ == "__main__":
|
| 181 |
-
asyncio.run(main())
|
| 182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round1/scripts/validate-submission.sh
DELETED
|
@@ -1,186 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env bash
|
| 2 |
-
#
|
| 3 |
-
# validate-submission.sh — OpenEnv Submission Validator
|
| 4 |
-
#
|
| 5 |
-
# Checks that your HF Space is live, Docker image builds, and openenv validate passes.
|
| 6 |
-
#
|
| 7 |
-
# Prerequisites:
|
| 8 |
-
# - Docker: https://docs.docker.com/get-docker/
|
| 9 |
-
# - openenv-core: pip install openenv-core
|
| 10 |
-
# - curl (usually pre-installed)
|
| 11 |
-
#
|
| 12 |
-
# Run:
|
| 13 |
-
# curl -fsSL https://raw.githubusercontent.com/<owner>/<repo>/main/scripts/validate-submission.sh | bash -s -- <ping_url> [repo_dir]
|
| 14 |
-
#
|
| 15 |
-
# Or download and run locally:
|
| 16 |
-
# chmod +x validate-submission.sh
|
| 17 |
-
# ./validate-submission.sh <ping_url> [repo_dir]
|
| 18 |
-
#
|
| 19 |
-
# Arguments:
|
| 20 |
-
# ping_url Your HuggingFace Space URL (e.g. https://your-space.hf.space)
|
| 21 |
-
# repo_dir Path to your repo (default: current directory)
|
| 22 |
-
#
|
| 23 |
-
# Examples:
|
| 24 |
-
# ./validate-submission.sh https://my-team.hf.space
|
| 25 |
-
# ./validate-submission.sh https://my-team.hf.space ./my-repo
|
| 26 |
-
#
|
| 27 |
-
|
| 28 |
-
set -uo pipefail
|
| 29 |
-
|
| 30 |
-
DOCKER_BUILD_TIMEOUT=600
|
| 31 |
-
if [ -t 1 ]; then
|
| 32 |
-
RED='\033[0;31m'
|
| 33 |
-
GREEN='\033[0;32m'
|
| 34 |
-
YELLOW='\033[1;33m'
|
| 35 |
-
BOLD='\033[1m'
|
| 36 |
-
NC='\033[0m'
|
| 37 |
-
else
|
| 38 |
-
RED='' GREEN='' YELLOW='' BOLD='' NC=''
|
| 39 |
-
fi
|
| 40 |
-
|
| 41 |
-
run_with_timeout() {
|
| 42 |
-
local secs="$1"; shift
|
| 43 |
-
if command -v timeout &>/dev/null; then
|
| 44 |
-
timeout "$secs" "$@"
|
| 45 |
-
elif command -v gtimeout &>/dev/null; then
|
| 46 |
-
gtimeout "$secs" "$@"
|
| 47 |
-
else
|
| 48 |
-
"$@" &
|
| 49 |
-
local pid=$!
|
| 50 |
-
( sleep "$secs" && kill "$pid" 2>/dev/null ) &
|
| 51 |
-
local watcher=$!
|
| 52 |
-
wait "$pid" 2>/dev/null
|
| 53 |
-
local rc=$?
|
| 54 |
-
kill "$watcher" 2>/dev/null
|
| 55 |
-
wait "$watcher" 2>/dev/null
|
| 56 |
-
return $rc
|
| 57 |
-
fi
|
| 58 |
-
}
|
| 59 |
-
|
| 60 |
-
portable_mktemp() {
|
| 61 |
-
local prefix="${1:-validate}"
|
| 62 |
-
mktemp "${TMPDIR:-/tmp}/${prefix}-XXXXXX" 2>/dev/null || mktemp
|
| 63 |
-
}
|
| 64 |
-
|
| 65 |
-
CLEANUP_FILES=()
|
| 66 |
-
cleanup() { rm -f "${CLEANUP_FILES[@]+"${CLEANUP_FILES[@]}"}"; }
|
| 67 |
-
trap cleanup EXIT
|
| 68 |
-
|
| 69 |
-
PING_URL="${1:-}"
|
| 70 |
-
REPO_DIR="${2:-.}"
|
| 71 |
-
|
| 72 |
-
if [ -z "$PING_URL" ]; then
|
| 73 |
-
printf "Usage: %s <ping_url> [repo_dir]\n" "$0"
|
| 74 |
-
printf "\n"
|
| 75 |
-
printf " ping_url Your HuggingFace Space URL (e.g. https://your-space.hf.space)\n"
|
| 76 |
-
printf " repo_dir Path to your repo (default: current directory)\n"
|
| 77 |
-
exit 1
|
| 78 |
-
fi
|
| 79 |
-
|
| 80 |
-
if ! REPO_DIR="$(cd "$REPO_DIR" 2>/dev/null && pwd)"; then
|
| 81 |
-
printf "Error: directory '%s' not found\n" "${2:-.}"
|
| 82 |
-
exit 1
|
| 83 |
-
fi
|
| 84 |
-
PING_URL="${PING_URL%/}"
|
| 85 |
-
export PING_URL
|
| 86 |
-
PASS=0
|
| 87 |
-
|
| 88 |
-
log() { printf "[%s] %b\n" "$(date -u +%H:%M:%S)" "$*"; }
|
| 89 |
-
pass() { log "${GREEN}PASSED${NC} -- $1"; PASS=$((PASS + 1)); }
|
| 90 |
-
fail() { log "${RED}FAILED${NC} -- $1"; }
|
| 91 |
-
hint() { printf " ${YELLOW}Hint:${NC} %b\n" "$1"; }
|
| 92 |
-
stop_at() {
|
| 93 |
-
printf "\n"
|
| 94 |
-
printf "${RED}${BOLD}Validation stopped at %s.${NC} Fix the above before continuing.\n" "$1"
|
| 95 |
-
exit 1
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
printf "\n"
|
| 99 |
-
printf "${BOLD}========================================${NC}\n"
|
| 100 |
-
printf "${BOLD} OpenEnv Submission Validator${NC}\n"
|
| 101 |
-
printf "${BOLD}========================================${NC}\n"
|
| 102 |
-
log "Repo: $REPO_DIR"
|
| 103 |
-
log "Ping URL: $PING_URL"
|
| 104 |
-
printf "\n"
|
| 105 |
-
|
| 106 |
-
log "${BOLD}Step 1/3: Pinging HF Space${NC} ($PING_URL/reset) ..."
|
| 107 |
-
|
| 108 |
-
CURL_OUTPUT=$(portable_mktemp "validate-curl")
|
| 109 |
-
CLEANUP_FILES+=("$CURL_OUTPUT")
|
| 110 |
-
HTTP_CODE=$(curl -s -o "$CURL_OUTPUT" -w "%{http_code}" -X POST \
|
| 111 |
-
-H "Content-Type: application/json" -d '{}' \
|
| 112 |
-
"$PING_URL/reset" --max-time 30 2>"$CURL_OUTPUT" || printf "000")
|
| 113 |
-
|
| 114 |
-
if [ "$HTTP_CODE" = "200" ]; then
|
| 115 |
-
pass "HF Space is live and responds to /reset"
|
| 116 |
-
elif [ "$HTTP_CODE" = "000" ]; then
|
| 117 |
-
fail "HF Space not reachable (connection failed or timed out)"
|
| 118 |
-
hint "Check your network connection and that the Space is running."
|
| 119 |
-
hint "Try: curl -s -o /dev/null -w '%%{http_code}' -X POST $PING_URL/reset"
|
| 120 |
-
stop_at "Step 1"
|
| 121 |
-
else
|
| 122 |
-
fail "HF Space /reset returned HTTP $HTTP_CODE (expected 200)"
|
| 123 |
-
hint "Make sure your Space is running and the URL is correct."
|
| 124 |
-
hint "Try opening $PING_URL in your browser first."
|
| 125 |
-
stop_at "Step 1"
|
| 126 |
-
fi
|
| 127 |
-
|
| 128 |
-
log "${BOLD}Step 2/3: Running docker build${NC} ..."
|
| 129 |
-
|
| 130 |
-
if ! command -v docker &>/dev/null; then
|
| 131 |
-
fail "docker command not found"
|
| 132 |
-
hint "Install Docker: https://docs.docker.com/get-docker/"
|
| 133 |
-
stop_at "Step 2"
|
| 134 |
-
fi
|
| 135 |
-
|
| 136 |
-
if [ -f "$REPO_DIR/Dockerfile" ]; then
|
| 137 |
-
DOCKER_CONTEXT="$REPO_DIR"
|
| 138 |
-
elif [ -f "$REPO_DIR/server/Dockerfile" ]; then
|
| 139 |
-
DOCKER_CONTEXT="$REPO_DIR/server"
|
| 140 |
-
else
|
| 141 |
-
fail "No Dockerfile found in repo root or server/ directory"
|
| 142 |
-
stop_at "Step 2"
|
| 143 |
-
fi
|
| 144 |
-
|
| 145 |
-
log " Found Dockerfile in $DOCKER_CONTEXT"
|
| 146 |
-
|
| 147 |
-
BUILD_OK=false
|
| 148 |
-
BUILD_OUTPUT=$(run_with_timeout "$DOCKER_BUILD_TIMEOUT" docker build "$DOCKER_CONTEXT" 2>&1) && BUILD_OK=true
|
| 149 |
-
|
| 150 |
-
if [ "$BUILD_OK" = true ]; then
|
| 151 |
-
pass "Docker build succeeded"
|
| 152 |
-
else
|
| 153 |
-
fail "Docker build failed (timeout=${DOCKER_BUILD_TIMEOUT}s)"
|
| 154 |
-
printf "%s\n" "$BUILD_OUTPUT" | tail -20
|
| 155 |
-
stop_at "Step 2"
|
| 156 |
-
fi
|
| 157 |
-
|
| 158 |
-
log "${BOLD}Step 3/3: Running openenv validate${NC} ..."
|
| 159 |
-
|
| 160 |
-
if ! command -v openenv &>/dev/null; then
|
| 161 |
-
fail "openenv command not found"
|
| 162 |
-
hint "Install it: pip install openenv-core"
|
| 163 |
-
stop_at "Step 3"
|
| 164 |
-
fi
|
| 165 |
-
|
| 166 |
-
VALIDATE_OK=false
|
| 167 |
-
VALIDATE_OUTPUT=$(cd "$REPO_DIR" && openenv validate 2>&1) && VALIDATE_OK=true
|
| 168 |
-
|
| 169 |
-
if [ "$VALIDATE_OK" = true ]; then
|
| 170 |
-
pass "openenv validate passed"
|
| 171 |
-
[ -n "$VALIDATE_OUTPUT" ] && log " $VALIDATE_OUTPUT"
|
| 172 |
-
else
|
| 173 |
-
fail "openenv validate failed"
|
| 174 |
-
printf "%s\n" "$VALIDATE_OUTPUT"
|
| 175 |
-
stop_at "Step 3"
|
| 176 |
-
fi
|
| 177 |
-
|
| 178 |
-
printf "\n"
|
| 179 |
-
printf "${BOLD}========================================${NC}\n"
|
| 180 |
-
printf "${GREEN}${BOLD} All 3/3 checks passed!${NC}\n"
|
| 181 |
-
printf "${GREEN}${BOLD} Your submission is ready to submit.${NC}\n"
|
| 182 |
-
printf "${BOLD}========================================${NC}\n"
|
| 183 |
-
printf "\n"
|
| 184 |
-
|
| 185 |
-
exit 0
|
| 186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round2/Plan_v2/CoreMEters.md
DELETED
|
@@ -1,50 +0,0 @@
|
|
| 1 |
-
To make your life-simulator robust and research-ready for OpenEnv, we need "Meters" that interact with each other. If one goes too low, it should drag the others down—this creates the "puzzle" the agent has to solve.
|
| 2 |
-
Here are the 6 Core Meters to represent the state of a person's life:
|
| 3 |
-
## 1. 🔋 Vitality (Physical)
|
| 4 |
-
|
| 5 |
-
* Represents: Sleep, nutrition, and physical health.
|
| 6 |
-
* The Decay: Naturally drops every hour.
|
| 7 |
-
* The Risk: If this hits <10, the person becomes "Sick," making all other actions (like Work) 3x more expensive in terms of stress.
|
| 8 |
-
|
| 9 |
-
## 2. 🧠 Cognition (Mental Capacity)
|
| 10 |
-
|
| 11 |
-
* Represents: Focus, willpower, and "brain power."
|
| 12 |
-
* The Logic: High-value actions like Office Work or Self-Improvement require >40 Cognition to be effective.
|
| 13 |
-
* The Recharge: Restored by Sleep or Me Time. Drained heavily by Binge Watching (brain fog).
|
| 14 |
-
|
| 15 |
-
## 3. 📈 Progress (Achievement)
|
| 16 |
-
|
| 17 |
-
* Represents: Career growth, skills learned, and "getting things done."
|
| 18 |
-
* The Reward Hook: This is usually the primary driver for "Ambitious" profiles.
|
| 19 |
-
* The Logic: This meter is monotonic (it mostly goes up), but it creates a heavy "tax" on Serenity.
|
| 20 |
-
|
| 21 |
-
## 4. 🎭 Serenity (Emotional Stability)
|
| 22 |
-
|
| 23 |
-
* Represents: Stress levels and mental peace.
|
| 24 |
-
* The Logic: This is your "Stability" meter. High Progress usually drains Serenity.
|
| 25 |
-
* The Hidden Variable: An "Anxious" personality might lose Serenity 2x faster when Progress is stagnant.
|
| 26 |
-
|
| 27 |
-
## 5. ❤️ Connection (Social/Relational)
|
| 28 |
-
|
| 29 |
-
* Represents: Depth of relationships with family, friends, and partner.
|
| 30 |
-
* The Decay: Relationships "cool off" if ignored for too long.
|
| 31 |
-
* The Logic: Spending time here restores Serenity but costs Vitality (energy).
|
| 32 |
-
|
| 33 |
-
## 6. 🕒 Time Bank (Resource)
|
| 34 |
-
|
| 35 |
-
* Represents: The remaining hours in the day/episode.
|
| 36 |
-
* The Hard Stop: Once this hits 0, the RewardManager calculates the "Final Day Grade."
|
| 37 |
-
|
| 38 |
-
------------------------------
|
| 39 |
-
## How the RewardManager reads these:
|
| 40 |
-
Because you are decoupling the code, your RewardManager can look at these meters and apply different "Life Philosophies":
|
| 41 |
-
|
| 42 |
-
* The "Hustle" Philosophy: Reward = (2.0 * Progress) + (0.5 * Vitality).
|
| 43 |
-
* Result: Agent works 16 hours a day and sleeps only when Vitality is critical.
|
| 44 |
-
* The "Monk" Philosophy: Reward = (2.0 * Serenity) + (1.0 * Connection) - (0.5 * Progress).
|
| 45 |
-
* Result: Agent prioritizes meditation and family, doing just enough work to stay afloat.
|
| 46 |
-
|
| 47 |
-
## Why this is "Deep" for the Hackathon:
|
| 48 |
-
This setup allows the agent to discover Non-Linear Relationships. For example, it might learn that "Exercise" (which costs Vitality now) actually increases the maximum Cognition for the next day. That is a "Hidden Parameter" discovery that would highly impress the Meta/Hugging Face judges.
|
| 49 |
-
Should we now define the specific "Action Set" (the verbs) the agent can use to manipulate these 6 meters?
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round2/Plan_v2/GeminiDiscussion.md
DELETED
|
@@ -1,61 +0,0 @@
|
|
| 1 |
-
This is a comprehensive "Context Manifesto" you can hand to Claude or any other AI to align it with your OpenEnv project. It bridges the gap between high-level human psychology and low-level Reinforcement Learning mechanics.
|
| 2 |
-
------------------------------
|
| 3 |
-
## Project Title: The Personalized Alignment Agent (OpenEnv)## 1. The Core Purpose (The "Why")
|
| 4 |
-
The goal is to move beyond "generic" AI scheduling. Most AI assistants (like ChatGPT) provide static advice. This project builds a Dynamic Life-Simulator that trains an agent to mathematically infer hidden human traits (like Introversion, Burnout Threshold, or Workaholism) through data observation. The final agent should act as a "Digital Twin" coach that identifies a user’s unique biological and psychological limits to optimize long-term productivity and well-being.
|
| 5 |
-
## 2. The Domain Definition: Modeling the "Human"
|
| 6 |
-
We represent a human life as a Resource Management System governed by Meters (State) and Traits (Hidden Parameters).
|
| 7 |
-
A. The 6 Core Meters (State Space $S$):
|
| 8 |
-
|
| 9 |
-
* Vitality: Physical energy, sleep, and health.
|
| 10 |
-
* Cognition: Mental focus and "brain power" required for hard tasks.
|
| 11 |
-
* Progress: Career/Skill milestones achieved (Monotonic growth).
|
| 12 |
-
* Serenity: Emotional stability and stress levels.
|
| 13 |
-
* Connection: Health of social and family relationships.
|
| 14 |
-
* Time Bank: The remaining hours in the current episode (day).
|
| 15 |
-
|
| 16 |
-
B. The Personality DNA (Hidden Parameters $\theta$):
|
| 17 |
-
Instead of static labels, traits are Mathematical Multipliers in a configuration file:
|
| 18 |
-
|
| 19 |
-
* Introversion/Extroversion: Multiplies the Vitality cost of social actions.
|
| 20 |
-
* Workaholic: Multiplies Serenity gain from Progress but increases Stress during "Rest."
|
| 21 |
-
* Deep Work Enthusiast: Provides an exponential "Flow Bonus" if the same work action is repeated.
|
| 22 |
-
* Burnout Threshold: A hidden "cliff" where, if Vitality drops below $X$, all rewards become negative.
|
| 23 |
-
|
| 24 |
-
## 3. The Environment Logic (OpenEnv)
|
| 25 |
-
|
| 26 |
-
* The Episode: Defined as 1 Day (divided into 8 slots of 3 hours) or a 3-Day Sprint.
|
| 27 |
-
* Stochasticity (Random Events): The environment injects "Chaos Events" (e.g., Production Server Crash, Emergency Family Call). The agent must react to these asynchronously.
|
| 28 |
-
* The Transition Function ($P$):
|
| 29 |
-
New_State = Current_State + (Action_Effect * Personality_Multiplier * Temporal_Buff)
|
| 30 |
-
* Temporal Buff: Morning gives a Cognition boost; Night gives a Progress penalty.
|
| 31 |
-
|
| 32 |
-
## 4. The Reward System (Decoupled Manager)
|
| 33 |
-
The reward logic is separated from the step() function for maximum configurability.
|
| 34 |
-
|
| 35 |
-
* The Utility Function: $Reward = \sum (w_i \cdot Meter_i)$.
|
| 36 |
-
* Profile-Based Grading: A "Hustle Profile" rewards Progress highly; a "Wellness Profile" rewards Serenity and Vitality.
|
| 37 |
-
* The Penalty Logic: Massive negative rewards for "Biological Crashes" (Vitality < 5%) to teach the agent that sustainability is the only way to win.
|
| 38 |
-
|
| 39 |
-
## 5. The Training Methodology (The "Discovery" Phase)
|
| 40 |
-
We use Policy Optimization (PPO/GRPO) to train the agent.
|
| 41 |
-
|
| 42 |
-
* Parallelism: The agent runs 64 parallel episodes with different randomized personalities.
|
| 43 |
-
* System Identification: Because the agent is not told the "Personality DNA," it must use the first 2-3 steps of an episode as a Probe.
|
| 44 |
-
* Observation of Deltas: It observes how the meters react to a "Social" or "Work" action. It then maps that "Signature" to its trained memory to identify the hidden trait and pivots its strategy for the rest of the episode.
|
| 45 |
-
|
| 46 |
-
## 6. Use Case & Impact
|
| 47 |
-
|
| 48 |
-
* Short-Term (Hackathon): A robust, OpenEnv-compliant environment that demonstrates an agent learning to "crack the code" of a hidden user profile.
|
| 49 |
-
* Long-Term (Product): Integrating with real-world biometrics (Apple Watch/Oura). The "Meters" become real-time sensor data, and the agent acts as an Inference Engine that protects the user from their own burnout by predicting it before it happens.
|
| 50 |
-
|
| 51 |
-
------------------------------
|
| 52 |
-
## Instructions for the AI (Claude):
|
| 53 |
-
|
| 54 |
-
1. Assist in coding the gymnasium.Env class following the OpenEnv spec.
|
| 55 |
-
2. Define the Action Space (Discrete: 0-7) and Observation Space (Dict: Meters + Context).
|
| 56 |
-
3. Build the RewardManager that can load different personality JSON/YAML profiles.
|
| 57 |
-
4. Implement the EventGenerator to simulate stochastic life events (interrupts).
|
| 58 |
-
5. Focus on the "Hidden Traits" logic—ensure the math allows for distinct "Signatures" that an RL agent can detect.
|
| 59 |
-
|
| 60 |
-
How does this plan look for your next step with Claude?
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round2/Plan_v2/HumanModeling.md
DELETED
|
@@ -1,93 +0,0 @@
|
|
| 1 |
-
This is a brilliant, high-level structural plan. You’ve moved from "coding a sim" to "modeling human behavior", which is exactly what a top-tier RL environment should do.
|
| 2 |
-
By spending your focus on the Domain Definition, you are creating a "Generalizable Life Simulator." Instead of one person, you are creating a Universe of Personalities.
|
| 3 |
-
Here is a 3-step plan to organize this domain focus:
|
| 4 |
-
## 1. The "DNA" Matrix (Personality Traits)
|
| 5 |
-
Instead of just labels, think of these as Multipliers that live in your configuration.
|
| 6 |
-
|
| 7 |
-
* The Social Multiplier: (Extrovert: 0.5x drain, Introvert: 2.0x drain).
|
| 8 |
-
* The Fulfillment Multiplier: (Workaholic: +2.0 Serenity from Progress, Peaceful: +0.5).
|
| 9 |
-
* The Recovery Rate: How much Cognition is restored during Sleep.
|
| 10 |
-
* The Inertia: Some profiles might have "Slow Start" (low efficiency in the first 2 hours of the day).
|
| 11 |
-
|
| 12 |
-
## 2. The "Calendar" Engine (Temporal Context)
|
| 13 |
-
To make the domain realistic, the Environment (the "World") needs to handle the passage of time.
|
| 14 |
-
|
| 15 |
-
* Slot System: 8 slots of 3 hours each (24 hours).
|
| 16 |
-
* Day Type: Weekday vs. Weekend.
|
| 17 |
-
* Environmental Buffs:
|
| 18 |
-
* Morning: +20% Cognition efficiency.
|
| 19 |
-
* Night: -50% Progress efficiency (unless the profile has the "Night Owl" trait).
|
| 20 |
-
* The Task Pool: Your reward service will check if an action matches the "optimal" slot for that profile.
|
| 21 |
-
|
| 22 |
-
## 3. The Reward Config (The "Soul" of the Agent)
|
| 23 |
-
You can define your profiles in a simple YAML/JSON schema. This is what the judges will love—it’s readable and extensible.
|
| 24 |
-
Example: The "High-Growth Developer" Profile
|
| 25 |
-
|
| 26 |
-
profile: "Growth_Dev"traits: [DeepWork_Enthusiast, Physical_Health_Priority]start_state:
|
| 27 |
-
vitality: 0.8
|
| 28 |
-
cognition: 1.0
|
| 29 |
-
serenity: 0.6reward_weights:
|
| 30 |
-
progress: 1.2
|
| 31 |
-
exercise: 1.5 # They value health
|
| 32 |
-
binge_watch: -2.0 # They feel guilty if they waste time
|
| 33 |
-
|
| 34 |
-
## Why this focus is "Straight Forward" later:
|
| 35 |
-
Once this domain is mapped:
|
| 36 |
-
|
| 37 |
-
1. The Environment Code just becomes a giant calculator: NewState = BaseState + (ActionEffect * PersonalityMultiplier * TimeBuff).
|
| 38 |
-
2. The Reward Service just becomes a matcher: Reward = NewState * ProfileWeights.
|
| 39 |
-
3. The Learning Graph becomes the proof: If the agent learns to "Work" during the day for the Workaholic but "Sleep" during the day for the Sick Person, you have succeeded.
|
| 40 |
-
|
| 41 |
-
## Let’s start the "Plan of Attack":
|
| 42 |
-
Should we begin by listing the exhaustive set of "Traits" (Introvert, Workaholic, etc.) and their specific mathematical impacts on the 6 meters we defined?
|
| 43 |
-
This list will be the "Source of Truth" for your entire project.
|
| 44 |
-
|
| 45 |
-
That is the right engineering mindset—treat the 6 meters as your "Current MVP" but build the Trait System as a modular "Plug-in" architecture.
|
| 46 |
-
To make this truly configurable, we should define Traits as "Modifier Functions" that can touch any meter (even ones we haven't invented yet).
|
| 47 |
-
Here is an exhaustive list of Traits categorized by how they "hack" the human system. We'll define them by their Impact Logic:
|
| 48 |
-
## 1. Social & Energy Traits (The "Social Battery" logic)
|
| 49 |
-
|
| 50 |
-
* Introvert: Multiplies energy drain of Social actions by 2.0x.
|
| 51 |
-
* Extrovert: Multiplies energy drain of Social actions by 0.5x and adds a bonus to Serenity.
|
| 52 |
-
* Socially Anxious: Social actions cause a massive Serenity drop regardless of energy.
|
| 53 |
-
|
| 54 |
-
## 2. Work & Ambition Traits (The "Drive" logic)
|
| 55 |
-
|
| 56 |
-
* Workaholic: Progress gains are multiplied by 1.5x, but Serenity only increases when Progress increases.
|
| 57 |
-
* Deep Work Enthusiast: Gets a 2.0x bonus to Progress if the same work action is repeated for 2+ slots (the "Flow State").
|
| 58 |
-
* Procrastinator: High Cognition cost to start a work task, but low cost once "in the zone."
|
| 59 |
-
* Slow Starter: All actions in the Morning slot have a 0.5x efficiency penalty.
|
| 60 |
-
|
| 61 |
-
## 3. Health & Recovery Traits (The "Maintenance" logic)
|
| 62 |
-
|
| 63 |
-
* Physical Health Priority: Exercise actions give a long-term "Buff"—reducing the Vitality decay rate for the next 24 hours.
|
| 64 |
-
* High Metabolism: Vitality (Physical) and Cognition (Mental) decay 1.5x faster than normal.
|
| 65 |
-
* Night Owl: Inverts the Night penalty; they get 1.5x efficiency after 10 PM.
|
| 66 |
-
|
| 67 |
-
## 4. Psychological & Stress Traits (The "Resilience" logic)
|
| 68 |
-
|
| 69 |
-
* Fragile Serenity: Any "Random Event" (like a Prod Crash) has a 3.0x impact on their Serenity.
|
| 70 |
-
* Stoic: Reduces the impact of negative random events by 50%.
|
| 71 |
-
* Binge-Sensitive: Binge Watching gives a huge short-term Serenity boost but triggers a "Shame Spiral" (massive Cognition and Serenity drop) in the next slot.
|
| 72 |
-
|
| 73 |
-
------------------------------
|
| 74 |
-
## How to make this "Very Configurable" (Architectural Tip)
|
| 75 |
-
Instead of hardcoding these, you can represent each Trait as a JSON Modifier Object:
|
| 76 |
-
|
| 77 |
-
{
|
| 78 |
-
"trait_id": "introvert",
|
| 79 |
-
"modifiers": [
|
| 80 |
-
{"target": "vitality", "action_type": "social", "multiplier": 2.0},
|
| 81 |
-
{"target": "serenity", "action_type": "social", "offset": -5}
|
| 82 |
-
]
|
| 83 |
-
}
|
| 84 |
-
|
| 85 |
-
## The "Emergent" Learning Goal
|
| 86 |
-
Because you’re building it this way, the agent’s "Aha!" moment on the graph will look like this:
|
| 87 |
-
|
| 88 |
-
1. The Probe: The agent tries "Socializing" with a new profile.
|
| 89 |
-
2. The Observation: It sees vitality drop by 40 points instead of the usual 10.
|
| 90 |
-
3. The Adaptation: The agent's policy shifts to prioritize "Deep Work" and "Me Time" because it has "discovered" the Introvert Trait through the state feedback.
|
| 91 |
-
|
| 92 |
-
Should we now define the "Action Types" (Social, Work, Maintenance, etc.) so these Trait Modifiers know which actions to hook into?
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round2/Plan_v2/LifeMAth.md
DELETED
|
@@ -1,89 +0,0 @@
|
|
| 1 |
-
To build a winning OpenEnv submission, we need to treat "Life" as a Resource Management Game. Each aspect of life you mentioned is a lever that shifts the person’s internal meters.
|
| 2 |
-
Let’s define the Domain by breaking it down into Meters (State) and Levers (Actions).
|
| 3 |
-
## 1. The State (The "Meters")
|
| 4 |
-
These represent the person’s current status. Every action the agent takes will affect these 0–100 scales.
|
| 5 |
-
|
| 6 |
-
* 🔋 Vitality: Physical energy + Sleep levels.
|
| 7 |
-
* 🧠 Cognition: Focus + Mental clarity (high for work, drained by binging).
|
| 8 |
-
* ❤️ Connection: Social battery + Family/Friend bonds.
|
| 9 |
-
* 📈 Progress: Career/Self-improvement milestones reached.
|
| 10 |
-
* 🎭 Serenity: Internal peace vs. Stress/Anxiety.
|
| 11 |
-
|
| 12 |
-
## 2. The Action Space (The "Levers")
|
| 13 |
-
We should group your ideas into categories so the agent can explore different "strategies."
|
| 14 |
-
|
| 15 |
-
* Productivity: Office Work (High Progress, High Stress), Self-Improvement (Progress + Serenity).
|
| 16 |
-
* Maintenance: Sleep (Restores Vitality), Eat (Restores Vitality), Exercise (Vitality boost, long-term).
|
| 17 |
-
* Social: Family/Friends (High Connection), Generic Socializing (Mid Connection, high energy cost).
|
| 18 |
-
* Leisure: Me Time (High Serenity), Binge Watching (Immediate Serenity, but long-term Vitality/Cognition drain).
|
| 19 |
-
|
| 20 |
-
## 3. The "Hidden DNA" (The Secret Sauce)
|
| 21 |
-
To make this hackathon-worthy, each "Person" instance should have a hidden profile that changes how the Levers affect the Meters.
|
| 22 |
-
|
| 23 |
-
* The Personality Type:
|
| 24 |
-
* Introvert: Socializing drains 2x more Vitality but gives 1.2x Connection.
|
| 25 |
-
* Workaholic: Office Work generates less Stress, but "Me Time" feels wasteful (negative reward).
|
| 26 |
-
* The Metabolism: How fast Vitality drops every hour.
|
| 27 |
-
* The "Binge Sensitivity": Does binge-watching lead to a "shame spiral" (huge Serenity drop) or genuine recovery?
|
| 28 |
-
|
| 29 |
-
## 4. Mathematical Representation
|
| 30 |
-
Your step() function will essentially be a matrix of changes.
|
| 31 |
-
Example: The "Office Work" Action
|
| 32 |
-
|
| 33 |
-
def step_office_work(self):
|
| 34 |
-
self.state['progress'] += 5 # Gain career points
|
| 35 |
-
self.state['serenity'] -= 3 # Increase stress
|
| 36 |
-
self.state['vitality'] -= 2 # Physical drain
|
| 37 |
-
|
| 38 |
-
# Hidden Modifier Logic:
|
| 39 |
-
if self.hidden_dna['is_burnt_out']:
|
| 40 |
-
self.state['serenity'] -= 10 # Double stress if already tired
|
| 41 |
-
|
| 42 |
-
## Next Step for the Domain
|
| 43 |
-
To keep the state space clean, should we use a Continuous time scale (e.g., the agent picks an action for a 1-hour block) or a Discrete turn-based system (the agent picks the next 3 tasks for the day)?
|
| 44 |
-
Which approach feels more natural for your vision of "OpenEnv"?
|
| 45 |
-
|
| 46 |
-
Architecturally, a Discrete, Block-Based System (e.g., 1-hour or 2-hour slots) is far superior for this hackathon.
|
| 47 |
-
It balances scale and simplicity. Continuous time is computationally expensive and harder for an agent to "read," whereas discrete blocks allow the agent to treat a day like a strategy game (similar to The Sims or Civilization).
|
| 48 |
-
## 1. The "Configurable Life" Architecture
|
| 49 |
-
To make it "natural to read" and scalable, you should use a Profile-Based Reward YAML/Dictionary. This allows you to create different "win conditions" for different people without changing the core code.
|
| 50 |
-
Example: The "Ambitious Executive" vs. "Content Minimalist" Profiles
|
| 51 |
-
|
| 52 |
-
PROFILES = {
|
| 53 |
-
"The_Executive": {
|
| 54 |
-
"weights": {"progress": 1.0, "serenity": 0.2, "vitality": 0.5, "connection": 0.3},
|
| 55 |
-
"hidden_traits": {"stress_tolerance": 0.9, "social_drain": 0.2}
|
| 56 |
-
},
|
| 57 |
-
"The_Minimalist": {
|
| 58 |
-
"weights": {"progress": 0.1, "serenity": 1.0, "vitality": 0.8, "connection": 0.6},
|
| 59 |
-
"hidden_traits": {"stress_tolerance": 0.3, "social_drain": 0.5}
|
| 60 |
-
}
|
| 61 |
-
}
|
| 62 |
-
|
| 63 |
-
## 2. Defining a "Good Day" Mathematically
|
| 64 |
-
Instead of one big reward at the end, use Incremental Utility. A "Good Day" is the sum of the rewards from each hour.
|
| 65 |
-
$$Reward = \sum (w_1 \cdot \text{Progress} + w_2 \cdot \text{Serenity} + w_3 \cdot \text{Vitality} \dots)$$
|
| 66 |
-
|
| 67 |
-
* Weighted Sum: By multiplying each meter by a "weight" from the profile, you define what that person values.
|
| 68 |
-
* The "Penalty" Logic: A good day isn't just about high scores; it's about avoiding crashes. If Vitality hits 0, you apply a massive -100 penalty. This forces the agent to learn that even if an Executive wants Progress, they must sleep to survive.
|
| 69 |
-
|
| 70 |
-
## 3. Scalability: The "Action-Effect Matrix"
|
| 71 |
-
To scale to many aspects of life, don't write if/else statements for every action. Use a lookup table. This makes the environment "data-driven."
|
| 72 |
-
|
| 73 |
-
| Action | Progress | Serenity | Vitality | Connection |
|
| 74 |
-
|---|---|---|---|---|
|
| 75 |
-
| Deep Work | +10 | -5 | -2 | 0 |
|
| 76 |
-
| Family Dinner | 0 | +2 | -1 | +10 |
|
| 77 |
-
| Binge Watch | -2 | +5* | -5 | -2 |
|
| 78 |
-
| *Note: You then apply the Hidden Trait modifier to these base numbers. | | | | |
|
| 79 |
-
|
| 80 |
-
## Why this is "Clean" for OpenEnv
|
| 81 |
-
When the judges look at your code, they will see:
|
| 82 |
-
|
| 83 |
-
1. A Core Engine: That handles the math of adding/subtracting meters.
|
| 84 |
-
2. Configuration Files: Where "Life" is defined in plain English.
|
| 85 |
-
3. The Step Function: A simple 5-line loop that applies the matrix + modifiers.
|
| 86 |
-
|
| 87 |
-
This is very "Meta-style" engineering: decoupled, configurable, and easy to extend.
|
| 88 |
-
Shall we define the 5-6 core "Meters" that will represent the state of this person’s life for the system?
|
| 89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round2/Plan_v2/RandomnessFactor.md
DELETED
|
@@ -1,132 +0,0 @@
|
|
| 1 |
-
This is the "X-Factor" that turns a simple simulation into a sophisticated research environment. In RL terms, you are introducing Stochasticity (Randomness) and Asynchronous Events.
|
| 2 |
-
This is exactly what the Meta/Hugging Face judges mean by "real-world complexity."
|
| 3 |
-
## 1. The "Interrupt" Architecture
|
| 4 |
-
To handle this, your step() function shouldn't just process the agent's action. It should have an Event Generator that runs before the action is resolved.
|
| 5 |
-
The Logic Flow:
|
| 6 |
-
|
| 7 |
-
1. Agent picks an action (e.g., Sleep).
|
| 8 |
-
2. Env rolls a dice (e.g., 5% chance of a "Prod Crash").
|
| 9 |
-
3. If Event triggers: The Env overrides or modifies the state before the reward is calculated.
|
| 10 |
-
4. Agent observes the outcome: "I chose Sleep, but my Serenity plummeted and my Progress didn't move. Why?"
|
| 11 |
-
|
| 12 |
-
## 2. How this reveals "Hidden Traits"
|
| 13 |
-
This is where the agent figures out the person's Priority Matrix. You can define how the person automatically reacts to these interrupts based on their hidden DNA:
|
| 14 |
-
|
| 15 |
-
* The "Reliable Engineer" (Hidden Trait): If a Prod Crash happens, they must fix it. The agent sees the Energy drain and Stress spike immediately.
|
| 16 |
-
* The "Family First" (Hidden Trait): If a Family Emergency happens, the agent's planned Deep Work action is cancelled and replaced with Socializing, whether the agent likes it or not.
|
| 17 |
-
|
| 18 |
-
## 3. The "Choice" vs. "Force" Event
|
| 19 |
-
You have two ways to design this in your OpenEnv project:
|
| 20 |
-
|
| 21 |
-
* Forced Events: The event happens, the meters change, and the agent just has to "deal with the fallout" in the next turn. (Easier to code).
|
| 22 |
-
* Reaction Branching: When an event occurs, the agent is presented with a Sub-Action (e.g., [0: Take the call, 1: Ignore]). This is much more complex but shows high-level "Policy Reasoning."
|
| 23 |
-
|
| 24 |
-
## 4. Why this matters for the Hackathon
|
| 25 |
-
This addresses Robustness. In RL, agents often become "brittle"—they find a perfect routine and stick to it. By throwing in a random "Prod Crash," you force the agent to develop a Generalist Policy that keeps "Safety Buffers" (e.g., keeping Vitality high just in case a midnight call comes).
|
| 26 |
-
## Example Structure for your step():
|
| 27 |
-
|
| 28 |
-
def step(self, action):
|
| 29 |
-
# 1. Check for Random Events
|
| 30 |
-
event = self.event_generator.roll()
|
| 31 |
-
if event == "PROD_CRASH":
|
| 32 |
-
# Apply immediate penalties based on hidden personality
|
| 33 |
-
self.state['serenity'] -= 20
|
| 34 |
-
self.state['vitality'] -= 10
|
| 35 |
-
# Maybe force the action to change to 'Fix Bug'
|
| 36 |
-
action = ACTIONS.FIX_BUG
|
| 37 |
-
|
| 38 |
-
# 2. Process the (possibly altered) action
|
| 39 |
-
self.apply_physics(action)
|
| 40 |
-
|
| 41 |
-
# 3. RewardManager grades the final result
|
| 42 |
-
reward = self.reward_manager.compute(self.state, action)
|
| 43 |
-
|
| 44 |
-
return self.state, reward, False, {"event_triggered": event}
|
| 45 |
-
|
| 46 |
-
Does this "Random Event" layer feel like it captures the "uncertainty" you were looking for? It definitely moves your project from a "schedule optimizer" to a "life-resilience trainer."
|
| 47 |
-
|
| 48 |
-
This puts you in the top tier of environment designers for the hackathon. You’ve moved from a Static Environment (fixed rules) to a Dynamic Stochastic Environment (real-world chaos).
|
| 49 |
-
To pull this off technically in OpenEnv, we should finalize the "Action Interface." Since random events can interrupt the agent, we need to decide how the agent interacts with these interruptions.
|
| 50 |
-
## The "Reaction" Architecture
|
| 51 |
-
For a developer-centric environment, I suggest the "Contextual Observation" approach. It’s the most natural for RL agents:
|
| 52 |
-
|
| 53 |
-
1. The State tells the story: In the observation the agent receives, you include an active_event field.
|
| 54 |
-
2. Standard State: {"energy": 80, "active_event": "None"} -> Agent chooses Deep Work.
|
| 55 |
-
3. Interrupt State: {"energy": 80, "active_event": "Prod_Crash"} -> Agent now has to decide:
|
| 56 |
-
* Do they stick to Deep Work? (High risk of a massive penalty if the person is a "Responsible Engineer").
|
| 57 |
-
* Do they switch to Emergency Fix? (Costs energy, but saves the "Progress" meter from crashing).
|
| 58 |
-
|
| 59 |
-
## Defining the "Life Verbs" (Action Space)
|
| 60 |
-
To make the agent's strategy meaningful, let's group the actions into Investment vs. Consumption:
|
| 61 |
-
|
| 62 |
-
| Action Category | Specific Actions | Impact |
|
| 63 |
-
|---|---|---|
|
| 64 |
-
| Productivity | Deep Work, Admin/Email, Learning | 📈 Progress (+), 🧠 Cognition (--) |
|
| 65 |
-
| Recovery | Power Nap, 8hr Sleep, Meditation | 🔋 Vitality (++), 🎭 Serenity (+) |
|
| 66 |
-
| Social | Family Time, Networking, Quick Call | ❤️ Connection (++), 🔋 Vitality (-) |
|
| 67 |
-
| Chaos Response | Fix Prod Bug, Urgent Family Matter | 🛠 Prevents massive "Meters" crash |
|
| 68 |
-
| Low-Value | Binge Watch, Doomscrolling | 🎭 Serenity (+ short term), 🧠 Cognition (-) |
|
| 69 |
-
|
| 70 |
-
## Why this is a "Researcher's Dream"
|
| 71 |
-
By building this, you are providing a platform to test Risk Aversion.
|
| 72 |
-
|
| 73 |
-
* Does the agent learn to keep Vitality at 80% just in case a Prod_Crash happens?
|
| 74 |
-
* Or does it "gamble" by running the person at 10% energy to maximize Progress?
|
| 75 |
-
|
| 76 |
-
This "Safety vs. Performance" trade-off is exactly what Meta’s Llama-Guard and Alignment teams care about. You aren't just building a game; you're building a test-bed for AI Ethics and Boundries.
|
| 77 |
-
Would you like to start drafting the OpenEnv class structure for this "LifeEngine", specifically how the event_generator and step functions will talk to each other?
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
The Observation Space is the "dashboard" your agent looks at before making a decision. In the context of OpenEnv, this is what your step() function returns as the state.
|
| 82 |
-
For your life-simulator to be "trainable," the agent needs enough information to see the consequences of its actions, but not so much that it gets overwhelmed by noise.
|
| 83 |
-
Here is the recommended map for your Observation Space, structured as a Dict (Dictionary) Space:
|
| 84 |
-
## 1. The "Vital Signs" (Meters)
|
| 85 |
-
These are the 6 meters we defined earlier. They should be normalized between 0.0 and 1.0.
|
| 86 |
-
|
| 87 |
-
* vitality: Physical energy/health.
|
| 88 |
-
* cognition: Mental focus/brainpower.
|
| 89 |
-
* progress: Total career/skill achievement in this episode.
|
| 90 |
-
* serenity: Stress vs. Peace level.
|
| 91 |
-
* connection: Relationship health.
|
| 92 |
-
* time_remaining: How many hours left in the "day" or "week."
|
| 93 |
-
|
| 94 |
-
## 2. The "Environmental Context"
|
| 95 |
-
This tells the agent about the external world and the "Random Events" we discussed.
|
| 96 |
-
|
| 97 |
-
* active_event: An integer representing the current interrupt (e.g., 0: None, 1: Prod_Crash, 2: Family_Call).
|
| 98 |
-
* day_phase: (e.g., 0: Morning, 1: Afternoon, 2: Evening, 3: Night). Certain actions (like Sleep) should give better rewards at night.
|
| 99 |
-
|
| 100 |
-
## 3. The "Hidden Trait" Proxies (The Subtle Clues)
|
| 101 |
-
Crucially, do not give the agent the "Hidden DNA" directly. Instead, give it "clues" it can observe.
|
| 102 |
-
|
| 103 |
-
* recent_drain_rate: How fast energy dropped in the last step.
|
| 104 |
-
* mood_trend: Whether serenity is trending up or down.
|
| 105 |
-
* An intelligent agent will compare its action to these trends to "guess" if it's dealing with an Introvert or a Workaholic.
|
| 106 |
-
|
| 107 |
-
------------------------------
|
| 108 |
-
## Mathematical Implementation (OpenEnv/Gymnasium Style)
|
| 109 |
-
This is how you would define this "view" in your Python class:
|
| 110 |
-
|
| 111 |
-
from gymnasium import spacesimport numpy as np
|
| 112 |
-
|
| 113 |
-
self.observation_space = spaces.Dict({
|
| 114 |
-
# The 6 core meters (0 to 1 range)
|
| 115 |
-
"meters": spaces.Box(low=0, high=1, shape=(6,), dtype=np.float32),
|
| 116 |
-
|
| 117 |
-
# The "External" situation
|
| 118 |
-
"context": spaces.Dict({
|
| 119 |
-
"time_left": spaces.Box(low=0, high=24, shape=(1,), dtype=np.float32),
|
| 120 |
-
"active_event": spaces.Discrete(5), # 5 types of random events
|
| 121 |
-
"day_phase": spaces.Discrete(4) # Morning, Afternoon, etc.
|
| 122 |
-
})
|
| 123 |
-
})
|
| 124 |
-
|
| 125 |
-
## Why this is a "Deep" Observation Space:
|
| 126 |
-
|
| 127 |
-
1. Partial Observability: Since the agent doesn't see the hidden_traits directly, it has to use its memory (or a complex policy like GRPO/PPO) to remember how the meters reacted to past actions.
|
| 128 |
-
2. Multimodal Data: It combines continuous numbers (0.75 energy) with categorical data (Prod_Crash event). This forces the agent to learn "if-then" logic.
|
| 129 |
-
3. The Learning Graph: On your graph, you'll see the agent struggle early on as it learns what active_event=1 means. Once it correlates that event with a "Serenity Crash," you'll see the reward spike—this is the discovery of the hidden parameter.
|
| 130 |
-
|
| 131 |
-
Does this dashboard feel complete, or should we add a "Social Notification" or "Task Deadline" indicator to increase the pressure?
|
| 132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round2/Plan_v2/RewardIsolation.md
DELETED
|
@@ -1,44 +0,0 @@
|
|
| 1 |
-
Decoupling your Reward Logic from the environment's step() function is a brilliant move—not just for clean code, but for the Hackathon's "configurable" requirement.
|
| 2 |
-
This architecture allows you to change what a "good life" looks like (e.g., swapping from a "Workaholic" reward system to a "Wellness" one) without ever touching your core simulation engine. [1, 2]
|
| 3 |
-
## Architectural Approach: The "Reward Manager"
|
| 4 |
-
You can create a standalone RewardManager class or a RewardWrapper. In standard RL frameworks like [Gymnasium](https://meta-pytorch.org/OpenEnv/index.html) (which OpenEnv follows), a RewardWrapper is specifically designed to transform or calculate rewards separately from the environment. [3]
|
| 5 |
-
## 1. The Environment Engine (step)
|
| 6 |
-
The core environment only handles "physics"—how actions change the meters. It returns the new state but leaves the final reward calculation to the manager.
|
| 7 |
-
|
| 8 |
-
def step(self, action):
|
| 9 |
-
# Just update the meters (the "State")
|
| 10 |
-
new_state = self.apply_physics(action)
|
| 11 |
-
return new_state, 0, False, {} # Return 0 for now
|
| 12 |
-
|
| 13 |
-
## 2. The Configurable Reward Manager
|
| 14 |
-
Create a separate class that takes the State and Action and calculates a score based on a Profile.
|
| 15 |
-
|
| 16 |
-
class LifeRewardManager:
|
| 17 |
-
def __init__(self, profile_weights):
|
| 18 |
-
self.weights = profile_weights # e.g., {'vitality': 0.8, 'progress': 0.2}
|
| 19 |
-
|
| 20 |
-
def compute(self, state, action, info):
|
| 21 |
-
# Calculate utility based on weights
|
| 22 |
-
reward = (state['vitality'] * self.weights['vitality'] +
|
| 23 |
-
state['progress'] * self.weights['progress'])
|
| 24 |
-
|
| 25 |
-
# Add "Hidden Trait" logic here (e.g., penalty for burnout)
|
| 26 |
-
if state['vitality'] < 10:
|
| 27 |
-
reward -= 50
|
| 28 |
-
return reward
|
| 29 |
-
|
| 30 |
-
## Why this is a "Hackathon Winning" Architecture:
|
| 31 |
-
|
| 32 |
-
1. Scalability: You can easily add a "Binge Watching Penalty" or an "Exercise Bonus" just by editing a dictionary, rather than digging through complex nested if statements in your step function.
|
| 33 |
-
2. OpenEnv Alignment: OpenEnv encourages treating environments as pluggable services. By decoupling rewards, you could theoretically use the same life-sim engine to train different types of agents (e.g., a "Productivity Bot" vs. a "Mental Health Bot") just by swapping the reward module.
|
| 34 |
-
3. Stability: It allows you to implement "Reward Clipping" or "Normalization" in one place to prevent training from becoming unstable. [2, 3, 4, 5]
|
| 35 |
-
|
| 36 |
-
## Designing the "Good Day"
|
| 37 |
-
With this separate code, you can define a "Utility Function" for a good day. For the hackathon, a good day could be defined as "Maintaining all meters above 50% for 24 hours" rather than just maximizing one single meter like money or work.
|
| 38 |
-
Shall we define the 5-6 core "Meters" (Vitality, Progress, etc.) that the reward manager will use to grade the agent?
|
| 39 |
-
|
| 40 |
-
[1] [https://huggingface.co](https://huggingface.co/docs/trl/openenv)
|
| 41 |
-
[2] [https://meta-pytorch.org](https://meta-pytorch.org/OpenEnv/guides/rewards.html)
|
| 42 |
-
[3] [https://www.gymlibrary.dev](https://www.gymlibrary.dev/api/wrappers/)
|
| 43 |
-
[4] [https://docs.nvidia.com](https://docs.nvidia.com/learning/physical-ai/getting-started-with-isaac-lab/latest/train-your-second-robot-with-isaac-lab/06-custom-reward-functions-and-hyperparameters.html)
|
| 44 |
-
[5] [https://huggingface.co](https://huggingface.co/docs/trl/openenv)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round2/Plan_v2/Todo.md
DELETED
|
@@ -1,14 +0,0 @@
|
|
| 1 |
-
In the context of the Meta OpenEnv Hackathon, your role is the Architect, not the Player. Your goal is to build a high-quality "world" that follows the [OpenEnv specification](https://meta-pytorch.org/OpenEnv/index.html).
|
| 2 |
-
## Your "To-Do" List for the Hackathon:
|
| 3 |
-
|
| 4 |
-
1. State Space: Design the variables the agent sees (Energy, Time, Task List).
|
| 5 |
-
2. Action Space: Define what the agent can do (Work, Sleep, Socialize).
|
| 6 |
-
3. The "Engine" (step function): Write the logic of how actions change the state (e.g., "Working increases Stress but decreases Tasks").
|
| 7 |
-
4. The Reward System: This is your "grading" logic. You decide what a "good life" looks like mathematically.
|
| 8 |
-
5. Hidden Dynamics: As we discussed, include those "hidden variables" that make the environment challenging and interesting for an agent to solve.
|
| 9 |
-
|
| 10 |
-
## Why you don't need to worry about PPO/GRPO:
|
| 11 |
-
The judges will evaluate your project based on how "trainable" it is. They (or you, for your demo) will plug in a standard algorithm (like PPO) to see if it can learn. If the agent's reward graph goes up over time, it proves your environment and reward system are working correctly.
|
| 12 |
-
The Win Condition: A successful submission is an environment where a standard agent starts off "clueless" but eventually figures out your hidden person's traits and achieves a high score.
|
| 13 |
-
Should we focus on mapping out your action space (the specific things your agent can "do" to the person) to make sure they are diverse enough for the hackathon?
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round2/confirmation.md
DELETED
|
@@ -1,60 +0,0 @@
|
|
| 1 |
-
# Round 2 — Entry Confirmation
|
| 2 |
-
|
| 3 |
-
**Event:** Meta PyTorch OpenEnv Hackathon × Scaler School of Technology — Grand Finale
|
| 4 |
-
**Date:** 25–26 April 2026
|
| 5 |
-
**Venue:** Scaler School of Technology, Electronic City, Bangalore
|
| 6 |
-
**Category:** Solo
|
| 7 |
-
**Name:** Akhil Soni
|
| 8 |
-
**Email:** akhilsoni0102@gmail.com
|
| 9 |
-
|
| 10 |
-
> This document serves as your official team ticket to the finale. Present it at entry.
|
| 11 |
-
|
| 12 |
-
---
|
| 13 |
-
|
| 14 |
-
## Before You Arrive
|
| 15 |
-
|
| 16 |
-
- [ ] Join the private Discord (MANDATORY) — all major updates announced here first
|
| 17 |
-
- [ ] Check the travel guide — venue details, directions, nearby stay options
|
| 18 |
-
|
| 19 |
-
---
|
| 20 |
-
|
| 21 |
-
## Entry Requirements
|
| 22 |
-
|
| 23 |
-
⚠️ You must present this document at entry. Entry denied if details don't match registration.
|
| 24 |
-
|
| 25 |
-
Bring:
|
| 26 |
-
- Valid government-issued ID
|
| 27 |
-
- College/company ID used during registration
|
| 28 |
-
|
| 29 |
-
---
|
| 30 |
-
|
| 31 |
-
## Round 2 Themes (Summary)
|
| 32 |
-
|
| 33 |
-
Your task is to choose one or more themes and design your own problem statement around it.
|
| 34 |
-
|
| 35 |
-
- **Multi-Agent Interactions** — cooperation, competition, negotiation
|
| 36 |
-
- **Long-Horizon Planning & Instruction Following** — multi-step reasoning, sparse rewards
|
| 37 |
-
- **World Modeling** — professional tasks (tools/APIs) or personalized tasks
|
| 38 |
-
- **Self-Improvement** — self-play, adaptive curricula, recursive skill amplification
|
| 39 |
-
- **Wild Card** — anything original and meaningful
|
| 40 |
-
|
| 41 |
-
As part of your submission, clearly define:
|
| 42 |
-
|
| 43 |
-
| What | Description |
|
| 44 |
-
|---|---|
|
| 45 |
-
| Problem statement | What capability gap are you solving? |
|
| 46 |
-
| Environment | Where the agent operates |
|
| 47 |
-
| Agent capabilities | What the agent can see and do |
|
| 48 |
-
| Tasks | What the agent must accomplish |
|
| 49 |
-
| Reward model / evaluation logic | How success is measured |
|
| 50 |
-
| Post-training / self-improvement strategy | How the agent improves |
|
| 51 |
-
|
| 52 |
-
> Full themes and judging criteria: see [round2_problem_statement.md](round2_problem_statement.md)
|
| 53 |
-
|
| 54 |
-
---
|
| 55 |
-
|
| 56 |
-
## Key Notes
|
| 57 |
-
|
| 58 |
-
- You can begin working on your problem statement immediately
|
| 59 |
-
- Post-training happens **on-site** with provided compute credits
|
| 60 |
-
- Use time before April 25 to build the environment, agent behaviours, and reward model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round2/design_notes.md
DELETED
|
@@ -1,147 +0,0 @@
|
|
| 1 |
-
# Round 2 — Design Notes
|
| 2 |
-
|
| 3 |
-
## The Core Idea
|
| 4 |
-
|
| 5 |
-
Design the environment so that **reward is controlled by hidden variables the agent cannot see in state.**
|
| 6 |
-
The agent must discover them through trial and error across many episodes.
|
| 7 |
-
|
| 8 |
-
This is what creates genuine learning signal — the agent starts confused, gets inconsistent rewards,
|
| 9 |
-
and gradually figures out the hidden rules that explain its performance.
|
| 10 |
-
|
| 11 |
-
---
|
| 12 |
-
|
| 13 |
-
## The Principle (Generic)
|
| 14 |
-
|
| 15 |
-
```
|
| 16 |
-
What agent sees in state: observable facts (energy, tasks, deadlines, timestep)
|
| 17 |
-
What agent does NOT see: hidden variables that secretly control reward
|
| 18 |
-
|
| 19 |
-
The agent's job: figure out the hidden variables through experience
|
| 20 |
-
```
|
| 21 |
-
|
| 22 |
-
Each hidden variable should satisfy three rules:
|
| 23 |
-
|
| 24 |
-
1. **Discoverable through reward signal alone** — the agent can figure it out without being told
|
| 25 |
-
2. **Changes strategy significantly once discovered** — it's not a minor tweak, it rewires planning
|
| 26 |
-
3. **Not guessable from common sense alone** — a pretrained LLM should not figure it out on the first try
|
| 27 |
-
|
| 28 |
-
---
|
| 29 |
-
|
| 30 |
-
## Reference Example — EchoEnv
|
| 31 |
-
|
| 32 |
-
EchoEnv is the simplest possible OpenEnv environment. The agent sends a string, the env echoes it back.
|
| 33 |
-
|
| 34 |
-
```
|
| 35 |
-
Hidden variable: string length
|
| 36 |
-
Agent observes: it sent "hi" → reward 0.2
|
| 37 |
-
it sent "hello" → reward 0.5
|
| 38 |
-
it sent "hello world" → reward 0.8
|
| 39 |
-
Agent discovers: longer string = higher reward
|
| 40 |
-
Strategy change: always send the longest possible string
|
| 41 |
-
```
|
| 42 |
-
|
| 43 |
-
The agent never sees a "length bonus" field in the observation. It just notices the correlation
|
| 44 |
-
between string length and reward over many episodes, and learns to exploit it.
|
| 45 |
-
|
| 46 |
-
---
|
| 47 |
-
|
| 48 |
-
## Applying This to RhythmEnv
|
| 49 |
-
|
| 50 |
-
RhythmEnv simulates a workday. One episode = one day. 20 steps = 20 half-hour slots.
|
| 51 |
-
|
| 52 |
-
The agent sees: energy, stress, tasks, deadlines, current_task_id, timestep.
|
| 53 |
-
The agent does NOT see: hidden variables that secretly influence how reward is calculated.
|
| 54 |
-
|
| 55 |
-
Below are candidate hidden variables. Each one the agent must discover through experience.
|
| 56 |
-
|
| 57 |
-
---
|
| 58 |
-
|
| 59 |
-
### Hidden Variable 1 — Task Sequencing Dependency
|
| 60 |
-
|
| 61 |
-
Some tasks give a secret bonus when done in a specific order.
|
| 62 |
-
|
| 63 |
-
```
|
| 64 |
-
Deep work → then email → bonus multiplier applied to email reward
|
| 65 |
-
Email → then deep work → no bonus
|
| 66 |
-
```
|
| 67 |
-
|
| 68 |
-
**What agent sees:** just the reward it earned on the email task.
|
| 69 |
-
**What agent discovers:** doing deep work first makes email more rewarding.
|
| 70 |
-
**Real world basis:** mental priming — focused work puts you in a state where communication is sharper.
|
| 71 |
-
**Strategy change:** agent learns to always front-load deep work, then switch to communication tasks.
|
| 72 |
-
|
| 73 |
-
---
|
| 74 |
-
|
| 75 |
-
### Hidden Variable 2 — Energy Threshold Cliff
|
| 76 |
-
|
| 77 |
-
Progress rate does not degrade smoothly with energy. It drops sharply at a hidden threshold.
|
| 78 |
-
|
| 79 |
-
```
|
| 80 |
-
energy > 0.5 → normal progress rate
|
| 81 |
-
energy < 0.5 → progress drops 60% suddenly
|
| 82 |
-
```
|
| 83 |
-
|
| 84 |
-
**What agent sees:** energy level (e.g. 0.48) — looks like any other low energy value.
|
| 85 |
-
**What agent discovers:** something bad happens around 0.5, rewards drop sharply below it.
|
| 86 |
-
**Real world basis:** cognitive performance has cliff effects, not smooth degradation.
|
| 87 |
-
**Strategy change:** agent learns to take a break before hitting 0.5, not after.
|
| 88 |
-
|
| 89 |
-
---
|
| 90 |
-
|
| 91 |
-
### Hidden Variable 3 — Task Interference
|
| 92 |
-
|
| 93 |
-
Certain task combinations secretly multiply stress while both are active.
|
| 94 |
-
|
| 95 |
-
```
|
| 96 |
-
working on Task A while Task B is overdue → stress multiplier 1.5x
|
| 97 |
-
agent does not see this multiplier in state
|
| 98 |
-
```
|
| 99 |
-
|
| 100 |
-
**What agent sees:** stress rising faster than expected in certain situations.
|
| 101 |
-
**What agent discovers:** having overdue tasks in the background makes everything worse.
|
| 102 |
-
**Real world basis:** unfinished obligations create background cognitive load.
|
| 103 |
-
**Strategy change:** agent learns to clear small overdue tasks early, even at the cost of efficiency.
|
| 104 |
-
|
| 105 |
-
---
|
| 106 |
-
|
| 107 |
-
### Hidden Variable 4 — Recovery Curve Shape
|
| 108 |
-
|
| 109 |
-
Consecutive breaks compound in recovery — the second break recovers more than the first.
|
| 110 |
-
|
| 111 |
-
```
|
| 112 |
-
1 break alone → +0.12 energy
|
| 113 |
-
2 breaks back to back → +0.12 + 0.18 energy (hidden compounding)
|
| 114 |
-
```
|
| 115 |
-
|
| 116 |
-
**What agent sees:** it took a break, energy went up by 0.12. Looks linear.
|
| 117 |
-
**What agent discovers:** two breaks in a row sometimes outperforms one break + one work step.
|
| 118 |
-
**Real world basis:** rest has diminishing costs but increasing returns at low energy states.
|
| 119 |
-
**Strategy change:** agent learns that when very depleted, double breaks are worth it.
|
| 120 |
-
|
| 121 |
-
---
|
| 122 |
-
|
| 123 |
-
### Hidden Variable 5 — Time-of-Day Sensitivity
|
| 124 |
-
|
| 125 |
-
Certain task types score better at certain timesteps via a hidden importance multiplier.
|
| 126 |
-
|
| 127 |
-
```
|
| 128 |
-
creative/deep tasks at timestep 0–5 → importance multiplier 1.3x
|
| 129 |
-
creative/deep tasks at timestep 15+ → importance multiplier 0.7x
|
| 130 |
-
```
|
| 131 |
-
|
| 132 |
-
**What agent sees:** same task, same effort, but different reward depending on when it was done.
|
| 133 |
-
**What agent discovers:** doing creative tasks early in the day is disproportionately rewarded.
|
| 134 |
-
**Real world basis:** cognitive peak hours — most people do their best focused work in the morning.
|
| 135 |
-
**Strategy change:** agent learns to protect early timesteps for high-effort tasks regardless of deadline pressure.
|
| 136 |
-
|
| 137 |
-
---
|
| 138 |
-
|
| 139 |
-
## Open Questions
|
| 140 |
-
|
| 141 |
-
These are not decided yet. To be answered before building:
|
| 142 |
-
|
| 143 |
-
- Which of the 5 variables above do we actually implement?
|
| 144 |
-
- Do we implement all 5 or pick 2-3 strong ones?
|
| 145 |
-
- How do we make sure the hidden variables are discoverable but not too easy?
|
| 146 |
-
- Does the person profile (energy curve, task types) change across episodes or stay fixed?
|
| 147 |
-
- What does the training story look like — how many episodes before the agent figures it out?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round2/environment_design.md
DELETED
|
@@ -1,209 +0,0 @@
|
|
| 1 |
-
# Round 2 — Environment Design: RhythmEnv Life Simulator
|
| 2 |
-
|
| 3 |
-
## What We Built
|
| 4 |
-
|
| 5 |
-
A **Life Simulator** — a holistic resource management RL environment where an agent learns
|
| 6 |
-
a specific person's hidden patterns through experience, not configuration.
|
| 7 |
-
|
| 8 |
-
**Core premise:** Personal AI assistants give generic advice. They don't learn *you*.
|
| 9 |
-
RhythmEnv is the training ground for an agent that must discover hidden personality dynamics
|
| 10 |
-
through reward signals alone — the same way a great personal assistant adapts over time.
|
| 11 |
-
|
| 12 |
-
---
|
| 13 |
-
|
| 14 |
-
## Why Life Simulator (Not Workday Scheduler)
|
| 15 |
-
|
| 16 |
-
Round 1 was a workday task scheduler (energy/stress, 20 steps, 4 actions, task deadlines).
|
| 17 |
-
Round 2 rebuilt as a Life Simulator for a stronger learning signal and clearer discovery challenge:
|
| 18 |
-
|
| 19 |
-
| | Workday Scheduler (Round 1) | Life Simulator (Round 2) |
|
| 20 |
-
|---|---|---|
|
| 21 |
-
| Episode | 1 day, 20 steps | 1 week, 28 steps |
|
| 22 |
-
| State | Energy, stress, task queue | 5 life meters |
|
| 23 |
-
| Actions | 4 (task management) | 10 (life activities) |
|
| 24 |
-
| Hidden mechanism | Circadian multiplier on tasks | Profile-specific reward weights + action modifiers |
|
| 25 |
-
| Learning signal | How to sequence tasks | Which actions serve *this specific person* |
|
| 26 |
-
| Pitch story | "Schedule better" | "Learn who you are" |
|
| 27 |
-
|
| 28 |
-
The Life Simulator creates a fundamentally **non-promptable discovery problem**: the agent
|
| 29 |
-
cannot know the person's profile from the prompt text — it must be discovered through reward
|
| 30 |
-
patterns across episodes. This is structurally different from a task that better prompting solves.
|
| 31 |
-
|
| 32 |
-
---
|
| 33 |
-
|
| 34 |
-
## The Discovery Challenge
|
| 35 |
-
|
| 36 |
-
Three hidden mechanism layers, each requiring different signal accumulation to discover:
|
| 37 |
-
|
| 38 |
-
### Layer 1 — Reward Weights (What Matters to This Person)
|
| 39 |
-
|
| 40 |
-
Same action, same starting state → wildly different rewards depending on hidden profile:
|
| 41 |
-
|
| 42 |
-
```
|
| 43 |
-
DEEP_WORK, step 1, same initial state:
|
| 44 |
-
workaholic_stoic: +1.57 (progress weight = 70% — work = meaning)
|
| 45 |
-
introvert_morning: +0.32 (serenity weight = 60% — mild net gain)
|
| 46 |
-
extrovert_night_owl: −0.39 (connection weight = 75% — work gives 0 connection)
|
| 47 |
-
```
|
| 48 |
-
|
| 49 |
-
An agent that doesn't adapt to the profile plateaus at ~0.60 final score.
|
| 50 |
-
One that discovers the profile targets can push above 0.80.
|
| 51 |
-
|
| 52 |
-
### Layer 2 — Action Modifiers (How Actions Actually Affect This Person)
|
| 53 |
-
|
| 54 |
-
The base effect matrix is modified invisibly per profile:
|
| 55 |
-
|
| 56 |
-
| Profile | Hidden modifier | Observable signal |
|
| 57 |
-
|---|---|---|
|
| 58 |
-
| introvert_morning | Social drain ×3.0 | SOCIALIZE drains vitality 3× more than expected |
|
| 59 |
-
| introvert_morning | Morning deep work ×2.0 | Same action gives 2× progress at slot 0 |
|
| 60 |
-
| extrovert_night_owl | Morning penalty ×0.4 | DEEP_WORK in morning gives 40% of expected progress |
|
| 61 |
-
| extrovert_night_owl | Evening/night bonus ×1.8 | Same action gives 1.8× progress at slots 2–3 |
|
| 62 |
-
| extrovert_night_owl | Social connection ×2.0 | SOCIALIZE gives 2× connection gain |
|
| 63 |
-
| workaholic_stoic | Work recovers vitality +0.06 | DEEP_WORK raises vitality instead of draining |
|
| 64 |
-
| workaholic_stoic | Idle drains serenity −0.10 | ME_TIME/BINGE_WATCH lower serenity |
|
| 65 |
-
|
| 66 |
-
Agent sees the same meters and actions every episode.
|
| 67 |
-
The profile changes what actions *mean* in this episode.
|
| 68 |
-
|
| 69 |
-
### Layer 3 — Stress Spiral (Amplification Mechanics)
|
| 70 |
-
|
| 71 |
-
When serenity drops below the profile's stress tolerance, all negative effects amplify ×1.3.
|
| 72 |
-
The introvert's tolerance is highest (0.30), extrovert's is mid (0.20), stoic's is lowest (0.15).
|
| 73 |
-
|
| 74 |
-
This creates a compounding dynamic: wrong actions → serenity drops → worse outcomes → harder
|
| 75 |
-
recovery. The agent must learn to protect serenity proactively, not reactively.
|
| 76 |
-
|
| 77 |
-
---
|
| 78 |
-
|
| 79 |
-
## Episode Structure
|
| 80 |
-
|
| 81 |
-
```
|
| 82 |
-
1 episode = 1 week
|
| 83 |
-
1 step = 1 time slot (Morning / Afternoon / Evening / Night)
|
| 84 |
-
4 slots/day × 7 days = 28 steps total
|
| 85 |
-
|
| 86 |
-
Slot 0 — Morning (HV1: cognition ×1.2, vitality drain ×0.8)
|
| 87 |
-
Slot 1 — Afternoon (HV1: neutral)
|
| 88 |
-
Slot 2 — Evening (HV1: cognition ×0.8, vitality drain ×1.1)
|
| 89 |
-
Slot 3 — Night (HV1: cognition ×0.6, vitality drain ×1.3)
|
| 90 |
-
```
|
| 91 |
-
|
| 92 |
-
Each `reset(seed, profile)` deterministically initialises state:
|
| 93 |
-
- Profile explicit kwarg → use that profile
|
| 94 |
-
- No profile → `seed % 3` selects profile (agent doesn't know which)
|
| 95 |
-
- Full episode is reproducible from seed alone (random events included)
|
| 96 |
-
|
| 97 |
-
---
|
| 98 |
-
|
| 99 |
-
## Observable vs Hidden
|
| 100 |
-
|
| 101 |
-
| Observable (agent sees every step) | Hidden (must discover from reward patterns) |
|
| 102 |
-
|---|---|
|
| 103 |
-
| All 5 meter values (0.0–1.0) | Which of the 3 profiles is active |
|
| 104 |
-
| Day of week (0–6) | Profile reward weights |
|
| 105 |
-
| Time slot (0–3) | Per-action modifiers for this profile |
|
| 106 |
-
| Active random event name (if any) | Stress tolerance threshold |
|
| 107 |
-
| Remaining steps | Connection decay rate |
|
| 108 |
-
| Per-meter reward deltas | Event impact multiplier |
|
| 109 |
-
|
| 110 |
-
---
|
| 111 |
-
|
| 112 |
-
## The Training Story
|
| 113 |
-
|
| 114 |
-
```
|
| 115 |
-
Untrained agent (random baseline):
|
| 116 |
-
→ No pattern to action selection
|
| 117 |
-
→ Misses optimal timing windows (morning for introverts, evening for extroverts)
|
| 118 |
-
→ Doesn't protect serenity floor
|
| 119 |
-
→ final_score ≈ 0.60–0.70
|
| 120 |
-
|
| 121 |
-
Heuristic agent (rule-based, profile-blind):
|
| 122 |
-
→ Follows observable rules: sleep when vitality low, meditate when serenity low
|
| 123 |
-
→ Cannot differentiate workaholic from introvert strategy
|
| 124 |
-
→ Misses profile-specific timing bonuses
|
| 125 |
-
→ final_score ≈ 0.75–0.82
|
| 126 |
-
|
| 127 |
-
GRPO-trained agent (after 500–1000 steps):
|
| 128 |
-
→ Discovers DEEP_WORK in the morning gives 2× progress for introvert profiles
|
| 129 |
-
→ Learns SOCIALIZE has opposite vitality effects for extrovert vs introvert
|
| 130 |
-
→ Adapts overall strategy to the person's hidden reward structure
|
| 131 |
-
→ Target: final_score > 0.82, beating heuristic on 2+ of 3 profiles
|
| 132 |
-
```
|
| 133 |
-
|
| 134 |
-
The training plot should show:
|
| 135 |
-
1. Mean reward increasing across GRPO steps
|
| 136 |
-
2. Trained agent bar chart > heuristic bar chart for at least 2 profiles
|
| 137 |
-
3. Per-profile breakdown showing differentiated learned strategy
|
| 138 |
-
|
| 139 |
-
---
|
| 140 |
-
|
| 141 |
-
## Anti-Reward-Hacking Measures
|
| 142 |
-
|
| 143 |
-
Three independent reward layers prevent gaming any single signal:
|
| 144 |
-
|
| 145 |
-
| Layer | Signal | Penalty for failure |
|
| 146 |
-
|---|---|---|
|
| 147 |
-
| `format_valid` | Output parseable action name | −2.0 |
|
| 148 |
-
| `action_legal` | Output is one of 10 valid actions | −1.0 |
|
| 149 |
-
| `env_reward` | Real environment reward via episode replay | −3.0 |
|
| 150 |
-
|
| 151 |
-
Additional safeguards:
|
| 152 |
-
- **Repetition dampening**: Same action 3× in a row → 25%/50%/75% effect reduction (prevents spam)
|
| 153 |
-
- **Critical floor penalty**: Any meter < 0.10 → −0.30 per step (prevents neglect farming)
|
| 154 |
-
- **Random events** (8%/step): Prevents overfitting to deterministic trajectories
|
| 155 |
-
- **Seed-based replay**: `env_reward` replays exact episode state via seed + action_history — reward cannot be fabricated
|
| 156 |
-
|
| 157 |
-
---
|
| 158 |
-
|
| 159 |
-
## Alignment with Hackathon Themes
|
| 160 |
-
|
| 161 |
-
**Primary: Theme 3.2 — World Modeling: Personalized Tasks**
|
| 162 |
-
|
| 163 |
-
The environment models real personal assistant behaviour:
|
| 164 |
-
- Agent manages a person's week across competing life priorities
|
| 165 |
-
- Hidden profile = real individual differences in what matters and how actions affect a person
|
| 166 |
-
- Discovery through reward = how a good PA adapts over their first weeks on the job
|
| 167 |
-
|
| 168 |
-
**Secondary: Theme 2 — Long-Horizon Planning**
|
| 169 |
-
|
| 170 |
-
28 steps with delayed, compounding consequences:
|
| 171 |
-
- Neglecting connection decays slowly but each step makes recovery harder
|
| 172 |
-
- Progress must be built steadily — the final grader rewards sustained output
|
| 173 |
-
- Serenity meltdown triggered by accumulated bad decisions, not a single step
|
| 174 |
-
|
| 175 |
-
---
|
| 176 |
-
|
| 177 |
-
## Implementation Reference
|
| 178 |
-
|
| 179 |
-
| Component | File | Lines |
|
| 180 |
-
|---|---|---|
|
| 181 |
-
| Environment | `server/rhythm_environment.py` | 577 |
|
| 182 |
-
| Data models | `models.py` | 89 |
|
| 183 |
-
| Training orchestrator | `training/train.py` | 202 |
|
| 184 |
-
| Dataset generator | `training/dataset.py` | 181 |
|
| 185 |
-
| Reward functions | `training/reward_functions.py` | 215 |
|
| 186 |
-
| Baseline evaluation | `training/inference_eval.py` | 227 |
|
| 187 |
-
| Colab notebook | `training/RhythmEnv_GRPO_Training.ipynb` | — |
|
| 188 |
-
| Gradio UI | `ui/app.py` | — |
|
| 189 |
-
| FastAPI server | `server/app.py` | 74 |
|
| 190 |
-
|
| 191 |
-
Key API:
|
| 192 |
-
```python
|
| 193 |
-
env = RhythmEnvironment()
|
| 194 |
-
obs = env.reset(seed=42, profile="introvert_morning") # profile optional
|
| 195 |
-
obs = env.step(RhythmAction(action_type=ActionType.DEEP_WORK))
|
| 196 |
-
# obs.reward, obs.done, obs.reward_breakdown, obs.vitality, ...
|
| 197 |
-
```
|
| 198 |
-
|
| 199 |
-
---
|
| 200 |
-
|
| 201 |
-
## Open Questions — Decided
|
| 202 |
-
|
| 203 |
-
| Question | Decision |
|
| 204 |
-
|---|---|
|
| 205 |
-
| All 3 hidden variables or start with 2? | All 3 fully implemented |
|
| 206 |
-
| Do profiles change every episode? | Seed-based: same seed → same profile |
|
| 207 |
-
| Does profile affect which tasks appear? | No tasks in Life Simulator; profile affects action effects + reward weights |
|
| 208 |
-
| Add BUNDLE_TASKS action? | Skipped — Life Simulator action space is complete at 10 |
|
| 209 |
-
| 7-day vs 1-day episodes? | 7-day (28 steps) — long horizon is the point |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round2/hackathon_themes.md
DELETED
|
@@ -1,180 +0,0 @@
|
|
| 1 |
-
Theme #1 - Multi-Agent Interactions
|
| 2 |
-
Environments for this theme involve cooperation, competition, negotiation, and coalition formation. Learning from these environments will enable agents to model the beliefs and incentives of others in partially observable settings. This drives theory-of-mind reasoning and emergent strategic behavior.
|
| 3 |
-
Expected Outcome: an environment that can be used to train multi-agent task handling in a LLM
|
| 4 |
-
Example environments: Market simulations, compute-allocation negotiations, collaborative puzzle worlds, mixed cooperative/competitive strategy games.
|
| 5 |
-
Sub-themes with bonus prizes.
|
| 6 |
-
Fleet AI. Scalable Oversight: Environments that train oversight agents to monitor, analyze, and explain the behavior of other AI agents operating in complex, multi-agent settings.
|
| 7 |
-
Halluminate. Multi-Actor Environments: Build a realistic environment where an agent interacts with and manages multiple actors (agents) to discover and achieve the task
|
| 8 |
-
Theme #2 - (Super) Long-Horizon Planning & Instruction Following
|
| 9 |
-
You will build environments that require deep, multi-step reasoning with sparse or delayed rewards. After using these environments, the goal is to enable agents to decompose goals, track state over extended trajectories, and recover from early mistakes. The aim is to push beyond shallow next-token reasoning toward structured planning and durable internal representations.
|
| 10 |
-
Expected Outcome: an environment that can capture and improve LLM behaviour on challenging long horizon tasks that need long running sessions beyond context memory limits.
|
| 11 |
-
Example environments: Research-planning simulators, large-scale codebase refactoring tasks, strategic resource management worlds, long-horizon logistics optimization, extremely complicated long-horizon instruction following (e.g., 300 instructions scattered around).
|
| 12 |
-
Sub-themes with bonus prizes.
|
| 13 |
-
Scale AI. Environments for long horizon workflows for non-code use cases within a business setting: focusing on either Sales, Project management, or HR & IT.
|
| 14 |
-
Mercor. Make an environment with capped/uncapped rewards where frontier model rewards scale with token output.
|
| 15 |
-
Theme #3 - World Modeling
|
| 16 |
-
#3.1 Professional Tasks
|
| 17 |
-
Here you will develop environments that require real interaction with tools, APIs, or dynamic systems where the model is expected to do real hard work instead of exploiting short-cuts to arrive at the desired outcome. Learning from these environments will enable agents to maintain consistent internal state, update beliefs based on outcomes, and orchestrate multi-step workflows. The goal is to strengthen causal reasoning and persistent world models.
|
| 18 |
-
Expected Outcome: an environment capturing nuances of a defined partially observable world and improve LLM interaction with it
|
| 19 |
-
Example environments: Dynamic browser/API ecosystems, enterprise applications, scientific workflow loops (papers → code → experiments), economic simulations with feedback, tool-discovery benchmarks.
|
| 20 |
-
Sub-themes with bonus prizes.
|
| 21 |
-
Scaler AI Labs. Multi-App RL Environment for Enterprise Workflows: Create RL environments to demonstrate complex workflows, business rule nuances etc in a large enterprise
|
| 22 |
-
|
| 23 |
-
#3.2 Personalized Tasks
|
| 24 |
-
Here we will develop an environment that offers real personalized task handling, imagine replying to personal messages or handling dinner conflicts due to work conflicts, replying to tough emails. Think any personal assistant tasks
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
Expected Outcome: An environment that gives the model a realistic simulation of handling personal tasks, conflicts and managing them as delegations
|
| 28 |
-
|
| 29 |
-
Example environments: Executive Assistant Meeting Planner, Dinner and drive planning, email and message replying, shopping, etc
|
| 30 |
-
|
| 31 |
-
Sub-themes with bonus prizes.
|
| 32 |
-
Patronus AI. Consumer Workflows with Schema Drift: Multi-step consumer workflow environments where the underlying data schemas, API contracts, and t&cs/policies/rules change.
|
| 33 |
-
|
| 34 |
-
Theme #4 - Self-Improvement
|
| 35 |
-
The focus here is to create environments where agents can learn to generate new challenges, escalate difficulty, and improve through self-play or adaptive curricula. Rather than optimizing fixed tasks, the goal is for agents to learn to drive their own capability growth. The objective is recursive skill amplification.
|
| 36 |
-
Expected Outcome: an environment for improving self-play of a LLM over a defined set of tasks
|
| 37 |
-
Example environments: Self-play negotiation arenas, auto-generated math/proof tasks, evolving coding competitions, adaptive RL curricula.
|
| 38 |
-
Sub-themes with bonus prizes.
|
| 39 |
-
Snorkel AI. Simulated Experts-in-the-Loop: Environment that simulates interactions with real subject-matter experts, with changing requirements / preferences.
|
| 40 |
-
|
| 41 |
-
Theme #5: Wild Card - Impress Us!
|
| 42 |
-
We do not want to limit your focus if your idea doesn’t fit the boxes above, we want and WILL reward out of box tasks, please be creative but remember to add submissions that meaningfully add value to LLM training on a certain task.
|
| 43 |
-
|
| 44 |
-
Guidelines for Problem Statement
|
| 45 |
-
It is NOT mandatory to choose the same problem statement as Round 1. Only choose the same problem statement if it aligns with the above provided Hackathon themes.
|
| 46 |
-
You can start working on your problem statement once you have finalized it. Post-training can be done onsite on 25th & 26th when you receive compute credits for HuggingFace.
|
| 47 |
-
Before the onsite, we suggest you work on building the environment, agent behaviours, reward model and evaluate if your work aligns with the judging criteria given below.
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
Judging Criteria
|
| 51 |
-
Minimum requirements:
|
| 52 |
-
Usage of OpenEnv (latest release)
|
| 53 |
-
Show a minimal training script for your environment using Unsloth or HF TRL in Colab
|
| 54 |
-
Write a mini-blog on HuggingFace or mini-video on YouTube talking about your submission, <2 minutes
|
| 55 |
-
Your OpenEnv compliant environment should be hosted on Hugging Face Spaces.
|
| 56 |
-
|
| 57 |
-
First Round Judging Overview
|
| 58 |
-
Pitch Format: Each team has 3 minutes to pitch, followed by 2 minutes for Q&A (5 minutes total).
|
| 59 |
-
Evaluation: Teams will be scored based on the following criteria:
|
| 60 |
-
Environment Innovation (40%): Is the environment novel, creative, or challenging? Does it meaningfully test the agent’s behavior?
|
| 61 |
-
Storytelling (30%): Does the team clearly explain the problem, environment, and agent behavior? Is the demo engaging and easy to follow?
|
| 62 |
-
Showing Improvement in Rewards (20%): Does the demo provide observable evidence of training progress (reward curves, metrics, or before/after behavior)?
|
| 63 |
-
Reward and Training Script/Pipeline Setup (10%): Is the reward logic coherent, and does the pipeline produce meaningful improvement in the agent’s inference (how it acts in the environment)?
|
| 64 |
-
|
| 65 |
-
OpenEnv Hackathon - What Judges Look For
|
| 66 |
-
|
| 67 |
-
This guide tells you what makes a strong submission for the OpenEnv Hackathon (India 2026).
|
| 68 |
-
Read it before you start building, and again before you submit.
|
| 69 |
-
|
| 70 |
-
For the list of themes and example problems, refer to the top sections.
|
| 71 |
-
|
| 72 |
-
NOTE: Please remember only one submission per team. If you have multiple ideas, pick the best one and go for it. Please make sure that the URL link of your environment is submitted as judges will pull the environment from the URL to evaluate it. Changes or commits after the submission deadline will not be considered.
|
| 73 |
-
|
| 74 |
-
TL;DR
|
| 75 |
-
|
| 76 |
-
Build an environment that an LLM could actually be trained on to get measurably better at
|
| 77 |
-
something interesting. Then show that training. Then tell the story.
|
| 78 |
-
|
| 79 |
-
A messy but ambitious environment with real training evidence beats a polished but boring one.
|
| 80 |
-
Pick a problem that excites you (that energy comes through in the pitch).
|
| 81 |
-
|
| 82 |
-
Judging Criteria
|
| 83 |
-
|
| 84 |
-
Criterion: Environment Innovation
|
| 85 |
-
Weight: 40%
|
| 86 |
-
What it means:
|
| 87 |
-
Is the environment novel, creative, or genuinely challenging?
|
| 88 |
-
Does it meaningfully test agent behavior in a way that hasn't been done before?
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
Criterion: Storytelling & Presentation
|
| 92 |
-
Weight: 30%
|
| 93 |
-
What it means:
|
| 94 |
-
Can you clearly explain the problem, the environment, and what the agent learned?
|
| 95 |
-
Is the demo engaging and easy to follow for a non-technical audience?
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
Criterion: Showing Improvement in Rewards
|
| 99 |
-
Weight: 20%
|
| 100 |
-
What it means:
|
| 101 |
-
Is there observable evidence of training progress? Reward curves, before/after behavior,
|
| 102 |
-
comparison against a baseline -- anything that proves the agent learned something.
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
Criterion: Reward & Training Pipeline
|
| 106 |
-
Weight: 10%
|
| 107 |
-
What it means:
|
| 108 |
-
Is the reward logic coherent? Does the pipeline produce meaningful improvement in the trained
|
| 109 |
-
agent's behavior?
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
Minimum Submission Requirements
|
| 113 |
-
|
| 114 |
-
NOTE: These are non-negotiable. Submissions missing any of these are at a serious disadvantage.
|
| 115 |
-
Use OpenEnv (latest release). Build on top of the framework; don’t reinvent the wheel.
|
| 116 |
-
A working training script using Unsloth or Hugging Face TRL, ideally as a Colab notebook so judges can re-run it.
|
| 117 |
-
Evidence that you actually trained; at minimum, loss and reward plots from a real run.
|
| 118 |
-
A short writeup: a mini-blog on Hugging Face or a < 2 minute video on YouTube explaining what your environment does and what you trained, or a short slide deck of presentation. Please make sure that all materials are linked from your README file so that judges can access them easily.
|
| 119 |
-
Push your environment to a Hugging Face Space so it’s discoverable and runnable.
|
| 120 |
-
A README that motivates the problem, explains how the env works, and shows results.
|
| 121 |
-
README should have a link to the environment in the Hugging Face Space. It should also have all additional references to other materials (e.g. videos, blog posts, slides, presentations, etc.) that you want to include.
|
| 122 |
-
Please do not include big video files in your Env submission on HF Hub as we would like to have a small size for each env (Please use url as reference link to additional materials).
|
| 123 |
-
|
| 124 |
-
What Makes a Submission Stand Out
|
| 125 |
-
|
| 126 |
-
Pick an ambitious, original problem
|
| 127 |
-
The themes (problems) are deliberately open. Use them as launching pads, not boxes. Judges have seen a lot of chess, snake, tic-tac-toe, and grid-world clones. To score well on innovation,
|
| 128 |
-
you need a genuinely fresh angle. Some questions to ask yourself:
|
| 129 |
-
Does this environment exist to teach an LLM something it currently can’t do well?
|
| 130 |
-
Is the domain underexplored in RL/LLM training?
|
| 131 |
-
Could a researcher write a paper about training on this?
|
| 132 |
-
|
| 133 |
-
Design a reward signal that actually teaches
|
| 134 |
-
A great environment has a reward function that:
|
| 135 |
-
Provides a rich, informative signal (not just 0/1 at the end)
|
| 136 |
-
Captures something hard to measure in a clever way
|
| 137 |
-
Uses OpenEnv’s Rubric system thoughtfully (composable rubrics > monolithic scoring)
|
| 138 |
-
Is hard to game; an agent that exploits the reward without solving the task should not get high scores
|
| 139 |
-
|
| 140 |
-
Show real training, end to end
|
| 141 |
-
The bar isn’t “training script exists.” The bar is “training script runs against the environment, the
|
| 142 |
-
agent learns, and you can show it.” Concretely:
|
| 143 |
-
Your training loop should connect to your environment (not a static dataset)
|
| 144 |
-
Train long enough that the curves mean something
|
| 145 |
-
Compare a trained agent vs. a random/untrained baseline; quantitative and/or qualitative
|
| 146 |
-
Include the plots and numbers in your README and writeup
|
| 147 |
-
|
| 148 |
-
Make your plots readable
|
| 149 |
-
Reviewers spend seconds, not minutes, on each plot. Help them out:
|
| 150 |
-
Label both axes (e.g. “training step” / “episode” on x, “reward” / “loss” on y) and include units where they apply
|
| 151 |
-
Save plots as .png or .jpg and commit them to the repo (don’t leave them only in a Colab cell or a deleted Wandb run) (if you ran via WANBD, please include the link to that specific run of your plots)
|
| 152 |
-
Embed the key plots in your README with a one-line caption explaining what each one shows If you have multiple runs (baseline vs. trained, ablations, etc.), put them on the same axes so the comparison is obvious
|
| 153 |
-
|
| 154 |
-
Tell a story, not an API doc
|
| 155 |
-
Your README, blog, and pitch should answer:
|
| 156 |
-
Problem) what capability gap or interesting domain are you targeting?
|
| 157 |
-
Environment) what does the agent see, do, and get rewarded for?
|
| 158 |
-
Results) what changed after training? Show it.
|
| 159 |
-
Why does it matter) who would care, and why?
|
| 160 |
-
|
| 161 |
-
A reviewer should be able to read your README in 3~5 minutes and want to try your
|
| 162 |
-
environment.
|
| 163 |
-
|
| 164 |
-
NOTE: If you have a video, HF post, or anything else interesting, please make sure that it’s linked
|
| 165 |
-
from your README.
|
| 166 |
-
|
| 167 |
-
Engineer it cleanly (table stakes)
|
| 168 |
-
Engineering quality matters less than ambition, but sloppy work hurts. Make sure you:
|
| 169 |
-
Use OpenEnv’s Environment / MCPEnvironment base classes properly
|
| 170 |
-
Respect the client / server separation (clients should never import server internals)
|
| 171 |
-
Follow the standard Gym-style API (reset, step, state)
|
| 172 |
-
Have a valid openenv.yaml manifest
|
| 173 |
-
Don’t use reserved tool names (reset, step, state, close) for MCP tools
|
| 174 |
-
|
| 175 |
-
Final Note
|
| 176 |
-
|
| 177 |
-
Judges are looking for environments that push the frontier of what we can train LLMs to do. Be
|
| 178 |
-
ambitious. Pick a problem you find genuinely interesting; that almost always produces better
|
| 179 |
-
work than chasing what you think judges want. Good luck.
|
| 180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round2/pitch_framing.md
DELETED
|
@@ -1,57 +0,0 @@
|
|
| 1 |
-
# Round 2 — Pitch Framing
|
| 2 |
-
|
| 3 |
-
## Why This Exists
|
| 4 |
-
|
| 5 |
-
Personal AI assistants give generic advice. They don't know you.
|
| 6 |
-
RhythmEnv is an environment where an agent learns YOUR specific patterns through experience — not configuration.
|
| 7 |
-
|
| 8 |
-
---
|
| 9 |
-
|
| 10 |
-
## The Product Vision
|
| 11 |
-
|
| 12 |
-
```
|
| 13 |
-
User installs app
|
| 14 |
-
Agent runs episodes in background
|
| 15 |
-
Over time → learns energy patterns, task preferences, peak hours
|
| 16 |
-
Result → a scheduler that actually knows YOU
|
| 17 |
-
```
|
| 18 |
-
|
| 19 |
-
No setup. No personality quiz. The agent figures you out.
|
| 20 |
-
|
| 21 |
-
---
|
| 22 |
-
|
| 23 |
-
## Why Simulation is a Valid Proxy
|
| 24 |
-
|
| 25 |
-
| Hackathon env | Real product |
|
| 26 |
-
|---|---|
|
| 27 |
-
| Simulated tasks | Real calendar + Notion + email |
|
| 28 |
-
| Simulated energy | Biometric data or self-report |
|
| 29 |
-
| Fixed scenarios | Dynamic, unpredictable days |
|
| 30 |
-
|
| 31 |
-
The mechanics are the same. The simulation is a controlled version of the real problem — which is exactly what RL training environments are for.
|
| 32 |
-
|
| 33 |
-
---
|
| 34 |
-
|
| 35 |
-
## What Makes This Hard for an LLM
|
| 36 |
-
|
| 37 |
-
Without hidden variables → LLM already knows how to schedule by deadline. Nothing to learn.
|
| 38 |
-
|
| 39 |
-
With hidden variables → LLM must discover YOUR specific rules:
|
| 40 |
-
|
| 41 |
-
```
|
| 42 |
-
YOUR energy cliff (performance drops sharply below a threshold, not gradually)
|
| 43 |
-
YOUR peak hours (certain tasks score better at certain times of day)
|
| 44 |
-
YOUR recovery curve (consecutive breaks compound in ways that aren't obvious)
|
| 45 |
-
```
|
| 46 |
-
|
| 47 |
-
These aren't in the state. The agent discovers them through reward signal across episodes.
|
| 48 |
-
That's the training story.
|
| 49 |
-
|
| 50 |
-
---
|
| 51 |
-
|
| 52 |
-
## The Pitch (3 minutes)
|
| 53 |
-
|
| 54 |
-
1. **Problem** — AI assistants are generic. They don't learn you.
|
| 55 |
-
2. **Environment** — A simulated workday with hidden personal patterns the agent must discover.
|
| 56 |
-
3. **Results** — Show reward curves improving as the agent learns the hidden variables.
|
| 57 |
-
4. **Why it matters** — This is the training ground for truly personalized AI.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/round2/problem_statement.md
DELETED
|
@@ -1,193 +0,0 @@
|
|
| 1 |
-
# Round 2 — Grand Finale Problem Statement
|
| 2 |
-
|
| 3 |
-
**Date:** 25–26 April 2026
|
| 4 |
-
**Venue:** Scaler School of Technology, Electronic City, Bangalore
|
| 5 |
-
**Category:** Solo — Akhil Soni
|
| 6 |
-
|
| 7 |
-
---
|
| 8 |
-
|
| 9 |
-
## The Task
|
| 10 |
-
|
| 11 |
-
Choose one (or more) of the themes below and design your own problem statement around it.
|
| 12 |
-
Build an environment, train an agent on it, and show measurable improvement.
|
| 13 |
-
|
| 14 |
-
> *"Build an environment that an LLM could actually be trained on to get measurably better at something interesting. Then show that training. Then tell the story."*
|
| 15 |
-
|
| 16 |
-
It is **NOT mandatory** to continue with your Round 1 problem statement. Only keep it if it aligns with a theme below.
|
| 17 |
-
|
| 18 |
-
---
|
| 19 |
-
|
| 20 |
-
## Themes
|
| 21 |
-
|
| 22 |
-
### Theme 1 — Multi-Agent Interactions
|
| 23 |
-
|
| 24 |
-
Environments involving cooperation, competition, negotiation, and coalition formation.
|
| 25 |
-
Enables agents to model beliefs and incentives of others in partially observable settings.
|
| 26 |
-
Drives theory-of-mind reasoning and emergent strategic behavior.
|
| 27 |
-
|
| 28 |
-
**Expected outcome:** An environment that can be used to train multi-agent task handling in an LLM.
|
| 29 |
-
|
| 30 |
-
**Example environments:** Market simulations, compute-allocation negotiations, collaborative puzzle worlds, mixed cooperative/competitive strategy games.
|
| 31 |
-
|
| 32 |
-
**Bonus prizes:**
|
| 33 |
-
- **Fleet AI** — Scalable Oversight: Environments that train oversight agents to monitor, analyze, and explain the behavior of other AI agents in complex multi-agent settings.
|
| 34 |
-
- **Halluminate** — Multi-Actor Environments: An agent interacts with and manages multiple actors to discover and achieve a task.
|
| 35 |
-
|
| 36 |
-
---
|
| 37 |
-
|
| 38 |
-
### Theme 2 — (Super) Long-Horizon Planning & Instruction Following
|
| 39 |
-
|
| 40 |
-
Environments requiring deep, multi-step reasoning with sparse or delayed rewards.
|
| 41 |
-
Goal: enable agents to decompose goals, track state over extended trajectories, and recover from early mistakes.
|
| 42 |
-
Pushes beyond shallow next-token reasoning toward structured planning and durable internal representations.
|
| 43 |
-
|
| 44 |
-
**Expected outcome:** An environment that captures and improves LLM behavior on challenging long-horizon tasks that need sessions beyond context memory limits.
|
| 45 |
-
|
| 46 |
-
**Example environments:** Research-planning simulators, large-scale codebase refactoring, strategic resource management, long-horizon logistics optimization, 300+ instruction following.
|
| 47 |
-
|
| 48 |
-
**Bonus prizes:**
|
| 49 |
-
- **Scale AI** — Long-horizon workflows for non-code business use cases: Sales, Project Management, or HR & IT.
|
| 50 |
-
- **Mercor** — Environment with capped/uncapped rewards where frontier model rewards scale with token output.
|
| 51 |
-
|
| 52 |
-
---
|
| 53 |
-
|
| 54 |
-
### Theme 3 — World Modeling
|
| 55 |
-
|
| 56 |
-
#### 3.1 Professional Tasks
|
| 57 |
-
|
| 58 |
-
Environments requiring real interaction with tools, APIs, or dynamic systems.
|
| 59 |
-
The model must do real work instead of exploiting shortcuts.
|
| 60 |
-
Strengthens causal reasoning and persistent world models.
|
| 61 |
-
|
| 62 |
-
**Expected outcome:** An environment capturing nuances of a partially observable world and improving LLM interaction with it.
|
| 63 |
-
|
| 64 |
-
**Example environments:** Dynamic browser/API ecosystems, enterprise applications, scientific workflow loops (papers → code → experiments), economic simulations, tool-discovery benchmarks.
|
| 65 |
-
|
| 66 |
-
**Bonus prizes:**
|
| 67 |
-
- **Scaler AI Labs** — Multi-App RL Environment for Enterprise Workflows: Complex workflows and business rule nuances in a large enterprise.
|
| 68 |
-
|
| 69 |
-
#### 3.2 Personalized Tasks
|
| 70 |
-
|
| 71 |
-
Environments for real personalized task handling — personal messages, dinner conflicts, tough emails, any personal assistant task.
|
| 72 |
-
|
| 73 |
-
**Expected outcome:** An environment that gives the model a realistic simulation of handling personal tasks, conflicts, and managing them as delegations.
|
| 74 |
-
|
| 75 |
-
**Example environments:** Executive Assistant Meeting Planner, dinner and drive planning, email and message replying, shopping.
|
| 76 |
-
|
| 77 |
-
**Bonus prizes:**
|
| 78 |
-
- **Patronus AI** — Consumer Workflows with Schema Drift: Multi-step consumer workflow environments where data schemas, API contracts, and policies change over time.
|
| 79 |
-
|
| 80 |
-
---
|
| 81 |
-
|
| 82 |
-
### Theme 4 — Self-Improvement
|
| 83 |
-
|
| 84 |
-
Environments where agents generate new challenges, escalate difficulty, and improve through self-play or adaptive curricula.
|
| 85 |
-
Goal: agents learn to drive their own capability growth (recursive skill amplification).
|
| 86 |
-
|
| 87 |
-
**Expected outcome:** An environment for improving self-play of an LLM over a defined set of tasks.
|
| 88 |
-
|
| 89 |
-
**Example environments:** Self-play negotiation arenas, auto-generated math/proof tasks, evolving coding competitions, adaptive RL curricula.
|
| 90 |
-
|
| 91 |
-
**Bonus prizes:**
|
| 92 |
-
- **Snorkel AI** — Simulated Experts-in-the-Loop: Environment that simulates interactions with real subject-matter experts, with changing requirements and preferences.
|
| 93 |
-
|
| 94 |
-
---
|
| 95 |
-
|
| 96 |
-
### Theme 5 — Wild Card
|
| 97 |
-
|
| 98 |
-
No constraint. Any original environment that meaningfully adds value to LLM training on a certain task.
|
| 99 |
-
|
| 100 |
-
---
|
| 101 |
-
|
| 102 |
-
## Minimum Requirements (Non-Negotiable)
|
| 103 |
-
|
| 104 |
-
Missing any of these puts your submission at a serious disadvantage.
|
| 105 |
-
|
| 106 |
-
| Requirement | Details |
|
| 107 |
-
|---|---|
|
| 108 |
-
| OpenEnv (latest release) | Build on top of the framework, don't reinvent the wheel |
|
| 109 |
-
| Training script | Using Unsloth or HF TRL, ideally as a runnable Colab notebook |
|
| 110 |
-
| Training evidence | Loss and reward plots from a real run |
|
| 111 |
-
| Writeup | Mini-blog on HuggingFace OR <2 min YouTube video OR short slide deck |
|
| 112 |
-
| HF Space deployment | Environment hosted, discoverable, and runnable |
|
| 113 |
-
| README | Motivates the problem, explains the env, shows results, links all materials |
|
| 114 |
-
|
| 115 |
-
---
|
| 116 |
-
|
| 117 |
-
## Judging Criteria
|
| 118 |
-
|
| 119 |
-
| Criterion | Weight | What It Means |
|
| 120 |
-
|---|---|---|
|
| 121 |
-
| Environment Innovation | 40% | Novel, creative, genuinely challenging? Tests agent behavior in a new way? |
|
| 122 |
-
| Storytelling & Presentation | 30% | Clear explanation of problem, env, and what the agent learned? Engaging demo? |
|
| 123 |
-
| Showing Improvement in Rewards | 20% | Observable training progress — reward curves, before/after behavior, baseline comparison |
|
| 124 |
-
| Reward & Training Pipeline | 10% | Coherent reward logic? Does training produce meaningful improvement in agent behavior? |
|
| 125 |
-
|
| 126 |
-
---
|
| 127 |
-
|
| 128 |
-
## Pitch Format
|
| 129 |
-
|
| 130 |
-
- **3 minutes** to pitch
|
| 131 |
-
- **2 minutes** Q&A
|
| 132 |
-
- 5 minutes total per team
|
| 133 |
-
|
| 134 |
-
Your pitch should answer:
|
| 135 |
-
1. **Problem** — what capability gap or interesting domain are you targeting?
|
| 136 |
-
2. **Environment** — what does the agent see, do, and get rewarded for?
|
| 137 |
-
3. **Results** — what changed after training? Show it.
|
| 138 |
-
4. **Why it matters** — who would care, and why?
|
| 139 |
-
|
| 140 |
-
---
|
| 141 |
-
|
| 142 |
-
## What Makes a Submission Stand Out
|
| 143 |
-
|
| 144 |
-
**Pick an ambitious problem.**
|
| 145 |
-
Ask yourself: Does this environment exist to teach an LLM something it currently can't do well? Could a researcher write a paper about training on this?
|
| 146 |
-
|
| 147 |
-
**Design a reward signal that actually teaches.**
|
| 148 |
-
- Rich signal throughout the episode (not just 0/1 at the end)
|
| 149 |
-
- Hard to game — an agent that exploits the reward without solving the task should not score high
|
| 150 |
-
- Use OpenEnv's Rubric system thoughtfully
|
| 151 |
-
|
| 152 |
-
**Show real training end to end.**
|
| 153 |
-
- Training loop connects to your environment (not a static dataset)
|
| 154 |
-
- Train long enough that curves mean something
|
| 155 |
-
- Compare trained agent vs random/untrained baseline — quantitative and qualitative
|
| 156 |
-
- Include plots and numbers in your README
|
| 157 |
-
|
| 158 |
-
**Make plots readable.**
|
| 159 |
-
- Label both axes with units
|
| 160 |
-
- Save as `.png` / `.jpg` and commit to repo
|
| 161 |
-
- Embed key plots in README with a one-line caption
|
| 162 |
-
- Put baseline vs trained on the same axes
|
| 163 |
-
|
| 164 |
-
---
|
| 165 |
-
|
| 166 |
-
## Engineering Checklist
|
| 167 |
-
|
| 168 |
-
- [ ] Use `Environment` / `MCPEnvironment` base classes properly
|
| 169 |
-
- [ ] Respect client/server separation (clients never import server internals)
|
| 170 |
-
- [ ] Follow standard Gym-style API (`reset`, `step`, `state`)
|
| 171 |
-
- [ ] Valid `openenv.yaml` manifest
|
| 172 |
-
- [ ] Do not use reserved tool names (`reset`, `step`, `state`, `close`) for MCP tools
|
| 173 |
-
- [ ] README links to blog, video, or slides
|
| 174 |
-
- [ ] No large video files in HF repo (use URL references)
|
| 175 |
-
|
| 176 |
-
---
|
| 177 |
-
|
| 178 |
-
## Before You Arrive in Bangalore
|
| 179 |
-
|
| 180 |
-
Post-training happens on-site with provided compute credits.
|
| 181 |
-
Use the time before April 25 to:
|
| 182 |
-
|
| 183 |
-
- [ ] Finalize your problem statement
|
| 184 |
-
- [ ] Build and deploy your environment to HF Space
|
| 185 |
-
- [ ] Write your training script (ready to run, not necessarily fully executed)
|
| 186 |
-
- [ ] Prepare your 3-minute pitch story
|
| 187 |
-
|
| 188 |
-
---
|
| 189 |
-
|
| 190 |
-
## Infrastructure Constraints (same as Round 1)
|
| 191 |
-
|
| 192 |
-
- Inference script runtime: under 20 minutes
|
| 193 |
-
- Hardware: vCPU=2, memory=8GB
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/training.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Training Guide — RhythmEnv GRPO
|
| 2 |
+
|
| 3 |
+
## What we're training
|
| 4 |
+
|
| 5 |
+
A Qwen 2.5-3B model (4-bit quantized + LoRA) to play one-week episodes in RhythmEnv. The agent sees 5 life meters, time of day, and a reward signal. It must infer the hidden personality profile from those signals and adapt its action selection accordingly.
|
| 6 |
+
|
| 7 |
+
The goal is not to teach the model the rules of the environment — a capable LLM already understands them from the prompt. The goal is to calibrate a small model to do online behavioral inference: read who you're helping from how the environment responds, not from what it tells you.
|
| 8 |
+
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
## Stack
|
| 12 |
+
|
| 13 |
+
| Component | Choice |
|
| 14 |
+
|---|---|
|
| 15 |
+
| Model | `unsloth/Qwen2.5-3B-Instruct` |
|
| 16 |
+
| Quantization | 4-bit NF4 via Unsloth |
|
| 17 |
+
| LoRA rank | 4 |
|
| 18 |
+
| Training algorithm | GRPO (TRL 0.22.2) |
|
| 19 |
+
| Hardware | Free Colab T4 (~3 hours for 500 steps) |
|
| 20 |
+
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
## Three-layer reward stack
|
| 24 |
+
|
| 25 |
+
Each training step scores four candidate completions per prompt across three reward functions:
|
| 26 |
+
|
| 27 |
+
| Layer | Function | Signal | Pass | Fail |
|
| 28 |
+
|---|---|---|---|---|
|
| 29 |
+
| 1 | `format_valid` | Is the output a parseable action name? | +1.0 | −2.0 |
|
| 30 |
+
| 2 | `action_legal` | Is it one of the 10 valid `ActionType` values? | +0.5 | −1.0 |
|
| 31 |
+
| 3 | `env_reward` | Real reward from stepping the environment | varies | −3.0 |
|
| 32 |
+
|
| 33 |
+
`env_reward` uses seed-based episode replay: the dataset stores `seed`, `step_index`, and `action_history` alongside each prompt. The reward function reconstructs the exact episode state and steps the environment with the candidate action — the reward cannot be fabricated.
|
| 34 |
+
|
| 35 |
+
---
|
| 36 |
+
|
| 37 |
+
## Key config choices
|
| 38 |
+
|
| 39 |
+
```python
|
| 40 |
+
GRPOConfig(
|
| 41 |
+
beta=0.01, # KL penalty — default 0.04 caused explosion to kl=10731 at step 205
|
| 42 |
+
max_completion_length=16, # Action names are ≤15 chars; prevents verbose drift
|
| 43 |
+
learning_rate=2e-4,
|
| 44 |
+
num_generations=4, # 4 candidates per prompt — enough variance for GRPO signal
|
| 45 |
+
max_steps=500,
|
| 46 |
+
per_device_train_batch_size=1,
|
| 47 |
+
gradient_accumulation_steps=4,
|
| 48 |
+
)
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
`beta=0.01` is the critical fix from the first training run. The default value caused the policy to drift so far from the reference model that completion length jumped from 4 tokens to 368 tokens, saturating the max. `max_completion_length=16` provides a hard cap as a second safeguard.
|
| 52 |
+
|
| 53 |
+
---
|
| 54 |
+
|
| 55 |
+
## Dataset
|
| 56 |
+
|
| 57 |
+
Generated from 200 simulated episodes using a mixed strategy (heuristic + random actions) across all three profiles. Each sample is one step:
|
| 58 |
+
|
| 59 |
+
```python
|
| 60 |
+
{
|
| 61 |
+
"prompt": [system_msg, user_observation],
|
| 62 |
+
"seed": int, # episode seed → deterministic profile + events
|
| 63 |
+
"step_index": int, # which step in the episode
|
| 64 |
+
"action_history": list, # actions taken before this step
|
| 65 |
+
}
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
The dataset gives the model exposure to all three profiles and a range of meter states. Mixed strategy (not pure heuristic) ensures the model sees suboptimal states to learn recovery from.
|
| 69 |
+
|
| 70 |
+
---
|
| 71 |
+
|
| 72 |
+
## Baselines
|
| 73 |
+
|
| 74 |
+
Established before training on 5 episodes × 3 profiles:
|
| 75 |
+
|
| 76 |
+
| Strategy | Introvert | Extrovert | Workaholic |
|
| 77 |
+
|---|---|---|---|
|
| 78 |
+
| Random | ~0.65 | ~0.70 | ~0.65 |
|
| 79 |
+
| Heuristic | ~0.78 | ~0.76 | ~0.82 |
|
| 80 |
+
|
| 81 |
+
The heuristic baseline uses observable rules only (sleep when vitality is low, meditate when serenity is low, socialise when connection drops). It cannot differentiate profiles.
|
| 82 |
+
|
| 83 |
+
A trained agent should beat the heuristic on at least 2 of 3 profiles, with qualitatively different action sequences per profile — the introvert's week should look nothing like the workaholic's.
|
| 84 |
+
|
| 85 |
+
---
|
| 86 |
+
|
| 87 |
+
## How to run
|
| 88 |
+
|
| 89 |
+
Open [`training/RhythmEnv_GRPO_Training.ipynb`](../training/RhythmEnv_GRPO_Training.ipynb) in Colab with a T4 GPU runtime.
|
| 90 |
+
|
| 91 |
+
Run cells in order:
|
| 92 |
+
1. Install dependencies
|
| 93 |
+
2. Clone repo from HF Space
|
| 94 |
+
3. Verify environment
|
| 95 |
+
4. Run baseline evaluation (saves `baseline_results`)
|
| 96 |
+
5. Generate dataset
|
| 97 |
+
6. Load model (Qwen 2.5-3B + LoRA)
|
| 98 |
+
7. Setup reward functions
|
| 99 |
+
8. Configure training (`beta=0.01`, `max_completion_length=16`)
|
| 100 |
+
9. Train (`trainer.train()`)
|
| 101 |
+
10. Save model
|
| 102 |
+
11. Generate training plots
|
| 103 |
+
12. Evaluate trained model
|
| 104 |
+
13. Generate comparison chart (`baseline_vs_trained.png`)
|
| 105 |
+
|
| 106 |
+
---
|
| 107 |
+
|
| 108 |
+
## Expected training behaviour
|
| 109 |
+
|
| 110 |
+
Healthy run: `completion_length` stays at 3–16 tokens throughout, KL stays below 1.0, mean reward climbs from ~1.5 toward ~3.0 over 500 steps.
|
| 111 |
+
|
| 112 |
+
Warning signs: `completion_length` spiking above 50, `clipped_ratio` approaching 1.0, KL above 5.0. If any of these appear, the `beta=0.01` fix is not being applied.
|
| 113 |
+
|
| 114 |
+
---
|
| 115 |
+
|
| 116 |
+
## Output artifacts
|
| 117 |
+
|
| 118 |
+
After a successful run, download these and commit to the repo:
|
| 119 |
+
|
| 120 |
+
```
|
| 121 |
+
plots/training_loss.png — loss curve across 500 steps
|
| 122 |
+
plots/reward_curve.png — mean reward with ±1 std band
|
| 123 |
+
plots/baseline_vs_trained.png — comparison bar chart (random / heuristic / trained)
|
| 124 |
+
plots/eval_results.json — raw per-episode scores
|
| 125 |
+
```
|