File size: 13,093 Bytes
0c4109d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f7d14b
 
 
 
0c4109d
 
 
 
5f7d14b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
---
license: cc-by-4.0
task_categories:
  - visual-question-answering
  - robotics
tags:
  - spatial-reasoning
  - navigation
  - vision-language-models
  - benchmark
  - cognitive-graph
size_categories:
  - 10K<n<100K
---

# GraphNav: Benchmarking Spatial Cognitive Graph Reasoning in Vision-Language Models

## Overview

GraphNav is a controlled benchmark designed to evaluate spatial cognitive-graph reasoning in vision-language models (VLMs) # GraphNav: Benchmarking Spatial Cognitive Graph Reasoning in Vision-Language Models

## Overview

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.

- **Paper**: Submitted to NeurIPS 2026 Evaluations and Datasets Track
- **License**: CC BY 4.0

## Tasks

| Task | Description |
|------|-------------|
| Repeated Navigation | Reproduce a previously explored path in the original direction |
| Reversed Navigation | Travel the same path in the opposite direction |
| Shortcut Discovery | Find the shortest path using partially observed topology |

## Confound Isolation

GraphNav isolates three execution-level confounds that entangle prior benchmarks:

| Confound | Isolation Strategy |
|----------|-------------------|
| Vision-Action Alignment | Four visual annotation conditions (C1–C4) |
| Visual Place Recognition | Distinctive 3D landmarks at every key node (127 unique models) |
| Distance-Angle Estimation | Discrete graph-node movement (no continuous metric estimation) |

## Dataset Structure

```
graphnav-dataset/
├── mazes/                              # 420 maze layout definitions (.txt)
│   ├── Maze_5x5_D0_T4_J2+0.txt
│   ├── Maze_7x7_D1_T6_J3+1.txt
│   ├── ...
│   └── Maze_17x17_*.txt
├── paths/                              # 37,443 navigation paths (.jsonl)
│   ├── repeated/
│   ├── reversed/
│   └── shortcut/
├── images/                             # Rendered observation images
│   ├── maze_nodes_noLabel/             # C1: Unlabeled
│   │   ├── 5x5/
│   │   ├── 7x7/
│   │   ├── 9x9/
│   │   ├── 11x11/
│   │   └── 13x13/
│   ├── maze_nodes_Arrow/               # C2: Arrow annotations (←, ↑, →)
│   │   ├── 5x5/
│   │   ├── 7x7/
│   │   ├── 9x9/
│   │   ├── 11x11/
│   │   └── 13x13/
│   ├── maze_nodes_LFR/                 # C3: Semantic letter annotations (L, F, R)
│   │   ├── 5x5/
│   │   ├── 7x7/
│   │   ├── 9x9/
│   │   ├── 11x11/
│   │   └── 13x13/
│   └── maze_nodes_Num/                 # C4: Numeric annotations (1, 2, 3)
│       ├── 5x5/
│       ├── 7x7/
│       ├── 9x9/
│       ├── 11x11/
│       └── 13x13/
└── README.md
```

## Maze Format (.txt)

Each maze is defined as a text file on a discrete S × S grid (S ∈ {5, 7, 9, 11, 13, 15, 17}).

**Naming convention**: `Maze_{S}x{S}_D{density}_T{topology}_J{junctions}+{loops}.txt`

Example (`Maze_5x5_D0_T4_J2+0.txt`):

```
// Maze Grid: 5x5
// Name: Maze_5x5_D0_T4_J2+0
// 0=Wall, 1=Path
0 1 1 1 1
0 1 0 0 1
0 1 1 1 1
0 1 0 0 1
0 1 1 1 1
```

- `0` = Wall
- `1` = Path (navigable)
- Lines starting with `//` are metadata comments (grid size, maze name, legend)

## Path Format (.jsonl)

Navigation paths are stored in JSONL format (one JSON object per line). Each record contains:

```json
{
  "maze_name": "Maze_5x5_D0_T4_J2+0",
  "episode_id": 1,
  "explore_path_len_target": 5,
  "explore_path": [[1,4], [4,4], [4,2], [1,2], [1,0]],
  "explore_arrivals": [null, 1, 2, 3, 2],
  "start_idx": 0,
  "goal_idx": 3,
  "start": [1, 4],
  "goal": [1, 2],
  "explore_subpath": [[1,4], [4,4], [4,2], [1,2]],
  "ideal_path": [[1,4], [1,2]],
  "explore_len_steps": 3,
  "ideal_len_steps": 1,
  "junctions_on_ideal": 0,
  "constraints": {
    "state_space": "key_nodes_only",
    "observed_graph": "full_explore_path",
    "visibility": "LFR",
    "min_gap": 2,
    "min_savings": 1,
    "min_junctions_on_ideal": 1,
    "ideal_is_global_shortest_on_key_graph": true,
    "ideal_has_junction_deg_ge_3_on_key_graph": true,
    "junction_include_endpoints": false
  }
}
```

### Field Descriptions

| Field | Type | Description |
|-------|------|-------------|
| `maze_name` | string | Identifier linking to the corresponding maze `.txt` file |
| `episode_id` | int | Unique episode index within the maze |
| `explore_path_len_target` | int | Target length for the exploration path |
| `explore_path` | list[list[int]] | Full sequence of key nodes visited during exploration (row, col) |
| `explore_arrivals` | list[int\|null] | Arrival direction at each node (0=N, 1=E, 2=S, 3=W; null for start) |
| `start_idx` | int | Index into `explore_path` for the navigation start node |
| `goal_idx` | int | Index into `explore_path` for the navigation goal node |
| `start` | list[int] | Start node coordinates (row, col) |
| `goal` | list[int] | Goal node coordinates (row, col) |
| `explore_subpath` | list[list[int]] | Subsegment of `explore_path` from `start_idx` to `goal_idx` |
| `ideal_path` | list[list[int]] | Ground-truth optimal path from start to goal |
| `explore_len_steps` | int | Number of steps in the explore subpath |
| `ideal_len_steps` | int | Number of steps in the ideal path |
| `junctions_on_ideal` | int | Number of junction nodes along the ideal path |
| `constraints` | object | Generation constraints and validation flags (see below) |

### Constraints Object

| Field | Description |
|-------|-------------|
| `state_space` | Movement restricted to key nodes only |
| `observed_graph` | Graph scope used for path planning |
| `visibility` | Visual annotation condition |
| `min_gap` | Minimum index gap between start and goal on explore path |
| `min_savings` | Minimum step savings of ideal path vs. explore subpath |
| `min_junctions_on_ideal` | Minimum junctions required on ideal path |
| `ideal_is_global_shortest_on_key_graph` | Whether ideal path is globally shortest |
| `ideal_has_junction_deg_ge_3_on_key_graph` | Whether ideal path passes through a degree ≥ 3 junction |
| `junction_include_endpoints` | Whether endpoints count as junctions |

## Image Conditions

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:

| Condition | Folder | Annotation | Description |
|-----------|--------|------------|-------------|
| C1 | `maze_nodes_noLabel/` | None | Raw triple-perspective image |
| C2 | `maze_nodes_Arrow/` | ← ↑ → | Arrow overlays on each sub-view |
| C3 | `maze_nodes_LFR/` | L F R | Semantic letter labels on each sub-view |
| C4 | `maze_nodes_Num/` | 1 2 3 | Numeric labels on each sub-view |

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.

## Benchmark Statistics

| Property | Value |
|----------|-------|
| Grid sizes | 5, 7, 9, 11, 13, 15, 17 |
| Total mazes | 420 |
| Total paths | 37,443 |
| Paths per maze | ~90 (avg ~30 per task) |
| Landmark catalog | 127 unique 3D models |
| Action space | {left, front, right} |
| Navigation tasks | 3 (repeated, reversed, shortcut) |

## Environment Generation

Mazes are procedurally generated using the Unity engine with a modified Prim-style randomized carving algorithm. The generation process controls:

- **Branching factor**: Interpolates between high branching and long corridors
- **Loop and junction control**: Bounded loop probability and junction counts
- **Landmark placement**: Distinct 3D objects from a 127-model catalog at every salient node
- **Geometric constraints**: Step-length, straight-corridor caps, wall-thickness minima

The Unity project for environment generation is available in the accompanying code repository.

## How to Use

### 1. Loading Maze Definitions

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).

