Views
No views yet
generate_patch — Generate minimal-token fix for vulnerabilityvalidate_patch — Run tests + regression checkssubmit_pr_patch — Submit validated patchupdate_training_dataset — Auto-append successful episodesescalate_tier — Advance Tier 1→2→3 on success thresholds1from curriculum_agent.self_play_loop import SelfPlayLoop
2
3loop = SelfPlayLoop()
4result = loop.run_episode(
5 vulnerability="md5_password_hashing",
6 vulnerable_code="""
7import hashlib
8def hash_password(password):
9 return hashlib.md5(password.encode()).hexdigest()
10"""
11)
12# Result: 15-token patch, 3/3 tests pass, 0 regressions
13# Mercor reward: 1.0 (capped, 2.5x Tier 1 bonus)| Tier | Name | Token Budget | Unlock Threshold |
|---|---|---|---|
| 1 | One-Line Fix | 0–50 tokens | 80% success + 10 patches |
| 2 | Function Rewrite | 51–200 tokens | 75% success + 8 patches |
| 3 | Architectural Patch | 201+ tokens | 70% success + 5 patches |
R = (1 / (1 + alpha * max(0, tokens - ideal))) * test_pass * (1 - regression) * tier_bonus
capped at 1.0curriculum_agent/tier_manager.py — Tier progression and loggingcurriculum_agent/patch_generator.py — Minimal-token patch generationcurriculum_agent/patch_validator.py — Test + regression validationcurriculum_agent/mercor_reward.py — Reward computationcurriculum_agent/self_play_loop.py — Full self-play episode loopdemo_beat11.py — Beat 11 standalone demo| Action | Reward |
|---|---|
| Tier 1 patch (≤50 tok) | +100 |
| 100% test pass | +80 |
| Zero regressions | +60 |
| Token count penalty | -40 |