File size: 14,493 Bytes
b14fcfe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
pretty_name: LEAF Agent Replays
license: cc-by-4.0
language:
- en
tags:
- robotics
- lerobot
- simulation
- manipulation
- failure-recovery
- multimodal
size_categories:
- 1M<n<10M
configs:
- config_name: default
  data_files:
  - split: train
    path: data/chunk-*/*.parquet
---

# LEAF Agent Replays

Replays of AI agents controlling a simulated Franka Panda arm on the 40 tasks of the
[LEAF benchmark](https://peter-cuhk.github.io/LEAF/). Every task is built around a designed
cause of failure (an arm offset, an unexpected mass distribution, a part that does not fit).
The first attempt fails in 69% of runs, and the data records what the agent does next.

Each 20 Hz control step pairs the robot action with external and wrist RGB views,
proprioception and step-level labels (which attempt, which agent command, which phase).
Each trajectory also has a JSON annotation with the agent's commands and notes, task
events, attempt outcomes and a run-level recovery class.

| | |
| --- | ---: |
| Benchmark tasks | 40 |
| Agent runs | 2,272 |
| Attempts | 3,454 |
| Trajectories (LeRobot episodes) | 3,303 |
| Trajectories ending in success / failure | 1,043 / 2,260 |
| Control steps at 20 Hz | 6,451,686 |
| Simulated time | 89.6 h |
| Agent models / harnesses | 9 / 8 |

A control step is counted once for both cameras.

## Repository layout

The repository has two layers. The root is a standard
[LeRobotDataset v3.0](https://huggingface.co/docs/lerobot/lerobot-dataset-v3) that LeRobot
loads directly. The `leaf/` directory holds what is specific to LEAF.

```text
.
├── meta/                       LeRobot metadata
│   ├── info.json               features, fps, path templates
│   ├── stats.json              normalization statistics
│   ├── tasks.parquet           44 instruction strings (task_index)
│   └── episodes/               per-episode offsets into data/ and videos/, per-episode stats
├── data/chunk-000/             87 Parquet files: per-step numeric data and labels (1.0 GB)
├── videos/                     256x256 MP4, 1,090 files per camera (65 GB)
│   ├── observation.images.image          external camera
│   └── observation.images.wrist_image    wrist camera
├── leaf/
│   ├── episodes.jsonl          one row per trajectory (3,303), flat fields for filtering
│   ├── runs.jsonl              one row per agent run (2,272), attempt history, final report
│   ├── tasks.json              task definitions, failure causes, phase codes
│   ├── annotations/            one JSON per trajectory (commands, events, outcomes)
│   ├── sim_state/              full simulator state per step, .npy float64 (3.4 GB)
│   ├── final/                  final state .npz and last external/wrist frames per trajectory
│   ├── code/                   export and replay code of each source batch
│   └── release/                source mappings, label audit, split groups, validation
└── SHA256SUMS
```

## Runs, attempts and episodes

![Runs, attempts and episodes](assets/structure.png)

- A **run** is one agent session on one task instance (task + seed). The agent may try up
  to 3 or 5 times, depending on the task. One row per run in `leaf/runs.jsonl`.
- An **attempt** is one try, judged success or failure by the simulator at the end.
- An **episode** is one continuous replay, the unit LeRobot indexes. Usually the scene is
  reset between attempts, so 3,209 episodes hold a single attempt. When the scene is not
  reset, consecutive attempts share an episode (94 episodes hold 2 or 3 attempts) and the
  per-step column `annotation.attempt_index` tells them apart.

Runs were collected under three conditions:

| Condition | Runs | Episodes | What the agent sees |
| --- | ---: | ---: | --- |
| `with_history` | 1,141 | 2,172 | Retries in one session, with its own earlier attempts and their feedback |
| `memory_free_retry` | 640 | 640 | One attempt per run; repeated runs are linked by `memory_free_chain_of`, without memory of each other |
| `independent_single_attempt` | 491 | 491 | One attempt, no retry |

## Per-step data

`data/*.parquet`, one row per control step. Videos are aligned through the timestamps in
`meta/episodes`.

| Feature | Shape | Description |
| --- | --- | --- |
| `observation.images.image` | 256x256x3 | External camera (video) |
| `observation.images.wrist_image` | 256x256x3 | Wrist camera (video) |
| `observation.state` | 8 | End-effector xyz, axis-angle rotation (3), left and right finger positions |
| `observation.joint_pos`, `observation.joint_vel` | 7, 7 | Joint positions and velocities |
| `observation.eef_quat` | 4 | End-effector quaternion (x, y, z, w) |
| `observation.gripper_width` | 1 | Gripper opening in metres |
| `action` | 7 | End-effector delta xyz, delta axis-angle (3), gripper close |
| `annotation.attempt_index` | 1 | Attempt this step belongs to |
| `annotation.command_index` | 1 | Agent command this step belongs to (`commands[].step` in the annotation) |
| `annotation.phase` | 1 | 0 move, 1 gripper, 2 judging |
| `annotation.attempt_success` | 1 | Final result of the step's attempt, repeated over the attempt |
| `annotation.task_event` | 1 | Number of task-monitor events at this step (for example, a bottle tipping over) |
| `timestamp`, `frame_index`, `episode_index`, `index`, `task_index` | 1 | LeRobot indices; `index` is the global step |

## Episode annotations

`leaf/annotations/episode_XXXXXX.json` (schema `leaf-replay-1`) is the most detailed record
of a trajectory.

| Block | Contents |
| --- | --- |
| `source` | Batch and run, condition, feedback level, attempt budget, replay check (end-effector deviation) |
| `agent` | Harness and version, model, reasoning effort, provider |
| `task` | Task name, failure cause, instruction, seed, instance parameters (for example the hidden mass offset) |
| `run_outcome` | Run-level recovery class and its evidence status, attempt history, the agent's final report |
| `attempts[]` | Per attempt: success, outcome details, feedback shown to the agent, judging frames, `error_event_in_attempt` (task monitor), `reviewed_operational_failure` (human review) |
| `commands[]` | Every agent command: arguments, frame span, end-effector position and gripper width afterwards, whether an object is held, and the agent's note |
| `task_events[]` | Task-monitor events with their frame |
| `frames`, `label_provenance` | Frame count, fps, initial state, phase codes; which evidence file each label comes from |

`leaf/episodes.jsonl` repeats the most used fields (task, cause, model, harness, condition,
per-attempt success, recovery class, `split_group_id`) as flat columns.

## Labels

**Failure cause.** Each task is built around one designed cause, recorded as `paper_cause`.

| Cause | Meaning |
| --- | --- |
| L1 | Execution offset: the arm does not go exactly where commanded |
| L2 | Disturbed state to restore, including damage the agent causes |
| L3 | Infeasible manipulation strategy: the grasp, contact or tool must change |
| L4 | Misjudged geometry: size, shape, fit or hidden structure |
| L5 | Misjudged physics: mass distribution, friction, dynamics |
| L6 | Composite long-horizon task combining several of the above |

The designed cause is recorded separately from the events actually observed in a run
(`task_events`, `attempts[].outcome`).

**Run recovery class** (`run_outcome_class`), for runs with history:

| Class | Attempts | Meaning | Runs |
| --- | --- | --- | ---: |
| CS | S | First attempt succeeded with no operational failure | 55 |
| IR | S | First attempt succeeded after recovering from a failure inside it, such as an empty grasp followed by a regrasp | 198 |
| XR | F…S | First attempt failed, a later attempt succeeded | 336 |
| F | F…F | No attempt succeeded | 379 |

`outcome_class_status` says how each class was set: `evidence_reviewed` (169 runs, checked
against logs and frames, evidence in `leaf/release/evidence/reviewed.json`) or
`rule_derived` (799 runs). 173 runs with history have no class yet (`unresolved`), and the
1,131 memory-free and single-attempt runs are `not_applicable`.

![Label distributions](assets/distributions.png)

## Tasks

<details>
<summary>All 40 tasks</summary>

| Cause | Task | ID | Family | Hidden variable | Max attempts | Episodes |
| --- | --- | --- | --- | --- | ---: | ---: |
| L1 | Biased place | `l1_bias_place` | hidden variable | xy arm offset (2.5–4 cm) | 5 | 57 |
| L1 | Height bias | `l1_height_bias` | hidden variable | z arm offset (2–3.5 cm) | 5 | 63 |
| L1 | Yaw bias | `l1_yaw_bias` | hidden variable | Wrist yaw offset (15–30°) | 5 | 53 |
| L2 | Bridge | `lh_bridge` | long horizon | None (own reach) | 3 | 74 |
| L2 | Bystander bottle | `lh_bystander` | long horizon | Bottle spot (own arm) | 3 | 63 |
| L2 | Count into box | `l6_count_into_box` | hidden variable | Cubes in box at the slip | 5 | 27 |
| L2 | Knock restore | `l2_knock_restore` | hidden variable | Which neighbour moves | 5 | 33 |
| L2 | Lid box | `lh_lid_box` | long horizon | Lid opening-stop angle | 3 | 105 |
| L2 | Nudge row | `lh_nudge_row` | long horizon | Mat spacing (own fingers) | 3 | 59 |
| L2 | Restore layout | `l2_restore_layout` | hidden variable | Moved box's start pose | 5 | 33 |
| L2 | Sequence resume | `l6_sequence_resume` | hidden variable | Progress at an e-stop | 5 | 26 |
| L2 | Swap interrupt | `l6_swap_interrupt` | hidden variable | Where the item slips to | 5 | 28 |
| L2 | Turntable restore | `l2_turntable_restore` | hidden variable | Turntable start angle | 5 | 95 |
| L3 | Card edge | `l3_card_edge` | hidden variable | Card too thin to grasp | 5 | 59 |
| L3 | Key turn | `l7_key_turn` | hidden variable | Key turning direction | 5 | 40 |
| L3 | Too-wide push | `l3_too_wide_push` | hidden variable | Box 4–10 mm too wide | 5 | 41 |
| L3 | Wall-flush box | `l3_wall_flush` | hidden variable | Box–wall gap (0–3 mm) | 5 | 125 |
| L4 | Clear cover | `lh_clear_cover` | long horizon | Near-invisible lid | 3 | 142 |
| L4 | False-bottom lid | `lh_false_bottom_lid` | long horizon | Box depth (4.5 / 8.4 cm) | 3 | 96 |
| L4 | Fit container | `l4_fit_container` | hidden variable | Clear caps (+1.6–1.8 cm) | 5 | 200 |
| L4 | Nest order | `l4_nest_order` | hidden variable | Tallest cup is not widest | 5 | 80 |
| L4 | Under-table tool | `l3_under_table_tool` | hidden variable | Invisible side panel | 5 | 143 |
| L5 | Balance board | `lh_balance_board` | long horizon | Cube masses | 3 | 113 |
| L5 | Card on shelf | `l3_card_shelf` | hidden variable | Weighted end of card | 3 | 196 |
| L5 | Drawer cabinet | `lh_drawer_cabinet` | long horizon | Self-closing drawer | 3 | 93 |
| L5 | Loaded beam | `l5_loaded_beam` | hidden variable | Bar mass offset (2.5–7 cm) | 3 | 108 |
| L5 | Off-centre push | `l7_offcenter_push` | hidden variable | Mass offset (4.5–7.5 cm) | 5 | 69 |
| L5 | Shelf droop | `lh_shelf_droop` | long horizon | Loose shelf bracket | 3 | 83 |
| L5 | Slide to target | `l5_slide_to_target` | hidden variable | Cube–table friction μ | 5 | 90 |
| L5 | Slippery lift | `l5_slippery_lift` | hidden variable | Bar mass offset (2.5–7 cm) | 5 | 43 |
| L5 | Tablecloth pull | `l5_tablecloth_pull` | hidden variable | Cube friction μ | 5 | 211 |
| L5 | Tidy stack | `lh_tidy_stack` | long horizon | Which box is a carton | 3 | 121 |
| L5 | Tray delivery | `lh_tray_delivery` | long horizon | Top-heavy bottles | 3 | 117 |
| L5 | Wobbly table | `lh_wobbly_table` | long horizon | Short leg, heavy bottle | 3 | 97 |
| L6 | Breakfast service | `lh_breakfast_service` | long horizon | Combines L1, L3, L4 | 5 | 62 |
| L6 | Desk organizer | `lh_desk_organizer` | long horizon | Combines L1, L3, L2 | 3 | 42 |
| L6 | Order dispatch | `lh_order_dispatch` | long horizon | Combines L1, L3, L5 | 5 | 61 |
| L6 | Parts cart | `lh_parts_cart` | long horizon | Combines L4, L2, L5 | 5 | 61 |
| L6 | Shim relay | `lh_shim_relay` | long horizon | Combines L1, L4, L2 | 5 | 55 |
| L6 | Split calibration | `lh_split_calibration` | long horizon | Combines L1, L2, L4 | 5 | 39 |

</details>

## Loading

Download the dataset:

```sh
hf download COCOMatrix/LEAF-Bench --repo-type dataset --local-dir ./leaf-replays
```

Use a LeRobot version that supports the v3.0 layout and the published video encodings.
The Hub's Parquet viewer shows the numeric tables only.

```python
from lerobot.datasets.lerobot_dataset import LeRobotDataset

root = "./leaf-replays"
ds = LeRobotDataset("COCOMatrix/LEAF-Bench", root=root)
step = ds[0]   # both camera images, state, action and annotation.* columns
```

Select trajectories with the flat index:

```python
import pandas as pd

eps = pd.read_json(f"{root}/leaf/episodes.jsonl", lines=True)
# physics tasks where the agent recovered within its first attempt
ir = eps[(eps.paper_cause == "L5") & (eps.run_outcome_class == "IR")]
```

Read what the agent did step by step:

```python
import json

a = json.load(open(f"{root}/leaf/annotations/episode_000558.json"))
for c in a["commands"]:
    print(c["attempt"], c["step"], c["command"], c["gripper_width_after"], c["holding_after"])
```

`leaf/sim_state/` and `leaf/final/` let you restore any step in the simulator or check a
final-state judgement.

## Splits

The `train` split holds everything. When you define train and evaluation sets:

- Split by `split_group_id` (task and seed), so that all retries of one task instance stay
  on the same side. Development batches (`rc_dev*`, `rcc_dev*`) share seven task/seed groups
  with other batches, so filtering by `batch` alone is not enough. The groups are listed
  under `dev_test_overlap` in `leaf/release/v181_patch.json`.
- Treat hidden instance parameters (`task.instance`) and the outcomes of later attempts as
  privileged offline information, not as policy inputs.

## Validation

The export checked all 6,451,686 numeric rows against their original source packages, hashed every
copied binary file, and checked episode metadata, attempt labels and retry links. All 1,175
sampled LeRobot frame reads matched the decoded source pixels. Reports and source mappings
are in `leaf/release/`. Historical runs that could not be replayed are listed in
`leaf/release/historical_replay_rejections.json`.

## License

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