DC-Ops: Teaching a 7B Model to Run a Datacenter

, ,

Teaching a 7B Model to Run a Datacenter

A condensed account of building a physics-grounded RL training pipeline for datacenter operations: a custom environment, teacher-distilled SFT, and live-simulation GRPO, on a single AMD Instinct MI300X.

Final Model: Melikshah/dc_ops_grpo_lora | Teacher Dataset: Melikshah/dc-ops-sft-data | Environment (HF Spaces): Melikshah/dc_ops_env | Repo: TheDeadcoder/dc_ops_training


The Stack

ROCm 7.2 · PyTorch 2.10 · vLLM 0.19.1 · Unsloth 2026.4.4 · TRL 0.21.0 · HuggingFace Transformers 4.54.1


1. Why This Problem Matters

Datacenters are the physical substrate of modern AI. Every GPU cluster runs inside a facility kept alive by NOC operators who watch dashboards, interpret alerts, and issue commands to cooling units, power distribution, and UPS banks. When something fails at 3 AM, the speed and correctness of their response separates a footnote in a post-mortem from a multi-million-dollar outage.

The question I wanted to answer: can a language model actually do that job? Not simulate it loosely, but reason about live thermal and power dynamics, issue the right commands in the right order, and recover a failing facility from a multi-fault cascade.

This is not a text-matching problem. There is no correct answer to retrieve, and the physics do not care about fluent prose. A model that hallucinates a plausible command, diagnosing a PDU when a CRAC compressor just failed, loses time while the inlet temperature climbs past the ASHRAE allowable limit. The environment has to be real enough that the model cannot game it, which forced me to build the pipeline from scratch.


2. The Environment: DC-Ops

DC-Ops is a physics-based datacenter operations environment I built on Meta’s OpenEnv framework. It simulates a complete facility in real time: RC thermal networks per cooling zone, UPS charge-discharge dynamics, diesel generator startup, and automatic transfer switch behavior. The agent reads a text-rendered NOC dashboard and issues natural-language commands. It is fully open-source and deployed on HuggingFace Space, with a web interface, a full OpenAPI schema, and native TRL/GRPO integration via the OpenEnv environment_factory pattern.

2.1 Scenarios and Difficulty

I designed six operational scenarios across three difficulty tiers, covering thermal and power faults:

ID Scenario Difficulty Type Fault
A1 Cooling Setpoint Optimization Easy Thermal CRACs at 15°C (wasteful overcooling)
A2 Thermal Event Response Medium Thermal CRAC-3 compressor failure
A4 CRAC Failure Cascade Hard Thermal CRAC-1 compressor + CRAC-3 fan
B1 UPS Alarm Response Medium Power UPS transferred to battery
B3 Generator Test Protocol Easy Power None (routine monthly test)
B4 Power Failure Cascade Hard Power Utility loss + extended generator warmup

The hard scenarios, A4 and B4, are where the training story gets interesting. A4 fails two CRAC units simultaneously, leaving only CRAC-2 and CRAC-4; the correct response is to diagnose the failed units, then redirect cooling through the survivors via fan speeds and setpoints. B4 starts with complete utility power loss and requires starting the diesel generator, managing UPS discharge during warmup, and shedding rack load, all within a strict time budget.

The agent’s observation at each step is a text-rendered dashboard structured like a real NOC screen: zone temperatures, CRAC status, UPS state of charge, generator state, an active alert, available commands, and steps remaining.

2.2 The Operator Command Set

The vocabulary covers the actions a real operator takes during an incident:

