zhangdw commited on
Commit
84f160e
·
verified ·
1 Parent(s): 7e962a2

Redesign dataset card with visual overview and reproducible usage

Browse files
Files changed (3) hide show
  1. README.md +130 -107
  2. assets/banner.svg +17 -0
  3. checksums.json +3 -2
README.md CHANGED
@@ -14,125 +14,148 @@ configs:
14
  path: fairness/train.jsonl
15
  - split: validation
16
  path: fairness/evaluation.jsonl
 
 
 
 
 
 
17
  ---
18
 
19
- # MiniGrid DoorKey fairness v1
20
-
21
- Custom **initial-state holdout** splits for `MiniGrid-DoorKey-8x8-v0`, protocol
22
- `minigrid-doorkey-8x8-h64-v1`, state schema `minigrid-semantic-state-v1`, policy
23
- prompt version `minigrid-vlm-v1`. This is not an official Farama evaluation split
24
- and does not measure generalization to unseen map structures. Train and validation
25
- may share wall layouts. No policy/model calls or model performance enter selection.
26
-
27
- ## Frozen membership
28
-
29
- - Generation seeds: all integers **0 through 4095**, ascending, NumPy 1.26.4.
30
- - Generated states: 4096; duplicates: **753**; unreachable within 64: **0**.
31
- - Eligible deduplicated frozen candidates: **3343**.
32
- - Canonical validation: exactly **256** unique tasks in ascending content-derived task ID order.
33
- - Canonical training: **2886** tasks, the **complete remaining eligible pool** after all validation split groups are excluded. There is no separate training target or loaded-record cap.
34
- - Additional orientation variants reserved by validation groups: **201**.
35
- - Initial-state/task overlap: 0; orientation-invariant split-group overlap: 0.
36
-
37
- Only `fairness/evaluation.jsonl` is the validation set. `candidates.jsonl` and
38
- `reference-solutions.audit-only.json` are offline audit material, never rollout
39
- observations or runtime validation candidates. The latter contains native action IDs.
40
-
41
- ## Exact semantic restoration
42
-
43
- Each row stores `initial_state` and metadata. The state has exactly these fields:
44
- `schema`, `env_id`, `mission`, `width`, `height`, `max_steps`, `step_count`,
45
- `grid`, `agent_pos`, `agent_dir`, and `carrying`. `grid[x][y]` is the official
46
- MiniGrid `[object_type_id, color_id, object_state]` encoding in **x-major** order;
47
- empty cells and all walls, goal, key and door are retained. Door states are
48
- 0=open, 1=closed/unlocked, 2=locked. `carrying` is null or the encoded held yellow
49
- key. Direction 0/1/2/3 means east/south/west/north. Positions use native `(x,y)`.
50
- The mission is exactly `use the key to open the door and then get to the goal`.
51
- Initial step count is zero; max steps is 64. Native actions are deterministic,
52
- so generator RNG state is not required to restore a decision or execute a task.
53
-
54
- Canonical serialization is UTF-8 JSON with sorted keys, compact separators,
55
- `ensure_ascii=False`, with no added newline for hashing. `task_id` is SHA256 of
56
- the complete initial state. `split_group_id` hashes that same state **omitting
57
- only `agent_dir`**, keeping all initial orientation variants in one split.
58
- Runtime CPAD matches task ID plus the full current semantic state, including
59
- elapsed steps (equivalently remaining budget); actor history is excluded from matching.
60
- Object coordinates and solutions are training/audit metadata, never policy text.
61
- `metadata.image_sha256` hashes raw C-order uint8 RGB pixels of the restored image.
62
- No external state resources, seeds-as-task substitutes, or procedural resets are needed.
63
-
64
- ## Physics and observation
65
-
66
- Pinned dependencies: MiniGrid **3.0.0**, Gymnasium **1.2.3**, NumPy **1.26.4**.
67
- Expose native IDs left=0, right=1, forward=2, pickup=3, toggle=5. Left/right turn.
68
- Drop/done are not selectable actions. Invalid responses execute an internal
69
- native done/no-op, count one step, and preserve physical state. Supported actions
70
- with no observable effect are valid. Native goal reward is `1 - 0.9*t/64` and
71
- zero otherwise. Goal success on step 64 wins even if termination and truncation
72
- are both true. The environment adds no training penalty.
73
-
74
- The official `RGBImgObsWrapper(tile_size=56)` over the underlying environment with
75
- `highlight=False` produces one full **448×448 RGB** image. No recoloring, coordinates,
76
- prior images, or reference paths are added. Actor context has mission, direction,
77
- holding status, remaining budget and the last two compact action/feedback records.
78
- Model/processor weights are not part of this dataset. Experiments use the existing
79
- local `/data/zhangdw12/models/Qwen2.5-VL-3B-Instruct`, with artifact checksums
80
- recorded by the experiment; ordinary input/output caps are 2048/256, CPAD input 3072.
81
-
82
- ## Deterministic selection
83
-
84
- Selection version **minigrid-eval-256-v1**. BFS expands the five native MiniGrid
85
- primitive actions (including turns, pickup and toggle), with a 64-action limit.
86
- Every eligible candidate is restored exactly, checked against its RGB hash, and
87
- its shortest path is replayed through the real native environment. Rejections and
88
- seed provenance are retained in `fairness/provenance.json`.
89
-
90
- Nearest-rank 25th/50th/75th shortest-length boundaries are
91
- **[14, 17, 19]**. Equal lengths stay together; empty bins are omitted.
92
- Length bin is crossed with splitting-wall x and door y. Hamilton largest-remainder
93
- allocation assigns 256 slots proportional to stratum size; remainder ties sort by
94
- `(length_bin, wall_position, door_position)`. Within strata, ascending
95
- `(SHA256(UTF8("minigrid-eval-256-v1:" + task_id)), task_id)` determines selection.
96
- The selected records are sorted by `task_id`; their whole split groups are removed
97
- from training. Audit lists strata, quotas, selected IDs, overlap results and hashes.
98
-
99
- ## Download and verify without the training stack
100
 
