File size: 3,554 Bytes
6f9c2d9
 
 
 
 
 
 
 
 
 
 
 
30bd47a
6f9c2d9
 
30bd47a
bb45f41
30bd47a
6f9c2d9
 
 
30bd47a
 
6f9c2d9
 
 
 
30bd47a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bb45f41
30bd47a
bb45f41
30bd47a
 
 
 
 
bb45f41
 
 
 
 
 
 
 
 
 
30bd47a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bb45f41
 
 
 
6f9c2d9
bb45f41
6f9c2d9
bb45f41
6f9c2d9
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
---
license: mit
task_categories:
- reinforcement-learning
- question-answering
language:
- en
tags:
- web-navigation
- preference-learning
- reward-modeling
size_categories:
- 1K<n<10K
---

# Web Agent Grouped Graph Dataset

This dataset contains web navigation tasks in grouped graph format with full history and candidate actions for training reward models.

## Dataset Description

- **Format**: JSON Lines (JSONL) - One entry per step with grouped candidates
- **Size**: ~2.8K step entries from 2.8K tasks
- **Domains**: GitLab, OpenStreetMap, Reddit, Shopping, Shopping Admin

## Data Format

Each line in `graph_dataset.jsonl` represents a single step with all candidate actions grouped together:

```json
{
  "task_id": "...",
  "goal": "Find product X and add to cart",
  "domain": "shopping",
  "step_index": 3,
  
  "history": [
    {"state_id": "S0", "screenshot": "...", "url": "...", "obs": "..."},
    {"state_id": "S1", "screenshot": "...", "url": "...", "obs": "..."},
    {"state_id": "S2", "screenshot": "...", "url": "...", "obs": "..."},
    {"state_id": "S3", "screenshot": "...", "url": "...", "obs": "..."}
  ],
  
  "current_state": {
    "state_id": "S3",
    "screenshot": "path/to/current.png",
    "url": "http://...",
    "obs": "accessibility tree..."
  },
  
  "candidates": [
    {
      "label": "gold",
      "action": "click('153')",
      "next_state": "S4",
      "next_screenshot": "path/to/next.png",
      "next_url": "http://...",
      "next_obs": "..."
    },
    {
      "label": "negative",
      "action": "click('88')",
      "negative_type": "hard_negative",
      "reason": "Leads to wrong page",
      "next_state": "S_bad1",
      "next_screenshot": "path/to/bad1.png",
      "next_url": "http://...",
      "next_obs": "..."
    }
  ]
}
```

## Key Features

- **Full History**: Complete trajectory up to current state
- **Grouped Candidates**: All possible actions (gold + negatives) from same state
- **Next-State Screenshots**: Screenshot paths for all candidate outcomes
- **Rich Metadata**: Task ID, domain, goal, step index
- **Negative Types**: Classification (easy_negative, hard_negative, detour_negative)

## Usage

```python
import json

# Load dataset
with open('graph_dataset.jsonl', 'r') as f:
    for line in f:
        entry = json.loads(line)
        
        # Access task info
        goal = entry['goal']
        step_idx = entry['step_index']
        
        # Access history
        history = entry['history']
        current_state = entry['current_state']
        
        # Process candidates
        for candidate in entry['candidates']:
            if candidate['label'] == 'gold':
                print(f"Gold action: {candidate['action']}")
            else:
                print(f"Negative: {candidate['action']} ({candidate['negative_type']})")
```

## Training Reward Models

This format is ideal for:
1. **Preference Learning**: Compare gold vs negative actions from same state
2. **Reward Modeling**: Predict which action leads to goal completion
3. **Action Ranking**: Rank all candidates by predicted reward

Example:
```python
# For each step entry
gold = [c for c in entry['candidates'] if c['label'] == 'gold'][0]
negatives = [c for c in entry['candidates'] if c['label'] == 'negative']

# Train model to rank gold higher than all negatives
reward_gold = model(entry['current_state'], gold)
rewards_neg = [model(entry['current_state'], neg) for neg in negatives]
```

## Statistics

See `conversion_stats.json` for detailed statistics.

## License

MIT License