Command Format Effect
diagnose diagnose <unit_id> Inspect a CRAC, UPS, or PDU for fault details
adjust_setpoint adjust_setpoint <crac_id> <temp_c> Change CRAC supply air temperature
set_fan_speed set_fan_speed <crac_id> <pct> Set CRAC fan speed (0-100%)
set_rack_load set_rack_load <rack_id> <kw> Shed or restore workload on a rack
start_crac / stop_crac start_crac <crac_id> Start or standby a CRAC unit
start_generator / stop_generator n/a Manually start or cool down the generator
set_ups_mode set_ups_mode <ups_id> <mode> Switch UPS mode (eco/double_conversion/bypass)
refuel_generator refuel_generator [liters] Refuel the diesel tank
acknowledge_alarm n/a Acknowledge the current active alert
check_status n/a Request a full status report
escalate n/a Escalate to a senior engineer
wait n/a Take no action this step

The vocabulary is intentionally expressive. The model has to learn not just that CRAC-3 failed, but that set_fan_speed CRAC-2 100 beats adjust_setpoint CRAC-3 18 when CRAC-3’s compressor is offline.

2.3 The Reward Architecture

The environment’s internal reward is a six-component composite informed by datacenter RL research, including Google DeepMind’s DC cooling work and the DCRL-Green paper (ICLR 2025). Each component is normalized to [-1, 1] via tanh, the weighted total clamped to [-1, 1]. The weight profile switches by scenario type: thermal scenarios weight thermal safety at 0.30 and procedure at 0.20; power scenarios flip those. The six components: Thermal Safety (dual softplus barriers at the ASHRAE recommended and allowable limits, plus a +0.1 baseline when all zones sit 3°C below the recommended max, giving signal for maintaining good state); Power Safety (softplus barrier below 50% UPS SOC plus a fixed -5.0 per UPS fault, compounding across units); Efficiency (PUE waste proxy via tanh((PUE - 1) / 2), suppressed while on battery so load shedding is not wrongly penalized); Scenario Progress (delta-based, rewarding the change in progress this step); Procedure (scenario-specific rules, e.g. starting the generator before UPS depletes in B4); and Action Quality (command validity, repetition penalties, a small diagnostic bonus).


3. The Training Pipeline

The pipeline has three sequential phases, each solving a problem the previous one could not: Phase 1 teacher-driven data generation (DeepSeek-R1-Distill-Qwen-32B) → Phase 2 SFT on Qwen2.5-7B → Phase 3 GRPO against the live simulation.

3.1 Phase 1: Teacher-Driven Data Generation

There are no human expert trajectories for this environment, and writing them by hand would be slow and biased. My solution: use a reasoning model as a teacher, DeepSeek-R1-Distill-Qwen-32B, served via vLLM with a 24,576-token context. The teacher runs live episodes and narrates decisions in a three-block format:

<think>   [chain of thought: free exploration, self-correction] </think>
<reasoning> [distilled conclusion, ≤200 words, the canonical saved signal] </reasoning>
<command> diagnose CRAC-3 </command>

The <think> block captures genuine reasoning including dead ends; <reasoning> is the clean post-incident-report summary; <command> is the actionable output. Saving all three gives the student both styles. One subtle decision: I strip <think> from history before feeding it back as next-turn context, since the <reasoning> summary is sufficient and keeps each request under the context limit on 12-turn episodes.

The plan targeted 1,520 episode attempts across six scenarios and four variant types, with seed variation. I ran 28 concurrent requests against vLLM, the maximum the 192 GB MI300X could sustain without KV cache preemption at the 24,576-token limit. After filtering for episodes with at least one valid agent turn and a parseable <reasoning> block, the final dataset held 934 kept episodes and 7,107 GPT turns. The p99 sequence length was about 2,700 tokens, setting max_seq_length: 3072 downstream.

Scenario Episodes Share
A1 145 15.5%
A2 225 24.1%
A4 181 19.4%
B1 120 12.8%
B3 160 17.1%
B4 103 11.0%

The dataset is published at Melikshah/dc-ops-sft-data. Each row is a ShareGPT-style episode; the gpt turns contain the full three-block output, so consumers can keep or strip <think>. The src/data_utils.py pipeline drops VAR_* variant episodes, strips <think>, rewrites the system prompt to two-block format, and windows each episode into (system, [context], user, assistant) tuples. Running it on the raw 1,083 episodes yields the 934 kept episodes and 7,107 windowed turns used in SFT.