101
  ```bash
102
- uvx hf download zhangdw/minigrid --type dataset --revision <published-commit> --local-dir minigrid
103
  cd minigrid
104
- uv venv --python 3.11 .venv
105
- uv pip install --python .venv/bin/python -r requirements.txt
106
- SDL_VIDEODRIVER=dummy .venv/bin/python code/restore_and_verify.py
107
- # Optional: re-run native BFS for every train and validation state.
108
- SDL_VIDEODRIVER=dummy .venv/bin/python code/restore_and_verify.py --bfs
109
  ```
110
 
111
- `checksums.json` verifies the published manifests, audit, provenance, card and
112
- restoration sources. No network access is needed after downloading dependencies.
113
- Pin the resolved Hub commit, never `main`, in formal experiment configs.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
 
115
- For complete generation/selection reproduction, use the `feat/minigrid-fairness`
116
- implementation in https://github.com/zhangdw156/verl-agent (issue #20):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
 
118
  ```bash
119
- python -m examples.data_preprocess.prepare_minigrid_fairness --output generated
120
- python -m examples.data_preprocess.package_minigrid_release --output generated
121
- python -m examples.data_preprocess.prepare_minigrid_fairness --output generated --audit --bfs
122
  ```
123
 
124
- The exact generation/state sources are also archived under `code/`. Running
125
- preparation against existing frozen candidates repeats selection byte for byte.
126
- A per-seed generation journal permits interrupted generation to resume; it is
127
- not part of the published dataset. File hashes identify the exact source bundle.
 
128
 
129
- ## Manifest SHA256
 
 
 
 
 
 
 
 
 
130
 
131
- - train: `9f83a24fb1bdb41987d88294d600175d0e9f9a0742e37c2c432f747740d48b32`
132
- - evaluation: `133d3ae56769cb63a783d32e7896db10c4be3c8ccb9acbebd3d05cecb8d5316d`
133
- - candidates: `e751cac40fba9235baf33535be4d57c6093822e52c36e0999548fabb27f1ef72`
134
 
135
- MiniGrid is distributed under the MIT license by Farama Foundation. This release
136
- contains synthetic task states generated using its DoorKey environment and no
137
- personal data. Repository feature acceptance remains pending owner-run ai02 GRPO
138
- and CPAD experiments; dataset publication is not a claim of training success.
 
14
  path: fairness/train.jsonl
15
  - split: validation
16
  path: fairness/evaluation.jsonl
17
+ tags:
18
+ - minigrid
19
+ - agentic-rl
20
+ - credit-assignment
21
+ - visual-agents
22
+ - reproducibility
23
  ---
24
 
