NeerjaK commited on
Commit
1dfd8ce
·
verified ·
1 Parent(s): 22753c7

Done with LaTeX formatting

Browse files
Files changed (1) hide show
  1. blog.md +25 -15
blog.md CHANGED
@@ -30,7 +30,7 @@ Site Reliability Engineering is the canonical professional-task domain for this
30
  - **Real tool interaction.** An on-call engineer interleaves read-only investigation (`kubectl logs`, `promql_query`, `jaeger_search`) with mutating remediation (`rollout_undo`, `feature_flag_toggle`, `kubectl_apply`). The action surface is non-trivially large and the consequences of each action propagate through a directed graph of dependent services.
31
  - **Partial observability.** No single log, metric, or trace contains the root cause; evidence must be aggregated across heterogeneous telemetry while the system state continues to drift.
32
  - **Multi-step workflow under time pressure.** The blast radius of an incident grows monotonically with mean-time-to-resolution. Optimal policies cannot be greedy — they must trade off investigation depth against remediation latency.
33
- - **Causal world model.** The agent must internalize a topology graph in which a failure in service $s_i$ at time $t$ propagates to dependent services $\lbrace s_j : (s_i, s_j) \in E \rbrace$ at time $t + \Delta$, with $\Delta$ determined by retry budgets, circuit-breaker thresholds, and connection pool sizes.
34
 