3.2 Phase 2: Supervised Fine-Tuning

I fine-tuned Qwen2.5-7B-Instruct using QLoRA via Unsloth. The base is a non-reasoning model, so a rewrite_system_prompt function collapses the teacher’s three-block instruction into a two-block one (deleting the <think> description, renumbering blocks, removing stray <think> tokens). The result is a byte-identical prompt string between SFT and GRPO, so the model sees no distribution shift at RL time. Training data is processed the same way, with <think> stripped from all assistant turns before the chat template is applied.

SFT hyperparameters:

Setting Value
Base model unsloth/Qwen2.5-7B-Instruct
LoRA rank 16
LoRA alpha 32
Target modules q, k, v, o, gate, up, down projections
Learning rate 7e-5
LR scheduler Cosine
Warmup steps 10
Batch size 10 (per device)
Gradient accumulation 2
Epochs 2
Max seq length 3,072
Quantization 4-bit NF4
Precision bfloat16
Gradient checkpointing Unsloth mode

I stopped at 2 epochs deliberately. The best checkpoint was saved at eval loss 2.652 (via load_best_model_at_end: true). Beyond epoch 1.5 the loss rose consistently, and runs to epoch 4 produced worse checkpoints (eval loss 2.827). Since GRPO refines further, early SFT stopping is correct.

SFT took about 60 minutes on the MI300X, 2 epochs over 934 episodes. Train loss converged to 0.0447; best eval loss checkpoint at 2.652. Beyond epoch 1.5 the loss rose consistently, confirming the early stop.

The SFT LoRA adapter is published at Melikshah/dc-ops-sft-lora-new and initializes GRPO.

3.3 Phase 3: GRPO with a Live Simulation

SFT gives the right format and a reasonable prior, but cannot teach physics: the teacher’s demonstrations are noisy and the model has no feedback to distinguish good decisions from mediocre ones. GRPO fixes this. I used TRL’s GRPOTrainer with Unsloth’s vLLM fast-inference backend to run RL directly against the live DC-Ops simulation.

GRPO hyperparameters:

Setting Value
Base checkpoint SFT LoRA adapter
num_generations 8
max_prompt_length 2,048
max_completion_length 512
per_device_train_batch_size 8
gradient_accumulation_steps 2
effective batch 16 (2 prompts × 8 completions)
Learning rate 5e-6
LR scheduler Cosine
Warmup ratio 0.1
Beta (KL coefficient) 0.05
max_grad_norm 0.1
Epochs 7
vLLM temperature 0.9
vLLM top_p 0.9
GPU memory utilization 65%
Precision bfloat16

The effective batch of 16 (8 per_device × 2 grad_accum) satisfies TRL’s constraint that batch size be divisible by num_generations. I arrived at gpu_memory_utilization: 0.65 after hitting OOM with 0.75.

The GRPO prompt dataset is not static. A build_grpo_prompts function constructs each prompt by resetting the live environment and capturing the dashboard. It mixes initial-state prompts (30 per scenario, 180 total) covering the first-response problem at reset, and mid-game prompts (55 per scenario, 330 total) where the environment is pre-rolled through one of 7 to 9 warmup sequences per scenario (for A4: ["diagnose CRAC-1"], ["diagnose CRAC-1", "set_fan_speed CRAC-2 100"], etc.), exposing the model to substantively different simulator states. Seeds vary across both types, making each (scenario, warmup, seed) a distinct slice. The total is about 510 prompts, shuffled before training.


4. The GRPO Reward System

This reward system is separate from and complementary to the environment’s internal reward (Section 2.3): four functions that together give a dense, multi-objective signal at every step.

