tangkey commited on
Commit
5f7d14b
·
verified ·
1 Parent(s): 8e99057

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +319 -3
README.md CHANGED
@@ -1,3 +1,319 @@
1
- ---
2
- license: cc-by-nc-4.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GraphNav: Benchmarking Spatial Cognitive Graph Reasoning in Vision-Language Models
2
+
3
+ ## Overview
4
+
5
+ GraphNav is a controlled benchmark designed to evaluate spatial cognitive-graph reasoning in vision-language models (VLMs) by isolating high-level topological reasoning from execution-level confounds. The benchmark comprises **420 procedurally generated 3D maze environments** and **37,443 navigation paths** across three navigation tasks.
6
+
7
+ - **Paper**: Submitted to NeurIPS 2026 Evaluations and Datasets Track
8
+ - **License**: CC BY 4.0
9
+
10
+ ## Tasks
11
+
12
+ | Task | Description |
13
+ |------|-------------|
14
+ | Repeated Navigation | Reproduce a previously explored path in the original direction |
15
+ | Reversed Navigation | Travel the same path in the opposite direction |
16
+ | Shortcut Discovery | Find the shortest path using partially observed topology |
17
+
18
+ ## Confound Isolation
19
+
20
+ GraphNav isolates three execution-level confounds that entangle prior benchmarks:
21
+
22
+ | Confound | Isolation Strategy |
23
+ |----------|-------------------|
24
+ | Vision-Action Alignment | Four visual annotation conditions (C1–C4) |
25
+ | Visual Place Recognition | Distinctive 3D landmarks at every key node (127 unique models) |
26
+ | Distance-Angle Estimation | Discrete graph-node movement (no continuous metric estimation) |
27
+
28
+ ## Dataset Structure
29
+
30
+ ```
31
+ graphnav-dataset/
32
+ ├── mazes/ # 420 maze layout definitions (.txt)
33
+ │ ├── Maze_5x5_D0_T4_J2+0.txt
34
+ │ ├── Maze_7x7_D1_T6_J3+1.txt
35
+ │ ├── ...
36
+ │ └── Maze_17x17_*.txt
37
+ ├── paths/ # 37,443 navigation paths (.jsonl)
38
+ │ ├── repeated/
39
+ │ ├── reversed/
40
+ │ └── shortcut/
41
+ ├── images/ # Rendered observation images
42
+ │ ├── maze_nodes_noLabel/ # C1: Unlabeled
43
+ │ │ ├── 5x5/
44
+ │ │ ├── 7x7/
45
+ │ │ ├── 9x9/
46
+ │ │ ├── 11x11/
47
+ │ │ └── 13x13/
48
+ │ ├── maze_nodes_Arrow/ # C2: Arrow annotations (←, ↑, →)
49
+ │ │ ├── 5x5/
50
+ │ │ ├── 7x7/
51
+ │ │ ├── 9x9/
52
+ │ │ ├── 11x11/
53
+ │ │ └── 13x13/
54
+ │ ├── maze_nodes_LFR/ # C3: Semantic letter annotations (L, F, R)
55
+ │ │ ├── 5x5/
56
+ │ │ ├── 7x7/
57
+ │ │ ├── 9x9/
58
+ │ │ ├── 11x11/
59
+ │ │ └── 13x13/
60
+ │ └── maze_nodes_Num/ # C4: Numeric annotations (1, 2, 3)
61
+ │ ├── 5x5/
62
+ │ ├── 7x7/
63
+ │ ├── 9x9/
64
+ │ ├── 11x11/
65
+ │ └── 13x13/
66
+ └── README.md
67
+ ```
68
+
69
+ ## Maze Format (.txt)
70
+
71
+ Each maze is defined as a text file on a discrete S × S grid (S ∈ {5, 7, 9, 11, 13, 15, 17}).
72
+
73
+ **Naming convention**: `Maze_{S}x{S}_D{density}_T{topology}_J{junctions}+{loops}.txt`
74
+
75
+ Example (`Maze_5x5_D0_T4_J2+0.txt`):
76
+
77
+ ```
78
+ // Maze Grid: 5x5
79
+ // Name: Maze_5x5_D0_T4_J2+0
80
+ // 0=Wall, 1=Path
81
+ 0 1 1 1 1
82
+ 0 1 0 0 1
83
+ 0 1 1 1 1
84
+ 0 1 0 0 1
85
+ 0 1 1 1 1
86
+ ```
87
+
88
+ - `0` = Wall
89
+ - `1` = Path (navigable)
90
+ - Lines starting with `//` are metadata comments (grid size, maze name, legend)
91
+
92
+ ## Path Format (.jsonl)
93
+
94
+ Navigation paths are stored in JSONL format (one JSON object per line). Each record contains:
95
+
96
+ ```json
97
+ {
98
+ "maze_name": "Maze_5x5_D0_T4_J2+0",
99
+ "episode_id": 1,
100
+ "explore_path_len_target": 5,
101
+ "explore_path": [[1,4], [4,4], [4,2], [1,2], [1,0]],
102
+ "explore_arrivals": [null, 1, 2, 3, 2],
103
+ "start_idx": 0,
104
+ "goal_idx": 3,
105
+ "start": [1, 4],
106
+ "goal": [1, 2],
107
+ "explore_subpath": [[1,4], [4,4], [4,2], [1,2]],
108
+ "ideal_path": [[1,4], [1,2]],
109
+ "explore_len_steps": 3,
110
+ "ideal_len_steps": 1,
111
+ "junctions_on_ideal": 0,
112
+ "constraints": {
113
+ "state_space": "key_nodes_only",
114
+ "observed_graph": "full_explore_path",
115
+ "visibility": "LFR",
116
+ "min_gap": 2,
117
+ "min_savings": 1,
118
+ "min_junctions_on_ideal": 1,
119
+ "ideal_is_global_shortest_on_key_graph": true,
120
+ "ideal_has_junction_deg_ge_3_on_key_graph": true,
121
+ "junction_include_endpoints": false
122
+ }
123
+ }
124
+ ```
125
+
126
+ ### Field Descriptions
127
+
128
+ | Field | Type | Description |
129
+ |-------|------|-------------|
130
+ | `maze_name` | string | Identifier linking to the corresponding maze `.txt` file |
131
+ | `episode_id` | int | Unique episode index within the maze |
132
+ | `explore_path_len_target` | int | Target length for the exploration path |
133
+ | `explore_path` | list[list[int]] | Full sequence of key nodes visited during exploration (row, col) |
134
+ | `explore_arrivals` | list[int\|null] | Arrival direction at each node (0=N, 1=E, 2=S, 3=W; null for start) |
135
+ | `start_idx` | int | Index into `explore_path` for the navigation start node |
136
+ | `goal_idx` | int | Index into `explore_path` for the navigation goal node |
137
+ | `start` | list[int] | Start node coordinates (row, col) |
138
+ | `goal` | list[int] | Goal node coordinates (row, col) |
139
+ | `explore_subpath` | list[list[int]] | Subsegment of `explore_path` from `start_idx` to `goal_idx` |
140
+ | `ideal_path` | list[list[int]] | Ground-truth optimal path from start to goal |
141
+ | `explore_len_steps` | int | Number of steps in the explore subpath |
142
+ | `ideal_len_steps` | int | Number of steps in the ideal path |
143
+ | `junctions_on_ideal` | int | Number of junction nodes along the ideal path |
144
+ | `constraints` | object | Generation constraints and validation flags (see below) |
145
+
146
+ ### Constraints Object
147
+
148
+ | Field | Description |
149
+ |-------|-------------|
150
+ | `state_space` | Movement restricted to key nodes only |
151
+ | `observed_graph` | Graph scope used for path planning |
152
+ | `visibility` | Visual annotation condition |
153
+ | `min_gap` | Minimum index gap between start and goal on explore path |
154
+ | `min_savings` | Minimum step savings of ideal path vs. explore subpath |
155
+ | `min_junctions_on_ideal` | Minimum junctions required on ideal path |
156
+ | `ideal_is_global_shortest_on_key_graph` | Whether ideal path is globally shortest |
157
+ | `ideal_has_junction_deg_ge_3_on_key_graph` | Whether ideal path passes through a degree ≥ 3 junction |
158
+ | `junction_include_endpoints` | Whether endpoints count as junctions |
159
+
160
+ ## Image Conditions
161
+
162
+ Each observation is a stitched triple-perspective image (left, front, right views) rendered from the agent's current position. Four annotation conditions control the level of vision-action alignment scaffolding:
163
+
164
+ | Condition | Folder | Annotation | Description |
165
+ |-----------|--------|------------|-------------|
166
+ | C1 | `maze_nodes_noLabel/` | None | Raw triple-perspective image |
167
+ | C2 | `maze_nodes_Arrow/` | ← ↑ → | Arrow overlays on each sub-view |
168
+ | C3 | `maze_nodes_LFR/` | L F R | Semantic letter labels on each sub-view |
169
+ | C4 | `maze_nodes_Num/` | 1 2 3 | Numeric labels on each sub-view |
170
+
171
+ Each condition folder contains 5 maze sizes (5×5, 7×7, 9×9, 11×11, 13×13), with rendered node-level observation images for the corresponding mazes.
172
+
173
+ ## Benchmark Statistics
174
+
175
+ | Property | Value |
176
+ |----------|-------|
177
+ | Grid sizes | 5, 7, 9, 11, 13, 15, 17 |
178
+ | Total mazes | 420 |
179
+ | Total paths | 37,443 |
180
+ | Paths per maze | ~90 (avg ~30 per task) |
181
+ | Landmark catalog | 127 unique 3D models |
182
+ | Action space | {left, front, right} |
183
+ | Navigation tasks | 3 (repeated, reversed, shortcut) |
184
+
185
+ ## Environment Generation
186
+
187
+ Mazes are procedurally generated using the Unity engine with a modified Prim-style randomized carving algorithm. The generation process controls:
188
+
189
+ - **Branching factor**: Interpolates between high branching and long corridors
190
+ - **Loop and junction control**: Bounded loop probability and junction counts
191
+ - **Landmark placement**: Distinct 3D objects from a 127-model catalog at every salient node
192
+ - **Geometric constraints**: Step-length, straight-corridor caps, wall-thickness minima
193
+
194
+ The Unity project for environment generation is available in the accompanying code repository.
195
+
196
+ ## How to Use
197
+
198
+ ### 1. Loading Maze Definitions
199
+
200
+ The maze grid loader skips comment lines (`//`, `#`) and retains only pure 0/1 rows. The grid is stored as `grid[x][y]` with the y-axis inverted (y increases upward in world coordinates).
201
+
202
+ ```python
203
+ def load_maze_grid(grid_path):
204
+ """Load maze grid from .txt file.
205
+ Returns: grid (2D list, grid[x][y]), width, height
206
+ """
207
+ with open(grid_path, "r", encoding="utf-8") as f:
208
+ lines = f.readlines()
209
+
210
+ data_lines = []
211
+ for line in lines:
212
+ line = line.strip()
213
+ if not line or line.startswith("//") or line.startswith("#"):
214
+ continue
215
+ toks = line.split()
216
+ if toks and all(t in ("0", "1") for t in toks):
217
+ data_lines.append(toks)
218
+
219
+ height = len(data_lines)
220
+ width = len(data_lines[0])
221
+
222
+ # grid[x][y], y increases upward (row 0 in file = top = max y)
223
+ grid = [[0] * height for _ in range(width)]
224
+ for row_idx in range(height):
225
+ for x in range(width):
226
+ grid_y = height - 1 - row_idx
227
+ grid[x][grid_y] = int(data_lines[row_idx][x])
228
+
229
+ return grid, width, height
230
+
231
+ grid, w, h = load_maze_grid("mazes/Maze_5x5_D0_T4_J2+0.txt")
232
+ print(f"Grid size: {w}x{h}")
233
+ # grid[x][y] == 1 means navigable path; 0 means wall
234
+ ```
235
+
236
+ ### 2. Loading Navigation Episodes
237
+
238
+ Episodes are stored in JSONL format (one JSON object per line). Each file may contain multiple episodes for the same maze.
239
+
240
+ ```python
241
+ import json
242
+
243
+ def load_episodes(filepath):
244
+ """Load all episodes from a .jsonl file."""
245
+ episodes = []
246
+ with open(filepath, "r", encoding="utf-8") as f:
247
+ for line in f:
248
+ line = line.strip()
249
+ if line:
250
+ episodes.append(json.loads(line))
251
+ return episodes
252
+
253
+ episodes = load_episodes("paths/shortcut/Maze_5x5_D0_T4_J2+0.jsonl")
254
+ print(f"Loaded {len(episodes)} episodes")
255
+
256
+ ep = episodes[0]
257
+ print(f"Maze: {ep['maze_name']}")
258
+ print(f"Start: {ep['start']}, Goal: {ep['goal']}")
259
+ print(f"Explore path ({ep['explore_path_len_target']} nodes): {ep['explore_path']}")
260
+ print(f"Ideal path ({ep['ideal_len_steps']} steps): {ep['ideal_path']}")
261
+ ```
262
+
263
+ ### 3. Running VLM Evaluation
264
+
265
+ The full evaluation code (environment, agent, prompt construction, metrics) is available in the accompanying code repository:
266
+
267
+ > **Code**: [https://anonymous.4open.science/r/paper-code-submission-2026-5FF4](https://anonymous.4open.science/r/paper-code-submission-2026-5FF4)
268
+
269
+ The codebase is organized as:
270
+
271
+ - `toolKit_core.py` / `toolKit_core_forward.py` — shared utilities: maze environment, navigation graph, image indexing, episode execution, metrics
272
+ - `maze_NUM_*.py` — C4 (numeric 1-2-3) agent and prompt
273
+ - `maze_LFR_*.py` — C3 (letter L-F-R) agent and prompt
274
+ - `maze_Arrow_*.py` — C2 (arrow ←↑→) agent and prompt
275
+ - `maze_noLabel_*.py` — C1 (unlabeled) agent and prompt
276
+
277
+ Quick start:
278
+
279
+ ```python
280
+ import toolKit_core as core
281
+
282
+ # Configure variant (num / lfr / arrow / nolabel)
283
+ core.configure("num")
284
+
285
+ # Load maze environment
286
+ env = core.MazeEnv("Maze_5x5_D0_T4_J2+0")
287
+
288
+ # Load episodes
289
+ episodes = core.load_episodes_for_maze("Maze_5x5_D0_T4_J2+0", core.PRECOMPUTED_EPISODES_ROOT)
290
+ ```
291
+
292
+ See the code repository README for detailed setup instructions, API configuration, and full reproduction steps.
293
+
294
+ ### 4. Navigation Loop
295
+
296
+ At each step, the VLM agent receives a multimodal prompt containing:
297
+
298
+ 1. **Task instructions** — navigation goal description
299
+ 2. **Few-shot examples** — wall vs. path image examples
300
+ 3. **Exploration experience** — sequence of triple-perspective images with action labels from the learned path
301
+ 4. **History** — images and actions taken so far in the current trip
302
+ 5. **Destination** — overview image of the goal node
303
+ 6. **Current observation** — triple-perspective stitched image at the current position
304
+
305
+ The agent outputs a single action token (`1`/`2`/`3` for C4, `L`/`F`/`R` for C3, `←`/`↑`/`→` for C2, or `left`/`front`/`right` for C1), which is mapped to a relative direction and executed in the maze environment. Invalid actions trigger a retry with explicit feedback.
306
+
307
+ ### 5. Metrics
308
+
309
+ | Metric | Task | Description |
310
+ |--------|------|-------------|
311
+ | **SR** (Success Rate) | All | Fraction of episodes where the agent reaches the goal within the step budget |
312
+ | **PFS** (Path Fidelity Score) | Repeated Nav., Reversed Nav. | Overlap of directed edges between actual and ideal paths, normalized by actual path length; 0 if goal not reached |
313
+ | **SPL** (Success weighted by Path Length) | Shortcut Discovery | Ratio of ideal to actual path length, scaled by success indicator |
314
+ | **DPS** (Directional Progress Score) | Shortcut Discovery | Average cosine similarity between movement vectors and goal vectors across all steps |
315
+
316
+
317
+ ## License
318
+
319
+ This dataset is released under the [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) license.