kissin42 commited on
Commit
048bad5
·
verified ·
1 Parent(s): 09b5f6a

docs: restructure card (overview + unified ladder summary + collapsible per-env tables); move reproduction recipe to docs/reproduction.md

Browse files
Files changed (2) hide show
  1. README.md +203 -359
  2. docs/reproduction.md +99 -0
README.md CHANGED
@@ -1,359 +1,203 @@
1
- ---
2
- license: cc-by-4.0
3
- tags:
4
- - reinforcement-learning
5
- - unity-ml-agents
6
- - minari
7
- - causal-gpt-rl
8
- ---
9
-
10
- # Causal GPT-RL — Unity ML-Agents trajectories
11
-
12
- Recorded Unity ML-Agents trajectories packaged as
13
- [Minari](https://minari.farama.org) datasets. The collection includes continuous
14
- and discrete action spaces for testing Causal GPT-RL across space types. Several environments ship a quality ladder -- an `expert` tier plus calibrated `medium`/`simple` tiers synthesized by injecting action noise into the stock policy. Tiers are keyed to Minari-normalized skill levels between a random-policy 0.0 anchor and the stock expert 1.0: `simple` ~= 0.60, `medium` ~= 0.80, `expert` = 1.0. The noise level is not a single constant: for the single-agent scenes it is drawn per episode from a calibrated range (cooperative scenes sample per group/team per match), so each tier's mean lands on its target while the episodes span a continuous band of skill rather than piling up at one point. See the per-environment notes below.
15
-
16
- **Companion repos**
17
- - Model-removed Unity builds + their matching stock ONNX policies:
18
- [ccnets/causal-gpt-rl-unity-envs](https://huggingface.co/datasets/ccnets/causal-gpt-rl-unity-envs)
19
- - Causal GPT-RL policy checkpoints (currently Crawler):
20
- [ccnets/causal-gpt-rl-unity](https://huggingface.co/ccnets/causal-gpt-rl-unity)
21
-
22
- ## Contents
23
-
24
- | Dataset id | Episodes | Transitions | Observation | Action |
25
- |---|---:|---:|---|---|
26
- | `unity/crawler/expert-v0` | 1,048 | 1,000,002 | `Tuple(Box(126), Box(32))` | `Box(20, [-1, 1])` |
27
- | `unity/crawler/medium-v0` | 1,129 | 1,000,000 | `Tuple(Box(126), Box(32))` | `Box(20, [-1, 1])` |
28
- | `unity/crawler/simple-v0` | 1,344 | 1,000,000 | `Tuple(Box(126), Box(32))` | `Box(20, [-1, 1])` |
29
- | `unity/pushblock/expert-v0` | 52,801 | 1,000,000 | `Tuple(Box(105), Box(105))` | `Discrete(7)` |
30
- | `unity/pushblock/medium-v0` | 2,450 | 1,000,000 | `Tuple(Box(105), Box(105))` | `Discrete(7)` |
31
- | `unity/pushblock/simple-v0` | 1,783 | 1,000,000 | `Tuple(Box(105), Box(105))` | `Discrete(7)` |
32
- | `unity/soccer-twos/expert-v0` | 14,588 | 1,000,816 | ego `Dict` wrapping `Tuple(Box(264), Box(72))` | ego `Dict` wrapping `MultiDiscrete([3, 3, 3])` |
33
- | `unity/soccer-twos/medium-v0` | 13,040 | 1,001,776 | ego `Dict` wrapping `Tuple(Box(264), Box(72))` | ego `Dict` wrapping `MultiDiscrete([3, 3, 3])` |
34
- | `unity/soccer-twos/simple-v0` | 12,860 | 1,003,048 | ego `Dict` wrapping `Tuple(Box(264), Box(72))` | ego `Dict` wrapping `MultiDiscrete([3, 3, 3])` |
35
- | `unity/dungeon-escape/expert-v0` | 35,787 | 1,003,523 | ego `Dict` wrapping `Tuple(Box(10), Box(360), Box(1))` | ego `Dict` wrapping `Discrete(7)` |
36
- | `unity/dungeon-escape/medium-v0` | 19,023 | 1,003,025 | ego `Dict` wrapping `Tuple(Box(10), Box(360), Box(1))` | ego `Dict` wrapping `Discrete(7)` |
37
- | `unity/dungeon-escape/simple-v0` | 11,367 | 1,003,316 | ego `Dict` wrapping `Tuple(Box(10), Box(360), Box(1))` | ego `Dict` wrapping `Discrete(7)` |
38
- | `unity/3dball-hard/expert-v0` | 1,009 | 1,000,008 | `Tuple(Box(27), Box(18))` | `Box(2)` |
39
- | `unity/3dball-hard/medium-v0` | 1,250 | 1,000,008 | `Tuple(Box(27), Box(18))` | `Box(2)` |
40
- | `unity/3dball-hard/simple-v0` | 1,655 | 1,000,008 | `Tuple(Box(27), Box(18))` | `Box(2)` |
41
- | `unity/pyramids/expert-v0` | 5,348 | 1,000,000 | `Tuple(Box(56), Box(56), Box(56), Box(4))` | `Discrete(5)` |
42
- | `unity/pyramids/medium-v0` | 1,858 | 1,000,000 | `Tuple(Box(56), Box(56), Box(56), Box(4))` | `Discrete(5)` |
43
- | `unity/pyramids/simple-v0` | 1,399 | 1,000,000 | `Tuple(Box(56), Box(56), Box(56), Box(4))` | `Discrete(5)` |
44
- | `unity/worm/expert-v0` | 1,000 | 1,000,000 | `Box(64)` | `Box(9, [-1, 1])` |
45
- | `unity/worm/medium-v0` | 1,000 | 1,000,000 | `Box(64)` | `Box(9, [-1, 1])` |
46
- | `unity/worm/simple-v0` | 1,000 | 1,000,000 | `Box(64)` | `Box(9, [-1, 1])` |
47
- | `unity/walker/expert-v0` | 1,458 | 1,000,010 | `Box(243)` | `Box(39, [-1, 1])` |
48
- | `unity/walker/medium-v0` | 1,712 | 1,000,000 | `Box(243)` | `Box(39, [-1, 1])` |
49
- | `unity/walker/simple-v0` | 2,247 | 1,000,000 | `Box(243)` | `Box(39, [-1, 1])` |
50
-
51
- ### ML-Agents release
52
-
53
- All published environments, trajectory datasets, and stock behavior policies
54
- use **ML-Agents `release_23`**. The machine-readable provenance is in
55
- `release_manifest.json`.
56
-
57
- Every dataset is stored at `<name>/<tier>/data/main_data.hdf5` with a sibling
58
- `metadata.json` and uses `minari_version` 0.5.3.
59
-
60
- PushBlock was collected by externally running the stock release-23
61
- `PushBlock.onnx` policy in the model-removed build. It is the original discrete
62
- PushBlock environment, not the separate hybrid PushBlockWithInput environment.
63
-
64
- SoccerTwos and DungeonEscape use an explicit ego-agent schema:
65
- `observations["agents"]["agent_0"]` and
66
- `actions["agents"]["agent_0"]`. Each physical agent is stored as one
67
- ego-centric episode because the Unity examples execute one shared decentralized
68
- policy independently for every agent. The wrapper makes the source multi-agent
69
- structure visible without giving the policy privileged access to teammates'
70
- private observations or actions.
71
-
72
- SoccerTwos is stock-policy self-play from ML-Agents release_23. It contains
73
- 3,647 complete four-player matches. Each match is represented as four linked
74
- decentralized agent episodes: two agents per team, with two winning and two
75
- losing trajectories. All 14,588 episodes terminate normally; none are truncated.
76
- Use `episode_metadata.jsonl` and `match_metadata.jsonl` to split or analyze data
77
- by `match_id` without leaking agents from one match across splits.
78
-
79
- `unity/soccer-twos/medium-v0` is a release-23 team-noise self-play dataset.
80
- At the start of every match, each team independently samples epsilon from
81
- `{0.08, 0.09, 0.10}`; both teammates share that epsilon for the match, while
82
- action resampling is independent per agent and decision. The pool sits one step
83
- below the simple pool (it drops the high-noise 0.15), calibrated by side-swapped
84
- match score against the fixed stock policy to a normalized skill of about 0.80.
85
- SoccerTwos self-play is noise-robust and its match-score calibration is noisier
86
- than the other scenes, so treat this figure as approximate. Rewards are the
87
- unmodified per-agent values returned by Unity (`reward + group_reward`). The
88
- dataset contains 3,260 complete matches, 13,040 terminated ego episodes,
89
- 1,001,776 transitions, and zero truncations. Mean episode length is
90
- 76.823313 +/- 70.864119; mean agent return is -0.038411 +/- 0.962893 (self-play
91
- stays balanced, so mean return does not track tier skill).
92
-
93
- `unity/soccer-twos/simple-v0` is a release-23 team-noise self-play dataset.
94
- At the start of every match, each team independently samples epsilon from
95
- `{0.08, 0.10, 0.15}`; both teammates share that epsilon for the match, while
96
- action resampling is independent per agent and decision. The pool was selected by
97
- side-swapped calibration against the fixed stock policy, giving a normalized skill
98
- of about 0.58 between a random 0.0 anchor and the stock expert 1.0 -- near the
99
- upper edge of the Minari-aligned `simple` band (target ~0.50). Rewards are the
100
- unmodified per-agent values returned by Unity (`reward + group_reward`).
101
- The dataset contains 3,215 complete matches, 12,860 terminated ego episodes,
102
- 1,003,048 transitions, and zero truncations. Mean episode length is
103
- 77.997512 +/- 71.649032; mean agent return is -0.038999 +/- 0.962336.
104
-
105
- DungeonEscape contains 11,929 complete three-player cooperative groups. Its
106
- agents share one POCA policy but act from separate local observations. Teammates
107
- are visible only indirectly through a limited stacked ray sensor. An individual
108
- agent can terminate with zero return before its surviving teammates unlock the
109
- door, so group success is authoritative in `group_metadata.jsonl`; do not infer
110
- group failure from an individual zero return. The dataset contains 11,371 group
111
- successes and 558 failures.
112
-
113
- ### DungeonEscape quality ladder
114
-
115
- The three DungeonEscape tiers form a monotone skill ladder. `expert-v0` is the
116
- stock shared POCA policy; `medium-v0` and `simple-v0` degrade it with
117
- progressively stronger per-group action noise. Every figure below comes from each
118
- tier's `validation_summary.json` (group success is `any(agent_return > 0)`).
119
- Approximate normalized skill is calibration-based against a random-policy anchor
120
- (group success rate ~0.19) and an expert 1.0.
121
-
122
- | tier | group success rate | epsilon pool | mean episode length | approx. normalized skill |
123
- |---|---:|---|---:|---:|
124
- | `expert-v0` | 0.9532 | stock (no noise) | 28.04 | 1.00 |
125
- | `medium-v0` | 0.7851 | {0.42, 0.44, 0.46, 0.48} | 52.73 | ~0.78 |
126
- | `simple-v0` | 0.6247 | {0.60, 0.65, 0.70, 0.75} | 88.27 | ~0.56 |
127
-
128
- `unity/dungeon-escape/medium-v0` is a release-23 group-noise dataset. At the
129
- start of every cooperative group episode the three agents share one epsilon
130
- sampled from `{0.42, 0.44, 0.46, 0.48}`, while action resampling is independent
131
- per agent and decision. The pool was chosen by calibrating group success rate
132
- (`any(agent_return > 0)`) against the fixed stock policy, giving a normalized
133
- skill of about 0.78 between an expert 1.0 and random 0.0 anchor. Rewards are the
134
- unmodified per-agent values returned by Unity (`reward + group_reward`). The
135
- dataset contains 6,341 complete groups, 19,023 terminated ego episodes, 1,003,025
136
- transitions, and zero truncations, with 4,978 group successes and 1,363 failures
137
- (success rate 0.7851). Less noise than the simple tier lets groups solve faster,
138
- so mean episode length falls to 52.726962 +/- 53.262907 and mean agent return
139
- rises to 0.494244 +/- 0.499967.
140
-
141
- `unity/dungeon-escape/simple-v0` is a release-23 group-noise dataset. At the
142
- start of every cooperative group episode the three agents share one epsilon
143
- sampled from `{0.60, 0.65, 0.70, 0.75}`, while action resampling is independent
144
- per agent and decision. DungeonEscape is highly robust to action noise, so the
145
- band sits at markedly higher epsilon than SoccerTwos; the pool was chosen by
146
- calibrating group success rate (`any(agent_return > 0)`) against the fixed stock
147
- policy, giving a normalized skill of about 0.56 between an expert 1.0 and random
148
- 0.0 anchor -- near the upper edge of the Minari-aligned `simple` band (target
149
- ~0.50). Rewards are the unmodified per-agent values returned by Unity
150
- (`reward + group_reward`). The dataset contains 3,789 complete groups, 11,367
151
- terminated ego episodes, 1,003,316 transitions, and zero truncations, with 2,367
152
- group successes and 1,422 failures (success rate 0.6247). Mean episode length is
153
- 88.265681 +/- 112.872284; mean agent return is 0.382951 +/- 0.486106.
154
-
155
- Load SoccerTwos on another machine with:
156
-
157
- ```python
158
- from pathlib import Path
159
- from huggingface_hub import snapshot_download
160
- import minari
161
-
162
- minari_root = Path.home() / ".minari" / "datasets"
163
- snapshot_download(
164
- repo_id="ccnets/causal-gpt-rl-unity-datasets",
165
- repo_type="dataset",
166
- allow_patterns="soccer-twos/**",
167
- local_dir=minari_root / "unity",
168
- )
169
- dataset = minari.load_dataset("unity/soccer-twos/expert-v0")
170
- # Or load the calibrated medium / simple tiers:
171
- # dataset = minari.load_dataset("unity/soccer-twos/medium-v0")
172
- # dataset = minari.load_dataset("unity/soccer-twos/simple-v0")
173
- print(dataset.observation_space) # Dict(agents=Dict(agent_0=Tuple(...)))
174
- print(dataset.action_space) # Dict(agents=Dict(agent_0=MultiDiscrete(...)))
175
- ```
176
-
177
- The recipe below regenerates these datasets from public materials.
178
-
179
- ## Reproduction recipe
180
-
181
- The scripts live in the GitHub repo — record with
182
- [`examples/unity_collection`](https://github.com/ccnets-team/causal-gpt-rl/tree/main/examples/unity_collection)
183
- and package with
184
- [`collection/build_minari.py`](https://github.com/ccnets-team/causal-gpt-rl/blob/main/collection/build_minari.py).
185
- For ONNX-driven environments, get the matching model-removed build and stock
186
- policy from the
187
- [envs repo](https://huggingface.co/datasets/ccnets/causal-gpt-rl-unity-envs),
188
- record each agent's per-step `(observation, action, reward, termination)`, and
189
- preserve the action/observation structure declared by that build.
190
-
191
- ### SoccerTwos release_23
192
-
193
- 1. Build the release_23 SoccerTwos scene with both teams' model assets removed,
194
- so both behavior groups are controlled externally.
195
- 2. Run the stock release_23 `SoccerTwos.onnx` policy for both teams and record
196
- both sides. The original ONNX declares two nonexistent Sentis metadata graph
197
- outputs; for ONNX Runtime collection, remove only those dangling output
198
- declarations. The action computation graph remains unchanged.
199
- 3. Store the sum of ML-Agents per-agent `reward` and `group_reward`. Soccer goal
200
- outcomes are delivered through `group_reward`.
201
- 4. Preserve the two vector sensors as `Tuple(Box(264), Box(72))` and the three
202
- discrete action branches as `MultiDiscrete([3, 3, 3])`.
203
- 5. Link the four decentralized episodes from each field with `match_id`, and
204
- finish all in-flight matches after crossing one million transitions.
205
-
206
- Final validation: 1,000,816 transitions, 14,588 terminated episodes, 3,647
207
- complete matches, zero truncations, zero NaN/Inf/shape/range errors, and every
208
- match has equal linked lengths with two wins and two losses. Mean agent episode
209
- length is 68.6054 and mean return is -0.034302.
210
-
211
- ### DungeonEscape release_23
212
-
213
- 1. Use the stock release_23 `DungeonEscape.onnx` shared POCA policy with the
214
- model removed from the Unity build so each agent is driven externally.
215
- 2. Record each physical agent independently. Preserve its three local sensor
216
- leaves (rigid-body state 10, stacked ray perception 360, has-key flag 1) and
217
- single `Discrete(7)` action.
218
- 3. Relabel every physical agent as the episode-local ego path
219
- `agents.agent_0`. Three episodes sharing one `match_id` reconstruct the
220
- original cooperative group; they are distinct local trajectories, not copies.
221
- 4. Sum ML-Agents `reward` and `group_reward` for the per-agent reward stream.
222
- Determine success only at group level because an agent that dies early may
223
- not receive a later positive group reward.
224
- 5. Split by `match_id`, never independently by ego episode.
225
-
226
- Final validation: 1,003,523 transitions, 35,787 terminated ego episodes, 11,929
227
- complete three-agent groups, 11,371 successes, 558 failures, and zero
228
- NaN/Inf/shape/action-range errors. Every match links exactly three episodes.
229
-
230
- ### PushBlock release_23
231
-
232
- 1. Use the model-removed release-23 PushBlock build and drive all 32 agents
233
- externally with the unmodified stock release-23 `PushBlock.onnx` policy.
234
- 2. Record the policy's live Unity rollouts with the release-23 collection runtime;
235
- preserve the two `105`-d sensors and the single `Discrete(7)` action branch.
236
- 3. Stop at one million transitions and package each physical agent episode
237
- independently. The final artifact contains 52,801 episodes (52,702 terminated
238
- and 99 truncated at the recording boundary), mean return 4.972084, and mean
239
- episode length 18.9390.
240
-
241
- ## Pyramids, Worm, and Walker release_23
242
-
243
- Use each model-removed release-23 build with its matching unmodified stock
244
- release-23 ONNX policy. Record each physical scene agent independently and
245
- stop at one million transitions. The published schemas come directly from
246
- the live ML-Agents behavior specs.
247
-
248
- - **Pyramids:** 5,348 episodes, 1,000,000 transitions,
249
- mean return 1.795309, mean length 186.9858,
250
- 5,298 terminated and 50 truncated episodes.
251
- - **Worm:** 1,000 episodes, 1,000,000 transitions,
252
- mean return 1044.106317, mean length 1000.0000,
253
- 0 terminated and 1,000 truncated episodes.
254
- - **Walker:** 1,458 episodes, 1,000,010 transitions,
255
- mean return 1363.645402, mean length 685.8779,
256
- 747 terminated and 711 truncated episodes.
257
-
258
- ### Pyramids quality ladder
259
-
260
- Pyramids ships an `expert` tier plus two calibrated lower-skill tiers
261
- (`medium`, `simple`) synthesized by adding uniform action noise to the stock
262
- policy (each discrete action is resampled with probability epsilon; epsilon is
263
- drawn per episode from the tier's range, seed 2310000). Pyramids is a
264
- sparse-reward single-agent scene, so tiers are keyed on normalized episode return
265
- between an expert 1.0 and a random 0.0 anchor (random mean return -1.0 -- the
266
- policy always times out). "reach rate" is the fraction of episodes that solve the
267
- maze and terminate; the rest time out at the step cap and are truncated. Because
268
- the reward is sparse (solve vs. time-out), the per-episode return stays bimodal
269
- even under the epsilon range; the range instead spreads the *trajectory*
270
- competence that produces those outcomes. Rewards are the unmodified Unity values.
271
-
272
- | tier | approx. normalized return | epsilon range | mean return | reach rate | mean episode length |
273
- |---|---:|---:|---:|---:|---:|
274
- | `expert-v0` | 1.00 | -- | 1.795309 | 0.9906 | 186.99 |
275
- | `medium-v0` | ~0.80 | 0.50–0.66 | 1.228100 | 0.8827 | 538.21 |
276
- | `simple-v0` | ~0.58 | 0.62–0.74 | 0.618400 | 0.6662 | 714.80 |
277
-
278
- ### 3DBallHard release_23
279
-
280
- Use the model-removed release-23 build with the unmodified release-23 stock
281
- `3DBallHard.onnx`. Preserve the two observation sensors (`27 + 18`) and the
282
- continuous `Box(2)` action. Final validation: 1,000,008 transitions,
283
- 1,009 episodes, mean return 99.107732, mean episode
284
- length 991.0882, 1 terminated and
285
- 1,008 truncated episodes.
286
-
287
- The recipe ends at the Minari dataset — a portable, env-less trajectory set.
288
-
289
- ## Single-agent quality ladders (continuous control & PushBlock)
290
-
291
- Crawler, Worm, Walker, 3DBallHard (continuous control) and PushBlock (discrete)
292
- each ship an `expert` tier plus calibrated `medium`/`simple` tiers. The noise level
293
- is **drawn independently per agent per episode from a calibrated range** — Gaussian
294
- `noise_std` added to the continuous actions, or a per-action resample probability
295
- `epsilon` on PushBlock's discrete branch (seed 2310000). Averaging over the run the
296
- mean normalized return lands on the tier target (`medium` ~0.80, `simple` ~0.60)
297
- while individual episodes cover a continuous band of skill instead of piling up at
298
- one point. Tiers are keyed on normalized episode return between the shipped
299
- `expert-v0` mean (1.0) and a random-policy (`epsilon` 1) anchor (0.0). "term. rate"
300
- is the fraction of episodes that end on the environment's terminal condition — a
301
- fall for Crawler / Walker / 3DBallHard, a solved push for PushBlock; Worm never
302
- terminates (pure locomotion, always truncated at 1000 steps). Rewards are the
303
- unmodified Unity values. PushBlock's reward is sparse (solve vs. time-out), so its
304
- per-episode return is bimodal even under the range; the range spreads the
305
- *trajectory* competence that produces those outcomes.
306
-
307
- **Crawler** (`Box(20)`; anchors: expert 2576.4899, random -0.88)
308
-
309
- | tier | approx. norm. return | noise_std range | mean return | term. rate | mean ep length |
310
- |---|---:|---:|---:|---:|---:|
311
- | `expert-v0` | 1.00 | -- | 2576.4899 | 0.077 | 954.20 |
312
- | `medium-v0` | ~0.82 | 0.15–0.23 | 2113.0960 | 0.209 | 885.74 |
313
- | `simple-v0` | ~0.60 | 0.21–0.32 | 1557.9818 | 0.460 | 744.05 |
314
-
315
- **Worm** (`Box(9)`; anchors: expert 1044.1063, random 0.80)
316
-
317
- | tier | approx. norm. return | noise_std range | mean return | term. rate | mean ep length |
318
- |---|---:|---:|---:|---:|---:|
319
- | `expert-v0` | 1.00 | -- | 1044.1063 | 0.000 | 1000.00 |
320
- | `medium-v0` | ~0.80 | 0.09–0.15 | 839.4910 | 0.000 | 1000.00 |
321
- | `simple-v0` | ~0.60 | 0.15–0.22 | 632.4776 | 0.000 | 1000.00 |
322
-
323
- **Walker** (`Box(39)`; anchors: expert 1363.6454, random -0.49)
324
-
325
- | tier | approx. norm. return | noise_std range | mean return | term. rate | mean ep length |
326
- |---|---:|---:|---:|---:|---:|
327
- | `expert-v0` | 1.00 | -- | 1363.6454 | 0.512 | 685.88 |
328
- | `medium-v0` | ~0.82 | 0.05–0.11 | 1122.0456 | 0.652 | 584.11 |
329
- | `simple-v0` | ~0.61 | 0.09–0.15 | 835.2383 | 0.822 | 445.04 |
330
-
331
- **3DBallHard** (`Box(2)`; anchors: expert 99.1077, random 0.84)
332
-
333
- | tier | approx. norm. return | noise_std range | mean return | term. rate | mean ep length |
334
- |---|---:|---:|---:|---:|---:|
335
- | `expert-v0` | 1.00 | -- | 99.1077 | 0.001 | 991.09 |
336
- | `medium-v0` | ~0.80 | 0.28–0.38 | 79.6258 | 0.341 | 800.01 |
337
- | `simple-v0` | ~0.60 | 0.31–0.44 | 59.7502 | 0.612 | 604.23 |
338
-
339
- **PushBlock** (`Discrete(7)`; anchors: expert 4.9721, random ~-0.16 — soft, the `epsilon` 1 baseline is noisy)
340
-
341
- | tier | approx. norm. return | epsilon range | mean return | term. rate (solved) | mean ep length |
342
- |---|---:|---:|---:|---:|---:|
343
- | `expert-v0` | 1.00 | -- | 4.972084 | ~1.00 | 18.94 |
344
- | `medium-v0` | ~0.79 | 0.78–0.85 | 3.908600 | 0.863 | 408.16 |
345
- | `simple-v0` | ~0.61 | 0.82–0.89 | 2.964500 | 0.705 | 560.85 |
346
-
347
- ## Provenance & attribution
348
-
349
- - Trajectories were generated by running Unity ML-Agents material (the builds
350
- and stock policies are Apache-2.0; see the envs repo for provenance and
351
- licenses).
352
- - The **trajectory data in this repo** is an original recording and is licensed
353
- **CC-BY-4.0**. Please attribute *ccnets — Causal GPT-RL* and note the Unity
354
- ML-Agents source environment.
355
-
356
- ## License
357
-
358
- Released under the Creative Commons Attribution 4.0 International license
359
- (CC-BY-4.0). See `LICENSE`.
 
1
+ ---
2
+ license: cc-by-4.0
3
+ tags:
4
+ - reinforcement-learning
5
+ - unity-ml-agents
6
+ - minari
7
+ - causal-gpt-rl
8
+ ---
9
+
10
+ # Causal GPT-RL — Unity ML-Agents trajectories
11
+
12
+ Recorded Unity ML-Agents trajectories packaged as
13
+ [Minari](https://minari.farama.org) datasets, spanning continuous and discrete
14
+ action spaces for testing Causal GPT-RL across space types. Every environment
15
+ ships an `expert` tier; eight ship a full **quality ladder** (`expert` +
16
+ calibrated `medium`/`simple`) synthesized by injecting action noise into the
17
+ stock policy.
18
+
19
+ Tiers are keyed to Minari-normalized skill between a random-policy `0.0` anchor
20
+ and the stock expert `1.0` — **targets `simple` 0.60 / `medium` 0.80 / `expert`
21
+ 1.0** (envs land at simple 0.56–0.61, medium 0.78–0.82). The noise is not a
22
+ single constant: it is drawn **per episode from a calibrated range** (cooperative
23
+ scenes sample per group/team per match), so each tier's *mean* hits its target
24
+ while the episodes span a continuous band of skill instead of piling at one point.
25
+
26
+ **Companion repos**
27
+ - Model-removed Unity builds + matching stock ONNX policies:
28
+ [ccnets/causal-gpt-rl-unity-envs](https://huggingface.co/datasets/ccnets/causal-gpt-rl-unity-envs)
29
+ - Causal GPT-RL policy checkpoints (currently Crawler):
30
+ [ccnets/causal-gpt-rl-unity](https://huggingface.co/ccnets/causal-gpt-rl-unity)
31
+
32
+ ## Contents
33
+
34
+ | Dataset id | Episodes | Transitions | Observation | Action |
35
+ |---|---:|---:|---|---|
36
+ | `unity/crawler/expert-v0` | 1,048 | 1,000,002 | `Tuple(Box(126), Box(32))` | `Box(20, [-1, 1])` |
37
+ | `unity/crawler/medium-v0` | 1,129 | 1,000,000 | `Tuple(Box(126), Box(32))` | `Box(20, [-1, 1])` |
38
+ | `unity/crawler/simple-v0` | 1,344 | 1,000,000 | `Tuple(Box(126), Box(32))` | `Box(20, [-1, 1])` |
39
+ | `unity/pushblock/expert-v0` | 52,801 | 1,000,000 | `Tuple(Box(105), Box(105))` | `Discrete(7)` |
40
+ | `unity/pushblock/medium-v0` | 2,450 | 1,000,000 | `Tuple(Box(105), Box(105))` | `Discrete(7)` |
41
+ | `unity/pushblock/simple-v0` | 1,783 | 1,000,000 | `Tuple(Box(105), Box(105))` | `Discrete(7)` |
42
+ | `unity/soccer-twos/expert-v0` | 14,588 | 1,000,816 | ego `Dict` wrapping `Tuple(Box(264), Box(72))` | ego `Dict` wrapping `MultiDiscrete([3, 3, 3])` |
43
+ | `unity/soccer-twos/medium-v0` | 13,040 | 1,001,776 | ego `Dict` wrapping `Tuple(Box(264), Box(72))` | ego `Dict` wrapping `MultiDiscrete([3, 3, 3])` |
44
+ | `unity/soccer-twos/simple-v0` | 12,860 | 1,003,048 | ego `Dict` wrapping `Tuple(Box(264), Box(72))` | ego `Dict` wrapping `MultiDiscrete([3, 3, 3])` |
45
+ | `unity/dungeon-escape/expert-v0` | 35,787 | 1,003,523 | ego `Dict` wrapping `Tuple(Box(10), Box(360), Box(1))` | ego `Dict` wrapping `Discrete(7)` |
46
+ | `unity/dungeon-escape/medium-v0` | 19,023 | 1,003,025 | ego `Dict` wrapping `Tuple(Box(10), Box(360), Box(1))` | ego `Dict` wrapping `Discrete(7)` |
47
+ | `unity/dungeon-escape/simple-v0` | 11,367 | 1,003,316 | ego `Dict` wrapping `Tuple(Box(10), Box(360), Box(1))` | ego `Dict` wrapping `Discrete(7)` |
48
+ | `unity/3dball-hard/expert-v0` | 1,009 | 1,000,008 | `Tuple(Box(27), Box(18))` | `Box(2)` |
49
+ | `unity/3dball-hard/medium-v0` | 1,250 | 1,000,008 | `Tuple(Box(27), Box(18))` | `Box(2)` |
50
+ | `unity/3dball-hard/simple-v0` | 1,655 | 1,000,008 | `Tuple(Box(27), Box(18))` | `Box(2)` |
51
+ | `unity/pyramids/expert-v0` | 5,348 | 1,000,000 | `Tuple(Box(56), Box(56), Box(56), Box(4))` | `Discrete(5)` |
52
+ | `unity/pyramids/medium-v0` | 1,858 | 1,000,000 | `Tuple(Box(56), Box(56), Box(56), Box(4))` | `Discrete(5)` |
53
+ | `unity/pyramids/simple-v0` | 1,399 | 1,000,000 | `Tuple(Box(56), Box(56), Box(56), Box(4))` | `Discrete(5)` |
54
+ | `unity/worm/expert-v0` | 1,000 | 1,000,000 | `Box(64)` | `Box(9, [-1, 1])` |
55
+ | `unity/worm/medium-v0` | 1,000 | 1,000,000 | `Box(64)` | `Box(9, [-1, 1])` |
56
+ | `unity/worm/simple-v0` | 1,000 | 1,000,000 | `Box(64)` | `Box(9, [-1, 1])` |
57
+ | `unity/walker/expert-v0` | 1,458 | 1,000,010 | `Box(243)` | `Box(39, [-1, 1])` |
58
+ | `unity/walker/medium-v0` | 1,712 | 1,000,000 | `Box(243)` | `Box(39, [-1, 1])` |
59
+ | `unity/walker/simple-v0` | 2,247 | 1,000,000 | `Box(243)` | `Box(39, [-1, 1])` |
60
+
61
+ All environments, datasets, and stock policies use **ML-Agents `release_23`**.
62
+ Each dataset is stored at `<name>/<tier>/data/main_data.hdf5` with a sibling
63
+ `metadata.json` (`minari_version` 0.5.3). SoccerTwos and DungeonEscape use an
64
+ ego-agent schema — `observations["agents"]["agent_0"]`,
65
+ `actions["agents"]["agent_0"]` — one ego episode per physical agent; split by
66
+ `match_id` (see [docs/reproduction.md](docs/reproduction.md)).
67
+
68
+ ## Loading
69
+
70
+ ```python
71
+ from pathlib import Path
72
+ from huggingface_hub import snapshot_download
73
+ import minari
74
+
75
+ snapshot_download(
76
+ repo_id="ccnets/causal-gpt-rl-unity-datasets",
77
+ repo_type="dataset",
78
+ allow_patterns="worm/**", # one env; drop to fetch all
79
+ local_dir=Path.home() / ".minari" / "datasets" / "unity",
80
+ )
81
+ dataset = minari.load_dataset("unity/worm/expert-v0")
82
+ # calibrated tiers: minari.load_dataset("unity/worm/medium-v0" | ".../simple-v0")
83
+ print(dataset.observation_space, dataset.action_space)
84
+ ```
85
+
86
+ ## Quality ladders
87
+
88
+ Each ladder is a monotone skill sequence built from ONE stock policy: `expert` is
89
+ the unmodified policy, `medium`/`simple` inject progressively stronger action
90
+ noise. The noise level is sampled per episode from a calibrated range (continuous
91
+ scenes vary Gaussian `noise_std`; discrete scenes vary the resample probability
92
+ `epsilon`; cooperative scenes sample per group/team per match, seed 2310000), so
93
+ the tier mean hits its normalized target while episodes cover a continuous skill
94
+ band. Normalization is `(candidate − random) / (expert − random)` on each env's
95
+ tier metric.
96
+
97
+ | env | tier metric | medium | simple | noise method |
98
+ |---|---|---:|---:|---|
99
+ | `crawler` | episode return | 0.82 | 0.60 | per-episode `noise_std` range |
100
+ | `worm` | episode return | 0.80 | 0.60 | per-episode `noise_std` range |
101
+ | `walker` | episode return | 0.82 | 0.61 | per-episode `noise_std` range |
102
+ | `3dball-hard` | episode return | 0.80 | 0.60 | per-episode `noise_std` range |
103
+ | `pushblock` | episode return | 0.79 | 0.61 | per-episode `epsilon` range |
104
+ | `pyramids` | episode return | 0.80 | 0.58 | per-episode `epsilon` range |
105
+ | `dungeon-escape` | group success | 0.78 | 0.56 | per-group `epsilon` pool |
106
+ | `soccer-twos` | match score | ~0.80 | ~0.58 | per-team `epsilon` pool |
107
+
108
+ `soccer-twos` figures are approximate: self-play stays balanced, so tier skill
109
+ cannot be read off the shipped returns and comes from side-swapped calibration.
110
+ Sparse-reward scenes (pyramids, pushblock, dungeon, soccer) have a physically
111
+ bimodal per-episode outcome (solve vs. time-out); there the range spreads
112
+ *trajectory* competence rather than the return histogram. `simple` targets 0.60
113
+ but the shipped tiers span **0.56–0.61** (DungeonEscape 0.56 and SoccerTwos ~0.58
114
+ sit at the low edge, calibrated to the earlier ~0.50 band); `medium` spans
115
+ 0.78–0.82.
116
+
117
+ "termination rate" below = fraction of episodes ending on the env's terminal
118
+ condition — a fall for Crawler/Walker/3DBallHard, a solved push for PushBlock,
119
+ maze solve ("reach") for Pyramids; Worm never terminates (truncated at 1000).
120
+
121
+ <details>
122
+ <summary><b>Per-environment ladder tables</b> — exact ranges, anchors, mean returns, rates</summary>
123
+
124
+ **Crawler** — anchors: expert 2576.4899, random −0.88
125
+
126
+ | tier | norm. return | noise_std range | mean return | term. rate | mean ep length |
127
+ |---|---:|---:|---:|---:|---:|
128
+ | `expert-v0` | 1.00 | -- | 2576.4899 | 0.077 | 954.20 |
129
+ | `medium-v0` | ~0.82 | 0.15–0.23 | 2113.0960 | 0.209 | 885.74 |
130
+ | `simple-v0` | ~0.60 | 0.21–0.32 | 1557.9818 | 0.460 | 744.05 |
131
+
132
+ **Worm** — anchors: expert 1044.1063, random 0.80 (never terminates)
133
+
134
+ | tier | norm. return | noise_std range | mean return | term. rate | mean ep length |
135
+ |---|---:|---:|---:|---:|---:|
136
+ | `expert-v0` | 1.00 | -- | 1044.1063 | 0.000 | 1000.00 |
137
+ | `medium-v0` | ~0.80 | 0.09–0.15 | 839.4910 | 0.000 | 1000.00 |
138
+ | `simple-v0` | ~0.60 | 0.15–0.22 | 632.4776 | 0.000 | 1000.00 |
139
+
140
+ **Walker** — anchors: expert 1363.6454, random −0.49 (high intrinsic return variance)
141
+
142
+ | tier | norm. return | noise_std range | mean return | term. rate | mean ep length |
143
+ |---|---:|---:|---:|---:|---:|
144
+ | `expert-v0` | 1.00 | -- | 1363.6454 | 0.512 | 685.88 |
145
+ | `medium-v0` | ~0.82 | 0.05–0.11 | 1122.0456 | 0.652 | 584.11 |
146
+ | `simple-v0` | ~0.61 | 0.09–0.15 | 835.2383 | 0.822 | 445.04 |
147
+
148
+ **3DBallHard** — anchors: expert 99.1077, random 0.84 (capped balance: near-bimodal)
149
+
150
+ | tier | norm. return | noise_std range | mean return | term. rate | mean ep length |
151
+ |---|---:|---:|---:|---:|---:|
152
+ | `expert-v0` | 1.00 | -- | 99.1077 | 0.001 | 991.09 |
153
+ | `medium-v0` | ~0.80 | 0.28–0.38 | 79.6258 | 0.341 | 800.01 |
154
+ | `simple-v0` | ~0.60 | 0.31–0.44 | 59.7502 | 0.612 | 604.23 |
155
+
156
+ **PushBlock** — anchors: expert 4.9721, random ~−0.16 (soft; the `epsilon` 1 baseline is noisy). Very noise-robust (flat until epsilon ~0.7, sharp fall over 0.80–0.92). term. rate = solved.
157
+
158
+ | tier | norm. return | epsilon range | mean return | term. rate | mean ep length |
159
+ |---|---:|---:|---:|---:|---:|
160
+ | `expert-v0` | 1.00 | -- | 4.972084 | ~1.00 | 18.94 |
161
+ | `medium-v0` | ~0.79 | 0.78–0.85 | 3.908600 | 0.863 | 408.16 |
162
+ | `simple-v0` | ~0.61 | 0.82–0.89 | 2.964500 | 0.705 | 560.85 |
163
+
164
+ **Pyramids** — anchors: expert 1.795309, random −1.0 (sparse: policy always times out at random). term. rate = mazes reached/solved.
165
+
166
+ | tier | norm. return | epsilon range | mean return | reach rate | mean ep length |
167
+ |---|---:|---:|---:|---:|---:|
168
+ | `expert-v0` | 1.00 | -- | 1.795309 | 0.9906 | 186.99 |
169
+ | `medium-v0` | ~0.80 | 0.50–0.66 | 1.228100 | 0.8827 | 538.21 |
170
+ | `simple-v0` | ~0.58 | 0.62–0.74 | 0.618400 | 0.6662 | 714.80 |
171
+
172
+ **DungeonEscape** — tier metric is **group success** `any(agent_return > 0)`; anchors: expert success 0.9532, random ~0.19. Group shares one pooled epsilon per episode; determine success at group level (`group_metadata.jsonl`).
173
+
174
+ | tier | group success | epsilon pool | mean ep length | approx. norm. skill |
175
+ |---|---:|---|---:|---:|
176
+ | `expert-v0` | 0.9532 | stock (no noise) | 28.04 | 1.00 |
177
+ | `medium-v0` | 0.7851 | {0.42, 0.44, 0.46, 0.48} | 52.73 | ~0.78 |
178
+ | `simple-v0` | 0.6247 | {0.60, 0.65, 0.70, 0.75} | 88.27 | ~0.56 |
179
+
180
+ **SoccerTwos** — tier metric is **side-swapped match score** vs the fixed stock policy (self-play, so mean shipped return ≈ −0.038 for both tiers and does not track skill; figures are calibration estimates). Each team samples one pooled epsilon per match.
181
+
182
+ | tier | approx. norm. skill | epsilon pool | matches | mean ep length |
183
+ |---|---:|---|---:|---:|
184
+ | `expert-v0` | 1.00 | stock (no noise) | 3,647 | 68.61 |
185
+ | `medium-v0` | ~0.80 | {0.08, 0.09, 0.10} | 3,260 | 76.82 |
186
+ | `simple-v0` | ~0.58 | {0.08, 0.10, 0.15} | 3,215 | 78.00 |
187
+
188
+ </details>
189
+
190
+ **Build & reproduction steps** (per-env recording recipe): see
191
+ [docs/reproduction.md](docs/reproduction.md).
192
+
193
+ ## Provenance & attribution
194
+
195
+ - Trajectories were generated by running Unity ML-Agents material (the builds and
196
+ stock policies are Apache-2.0; see the envs repo for provenance and licenses).
197
+ - The **trajectory data in this repo** is an original recording licensed
198
+ **CC-BY-4.0**. Please attribute *ccnets — Causal GPT-RL* and note the Unity
199
+ ML-Agents source environment.
200
+
201
+ ## License
202
+
203
+ Creative Commons Attribution 4.0 International (CC-BY-4.0). See `LICENSE`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/reproduction.md ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Reproduction recipe
2
+
3
+ How the datasets in [this repo](../README.md) were recorded from public
4
+ materials. Scripts live in the GitHub repo — record with
5
+ [`examples/unity_collection`](https://github.com/ccnets-team/causal-gpt-rl/tree/main/examples/unity_collection)
6
+ and package with
7
+ [`collection/build_minari.py`](https://github.com/ccnets-team/causal-gpt-rl/blob/main/collection/build_minari.py).
8
+ For each ONNX-driven environment, get the matching model-removed build and stock
9
+ policy from the
10
+ [envs repo](https://huggingface.co/datasets/ccnets/causal-gpt-rl-unity-envs),
11
+ record each agent's per-step `(observation, action, reward, termination)`, and
12
+ preserve the action/observation structure declared by that build.
13
+
14
+ ## Format & provenance
15
+
16
+ All environments, datasets, and stock behavior policies use **ML-Agents
17
+ `release_23`**; machine-readable provenance is in `release_manifest.json`. Every
18
+ dataset is stored at `<name>/<tier>/data/main_data.hdf5` with a sibling
19
+ `metadata.json` (`minari_version` 0.5.3).
20
+
21
+ **Ego-agent schema (SoccerTwos, DungeonEscape).** These use
22
+ `observations["agents"]["agent_0"]` / `actions["agents"]["agent_0"]`. Each
23
+ physical agent is stored as one ego-centric episode because the Unity examples run
24
+ one shared decentralized policy independently per agent; the wrapper exposes the
25
+ multi-agent structure without granting the policy privileged access to teammates'
26
+ private observations. Reconstruct a match/group by grouping the linked episodes on
27
+ `match_id`; **split by `match_id`, never by individual ego episode.**
28
+
29
+ **Quality tiers.** `medium`/`simple` add action noise to the stock policy, sampled
30
+ per episode from a calibrated range (single-agent) or per group/team per match from
31
+ a pool (cooperative), seed 2310000. Exact ranges, anchors, and calibration notes
32
+ are in the [dataset card](../README.md)'s "Quality ladders" section.
33
+
34
+ ## SoccerTwos
35
+
36
+ 1. Build the release_23 SoccerTwos scene with both teams' model assets removed so
37
+ both behavior groups are controlled externally.
38
+ 2. Run the stock `SoccerTwos.onnx` for both teams and record both sides. The
39
+ original ONNX declares two nonexistent Sentis metadata graph outputs; for ONNX
40
+ Runtime, remove only those dangling output declarations (the action graph is
41
+ unchanged).
42
+ 3. Store the sum of per-agent `reward` and `group_reward` (goals arrive via
43
+ `group_reward`).
44
+ 4. Preserve `Tuple(Box(264), Box(72))` observations and `MultiDiscrete([3, 3, 3])`
45
+ actions.
46
+ 5. Link the four decentralized episodes per field with `match_id`; finish all
47
+ in-flight matches after crossing one million transitions.
48
+
49
+ Expert validation: 1,000,816 transitions, 14,588 terminated episodes, 3,647
50
+ matches, 0 truncations, every match has equal linked lengths with two wins / two
51
+ losses. Mean agent ep length 68.61, mean return −0.034302.
52
+
53
+ ## DungeonEscape
54
+
55
+ 1. Use the stock `DungeonEscape.onnx` shared POCA policy with the model removed so
56
+ each agent is driven externally.
57
+ 2. Record each physical agent independently; preserve its three local sensor leaves
58
+ (rigid-body 10, stacked ray 360, has-key flag 1) and single `Discrete(7)` action.
59
+ 3. Relabel each physical agent as ego path `agents.agent_0`. Three episodes sharing
60
+ one `match_id` reconstruct the cooperative group (distinct local trajectories,
61
+ not copies).
62
+ 4. Sum `reward` and `group_reward`. Determine success only at group level — an
63
+ agent that dies early may not receive a later positive group reward.
64
+ 5. Split by `match_id`.
65
+
66
+ Expert validation: 1,003,523 transitions, 35,787 ego episodes, 11,929 groups
67
+ (11,371 successes / 558 failures), 0 shape/range errors. Every match links exactly
68
+ three episodes.
69
+
70
+ ## PushBlock
71
+
72
+ 1. Use the model-removed PushBlock build and drive all 32 agents with the stock
73
+ `PushBlock.onnx`. This is the original discrete PushBlock, not the hybrid
74
+ PushBlockWithInput.
75
+ 2. Preserve the two `105`-d sensors and the single `Discrete(7)` action branch.
76
+ 3. Stop at one million transitions and package each physical-agent episode
77
+ independently.
78
+
79
+ Expert validation: 52,801 episodes (52,702 terminated / 99 truncated at the
80
+ recording boundary), mean return 4.972084, mean ep length 18.94.
81
+
82
+ ## Pyramids, Worm, Walker, 3DBallHard
83
+
84
+ Use each model-removed build with its matching stock ONNX; record each physical
85
+ scene agent independently and stop at one million transitions. Schemas come
86
+ directly from the live ML-Agents behavior specs.
87
+
88
+ - **Pyramids** — 5,348 episodes, 1,000,000 transitions, mean return 1.795309, mean
89
+ length 186.99 (5,298 terminated / 50 truncated). `Tuple(Box(56)×3, Box(4))`,
90
+ `Discrete(5)`.
91
+ - **Worm** — 1,000 episodes, 1,000,000 transitions, mean return 1044.106317, mean
92
+ length 1000.00 (0 terminated / 1,000 truncated). `Box(64)`, `Box(9)`.
93
+ - **Walker** — 1,458 episodes, 1,000,010 transitions, mean return 1363.645402, mean
94
+ length 685.88 (747 terminated / 711 truncated). `Box(243)`, `Box(39)`.
95
+ - **3DBallHard** — 1,009 episodes, 1,000,008 transitions, mean return 99.107732,
96
+ mean length 991.09 (1 terminated / 1,008 truncated). `Tuple(Box(27), Box(18))`,
97
+ `Box(2)`.
98
+
99
+ The recipe ends at the Minari dataset — a portable, env-less trajectory set.