format_reward_fn (structural compliance, [-1.5, +0.3]). Checks the <reasoning> and <command> tags. It is deliberately asymmetric: well-formed output lands in [-0.2, +0.3], malformed output is penalized to -1.5. The asymmetry is the key decision. A flat +1.0 ceiling would let the already-clean SFT checkpoint max out format reward on every completion, collapsing the group-mean advantage to zero and giving GRPO no gradient. Capping the positive at +0.3 keeps small within-group variation in reasoning quality producing nonzero advantages. Additional signals: deductions for <think> tags, unknown verbs, and text after </command>, plus a +0.15 bonus when the reasoning block is 25 to 180 words.

env_reward_fn (physics simulation reward, [-4.0, +5.0]). The richest and most expensive signal. For each completion I spin up a fresh DcOpsEnvironment, replay the warmup to the mid-game state, execute the command, and measure the result:

r_now × 3.0                            # environment's own immediate reward
+ (proxy_after - proxy_before) × 2.5   # thermal/power health delta from this action
+ (best_proxy - proxy_before) × 1.0    # stability over a 4-step wait probe
+ 3.0 if scenario resolved / - 3.0 if scenario crashed

The proxy_health score is a continuous [0, 1] metric replacing the sparse binary scenario.resolved gate. It blends a thermal half (ASHRAE compliance averaged across zones) and a power half (UPS state of charge plus generator readiness during outage). Because it is earnable in one to five steps, the model gets dense signal every step without needing full resolution. The 4-step wait probe is a forward stability check: an action that sets a good thermal trajectory scores higher than one with the same immediate delta that destabilizes the system.

command_quality_fn (scenario-aware heuristics, [-1.5, +1.2]). Encodes per-scenario priors without a live sim call, at under 1 ms. It distinguishes initial turns (optimal/good/bad first actions, e.g. for A4 diagnose is optimal, escalate is bad) from mid-game turns (rewards post-diagnosis actions like set_fan_speed). For A4, operating surviving CRAC-2/CRAC-4 is rewarded while commanding failed CRAC-1/CRAC-3 is penalized, and setpoints below 17°C are penalized as overcooling. For B4, starting the generator is rewarded and idle wait is penalized. A vocabulary bonus (up to +0.15) rewards terms like “ASHRAE,” “compressor,” “setpoint,” “battery SOC.”

no_repeat_fn (anti-looping penalty, [-1.0, 0.0]). Prevents action loops by tracking repetition against the warmup history: exact duplicate of a warmup action -1.0; same verb and target but different parameter -0.4; redundant wait when warmup already contains one -0.2. wait and check_status are partially whitelisted. This eliminates the [wait, wait, wait, ...] loop the model falls into on difficult scenarios.


5. Training Results

The GRPO run trained for 7 epochs (~1,784 global steps) over 4.06 hours, processing about 15.9 billion tokens, logged to Weights & Biases under dc-ops-amd.

5.1 Composite Reward Trajectory

The headline result: composite reward grew from 0.394 at the first step to 1.136 at the final step, a +188% absolute improvement, peaking at 4.130 around step 7,500.

Training Phase Mean Reward Peak Reward
Very first step 0.394 n/a
Q1 (steps 143-4,031) 1.327 2.500
Q2 (steps 4,031-7,559) 1.377 4.130
Q3 (steps 7,559-11,501) 1.414 2.874
Q4 (steps 11,501-15,884) 1.183 2.520
Very last step 1.136 n/a

Train Reward Composite reward rises from 0.39 to a peak of 4.13 around step 7,500, then stabilizes above 1.0.

5.2 Per-Function Convergence

Reward Function Range Run Mean Trajectory Signal
format_reward_fn [-1.5, +0.3] +0.150 0.15 → 0.15 Saturated perfect from step 1
env_reward_fn [-4.0, +5.0] +0.541 0.123 → 0.298 Positive throughout, noisy
command_quality_fn [-1.5, +1.2] +0.653 0.184 → 0.688 Strong upward trend
no_repeat_fn [-1.0, 0.0] -0.019 -0.063 → 0.000 Converged fully to zero