25
+ ![MiniGrid — DoorKey, one decision at a time](assets/banner.svg)
26
+
27
+ **MiniGrid DoorKey** provides frozen initial states for `MiniGrid-DoorKey-8x8-v0`. An agent must find a key, unlock a door, and reach the goal within **64 actions**. Exact state restoration and fixed evaluation membership make this a useful setting for visual agentic reinforcement learning and credit assignment research.
28
+
29
+ <table width="100%" style="display: table; width: 100%; table-layout: fixed;">
30
+ <tr>
31
+ <td width="33%" align="center" style="text-align: center; padding: 16px 8px;"><strong style="font-size: 24px;">2,886</strong><br>Training states</td>
32
+ <td width="33%" align="center" style="text-align: center; padding: 16px 8px;"><strong style="font-size: 24px;">256</strong><br>Validation states</td>
33
+ <td width="33%" align="center" style="text-align: center; padding: 16px 8px;"><strong style="font-size: 24px;">448 × 448</strong><br>Native RGB observation</td>
34
+ </tr>
35
+ </table>
36
+
37
+ <p align="center">
38
+ <a href="#quick-start">Quick start</a> · <a href="#frozen-splits">Frozen splits</a> · <a href="#interaction-protocol">Interaction</a> · <a href="#state-format">State format</a> · <a href="#reproducibility">Reproducibility</a>
39
+ </p>
40
+
41
+ **Evaluation scope:** this is a custom **initial-state holdout** split. Training and validation may share wall layouts, so results measure initial-state generalization. The split is independently constructed and is not an official Farama evaluation protocol.
42
+
43
+ ## Quick start
44
+
45
+ Download the package and run its offline restoration verifier in a dedicated environment:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  ```bash
48
+ uvx hf download zhangdw/minigrid --type dataset --local-dir minigrid
49
  cd minigrid
50
+ uv venv --python 3.11 .uv-venv/minigrid
51
+ uv pip install --python .uv-venv/minigrid/bin/python -r requirements.txt
52
+ SDL_VIDEODRIVER=dummy .uv-venv/minigrid/bin/python code/restore_and_verify.py
 
 
53
  ```
54
 
55
+ The verifier checks file hashes, restores every training and validation state, compares the exact RGB pixels, and verifies split separation. It does not load a policy or model. Dependencies are pinned to MiniGrid 3.0.0, Gymnasium 1.2.3, NumPy 1.26.4, Pygame 2.6.1, and Pillow 12.3.0.
56
+
57
+ ## Frozen splits
58
+
59
+ | File | States | Role |
60
+ | --- | ---: | --- |
61
+ | `fairness/train.jsonl` | 2,886 | Complete eligible training pool after validation groups are excluded |
62
+ | `fairness/evaluation.jsonl` | 256 | Canonical validation set, sorted by task ID |
63
+ | `fairness/candidates.jsonl` | 3,343 | Deduplicated candidate archive for audit |
64
+
65
+ The source generator uses seeds **0–4095**: 4,096 states yield 753 duplicates and 3,343 eligible candidates, with zero candidates unreachable within 64 actions. After selecting 256 validation states, **201 additional orientation variants** are reserved with their validation groups. Thus `2,886 + 256 + 201 = 3,343`.
66
+
67
+ Both task overlap and orientation-invariant split-group overlap are zero. Only `fairness/evaluation.jsonl` is the validation set. Selection uses environment structure and native shortest paths, with no model calls or model-performance filtering.
68
+
69
+ ## Interaction protocol
70
+
71
+ | Property | Definition |
72
+ | --- | --- |
73
+ | Environment | `MiniGrid-DoorKey-8x8-v0` |
74
+ | Mission | `use the key to open the door and then get to the goal` |
75
+ | Action budget | 64 native actions |
76
+ | Actions | `left`, `right`, `forward`, `pickup`, `toggle` |
77
+ | Observation | Full 448 × 448 RGB image, `RGBImgObsWrapper(tile_size=56)`, `highlight=False` |
78
+ | Goal reward | `1 - 0.9 × t / 64` on reaching the goal at action `t`; zero otherwise |
79
+ | Protocol | `minigrid-doorkey-8x8-h64-v1` |
80
+
81
+ The key–door–goal sequence supports studying how earlier actions contribute to a later reward. The stored shortest paths are **audit material**, not step-level credit labels or policy inputs. Keep observations, reward, action budget, and fixed task membership consistent across methods.
82
+
83
+ <details>
84
+ <summary><strong>Action and observation details</strong></summary>
85
+
86
+ Native action IDs are `left=0`, `right=1`, `forward=2`, `pickup=3`, and `toggle=5`. Left and right rotate the agent; drop and done are not selectable policy actions. In the reference interaction protocol, an invalid response executes an internal native done/no-op, consumes one action, and preserves physical state. A supported action with no visible effect is still valid. Goal success on action 64 takes precedence when termination and truncation are both true. The environment adds no training penalty.
87
+
88
+ The RGB observation has no recoloring, coordinates, prior images, or reference paths. The reference policy context includes the mission, direction, holding status, remaining budget, and the last two compact action/feedback records. The prompt version is `minigrid-vlm-v1`; model and processor weights are supplied by the experiment.
89
+
90
+ </details>
91
+
92
+ ## State format
93
 
