Sriram611 commited on
Commit
d79beef
Β·
verified Β·
1 Parent(s): 0bbfc73

Update Blog.md

Browse files
Files changed (1) hide show
  1. Blog.md +146 -129
Blog.md CHANGED
@@ -1,130 +1,147 @@
1
- # RevOps Gym β€” I Built an RL Environment That Actively Tries to Destroy Your Company
2
-
3
- Most RL environments are static. The world doesn't fight back. You learn the rules, you optimize, you win.
4
-
5
- I wanted to build something that fights back.
6
-
7
- ---
8
-
9
- ## The Problem I Was Trying to Solve
10
-
11
- Running a SaaS company is not a puzzle with a fixed solution. It's a moving target. You're balancing revenue growth, customer churn, marketing spend, and cash runway β€” all at the same time β€” while the market keeps throwing curveballs at you.
12
-
13
- I wanted to see if a small LLM could learn to handle that. Not just answer questions *about* business strategy, but actually *make decisions* inside a simulation and get measurably better at it through training.
14
-
15
- That's RevOps Gym.
16
-
17
- ---
18
-
19
- ## What It Is
20
-
21
- RevOps Gym is an RL training environment where an LLM agent β€” I call it the **Pilot** β€” has to manage a B2B SaaS company across 30 decision steps.
22
-
23
- Every episode starts fresh: different starting revenue, different costs, different churn rate. The agent sees a live dashboard of its company's health and picks from 10 strategic actions like increasing marketing, hiring support staff, raising prices, or pivoting to a new customer segment.
24
-
25
- The goal: keep Monthly Recurring Revenue (MRR) above $20,000. The VC fires you if it drops below that. Survive 30 steps and you win.
26
-
27
- Simple enough. But here's the twist.
28
-
29
- ---
30
-
31
- ## The Crisis Engine β€” This Is What Makes It Different
32
-
33
- Every 3 steps, a **Crisis Engine** (powered by Gemini 2.0 Flash) wakes up, looks at the agent's current state, finds its weakest metric, and hits it with the most painful crisis it can.
34
-
35
- High churn already? Expect a competitor to launch aggressive pricing.
36
- CAC already climbing? Ad costs are about to double.
37
- Cash runway getting thin? Surprise infrastructure bill incoming.
38
-
39
- It's not random. It's targeted. The environment reads you and attacks your blind spots β€” just like real markets do.
40
-
41
- Some of the crises it can throw at you:
42
-
43
- - `CHURN_SPIKE` β€” competitor launches aggressive pricing
44
- - `CAC_EXPLOSION` β€” ad costs double overnight
45
- - `SUPPORT_CRISIS` β€” key engineers quit, satisfaction tanks
46
- - `ENTERPRISE_CHURN` β€” top 3 accounts cancel at once
47
- - `CASH_CRUNCH` β€” unexpected bill, runway shrinks fast
48
-
49
- This means the agent can't just memorize a fixed sequence of actions and win. It has to actually reason about its current situation and adapt. That's the whole point.
50
-
51
- ---
52
-
53
- ## How the Reward Works
54
-
55
- I used 4 independent reward signals instead of one, and this was one of the most important design decisions I made.
56
-
57
- | Signal | Weight | What It's Measuring |
58
- |---|---|---|
59
- | LTV/CAC Ratio | 35% | Are you acquiring customers profitably? (target: 3x+) |
60
- | MRR Growth | 30% | Is revenue going up or down vs last step? |
61
- | Burn Efficiency | 20% | Are you spending sustainably? |
62
- | Survival Bonus | 15% | Are you above the VC floor with healthy runway? |
63
-
64
- If your company dies: **βˆ’2.0 penalty on top of everything.**
65
-
66
- Why 4 signals? Because a single reward is easy to game. An agent optimizing only for MRR will just blast marketing spend until it burns through all its cash. Multiple independent signals force the agent to balance real tradeoffs β€” which is exactly what the task actually demands.
67
-
68
- ---
69
-
70
- ## The Training Results
71
-
72
- I trained **Qwen2.5-1.5B-Instruct** using GRPO (via HuggingFace TRL + Unsloth) on a Colab T4. Compared the trained model against the untrained baseline on the same environment.
73
-
74
- | Metric | Baseline | Trained | Change |
75
- |---|---|---|---|
76
- | Mean Episode Reward | ~0.18 | ~0.41 | **+128%** |
77
- | Mean Final MRR | ~$31K | ~$58K | **+87%** |
78
- | Survival Rate | ~30% | ~70% | **+133%** |
79
-
80
- The baseline model basically picks the same action over and over regardless of what's happening. The trained model actually adapts β€” it responds differently to a `CAC_EXPLOSION` crisis versus a `CHURN_SPIKE`, and it learned to pull back spending when runway gets low instead of doubling down.
81
-
82
- That behavior change is real and it came entirely from training on this environment.
83
-
84
- ---
85
-
86
- ## Why I Think This Matters Beyond the Hackathon
87
-
88
- Business decision-making under pressure is one of those things LLMs *seem* good at when you chat with them, but struggle with when you actually stress-test their reasoning over multiple steps.
89
-
90
- This environment creates a training ground for exactly that β€” multi-step strategic thinking, adapting to adversarial conditions, managing competing constraints. The domain is real, the decisions are meaningful, and the skills that transfer out of this simulation are genuinely useful.
91
-
92
- A model trained on RevOps Gym isn't just learning to win a game. It's learning to reason under pressure with incomplete information. That's a capability that matters.
93
-
94
- ---
95
-
96
- ## A Few Things I Learned Building This
97
-
98
- **Start with curriculum learning.** My first training runs on hard difficulty gave the model near-zero reward for hundreds of steps β€” basically no learning signal at all. Starting on easy mode first, then ramping up, made a huge difference.
99
-
100
- **The adversarial Crisis Engine accidentally solved reward hacking.** I was worried about the agent gaming the reward, but the targeted crises made that nearly impossible. If you over-optimize one metric, the environment hammers that exact metric 3 steps later.
101
-
102
- **Inspect your generations during training, not just the reward curve.** The reward going up doesn't always mean the model is learning what you think it's learning. Looking at actual outputs caught some weird behavior early on.
103
-
104
- ---
105
-
106
- ## Quick Start
107
-
108
- ```python
109
- from revops_gym import RevOpsEnv
110
-
111
- env = RevOpsEnv(crisis_every=3, difficulty="normal")
112
- obs = env.reset()
113
- print(obs.to_prompt_text())
114
-
115
- obs = env.step({"action_type": "hire_support", "magnitude": 0.8})
116
- print(f"Reward: {obs.reward_last_step:.3f} | MRR: ${obs.mrr:,.0f}")
117
- ```
118
-
119
- ---
120
-
121
- ## Links
122
-
123
- - πŸ€— **HF Space**: [Sriram611/revops-gym](https://huggingface.co/spaces/Sriram611/revops-gym)
124
- - πŸ““ **Training Colab**: [Open in Colab](https://colab.research.google.com/drive/1Gg-odqjf1eQLlYZe8LDkqzTtKWb3blz9?usp=sharing)
125
-
126
- - πŸ€— **Trained Model**: [Sriram611/revops-gym-model](https://huggingface.co/Sriram611/revops-gym-model)
127
-
128
- ---
129
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  *Built for the OpenEnv Hackathon India, April 2026 β€” Theme #3.1 World Modeling + Theme #1 Multi-Agent Adversarial.*
 
1
+ # RevOps Gym β€” I Built an RL Environment That Actively Tries to Destroy Your Company
2
+
3
+ Most RL environments are static. The world doesn't fight back. You learn the rules, you optimize, you win.
4
+
5
+ I wanted to build something that fights back.
6
+
7
+ ---
8
+
9
+ ## The Problem I Was Trying to Solve
10
+
11
+ Running a SaaS company is not a puzzle with a fixed solution. It's a moving target. You're balancing revenue growth, customer churn, marketing spend, and cash runway β€” all at the same time β€” while the market keeps throwing curveballs at you.
12
+
13
+ I wanted to see if a small LLM could learn to handle that. Not just answer questions *about* business strategy, but actually *make decisions* inside a simulation and get measurably better at it through training.
14
+
15
+ That's RevOps Gym.
16
+
17
+ ---
18
+
19
+ ## What It Is
20
+
21
+ RevOps Gym is an RL training environment where an LLM agent β€” I call it the **Pilot** β€” has to manage a B2B SaaS company across 30 decision steps.
22
+
23
+ Every episode starts fresh: different starting revenue, different costs, different churn rate. The agent sees a live dashboard of its company's health and picks from 10 strategic actions like increasing marketing, hiring support staff, raising prices, or pivoting to a new customer segment.
24
+
25
+ The goal: keep Monthly Recurring Revenue (MRR) above $20,000. The VC fires you if it drops below that. Survive 30 steps and you win.
26
+
27
+ Simple enough. But here's the twist.
28
+
29
+ ---
30
+
31
+ ## The Crisis Engine β€” This Is What Makes It Different
32
+
33
+ Every 3 steps, a **Crisis Engine** (powered by Gemini 2.0 Flash) wakes up, looks at the agent's current state, finds its weakest metric, and hits it with the most painful crisis it can.
34
+
35
+ High churn already? Expect a competitor to launch aggressive pricing.
36
+ CAC already climbing? Ad costs are about to double.
37
+ Cash runway getting thin? Surprise infrastructure bill incoming.
38
+
39
+ It's not random. It's targeted. The environment reads you and attacks your blind spots β€” just like real markets do.
40
+
41
+ Some of the crises it can throw at you:
42
+
43
+ - `CHURN_SPIKE` β€” competitor launches aggressive pricing
44
+ - `CAC_EXPLOSION` β€” ad costs double overnight
45
+ - `SUPPORT_CRISIS` β€” key engineers quit, satisfaction tanks
46
+ - `ENTERPRISE_CHURN` β€” top 3 accounts cancel at once
47
+ - `CASH_CRUNCH` β€” unexpected bill, runway shrinks fast
48
+
49
+ This means the agent can't just memorize a fixed sequence of actions and win. It has to actually reason about its current situation and adapt. That's the whole point.
50
+
51
+ ---
52
+
53
+ ## How the Reward Works
54
+
55
+ I used 4 independent reward signals instead of one, and this was one of the most important design decisions I made.
56
+
57
+ | Signal | Weight | What It's Measuring |
58
+ |---|---|---|
59
+ | LTV/CAC Ratio | 35% | Are you acquiring customers profitably? (target: 3x+) |
60
+ | MRR Growth | 30% | Is revenue going up or down vs last step? |
61
+ | Burn Efficiency | 20% | Are you spending sustainably? |
62
+ | Survival Bonus | 15% | Are you above the VC floor with healthy runway? |
63
+
64
+ If your company dies: **βˆ’2.0 penalty on top of everything.**
65
+
66
+ Why 4 signals? Because a single reward is easy to game. An agent optimizing only for MRR will just blast marketing spend until it burns through all its cash. Multiple independent signals force the agent to balance real tradeoffs β€” which is exactly what the task actually demands.
67
+
68
+ ---
69
+ ## Training Progress
70
+ Below is a snapshot of the GRPO training process in Colab. You can see the model starting to stabilize its completion lengths and reward mean as it moves through the steps.
71
+
72
+ ![GRPO Training Logs](training_logs.jpg)
73
+
74
+ ---
75
+ ## The Training Results
76
+
77
+ I trained **Qwen2.5-1.5B-Instruct** using GRPO (via HuggingFace TRL + Unsloth) on a Colab T4. Compared the trained model against the untrained baseline on the same environment.
78
+
79
+ | Metric | Baseline | Trained | Change |
80
+ |---|---|---|---|
81
+ | Mean Episode Reward | ~0.18 | ~0.41 | **+128%** |
82
+ | Mean Final MRR | ~$31K | ~$58K | **+87%** |
83
+ | Survival Rate | ~30% | ~70% | **+133%** |
84
+
85
+ The baseline model basically picks the same action over and over regardless of what's happening. The trained model actually adapts β€” it responds differently to a `CAC_EXPLOSION` crisis versus a `CHURN_SPIKE`, and it learned to pull back spending when runway gets low instead of doubling down.
86
+
87
+ That behavior change is real and it came entirely from training on this environment.
88
+
89
+ ---
90
+ ## Reward vs. Loss
91
+ The training curves show a clear upward trend in mean reward. While RL training can be noisy, the general trajectory confirms the agent is successfully learning to navigate the Crisis Engine.
92
+
93
+ ![RevOps Gym Training Curves](training_curves.png)
94
+
95
+ ---
96
+ ### Baseline vs. Trained Comparison
97
+ When put head-to-head in the same environment, the trained agent significantly outperforms the baseline across every core business metric.
98
+
99
+ ![RevOps Gym Comparison Results](results_comparison.png)
100
+
101
+ ---
102
+
103
+ ## Why I Think This Matters Beyond the Hackathon
104
+
105
+ Business decision-making under pressure is one of those things LLMs *seem* good at when you chat with them, but struggle with when you actually stress-test their reasoning over multiple steps.
106
+
107
+ This environment creates a training ground for exactly that β€” multi-step strategic thinking, adapting to adversarial conditions, managing competing constraints. The domain is real, the decisions are meaningful, and the skills that transfer out of this simulation are genuinely useful.
108
+
109
+ A model trained on RevOps Gym isn't just learning to win a game. It's learning to reason under pressure with incomplete information. That's a capability that matters.
110
+
111
+ ---
112
+
113
+ ## A Few Things I Learned Building This
114
+
115
+ **Start with curriculum learning.** My first training runs on hard difficulty gave the model near-zero reward for hundreds of steps β€” basically no learning signal at all. Starting on easy mode first, then ramping up, made a huge difference.
116
+
117
+ **The adversarial Crisis Engine accidentally solved reward hacking.** I was worried about the agent gaming the reward, but the targeted crises made that nearly impossible. If you over-optimize one metric, the environment hammers that exact metric 3 steps later.
118
+
119
+ **Inspect your generations during training, not just the reward curve.** The reward going up doesn't always mean the model is learning what you think it's learning. Looking at actual outputs caught some weird behavior early on.
120
+
121
+ ---
122
+
123
+ ## Quick Start
124
+
125
+ ```python
126
+ from revops_gym import RevOpsEnv
127
+
128
+ env = RevOpsEnv(crisis_every=3, difficulty="normal")
129
+ obs = env.reset()
130
+ print(obs.to_prompt_text())
131
+
132
+ obs = env.step({"action_type": "hire_support", "magnitude": 0.8})
133
+ print(f"Reward: {obs.reward_last_step:.3f} | MRR: ${obs.mrr:,.0f}")
134
+ ```
135
+
136
+ ---
137
+
138
+ ## Links
139
+
140
+ - πŸ€— **HF Space**: [Sriram611/revops-gym](https://huggingface.co/spaces/Sriram611/revops-gym)
141
+ - πŸ““ **Training Colab**: [Open in Colab](https://colab.research.google.com/drive/1Gg-odqjf1eQLlYZe8LDkqzTtKWb3blz9?usp=sharing)
142
+
143
+ - πŸ€— **Trained Model**: [Sriram611/revops-gym-model](https://huggingface.co/Sriram611/revops-gym-model)
144
+
145
+ ---
146
+
147
  *Built for the OpenEnv Hackathon India, April 2026 β€” Theme #3.1 World Modeling + Theme #1 Multi-Agent Adversarial.*