Format compliance saturated at +0.150 with zero std from the first step: strong evidence the SFT checkpoint had already mastered the XML format. The asymmetric design assigned zero gradient to format and redirected all learning toward semantic and physical quality. Format reward fixed at 0.150 every step (1,819 of 1,819 records), std 0.000.

Command quality trended steadily upward, from 0.184 to values as high as 0.947, as the model learned to target the right failing unit, use rewarded parameter ranges, and name the domain concepts each scenario requires.

The anti-repetition penalty converged completely to zero by the end, std collapsing from 0.25 to 0.00; 73.8% of all records logged exactly 0.0. A clean behavioral convergence signal.

5.3 Training Stability

KL Divergence grew from 0.879 to 1.269 (run-mean 1.06), the expected behavior as the policy diverges from the frozen reference without losing coherence.

Policy Loss moved from a slightly negative -0.0075 (warm SFT init) to a small positive 0.063, low magnitude throughout: the gradient is reshaping the policy without large destabilizing steps.

frac_reward_zero_std (the GRPO failure mode where all completions in a group score identically) averaged only 0.033, so in 96.7% of groups the model produced diverse enough outputs for useful advantage estimates. GRPO was genuinely learning throughout.

Completion Length grew from a mean of 100.3 to 114.4 tokens (14.1%) with a clipped ratio of 0.000 throughout, so the model never hit the length cap. The growth is consistent with using the <reasoning> block more fully to plan multi-step actions.

Gradient Norms showed 17 spikes exceeding 50 (max 408.86), all coinciding with large-reward discovery events. The max_grad_norm: 0.1 clip and LR decay kept any from destabilizing training. Mean grad norm grew from 1.95 in Q1 to 5.66 in Q4, expected as the policy finds steeper gradients.

5.4 Efficiency and Profiling

Component Mean Time Max Time
vLLM.generate 5.18s 8.43s
_prepare_inputs 3.66s 10.13s
_calculate_rewards 0.68s 0.96s
env_reward_fn 0.71s 1.16s
command_quality_fn 0.0007s 0.001s
format_reward_fn 0.0004s 0.001s
no_repeat_fn 0.0001s 0.0002s

The loop is compute-bound on generation (~5.2s per call), not reward evaluation. The live physics sim adds only ~0.71s per reward call, and the heuristics are negligible at under 1 ms. This is the ideal profile for scaling: the bottleneck stays on the GPU, not the reward logic.

GPU utilization across the run. Periodic dips are the CPU-bound reward evaluation (environment simulation), characteristic of a healthy vLLM-backed GRPO loop.


6. Evaluation: Base vs. GRPO

I evaluated the final GRPO checkpoint against base unsloth/Qwen2.5-7B-Instruct on the two hardest scenarios, A4 and B4, across five seeds each with a 10-step budget.

python scripts/evaluate.py --grpo-model ./outputs/dc_ops_grpo_final \
  --base-model unsloth/Qwen2.5-7B-Instruct \
  --scenarios A4 B4 --seeds 100 200 300 400 500 --temperature 0.4

Aggregate Results:

Model Scenario N ResRate MeanRew StdRew PerStep
base A4 5 0.0% 0.041 0.037 0.004
base B4 5 0.0% -0.147 0.011 -0.015
grpo A4 5 0.0% 0.430 0.033 0.043
grpo B4 5 0.0% -0.092 0.364 -0.009

On A4 the difference is stark. The base model spent most of every episode issuing wait, with occasional off-target actions like diagnose PDU-A-01, wrong for a CRAC cascade. The GRPO model opened every seed with diagnose CRAC-1, the correct first action, then moved into setpoint control on the surviving units. Mean reward improved by +0.389 (0.041 to 0.430), consistent and low-variance across all five seeds.

GRPO rollout on A4 (seed 100):

diagnose CRAC-1 → adjust_setpoint CRAC-2 22.0 → adjust_setpoint CRAC-4 22.0
→ adjust_setpoint CRAC-4 22.0 → ... → adjust_setpoint CRAC-2 27.1