94
+ Each JSONL row contains `initial_state` and `metadata`. Initial states store the entire board and agent configuration, allowing exact restoration without procedural regeneration.
95
+
96
+ | Field | Meaning |
97
+ | --- | --- |
98
+ | `initial_state.grid` | Native `[object_type_id, color_id, object_state]` cells, indexed as `grid[x][y]` |
99
+ | `initial_state.agent_pos`, `agent_dir` | Native `(x, y)` position and facing direction |
100
+ | `initial_state.carrying` | Encoded held key, or `null` |
101
+ | `initial_state.step_count`, `max_steps` | Elapsed actions and action budget; initially 0 and 64 |
102
+ | `metadata.task_id` | SHA-256 of the complete initial state |
103
+ | `metadata.split_group_id` | State hash omitting only the initial facing direction |
104
+ | `metadata.image_sha256` | Hash of the restored raw RGB pixels |
105
+ | `metadata.shortest_length` | Verified shortest path length in native actions |
106
+
107
+ <details>
108
+ <summary><strong>Exact encoding and task identity</strong></summary>
109
+
110
+ The state schema is `minigrid-semantic-state-v1`. Its exact keys are `schema`, `env_id`, `mission`, `width`, `height`, `max_steps`, `step_count`, `grid`, `agent_pos`, `agent_dir`, and `carrying`.
111
+
112
+ The grid is **x-major**, preserving empty cells, walls, the goal, key, and door. Door states are `0=open`, `1=closed/unlocked`, and `2=locked`. Directions are `0=east`, `1=south`, `2=west`, and `3=north`. Inventory is `null` or the encoded yellow key.
113
+
114
+ Hashes use UTF-8 JSON with sorted keys, compact separators, `ensure_ascii=False`, and no added newline. The image hash covers raw C-order uint8 RGB pixels. Native actions are deterministic, so generator RNG state is unnecessary for restoration.
115
+
116
+ For matching decision states, the reference helper uses the task ID plus the full current semantic state, including elapsed steps; actor history is excluded. Object coordinates and stored solutions remain training/audit metadata and are not exposed in policy text.
117
+
118
+ </details>
119
+
120
+ ## Reproducibility
121
+
122
+ <details>
123
+ <summary><strong>How the 256 validation states are selected</strong></summary>
124
+
125
+ Selection version: `minigrid-eval-256-v1`. Native breadth-first search expands turns, forward movement, pickup, and toggle under the 64-action budget. Eligible candidates are restored, checked against their RGB hashes, and their shortest paths are replayed in the native environment. Seed provenance and rejections are recorded in `fairness/provenance.json`.
126
+
127
+ Shortest-length quartile boundaries are **[14, 17, 19]**, using the nearest-rank rule. Equal lengths stay together, and empty bins are omitted. Length bins are crossed with splitting-wall x and door y. Hamilton's largest-remainder allocation assigns 256 slots proportionally; ties sort by `(length_bin, wall_position, door_position)`.
128
+
129
+ Within each stratum, candidates rank by `(SHA256(UTF8("minigrid-eval-256-v1:" + task_id)), task_id)`. Selected rows are sorted by task ID. Their complete orientation-invariant groups are excluded from training. Quotas, selected IDs, overlaps, and hashes are retained in `fairness/evaluation-256.selection.json`.
130
+
131
+ </details>
132
+
133
+ <details>
134
+ <summary><strong>Additional verification and generation sources</strong></summary>
135
+
136
+ To recompute native shortest paths for every training and validation state after the quick start:
137
 
138
  ```bash
139
+ SDL_VIDEODRIVER=dummy .uv-venv/minigrid/bin/python code/restore_and_verify.py --bfs
 
 
140
  ```
141
 
