final: polish README (RLVR specs) and cleanup scratch scripts
Browse files- README.md +19 -6
- verify_repetition.py +0 -39
README.md
CHANGED
|
@@ -6,11 +6,24 @@ sdk: docker
|
|
| 6 |
app_port: 7860
|
| 7 |
base_path: /dashboard/
|
| 8 |
---
|
| 9 |
-
#
|
| 10 |
|
| 11 |
-
**PolicyEvolverEnv** is an OpenEnv-compliant reinforcement learning environment designed for the Meta × PyTorch × Scaler Hackathon.
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
PolicyEvolverEnv is a real-world governance sandbox where an AI agent learns to **design and evolve governance policies** through meta-reasoning over real-world operational data. In modern platforms (social media, enterprise HR, e-commerce), static policies quickly become outdated or vaguely applied, leading to inconsistent enforcement, false-positive moderation, and unrecognized fraud.
|
| 15 |
|
| 16 |
This environment simulates this challenge by presenting the agent with a corpus of operational data alongside an existing policy framework. The agent's goal is to analyze the outcomes, identify systemic flaws or ambiguities, and act directly on the policies to optimize governance outcomes. This directly tackles live production problems faced by platforms like Meta.
|
|
@@ -28,12 +41,12 @@ The environment represents the **Reinforcement Learning from Verifiable Rewards
|
|
| 28 |
### 2. The Gradio "Judge Console": How it Works
|
| 29 |
The dashboard we built (`server/app.py`) is the human-readable window into this environment. It’s designed as a **Command & Control** center for a "Policy Judge."
|
| 30 |
|
| 31 |
-
####
|
| 32 |
* **Environment Best Score**: This tracks the highest score achieved in this session. It represents the "Gold Standard" the agent is aiming for.
|
| 33 |
* **Remaining Execution Steps**: Each "Episode" has a limit (5 steps). The agent must improve the policy within this budget. This forces **Strategic Efficiency**.
|
| 34 |
* **Latest Strategic Reward**: Every time you click "Execute," the Grader (`server/grader.py`) analyzes your proposal. If it’s vague, you get a low reward (0.1–0.3). If it’s specific and measurable, you get a high reward (0.8–0.9).
|
| 35 |
|
| 36 |
-
####
|
| 37 |
* **Data Corpus (Tabular View)**: These are the "Facts on the Ground." These are real-world incidents (e.g., a post flagged for 'harassment' vs one that wasn't).
|
| 38 |
* **Active Framework**: This shows the current "Code of Law."
|
| 39 |
* **The Workflow**: Your goal is to find an incident in the Corpus that doesn't fit correctly into the Framework, then use the bottom console to fix it.
|
|
@@ -142,7 +155,7 @@ The following baseline scores were achieved using the reference agent (Gemini 2.
|
|
| 142 |
## 📈 Strategic Reward Evolution & RLVR
|
| 143 |
PolicyEvolverEnv serves as the **Strategic Sandbox** for the **Reinforcement Finetuning (RLVR)** stage of the modern LLM training pipeline. Unlike static evaluation, this environment enables agents to refine their strategies iteratively based on high-quality, verifiable feedback.
|
| 144 |
|
| 145 |
-

|
| 159 |
|
| 160 |
### 🧠 How It Works: The Iterative Learning Process
|
| 161 |
1. **Refinement Hub**: The baseline agent tracks its previous rewards and actions through the observation's metadata (`info`).
|
verify_repetition.py
DELETED
|
@@ -1,39 +0,0 @@
|
|
| 1 |
-
import asyncio
|
| 2 |
-
import os
|
| 3 |
-
import sys
|
| 4 |
-
|
| 5 |
-
# Add current directory to path so we can import everything correctly
|
| 6 |
-
sys.path.insert(0, os.getcwd())
|
| 7 |
-
|
| 8 |
-
from server.environment import PolicyEvolverEnvironment
|
| 9 |
-
from models import Action
|
| 10 |
-
|
| 11 |
-
async def verify_repetition():
|
| 12 |
-
env = PolicyEvolverEnvironment()
|
| 13 |
-
# Reset to start fresh
|
| 14 |
-
obs1 = env.reset(task_id="task_easy")
|
| 15 |
-
|
| 16 |
-
same_action = {
|
| 17 |
-
"action_type": "propose_clarification",
|
| 18 |
-
"ambiguous_term": "appropriate",
|
| 19 |
-
"suggested_definition": "Behavior is defined as appropriate when it specifically follows the community guidelines, meaning it does not include excessive slurs and meets the 5% threshold for verified user reports.",
|
| 20 |
-
"justification": "The current policy leads to inconsistent and subjective moderation because it is unclear and varies between interpreters.",
|
| 21 |
-
"think": ""
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
# First step
|
| 25 |
-
print("\n--- Step 1 ---")
|
| 26 |
-
res1 = env.step(same_action)
|
| 27 |
-
print(f"Step 1 Reward: {res1.reward}")
|
| 28 |
-
|
| 29 |
-
# Second step with identical action
|
| 30 |
-
print("\n--- Step 2 (Repeat) ---")
|
| 31 |
-
res2 = env.step(same_action)
|
| 32 |
-
print(f"Step 2 Reward: {res2.reward}")
|
| 33 |
-
|
| 34 |
-
# Assert
|
| 35 |
-
assert res2.reward < res1.reward, f"Repeated action should score lower! res2={res2.reward}, res1={res1.reward}"
|
| 36 |
-
print("\n✅ Anti-repetition test passed! Reward was penalized as expected.")
|
| 37 |
-
|
| 38 |
-
if __name__ == "__main__":
|
| 39 |
-
asyncio.run(verify_repetition())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|