Base rollout on A4 (seed 100):

wait → wait → wait → wait → wait → wait → wait → diagnose PDU-A-01 → wait → wait

On B4, GRPO responded earlier (the generator started in all five GRPO seeds versus only one base seed), but follow-through was inconsistent. Some rollouts used malformed rack identifiers (A-4, A-0 instead of A-01 through A-05), showing the model has not fully learned the rack naming convention here. The best B4 rollout (seed 400, reward 0.540) diagnosed the generator before starting it, the correct order, then shed load across five racks.

The honest conclusion: GRPO produces meaningfully better emergency-response behavior than the base model, especially on hard thermal scenarios; on the power failure scenario the improvement is real but incomplete. No episode resolved within the 10-step budget, so resolution rate stayed 0.0% for both models on both scenarios. GRPO improves the quality of each step without yet converting that to full recovery.


7. The ROCm Engineering Story

Running this on a single AMD Instinct MI300X (gfx942) required solving compatibility problems not documented anywhere in consolidated form. These fixes took significant time to find.

vLLM platform detection bug. On ROCm 7.2 + vLLM 0.19.1, vLLM’s platform-detection singleton initializes to UnspecifiedPlatform during the Unsloth import, before the HIP-compat resolver fires, breaking GPU memory queries and dtype checks. My fix is a _fix_vllm_rocm_platform() function in scripts/run_grpo.py that swaps in a custom _MI300XPlatform subclass of RocmPlatform, overriding the failing stubs (check_if_supports_dtype, mem_get_info, get_punica_wrapper) with a __getattribute__ safety net that falls back to CudaPlatform. It then patches the new singleton into every module that captured current_platform via a from ... import binding, since that pattern creates an independent binding module-level replacement cannot reach.

bitsandbytes symlink. The ROCm fork builds libbitsandbytes_rocm72.so but the loader probes for libbitsandbytes_rocm71.so (the validated torch stack is 2.10.0+rocm7.1). One-line fix:

ln -sf libbitsandbytes_rocm72.so libbitsandbytes_rocm71.so

PEFT tensor-parallel sharding conflict. PEFT 0.19.x added LoRA TP checkpoint sharding expecting newer Transformers internals than 4.54.1. Single-GPU does not need it, so I disable the helper with a one-line monkey-patch:

peft.utils.save_and_load._maybe_shard_state_dict_for_tp = lambda *args, **kwargs: None

Import order. The order in run_grpo.py is load-bearing. src.rocm_env must run before any GPU-touching library, and unsloth.PatchFastRL("GRPO", FastLanguageModel) must run before trl.GRPOTrainer is imported, since PatchFastRL patches the trainer at import time. Violating this silently yields a non-patched GRPOTrainer that rejects max_prompt_length.

Flash-Attention ROCm build. Building Flash-Attention from source against the ROCm CK backend takes 40 to 50 minutes, so I run it inside tmux. If it fails, it is safe to skip: PyTorch SDPA on ROCm is a correct fallback at some throughput cost.

Validated software stack:

Package Version
torch 2.10.0+rocm7.1
unsloth 2026.4.4
transformers 4.54.1
peft 0.19.1
trl 0.21.0
vllm 0.19.1+rocm721
flash-attn 2.8.4 (CK ROCm)
triton 3.6.0
bitsandbytes 0.43.3.dev (ROCm fork)

8. Using the Model

The final checkpoint is a QLoRA adapter (rank 16, bfloat16) on unsloth/Qwen2.5-7B-Instruct, published at Melikshah/dc_ops_grpo_lora. Load it with Unsloth for 2x faster inference, or standard Transformers + PEFT.

from unsloth import FastLanguageModel

model, tokenizer = FastLanguageModel.from_pretrained(
    model_name="Melikshah/dc_ops_grpo_lora",
    max_seq_length=3072, load_in_4bit=True, dtype=None,
)
FastLanguageModel.for_inference(model)