142
+ For complete generation and selection reproduction, use the [matching generator implementation](https://github.com/zhangdw156/verl-agent/tree/feat/minigrid-fairness). Exact state and generation source snapshots are archived under `code/`. The archived preparation script imports that companion project's package; the standalone restoration verifier works directly from this dataset.
143
+
144
+ Preparation from existing frozen candidates repeats selection byte for byte. A per-seed generation journal supports resumption but is not part of the published release. For formal experiments, record the resolved Hub commit and pass it through `--revision` when downloading.
145
+
146
+ </details>
147
 
148
+ | Path | Contents |
149
+ | --- | --- |
150
+ | `code/restore_and_verify.py` | Standalone file, state, image, and split verification |
151
+ | `code/minigrid_fairness.py` | Native restoration, validation, sampling, and BFS helpers |
152
+ | `code/minigrid_protocol.py` | Reference action grammar |
153
+ | `fairness/evaluation-256.selection.json` | Frozen selection audit |
154
+ | `fairness/provenance.json` | Candidate-generation provenance |
155
+ | `fairness/reference-solutions.audit-only.json` | Native action sequences for offline audit |
156
+ | `checksums.json`, `fairness/checksums.json` | Package and manifest hashes |
157
+ | `requirements.txt` | Pinned restoration dependencies |
158
 
159
+ MiniGrid is developed by the [Farama Foundation](https://github.com/Farama-Foundation/Minigrid) and distributed under the MIT license. This release contains synthetic DoorKey states. Dataset verification concerns state restoration and split integrity; training results must be measured separately.
 
 
160
 
161
+ **Related environments:** [ALFWorld](https://huggingface.co/datasets/zhangdw/alfworld) · [WebShop](https://huggingface.co/datasets/zhangdw/webshop) · [Sokoban](https://huggingface.co/datasets/zhangdw/sokoban)
 
 
 
assets/banner.svg ADDED
checksums.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "README.md": "b48ad1a9f4339f24ba970126bf4ba896243c3b58905ff44e3edec038a3f286fb",
3
  "code/minigrid_fairness.py": "dc531bf3a0c7fe6b98c751ad32d15c67a505a589c2a165589a15f4d06ca80f12",
4
  "code/minigrid_protocol.py": "3f1ad6e861f8c421764152ba5205c77d60ea648ba89c8258f11d6d87a6d303bb",
5
  "code/prepare_minigrid_fairness.py": "5fdcd030e0d837411a6283f5a491497f5bad3dce7a2b54b78d896644905d0b56",
@@ -11,5 +11,6 @@
11
  "fairness/provenance.json": "d66b5b071f0848ccd6491e7a6c887f78d86fe881b9e21916ab072ea43d4fde1b",
12
  "fairness/reference-solutions.audit-only.json": "3bea4bbf36fb0d1634f0a97757c2cfa913a65964cd881cb825de9cc20a9f3f93",
13
  "fairness/train.jsonl": "9f83a24fb1bdb41987d88294d600175d0e9f9a0742e37c2c432f747740d48b32",
14
- "requirements.txt": "0f7e3ea58e4d8ccdf7900745469d6bfe981e895a20384cc35864e4e644a5afd2"
 
15
  }
 
1
  {
2
+ "README.md": "5b3a393b7fd527e27007b4a9b4f1d004b460e3726997d0315bdcf30f6d16a11b",
3
  "code/minigrid_fairness.py": "dc531bf3a0c7fe6b98c751ad32d15c67a505a589c2a165589a15f4d06ca80f12",
4
  "code/minigrid_protocol.py": "3f1ad6e861f8c421764152ba5205c77d60ea648ba89c8258f11d6d87a6d303bb",
5
  "code/prepare_minigrid_fairness.py": "5fdcd030e0d837411a6283f5a491497f5bad3dce7a2b54b78d896644905d0b56",
 
11
  "fairness/provenance.json": "d66b5b071f0848ccd6491e7a6c887f78d86fe881b9e21916ab072ea43d4fde1b",
12
  "fairness/reference-solutions.audit-only.json": "3bea4bbf36fb0d1634f0a97757c2cfa913a65964cd881cb825de9cc20a9f3f93",
13
  "fairness/train.jsonl": "9f83a24fb1bdb41987d88294d600175d0e9f9a0742e37c2c432f747740d48b32",
14
+ "requirements.txt": "0f7e3ea58e4d8ccdf7900745469d6bfe981e895a20384cc35864e4e644a5afd2",
15
+ "assets/banner.svg": "d2278c9effab479c94c8c2bfd20d44ea22d818df9a5a56423e94376435044dfc"
16
  }