atothey's picture
fix numbers
a6543fc
|
Raw History Blame Contribute Delete
5.24 kB
---
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.*