system_prompt = (
    "You are an expert datacenter NOC operator. "
    "Produce two blocks in order: <reasoning>, <command>. "
    "Each block must appear exactly once.\n\n"
    "1. <reasoning>...</reasoning>  — your concise analysis (≤200 words).\n"
    "2. <command>...</command>      — exactly one operator command."
)
user_turn = (
    "**Action Result:** Episode started. ALERT: CRAC-3 compressor failure.\n\n"
    "**Steps Remaining:** 15\n\n"
    "=== NOC DASHBOARD ===\n"
    "Zone A | Inlet: 27.3°C | CRAC-1: OK | CRAC-2: OK | CRAC-3: FAULT | CRAC-4: OK\n"
    "Available commands: diagnose, adjust_setpoint, set_fan_speed, ..."
)
messages = [
    {"role": "system", "content": system_prompt},
    {"role": "user", "content": user_turn},
]
inputs = tokenizer.apply_chat_template(
    messages, tokenize=True, add_generation_prompt=True, return_tensors="pt",
).to("cuda")
outputs = model.generate(
    input_ids=inputs, max_new_tokens=512, temperature=0.4, do_sample=True, top_p=0.9,
)
print(tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True))
# Expected: a <reasoning> block analyzing the CRAC-3 fault,
# then a <command>diagnose CRAC-3</command> block.

For an interactive evaluation loop against the live environment, use scripts/evaluate.py with --grpo-model Melikshah/dc_ops_grpo_lora, a base model, scenarios, seeds, and a temperature.


9. Repository Layout

dc-ops-amd/
├── configs/        # grpo.yaml, sft.yaml
├── launch/         # grpo.sh, sft.sh (nohup launchers)
├── scripts/        # run_sft.py, run_grpo.py (ROCm patches), evaluate.py,
│                   # eda.py, push_to_hf.py, verify_setup.py
├── src/            # constants.py, data_utils.py, grpo_data.py, prompts.py,
│                   # rewards.py (4 GRPO rewards), rocm_env.py (import first)
├── server_ouputs/  # grpo.md, eval_result.md, sft.md, verify.md (run logs)
└── setup_env.sh    # full ROCm stack installer

Quick start: install the environment (./setup_env.sh, ~40-50 min for ROCm flash-attention), create the bitsandbytes symlink, configure .env, verify the stack (python scripts/verify_setup.py), then run ./launch/sft.sh followed by ./launch/grpo.sh. The GRPO script resolves the SFT source automatically, preferring ./outputs/dc_ops_sft_lora and falling back to configs/grpo.yaml, so SFT and GRPO can run on different machines with no manual path editing.


10. Honest Limitations and What Comes Next

The GRPO model shows a genuine, measurable improvement over base Qwen2.5-7B-Instruct. On A4 the mean per-step reward improved from 0.004 to 0.043, more than 10x, with low variance across seeds. The model learned to diagnose the correct failing unit, command surviving units rather than failed ones, and avoid the passive wait loops that dominate the base model.

Still, neither model resolved any episode within the 10-step budget. Full resolution on the hardest incidents needs a longer planning horizon, and possibly a larger model or more data. B4 remains difficult: the model knows to start the generator but struggles with the subsequent load-shedding sequence, including some malformed rack identifiers.

The 934-episode dataset is small by LLM standards; a larger, more varied dataset with more multi-fault partial-recovery coverage would likely improve both the SFT init and GRPO rollout diversity. On the reward side, env_reward_fn runs a full reset and replay for each of 8 completions, the second-most expensive component after generation; batching those steps would cut wall-clock time. A richer dense reward tracking rate of change and trajectory direction would give better gradient signal for multi-step planning.

The core result holds: a 7-billion-parameter model can learn to reason about real physical systems through RL against a live simulation, without any human-labeled data, on a single consumer-class GPU. The pipeline is fully reproducible from the code and configs in this repository.