File size: 8,955 Bytes
670ccf0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# HCM:21 β€” PyTorch Conference NA 2026 Poster Draft

> Status: Path A complete β€” reward recalibrated, policy separation proven on real
> data, 43/43 tests passing. Figure `poster_figure.png` is generated from

> `poster_experiment.py` (raw numbers in `results.json`). Hermes-Agent
> enhancement designed below.

---

## Title

**Primary:** *HCM:21 β€” Reward Design for Long-Horizon LLM Agents in an OpenEnv

Workforce-Planning Benchmark*

**Subtitle:** *Why naΓ―ve efficiency rewards get hacked by downsizing, and a

health-gated fix that restores policy separation β€” plus a skill-growing

(Hermes-Agent) training pipeline.*

Two-author max (per CFP). Submit on Sessionize by **July 26, 11:59 PM PDT**.

---

## 1. Motivation (top-left)

- **Long-horizon planning + sparse/delayed rewards** is the hardest axis of agent
  evaluation. HCM:21 puts an LLM agent in the seat of a Chief Human Capital
  Officer steering a 200–500-person company across **6 quarters / 150–200 steps**,
  scored on validated Fitz-enz HR analytics (HCVA, HCROI, QIPS).
- **A non-code domain.** Most agent benchmarks are code/math/games. Workforce
  strategy is a fresh, economically grounded long-horizon testbed.