```python
def load_maze_grid(grid_path):
    """Load maze grid from .txt file.
    Returns: grid (2D list, grid[x][y]), width, height
    """
    with open(grid_path, "r", encoding="utf-8") as f:
        lines = f.readlines()

    data_lines = []
    for line in lines:
        line = line.strip()
        if not line or line.startswith("//") or line.startswith("#"):
            continue
        toks = line.split()
        if toks and all(t in ("0", "1") for t in toks):
            data_lines.append(toks)

    height = len(data_lines)
    width = len(data_lines[0])

    # grid[x][y], y increases upward (row 0 in file = top = max y)
    grid = [[0] * height for _ in range(width)]
    for row_idx in range(height):
        for x in range(width):
            grid_y = height - 1 - row_idx
            grid[x][grid_y] = int(data_lines[row_idx][x])

    return grid, width, height

grid, w, h = load_maze_grid("mazes/Maze_5x5_D0_T4_J2+0.txt")
print(f"Grid size: {w}x{h}")
# grid[x][y] == 1 means navigable path; 0 means wall
```

### 2. Loading Navigation Episodes

Episodes are stored in JSONL format (one JSON object per line). Each file may contain multiple episodes for the same maze.

```python
import json

def load_episodes(filepath):
    """Load all episodes from a .jsonl file."""
    episodes = []
    with open(filepath, "r", encoding="utf-8") as f:
        for line in f:
            line = line.strip()
            if line:
                episodes.append(json.loads(line))
    return episodes

episodes = load_episodes("paths/shortcut/Maze_5x5_D0_T4_J2+0.jsonl")
print(f"Loaded {len(episodes)} episodes")

ep = episodes[0]
print(f"Maze: {ep['maze_name']}")
print(f"Start: {ep['start']}, Goal: {ep['goal']}")
print(f"Explore path ({ep['explore_path_len_target']} nodes): {ep['explore_path']}")
print(f"Ideal path ({ep['ideal_len_steps']} steps): {ep['ideal_path']}")
```

### 3. Running VLM Evaluation

The full evaluation code (environment, agent, prompt construction, metrics) is available in the accompanying code repository:

> **Code**: [https://anonymous.4open.science/r/paper-code-submission-2026-5FF4](https://anonymous.4open.science/r/paper-code-submission-2026-5FF4)

The codebase is organized as:

- `toolKit_core.py` / `toolKit_core_forward.py` — shared utilities: maze environment, navigation graph, image indexing, episode execution, metrics
- `maze_NUM_*.py` — C4 (numeric 1-2-3) agent and prompt
- `maze_LFR_*.py` — C3 (letter L-F-R) agent and prompt
- `maze_Arrow_*.py` — C2 (arrow ←↑→) agent and prompt
- `maze_noLabel_*.py` — C1 (unlabeled) agent and prompt

Quick start:

```python
import toolKit_core as core

# Configure variant (num / lfr / arrow / nolabel)
core.configure("num")

# Load maze environment
env = core.MazeEnv("Maze_5x5_D0_T4_J2+0")

# Load episodes
episodes = core.load_episodes_for_maze("Maze_5x5_D0_T4_J2+0", core.PRECOMPUTED_EPISODES_ROOT)
```

See the code repository README for detailed setup instructions, API configuration, and full reproduction steps.

### 4. Navigation Loop

At each step, the VLM agent receives a multimodal prompt containing:

1. **Task instructions** — navigation goal description
2. **Few-shot examples** — wall vs. path image examples
3. **Exploration experience** — sequence of triple-perspective images with action labels from the learned path
4. **History** — images and actions taken so far in the current trip
5. **Destination** — overview image of the goal node
6. **Current observation** — triple-perspective stitched image at the current position

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.

### 5. Metrics

| Metric | Task | Description |
|--------|------|-------------|
| **SR** (Success Rate) | All | Fraction of episodes where the agent reaches the goal within the step budget |
| **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 |
| **SPL** (Success weighted by Path Length) | Shortcut Discovery | Ratio of ideal to actual path length, scaled by success indicator |
| **DPS** (Directional Progress Score) | Shortcut Discovery | Average cosine similarity between movement vectors and goal vectors across all steps |


## License

This dataset is released under the [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) license.