File size: 5,235 Bytes
aad36d5 f474cdd aad36d5 f474cdd a6543fc f474cdd aad36d5 | 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 | ---
license: mit
---
# π§© Maze Navigation Dataset
A comprehensive dataset of 899 maze-solving examples generated using three different maze generation algorithms, designed for training and evaluating LLM navigation capabilities.
## π Dataset Overview
- **Total Mazes**: 899 examples
- **Algorithms**: 3 different maze generation techniques (~300 examples each)
- **Map Sizes**: 3 different sizes per algorithm
- **5x5** inner grid (7x7 with walls)
- **10x10** inner grid (12x12 with walls)
- **20x20** inner grid (22x22 with walls)
- **Format**: JSONL (JSON Lines)
- **Task**: Navigation from Player (P) to Destination (D)
### Map Elements
- `#`: Wall (impassable)
- `P`: Player start position
- `D`: Destination (goal)
- `.`: Walkable tile (empty space)
### Example 5x5 Map
```
#######
#P....#
#.###.#
#.#...#
#.#.#.#
#...#D#
#######
```
**Note**: Map dimensions (5x5, 10x10, 20x20) refer to the **inner walkable grid**, excluding the outer perimeter walls. A 5x5 inner grid becomes a 7x7 grid with walls.
## π² Generation Algorithms
### 1. Recursive Backtracker (DFS-based)
**Description**: Creates "perfect" mazes with no loops or isolated sections. Each pair of cells has exactly one path between them.
**Characteristics**:
- Long, winding corridors
- Many dead ends
- Spindly, organic branching
- High path complexity
**Use Case**: Testing LLM's ability to handle complex, maze-like navigation with many decision points.
### 2. Prim's Algorithm (MST-based)
**Description**: Also creates perfect mazes but with a different structural feel.
**Characteristics**:
- Blockier, denser layout
- More interconnected "room-like" areas
- Wider passages
- Bulbous cavern structures
**Use Case**: Testing LLM's spatial reasoning with more open, room-based layouts.
### 3. Cellular Automata
**Description**: Generates organic, natural-looking cave systems using Game of Life-like rules.
**Algorithm**:
1. Initialize with random wall distribution (~45%)
2. Apply cellular automata rules for 5-8 iterations
3. Ensure single connected component via flood fill
4. Smooth edges with additional iterations
**Characteristics**:
- Organic, irregular shapes
- Natural cavern feel
- Open areas with scattered obstacles
- Less predictable structure
**Use Case**: Testing LLM's adaptability to non-traditional, organic layouts.
## π Output Formats
### Fine-tuning Dataset (`mazes.jsonl`)
Each line is a JSON object:
```json
{"input": "Map:\n#######\n#P....#\n#.....#\n#.....#\n#....D#\n#######", "output": "DOWN,DOWN,DOWN,RIGHT,RIGHT,RIGHT,RIGHT"}
```
The output contains comma-separated directional commands:
- `UP`: Move north
- `DOWN`: Move south
- `LEFT`: Move west
- `RIGHT`: Move east
## π Dataset Statistics
| Algorithm | Small (7x7) | Medium (12x12) | Large (22x22) | Total |
|-----------|-------------|----------------|---------------|---------|
| Recursive Backtracker | ~100 | ~100 | ~100 | ~300 |
| Prim's Algorithm | ~100 | ~100 | ~100 | ~300 |
| Cellular Automata | ~100 | ~100 | ~100 | ~300 |
| **Total** | ~300 | ~300 | ~300 | **900** |
## π Usage Examples
### Loading the Dataset
```python
import json
mazes = []
with open('mazes.jsonl', 'r') as f:
for line in f:
mazes.append(json.loads(line))
print(f"Loaded {len(mazes)} maze examples")
```
### Example Training Format
```python
# Example maze entry
example = mazes[0]
print("Input:")
print(example['input'])
print("\nExpected Output:")
print(example['output'])
```
### Parsing Map Data
```python
def parse_maze(input_text):
lines = input_text.split('\n')[1:] # Skip "Map:" header
grid = [list(line) for line in lines]
# Find start and end positions
start_pos = None
end_pos = None
for i, row in enumerate(grid):
for j, cell in enumerate(row):
if cell == 'P':
start_pos = (i, j)
elif cell == 'D':
end_pos = (i, j)
return grid, start_pos, end_pos
```
## π― Use Cases
### 1. LLM Fine-tuning
Train language models to navigate mazes and understand spatial reasoning.
### 2. Path Planning Evaluation
Benchmark different algorithms on maze navigation tasks.
### 3. Spatial Intelligence Research
Study how models handle different types of spatial layouts.
### 4. Multi-step Reasoning
Evaluate models' ability to plan sequences of actions to reach goals.
## π Quality Assurance
- All mazes are **solvable** with exactly one optimal path
- **Consistent formatting** across all examples
- **Balanced distribution** across algorithms and sizes
- **Verified solutions** through automated validation
## π Notes
- Solutions represent the **shortest path** from P to D
- All paths avoid walls (#) and only use walkable spaces (.)
- Movement is restricted to 4-directional (no diagonal moves)
- Each maze has a **unique solution path**
## π€ Model Training Tips
- Use the input as a prompt: `"Map:\n{maze_grid}"`
- Expected output format: `"UP,DOWN,LEFT,RIGHT"` sequences
- Consider fine-tuning on smaller mazes first, then scaling up
- Balance training across different algorithm types for robustness
---
*Dataset generated for maze navigation research and LLM spatial reasoning evaluation.*
|