- **OpenEnv-native.** Built to the `meta-pytorch/OpenEnv` contract β†’ plugs
  directly into the PyTorch RL-environments ecosystem (the conference's own turf).

## 2. The environment (left column)

- **4-phase Γ— 6-quarter state machine** (`phases.py`): Scanning β†’ Planning β†’
  Producing β†’ Controlling, with per-phase minimum-action gating.
- **Company simulation** (`company.py`): 5 departments, Cobb-Douglas production
  linking headcount Γ— skills Γ— engagement β†’ output; per-employee performance,
  engagement, flight-risk, promotability, salary, tenure.
- **Fitz-enz metrics** (`metrics.py`): HCVA = (Rev βˆ’ non-employment cost)/FTE;
  HCROI = Rev/employment cost; QIPS composite; Five Indexes of Change; Employee
  Value composite.
- **Stochastic events** (`events.py`): market downturns, competitor poaching,
  exec departures, budget cuts β€” force re-planning.
- **4 scenario tasks**: high-turnover, budget-cuts, rapid-growth, balanced-opt.
- *Figure 1: architecture diagram. Figure 2: the phase Γ— quarter loop.*

## 3. Finding: the reward was being hacked (center β€” the hook)

Running three **non-LLM** policies through the env (5 seeds each) exposed a
reward-hacking failure in the original scoring:

| Policy | v1 score (sigmoid-centred) | What actually happened |
|---|---|---|
| Null (do-nothing) | **0.672** | workforce collapses 300β†’41; HCVA/HCROI *rise* +75% |
| Random | 0.652 | β€” |
| Heuristic (real strategy) | 0.649 | keeps 96 staff, +65% HCVA, QIPS maintained |

**All three were indistinguishable.** Root cause: HCVA (per-FTE) and HCROI
(per-employment-cost) are *ratios* that a do-nothing agent inflates by letting
attrition shrink the denominator. The original scoring also mapped "no change" to
0.5 via a sigmoid, handing out free credit. The benchmark rewarded **gutting the

company**.

> This is the poster's intellectual hook: *efficiency ratios are reward-hackable

> in long-horizon economic environments, and a do-nothing baseline is the cheapest

> way to discover it.*

## 4. The fix: health-gated scoring (center-right)

`scoring.py` v2 (this work):

1. **One-sided ramps** β€” "no improvement" scores **0**, not 0.5 (no free credit).
2. **Health gate** β€” HCVA/HCROI credit is multiplied by workforce retention; an
   agent that keeps <60% of staff cannot bank efficiency "gains."
3. **Sustainability as a first-class term (30%)** β€” headcount Γ— engagement
   retention. Solvency is itself gated by health (a profitable shell β‰  healthy).

Measured after recalibration (5 seeds, real runs, fully deterministic):

| Policy | v2 score | Β± |
|---|---|---|
| Null (do-nothing) | **0.247** | 0.017 |
| Random | 0.262 | 0.028 |
| Heuristic | **0.448** | 0.029 |

**Separation restored:** strategy now scores ~1.8Γ— no-strategy, with headroom to
~0.65+ for a trained agent. All 43 unit tests pass. Runs are bit-reproducible β€”
all stochastic streams (turnover, hire generation) are seeded from the episode
seed, so the same seed yields the same score every time.

- *Figure 3 (hero): `poster_figure.png` β€” left: v1 collapse vs v2 separation;

  right: sparse quarterly-reward trajectory.*

## 5. Training pipeline (right column)

- **GRPO** (TRL `GRPOTrainer`) + **Unsloth**, `unsloth/Qwen3-0.6B`, LoRA r=16,
  4-bit, T4-friendly (batch 2 Γ— grad-accum 4, 4 generations, lr 5e-6).
- **Reward** = the env's health-gated quarterly reward; completions are parsed for
  JSON action sequences and executed in the live OpenEnv server (HF Space).
- *Figure 4: GRPO loop diagram. Figure 5 (Path A follow-up): post-fix GRPO reward

  curve + trained-agent bar added to Fig 3.*

## 6. Skill-growing agents with Hermes-Agent (right column β€” the differentiator)

A from-scratch GRPO'd 0.6B model struggles to even emit valid 150-step action
sequences (cold start). We pair HCM:21 with **Nous Research's Hermes-Agent**
("the agent that grows with you") to attack this on three fronts:

1. **Expert rollouts β†’ SFT warm-start, then GRPO.** Run Hermes (model-agnostic)
   as the CHCO against the HCM:21 OpenEnv server; use its **batch trajectory

   generation + trajectory compression** to build a dataset of successful
   6-quarter episodes; SFT Qwen3-0.6B on it as a warm start *before* GRPO. Fixes
   the cold-start that makes raw GRPO on a small model fail.
2. **Skills as procedural memory for long-horizon competence.** Hermes' skills
   system (agentskills.io standard, autonomous skill creation/self-improvement)
   lets the agent distill reusable HR sub-routines β€” `diagnose_at_risk_depts`,
   `rebalance_hiring_to_offset_turnover`, `protect_engagement_under_budget_cut`.
   "Grows with you" = the agent accumulates HR strategy across episodes. This is a
   direct mechanism for the long-horizon theme.
3. **Memory for state beyond the context window.** By Q4 full state history
   exceeds 128K tokens. Hermes' agent-curated memory (`MEMORY.md`/`USER.md`) +
   session search/summarization lets the agent compress prior quarters into
   durable memory instead of carrying raw history β€” addressing the "beyond
   context memory limits" requirement head-on.

**Experimental matrix the poster can show (learning in weight-space vs.

memory/skill-space vs. hybrid):**

| Regime | Mechanism | Hypothesis |
|---|---|---|
| GRPO-only (0.6B) | weight updates | strong but cold-start-limited |
| Hermes skills-only | in-context skills + memory, no weight updates | strong sample-efficiency, larger model |
| Hermes→SFT→GRPO (hybrid) | distill expert trajectories into a small model | best score-per-param |

**Integration path:** expose HCM:21 actions as an **MCP tool server** (Hermes
supports MCP natively) β†’ Hermes calls `step()`/`reset()` as tools with zero glue.

> Caveat to verify before final: exact Hermes script names for batch generation /
> trajectory compression aren't in the public README β€” confirm against the repo
> (`agent/`, `skills/`, any `batch_runner.py`) before printing command names.



## 7. Try it (footer)



QR codes β†’ HF Space (`paretooptimal-hcm21.hf.space`), GitHub repo, Colab notebook.

MIT licensed. OpenEnv-compliant (`openenv validate`).



---



## Figure checklist



| # | Figure | Status | Source |

|---|---|---|---|

| 1 | Architecture diagram | **DONE** | `poster_diagrams.py` β†’ `fig1_architecture.png` |

| 2 | Phase Γ— quarter loop | **DONE** | `poster_diagrams.py` β†’ `fig2_phase_loop.png` |
| 3 | **v1β†’v2 recalibration + reward trajectory** | **DONE (real)** | `poster_experiment.py` β†’ `poster_figure.png` |
| 4 | GRPO training loop | **DONE** | `poster_diagrams.py` β†’ `fig4_grpo_loop.png` |
| 5 | Post-fix GRPO reward curve + trained-agent bar | NEEDS Colab run | auto-built by `poster_experiment.py` when `grpo_results.json` is present |

Four of five figures are generated and committed. Fig 5 (and the trained-agent
bar on Fig 3) is wired to auto-generate: drop the Colab `grpo_results.json` in the
repo root and re-run `poster_experiment.py` β€” no code edits. See RUNBOOK.md Β§2–3.

## Hermes integration assets (in repo)

`integrations/hcm21_mcp_server.py` β€” an MCP tool server exposing
`hcm21_reset / hcm21_step / hcm21_available_actions / hcm21_state / hcm21_score`.
Hermes (MCP client) drives the env natively. Verified end-to-end in-process.
Setup in RUNBOOK.md step 5.

## Reproducibility appendix (for reviewers)

```bash

pip install -e ".[server]"          # faker, numpy, fastapi, pydantic

python poster_experiment.py         # writes results.json + poster_figure.png

python -m pytest tests/ -q          # 43 passing

```

Raw measured numbers live in `results.json`.