35
  The submission additionally engages **Theme 4 — Self-Improvement** through its automatic curriculum (an attacker policy that generates scenarios at the frontier of the defender's ability) and **Theme 1 — Multi-Agent Interactions** through the asymmetric attacker–defender pairing trained jointly.
36
 
@@ -90,7 +90,7 @@ Twelve fault families are implemented as composable primitives that mutate `Micr
90
 
91
  $$\mathcal{F} = \lbrace\, \texttt{oom\_kill},\; \texttt{cpu\_hog},\; \texttt{network\_partition},\; \texttt{dns\_misconfig},\; \texttt{replica\_lag},\; \texttt{cache\_stampede},\; \texttt{http\_503\_loop},\; \texttt{deadlock},\; \texttt{disk\_full},\; \texttt{cert\_expiry},\; \texttt{clock\_skew},\; \texttt{gc\_pause}\, \rbrace$$
92
 
93
- Each fault $f \in \mathcal{F}$ defines a `required_remediation` set, a `root_cause_label`, and a parameterized `tick(graph, t)` function that determines how the symptom evolves over simulated time. This structure permits scenario specification at a coarse level (a `ScenarioSpec` is a tuple of topology, primary fault, optional secondary fault, inject service, latency, blast radius, metric noise, red herrings, deploy window, schema drift, seed, and max steps) while letting the simulator handle the dynamics.
94
 
95
  ### 2.5 Composable reward rubric
96
 
@@ -98,12 +98,16 @@ The reward is implemented using OpenEnv's composable Rubric API as a weighted su
98
 
99
  $$R \;=\; w_{\text{rec}} \cdot R_{\text{rec}} \;+\; w_{\text{rca}} \cdot R_{\text{rca}} \;+\; w_{\text{blast}} \cdot R_{\text{blast}} \;+\; w_{\text{safe}} \cdot R_{\text{safe}}$$
100
 
101
- with weights $(w_{\text{rec}},\, w_{\text{rca}},\, w_{\text{blast}},\, w_{\text{safe}}) = (0.35,\, 0.30,\, 0.25,\, 0.10)$ and:
102
 
103
- - $R_{\text{rec}} \in [0, 1]$: rewards correct remediation, paid only after `declare_resolved` and only if all required remediation actions for the active fault have fired. This deliberately *cannot* be earned by spamming destructive commands.
104
- - $R_{\text{rca}} \in [0, 1]$: scores root-cause-category match, presence of a timeline event for the root service, non-generic five-whys, and service-specific action items in the submitted RCA.
105
- - $R_{\text{blast}} \in [0, 1]$: penalizes prolonged customer-facing impact, computed as a function of elapsed time and current error rate at resolution.
106
- - $R_{\text{safe}} \in [0, 1]$: starts at $1.0$ and decrements by $0.5$ per unsafe action, with `kubectl_rollout_undo` or `kubectl_rollout_restart` against stateful services (`postgres-primary`, `redis-cache`) flagged as unsafe by default.
 
 
 
 
107
 
108
  An optional `REWARD_CAP` parameter clips total reward, supporting capped-vs-uncapped ablations.
109
 
@@ -115,11 +119,11 @@ The environment ships with six hand-authored seed scenarios spanning the canonic
115
 
116
  ## 3. Training methodology
117
 
118
- We compare three curriculum-generation strategies. All three use an identical defender architecture (`unsloth/Qwen2.5-3B-Instruct-bnb-4bit`, LoRA rank=16 alpha=32 targeting all attention and MLP projections, 29.9M trainable parameters out of 3.1B total, ~0.96%) and an identical training algorithm (GRPO via TRL on 2× Tesla T4 with batch size 2 per device, gradient accumulation 8, num_generations=2, learning rate $5 \times 10^{-6}$, max completion length 256 tokens). Only the scenario-sampling strategy differs.
119
 
120
  ### 3.1 GRPO training objective
121
 
122
- We use Group Relative Policy Optimization (Shao et al., DeepSeekMath, arXiv 2402.03300), which avoids learning a value network by computing advantages relative to the group mean within a sampled batch. For each prompt $q$, we sample $G$ responses $\lbrace o_i \rbrace_{i=1}^{G}$ from the current policy $\pi_\theta$ and compute group-relative advantages:
123
 
124
  $$A_i = \frac{R(o_i) \;-\; \mathrm{mean}\lbrace R(o_j) \rbrace_{j=1}^{G}}{\mathrm{std}\lbrace R(o_j) \rbrace_{j=1}^{G}}$$
125
 
@@ -127,7 +131,11 @@ The policy is updated with the clipped surrogate objective:
127
 
128
  $$\mathcal{J}_{\text{GRPO}}(\theta) = \mathbb{E}\!\left[\frac{1}{G}\sum_{i=1}^{G} \min\!\Big(\rho_i A_i,\;\; \text{clip}(\rho_i,\, 1{-}\epsilon,\, 1{+}\epsilon)\, A_i\Big) \;-\; \beta\, D_{\text{KL}}\!\left(\pi_\theta \,\|\, \pi_{\text{ref}}\right)\right]$$
129
 
130
- where $\rho_i = \pi_\theta(o_i \mid q) \;/\; \pi_{\theta_{\text{old}}}(o_i \mid q)$ is the importance ratio, $\epsilon$ is the clip range, and $\beta$ is the KL penalty coefficient against the reference (frozen base) model.
 
 
 
 
131
 
132
  ### 3.2 Method 1 — No-feedback static curriculum (baseline)
133
 
@@ -137,17 +145,17 @@ The simplest strategy, and the experimental control. Scenarios are drawn from a
137
 
138
  The second strategy implements an adaptive curriculum that operationalizes the **regret-based environment design** principle of Parker-Holder et al.'s ACCEL (ICML 2022, arXiv 2203.01302) and the broader unsupervised environment design framework of Dennis et al.'s PAIRED (NeurIPS 2020, arXiv 2012.02096). The "attacker" here is an algorithm, not an LLM: it maintains a buffer of scenarios, observes the defender's solve rates, and re-samples the buffer to bias training toward scenarios at the defender's frontier.
139
 
140
- Concretely, every 40 rollouts, the per-task reward log is aggregated into a per-scenario empirical solve probability $\hat{p}_s$, and the buffer is pruned and re-weighted using a difficulty-band sampling distribution that prioritizes scenarios with $\hat{p}_s$ near 0.5 (maximum Bernoulli variance). After a warmup period, new scenarios are added to the buffer through mutation operators that perturb the parent scenario along one of the `ScenarioSpec` axes (topology, fault type, inject service, red herrings, schema drift), with novelty filtering to reject duplicates. Buffer size is fixed and pruning preserves the highest-Bernoulli-variance entries — the operational analogue of Maximum Monte-Carlo regret used in the original ACCEL formulation.
141
 
142
  The interpretation is direct: the curriculum is *adversarial in expectation but cooperative in distribution* — it pushes the defender toward harder scenarios as soon as easier ones are mastered, while preserving sufficient solvable mass for credit assignment.
143
 
144
  ### 3.4 Method 3 — LLM attacker with self-play (SPICE-style)
145
 
146
- The third strategy is a faithful adaptation of **SPICE: Self-Play In Corpus Environments Improves Reasoning** (Liu et al., FAIR @ Meta, arXiv 2510.24684, October 2025). A second LLM acts as an *attacker* that generates scenarios by editing the YAML `ScenarioSpec`, and is itself trained via reinforcement learning. The training signal for the attacker is *not* whether the defender fails — that would incentivize unsolvable scenarios — but rather whether the defender's performance has **high variance** at the frontier of its current capability, formally a Gaussian-shaped reward peaking at solve probability $0.5$:
147
 
148
  $$r_{\text{attacker}}(s) = \exp\!\left(-\frac{\left(\widehat{\mathrm{Var}}\lbrace R(s) \rbrace \;-\; \tfrac{1}{4}\right)^{2}}{2\,\sigma^{2}}\right)$$
149
 
150
- where $\widehat{\mathrm{Var}}\lbrace R(s) \rbrace$ is the empirical Bernoulli variance of binarized defender returns over $K$ rollouts on scenario $s$, and $\sigma$ is a bandwidth hyperparameter. This is mathematically a smooth difficulty bandpass filter centred at frontier learning, and is strictly preferable to a naive maximum-regret reward because it has a single peaked optimum that prevents the attacker from exploiting "make it impossible" as a degenerate strategy. Both attacker and defender are updated jointly in alternating GRPO steps, with the attacker's action space restricted to schema-valid mutations of the `ScenarioSpec` — a hybrid family-with-parameters formulation that keeps the malformed-output rate manageable.
151
 
152
  ### 3.5 Reward shaping and prompt regime
153
 
@@ -204,7 +212,9 @@ The strongest reproducible reward-improvement artifact in this submission is the
204
  | **After 300 GRPO steps with feedback** | **0.905** |
205
  | Wall time | ~6.4 hours on 2× T4 (Kaggle free tier) |
206
 
207
- For context, the scripted-defender ceiling (a hand-tuned policy with full simulator access) achieves 0.921, and a random-action baseline achieves 0.27. Method 2 closes $\frac{0.905 - 0.638}{0.921 - 0.638} = 94.3\%$ of the gap from the untrained baseline to the scripted ceiling.
 
 
208
 
209
  ---
210
 
@@ -214,7 +224,7 @@ We want this section to do justice to the engineering reality of training a smal
214
 
215
  ### 5.1 The harder version of the dataset did not work
216
 
217
- Our initial design used a substantially larger and harder seed scenario set with more complex topologies, deeper dependency chains, and harder fault families (multi-root-cause incidents, schema drift mid-incident, adversarial red herrings). The reward function in that version was closer to a binary outcome signal — full credit only on correct remediation plus correct RCA, near-zero credit otherwise. Under that regime, **Qwen2.5-3B simply could not learn**: the per-rollout reward signal had near-zero variance because almost no rollouts succeeded, the GRPO advantage $A_i$ collapsed to noise, and 200 steps of training produced no measurable improvement over the random baseline. This is the canonical failure mode of RL with verifiable rewards on tasks above the model's capability frontier — it is precisely the problem that curriculum learning is supposed to solve, but at 3B parameters the model needs a much smoother path up.
218
 
219
  The fix was a deliberate downgrade of the task surface in three directions simultaneously: (i) we shrank to seven canonical services and 12 fault primitives rather than the wider topology corpus we had built; (ii) we adopted "easy-mode" prompts that scaffold the agent with the affected service and expected remediation category; (iii) we implemented the shaped partial-credit reward described in §3.5, providing dense gradient signal even on partially-incorrect rollouts. The Method-2 results reported in §4 are *with* these scaffolds. We view this not as a weakness of the approach but as the empirical price of training a small model — a price that, per the SPICE paper and the broader self-play literature, is significantly reduced at the 4B–8B scale.
220
 
 
30
  - **Real tool interaction.** An on-call engineer interleaves read-only investigation (`kubectl logs`, `promql_query`, `jaeger_search`) with mutating remediation (`rollout_undo`, `feature_flag_toggle`, `kubectl_apply`). The action surface is non-trivially large and the consequences of each action propagate through a directed graph of dependent services.
31
  - **Partial observability.** No single log, metric, or trace contains the root cause; evidence must be aggregated across heterogeneous telemetry while the system state continues to drift.
32
  - **Multi-step workflow under time pressure.** The blast radius of an incident grows monotonically with mean-time-to-resolution. Optimal policies cannot be greedy — they must trade off investigation depth against remediation latency.
33
+ - **Causal world model.** The agent must internalize a topology graph in which a failure in service sᵢ at time t propagates to dependent services { sⱼ : (sᵢ, sⱼ) ∈ E } at time t + Δ, with Δ determined by retry budgets, circuit-breaker thresholds, and connection pool sizes.
34
 
35
  The submission additionally engages **Theme 4 — Self-Improvement** through its automatic curriculum (an attacker policy that generates scenarios at the frontier of the defender's ability) and **Theme 1 — Multi-Agent Interactions** through the asymmetric attacker–defender pairing trained jointly.
36
 
 
90
 
91
  $$\mathcal{F} = \lbrace\, \texttt{oom\_kill},\; \texttt{cpu\_hog},\; \texttt{network\_partition},\; \texttt{dns\_misconfig},\; \texttt{replica\_lag},\; \texttt{cache\_stampede},\; \texttt{http\_503\_loop},\; \texttt{deadlock},\; \texttt{disk\_full},\; \texttt{cert\_expiry},\; \texttt{clock\_skew},\; \texttt{gc\_pause}\, \rbrace$$
92
 
93
+ Each fault f ∈ 𝓕 defines a `required_remediation` set, a `root_cause_label`, and a parameterized `tick(graph, t)` function that determines how the symptom evolves over simulated time. This structure permits scenario specification at a coarse level (a `ScenarioSpec` is a tuple of topology, primary fault, optional secondary fault, inject service, latency, blast radius, metric noise, red herrings, deploy window, schema drift, seed, and max steps) while letting the simulator handle the dynamics.
94
 
95
  ### 2.5 Composable reward rubric
96
 
 
98
 
99
  $$R \;=\; w_{\text{rec}} \cdot R_{\text{rec}} \;+\; w_{\text{rca}} \cdot R_{\text{rca}} \;+\; w_{\text{blast}} \cdot R_{\text{blast}} \;+\; w_{\text{safe}} \cdot R_{\text{safe}}$$
100
 
101
+ with weights:
102
 
103
+ $$(w_{\text{rec}},\, w_{\text{rca}},\, w_{\text{blast}},\, w_{\text{safe}}) = (0.35,\, 0.30,\, 0.25,\, 0.10)$$
104
+
105
+ and:
106
+
107
+ - **R_rec ∈ [0, 1]:** rewards correct remediation, paid only after `declare_resolved` and only if all required remediation actions for the active fault have fired. This deliberately *cannot* be earned by spamming destructive commands.
108
+ - **R_rca ∈ [0, 1]:** scores root-cause-category match, presence of a timeline event for the root service, non-generic five-whys, and service-specific action items in the submitted RCA.
109
+ - **R_blast ∈ [0, 1]:** penalizes prolonged customer-facing impact, computed as a function of elapsed time and current error rate at resolution.
110
+ - **R_safe ∈ [0, 1]:** starts at 1.0 and decrements by 0.5 per unsafe action, with `kubectl_rollout_undo` or `kubectl_rollout_restart` against stateful services (`postgres-primary`, `redis-cache`) flagged as unsafe by default.
111
 
112
  An optional `REWARD_CAP` parameter clips total reward, supporting capped-vs-uncapped ablations.
113
 
 
119
 
120
  ## 3. Training methodology
121
 
122
+ We compare three curriculum-generation strategies. All three use an identical defender architecture (`unsloth/Qwen2.5-3B-Instruct-bnb-4bit`, LoRA rank=16 alpha=32 targeting all attention and MLP projections, 29.9M trainable parameters out of 3.1B total, ~0.96%) and an identical training algorithm (GRPO via TRL on 2× Tesla T4 with batch size 2 per device, gradient accumulation 8, num_generations=2, learning rate 5×10⁻⁶, max completion length 256 tokens). Only the scenario-sampling strategy differs.
123
 
124
  ### 3.1 GRPO training objective
125
 
126
+ We use Group Relative Policy Optimization (Shao et al., DeepSeekMath, arXiv 2402.03300), which avoids learning a value network by computing advantages relative to the group mean within a sampled batch. For each prompt q, we sample G responses { oᵢ }ᵢ₌₁ᴳ from the current policy πθ and compute group-relative advantages:
127
 
128
  $$A_i = \frac{R(o_i) \;-\; \mathrm{mean}\lbrace R(o_j) \rbrace_{j=1}^{G}}{\mathrm{std}\lbrace R(o_j) \rbrace_{j=1}^{G}}$$
129
 
 
131
 
132
  $$\mathcal{J}_{\text{GRPO}}(\theta) = \mathbb{E}\!\left[\frac{1}{G}\sum_{i=1}^{G} \min\!\Big(\rho_i A_i,\;\; \text{clip}(\rho_i,\, 1{-}\epsilon,\, 1{+}\epsilon)\, A_i\Big) \;-\; \beta\, D_{\text{KL}}\!\left(\pi_\theta \,\|\, \pi_{\text{ref}}\right)\right]$$
133
 
134
+ where ρᵢ is the importance ratio:
135
+
136
+ $$\rho_i = \frac{\pi_\theta(o_i \mid q)}{\pi_{\theta_{\text{old}}}(o_i \mid q)}$$
137
+
138
+ ε is the clip range, and β is the KL penalty coefficient against the reference (frozen base) model.
139
 
140
  ### 3.2 Method 1 — No-feedback static curriculum (baseline)
141
 
 
145
 
146
  The second strategy implements an adaptive curriculum that operationalizes the **regret-based environment design** principle of Parker-Holder et al.'s ACCEL (ICML 2022, arXiv 2203.01302) and the broader unsupervised environment design framework of Dennis et al.'s PAIRED (NeurIPS 2020, arXiv 2012.02096). The "attacker" here is an algorithm, not an LLM: it maintains a buffer of scenarios, observes the defender's solve rates, and re-samples the buffer to bias training toward scenarios at the defender's frontier.
147
 
148
+ Concretely, every 40 rollouts, the per-task reward log is aggregated into a per-scenario empirical solve probability p̂ₛ, and the buffer is pruned and re-weighted using a difficulty-band sampling distribution that prioritizes scenarios with p̂ₛ near 0.5 (maximum Bernoulli variance). After a warmup period, new scenarios are added to the buffer through mutation operators that perturb the parent scenario along one of the `ScenarioSpec` axes (topology, fault type, inject service, red herrings, schema drift), with novelty filtering to reject duplicates. Buffer size is fixed and pruning preserves the highest-Bernoulli-variance entries — the operational analogue of Maximum Monte-Carlo regret used in the original ACCEL formulation.
149
 
150
  The interpretation is direct: the curriculum is *adversarial in expectation but cooperative in distribution* — it pushes the defender toward harder scenarios as soon as easier ones are mastered, while preserving sufficient solvable mass for credit assignment.
151
 
152
  ### 3.4 Method 3 — LLM attacker with self-play (SPICE-style)
153
 
154
+ The third strategy is a faithful adaptation of **SPICE: Self-Play In Corpus Environments Improves Reasoning** (Liu et al., FAIR @ Meta, arXiv 2510.24684, October 2025). A second LLM acts as an *attacker* that generates scenarios by editing the YAML `ScenarioSpec`, and is itself trained via reinforcement learning. The training signal for the attacker is *not* whether the defender fails — that would incentivize unsolvable scenarios — but rather whether the defender's performance has **high variance** at the frontier of its current capability, formally a Gaussian-shaped reward peaking at solve probability 0.5:
155
 
156
  $$r_{\text{attacker}}(s) = \exp\!\left(-\frac{\left(\widehat{\mathrm{Var}}\lbrace R(s) \rbrace \;-\; \tfrac{1}{4}\right)^{2}}{2\,\sigma^{2}}\right)$$
157
 
158
+ where Var̂{ R(s) } is the empirical Bernoulli variance of binarized defender returns over K rollouts on scenario s, and σ is a bandwidth hyperparameter. This is mathematically a smooth difficulty bandpass filter centred at frontier learning, and is strictly preferable to a naive maximum-regret reward because it has a single peaked optimum that prevents the attacker from exploiting "make it impossible" as a degenerate strategy. Both attacker and defender are updated jointly in alternating GRPO steps, with the attacker's action space restricted to schema-valid mutations of the `ScenarioSpec` — a hybrid family-with-parameters formulation that keeps the malformed-output rate manageable.
159
 
160
  ### 3.5 Reward shaping and prompt regime
161
 
 
212
  | **After 300 GRPO steps with feedback** | **0.905** |
213
  | Wall time | ~6.4 hours on 2× T4 (Kaggle free tier) |
214
 
215
+ For context, the scripted-defender ceiling (a hand-tuned policy with full simulator access) achieves 0.921, and a random-action baseline achieves 0.27. Method 2 closes 94.3% of the gap from the untrained baseline to the scripted ceiling:
216
+
217
+ $$\frac{0.905 - 0.638}{0.921 - 0.638} = 94.3\%$$
218
 
219
  ---
220
 
 
224
 
225
  ### 5.1 The harder version of the dataset did not work
226
 
227
+ Our initial design used a substantially larger and harder seed scenario set with more complex topologies, deeper dependency chains, and harder fault families (multi-root-cause incidents, schema drift mid-incident, adversarial red herrings). The reward function in that version was closer to a binary outcome signal — full credit only on correct remediation plus correct RCA, near-zero credit otherwise. Under that regime, **Qwen2.5-3B simply could not learn**: the per-rollout reward signal had near-zero variance because almost no rollouts succeeded, the GRPO advantage Aᵢ collapsed to noise, and 200 steps of training produced no measurable improvement over the random baseline. This is the canonical failure mode of RL with verifiable rewards on tasks above the model's capability frontier — it is precisely the problem that curriculum learning is supposed to solve, but at 3B parameters the model needs a much smoother path up.
228
 
229
  The fix was a deliberate downgrade of the task surface in three directions simultaneously: (i) we shrank to seven canonical services and 12 fault primitives rather than the wider topology corpus we had built; (ii) we adopted "easy-mode" prompts that scaffold the agent with the affected service and expected remediation category; (iii) we implemented the shaped partial-credit reward described in §3.5, providing dense gradient signal even on partially-incorrect rollouts. The Method-2 results reported in §4 are *with* these scaffolds. We view this not as a weakness of the approach but as the empirical price of training a small model — a price that, per the SPICE paper and the broader self-play literature, is significantly reduced at the 4B–8B scale.
230