Teaching a Robot Arm to Pick and Place

Fine-tuning GR00T N1.7 to pick and place with an SO-101 arm using imitation learning and DAgger.

Nov 21, 202622 min read

This post fine-tunes NVIDIA’s GR00T N1.7[1] to pick up a cube and drop it in a box with an SO-101 arm, using only demos recorded by hand. It covers the whole loop, from recording the demos to running the policy on a Jetson Thor.

Running the arm autonomously for 5 minutes (6x speed). Six attempts, each one a little different. In the first three the red cube starts in a new spot. In the last three the green box is also moved and turned. The last two use a purple cube, and every demo used a red one. The two cameras show the frames the policy saw. Below them is every joint over the run, with the plan at each step drawn at the cursor.

The video above shows the final policy on six attempts in a row, with nobody steering. It looks at two cameras and plans the next joint angles about every 0.7 seconds. The cube starts somewhere new each time, the box is moved and turned, and the last two cubes are purple. Every demo used a red one.

The policy improved over three rounds of training, with longer training runs, corrections based on observed failures, and greater diversity in cube positions.

How behaviour cloning works

Behaviour cloning is a form of supervised learning where the actions serve as labels. A demonstrator performs a task while we record the camera observations and corresponding actions. The network learns to predict the demonstrator’s actions from camera frames. Once trained, it uses those predictions to control the arm autonomously, as shown in the three-step diagram.

Three columns, each with an overhead camera frame and a table of the six joints. Record, a demonstrator moves the arm with the cube in view, and their joint values are saved. Train, the same frame goes to the policy, and its guess sits next to the demonstrator's values, off by 0.2 to 0.9 on each joint. The gap is the loss. Run, a new frame with the gripper open above the cube, and the policy's own joint values. The arm moves there and the cameras look again.
Behaviour cloning in three steps. Record demonstrations, train the policy to predict their actions, then let the policy drive. The numbers are real. The guess is the final policy on one frame of the first demo.

The input at each step is an observation. Here that is two camera frames, the six joint readings and a line of text naming the task. The output is an action, the six joint angles the arm should move to next.

Action chunking

A policy that predicts one action at a time must make the right decision hundreds of times during a task. Even small mistakes can gradually push the arm away from the trajectory seen in the demonstrations. Each subsequent decision then starts from a slightly different state. Eventually, the robot may reach a state it never encountered during training, making its next prediction less reliable and causing errors to compound.

To address this, modern robot policies predict a short sequence of actions, known as an action chunk, from a single set of camera observations[2]. This helps in two ways.

First, planning a chunk at a time means fewer decisions, so there are fewer chances for errors to accumulate. Second, demonstrators sometimes pause in the middle of a task. In the demonstrations, the same camera view may be followed by either a pause or a movement. A policy that predicts one action at a time may struggle to distinguish between the two. An action chunk can capture both the pause and the movement that follows it[2]. By predicting the sequence together, the policy can account for how long to wait before moving again. The pause simulation illustrates how the two policies handle this situation.

A pause in the demos. A toy, not the arm. The demos stop halfway to the cube. Switch between one action per look and a chunk of 8 per look, and press Play. Each blue dot is a look.

Our policy predicts 16 steps but executes only the first 8 before observing the scene again, as the chunk diagram shows. The remaining 8 steps are discarded for two reasons. First, they extend furthest into the future and are therefore the least accurate, as the error along the chunk shows later. Second, replanning halfway through allows the policy to respond to the latest camera observations, such as a cube slipping in the gripper.

Predict 16, run 8, look again. Real plans from the rollout, with the two frames each plan was made from. Press Play to watch each cycle. The cameras take a frame, the policy plans 16 actions, and only the first 8 run before the next frame replaces the rest. Click a joint name to switch joints.

The model

We fine-tune GR00T N1.7[1], a 3-billion-parameter model designed for robotics. As shown in the model figure, it has two main components. A vision-language model converts the camera frames and task instructions into a sequence of tokens. An action head then takes those tokens along with the robot’s joint readings and predicts a 16-step action chunk.

Inside GR00T N1.7. The action head attends to every token from the vision-language model. Press Play to watch one call from start to finish, or Next to go one stage at a time. The slider picks a different moment of the rollout. The inputs and the final chunk are real. The tokens and the in-between chunks are drawn.

The action head uses a technique called flow matching. It starts with random noise shaped like an action chunk and refines it over four steps into a complete plan.

This matters because robot tasks are often multimodal, meaning the same camera observation can correspond to multiple valid actions. Consider the example in the figure below, where an obstacle lies between the arm and its goal. The demonstrations show two valid ways to reach the goal, passing on either side of the obstacle. A deterministic policy trained with mean squared error (MSE) loss learns to predict the conditional mean of the demonstrated actions for a given observation. When the demonstrations contain two distinct modes, this prediction can fall between them, producing a trajectory that goes straight through the obstacle.

Averaging vs. sampling. Each plan consists of 16 waypoints. Compare the average of the demonstrations with plans generated by flow matching, which transforms random noise into a complete path over four steps. Press the sample button a few times to see how different samples take either the path above or below the obstacle.

Flow matching addresses this by learning a conditional velocity field that transforms random noise into demonstrated action sequences. This allows the model to capture the full distribution of possible actions for a given observation, including multiple distinct modes. At inference time, the model samples an action sequence from this distribution, producing one of the valid solutions rather than averaging across them.

The robot and the setup

The arm is an SO-101, a 3D-printed robotic arm with six hobby servos from the LeRobot project[3]. It comes as a matched pair, a leader and a follower, shown in the arm photos. We collect demonstrations through teleoperation, where a human demonstrator moves the leader by hand and the follower mirrors its movements.

The leader’s motors are disabled, allowing its joints to move freely while its servos report their angles. The follower continuously reads these angles and drives its own six joints to match the leader’s movements. During demonstrations, we record the leader’s joint angles as actions and the camera frames as observations. Once trained, the policy replaces the leader by sending predicted joint angles directly to the follower.

The black leader arm, with a handle in place of a gripper and its servo cables looping along each link, and the background blurred.
The leader arm, moved by hand. Its readings are the actions.
The white follower arm on the black mat, with a camera mounted near its gripper, and the background blurred.
The follower arm, which does the work and carries the wrist camera.
A 3D render of the SO-101 arm with six labelled joints. 1 shoulder pan at the base, 2 shoulder lift above it, 3 elbow flex at the top of the upper arm, 4 wrist flex, 5 wrist roll, and 6 gripper at the blue jaw.
The six joints. Every plot in this post uses these names.

The joint figure shows the six joints, and the 3D arm lets you move each one. The gripper reads 0 when closed and about 100 when open.

Move the arm. One slider per joint, in the same units the motors report. Press Joint tour to see each joint move in turn, and drag the arm to look around. The faint purple arm is the rest pose.

The hardware setup follows NVIDIA’s course, Train an SO-101 Robot From Sim-to-Real With NVIDIA Isaac[4]. It covers building the workspace and calibrating and driving the arm. This build changes a few things. The cameras sit in new places, a cube and a 3D-printed box replace the vials and the rack, and everything runs on the Thor. The training recipe is my own.

The rig photo shows the workspace.

Photo of the workspace from above and to the side. A white 3D-printed arm stands at the right edge of a black mat, a green box sits at the top of the mat, and a cube is on the mat.
The whole world the policy will ever see. A black mat, a green box, a cube, an overhead camera and a camera on the gripper.

Everything runs on an NVIDIA Jetson AGX Thor next to the arm. It records the demos, trains the model and runs it on the arm. The rig figure shows how the pieces connect.

The rig. The policy server runs the model on the GPU. The robot client talks to the cameras and the servos. Switch between Teleoperation, where a demonstrator drives the follower through the leader, and Autonomous, where the policy drives it, to see which paths carry data, and click a part for its details.
partwhat it is
armsSO-101 leader and follower, 6 Feetech STS3215 servos each
overhead cameraArducam, 1280 x 720 at 30 fps
wrist cameraon the gripper, 640 x 480 at 30 fps
computerNVIDIA Jetson AGX Thor
modelGR00T N1.7, 3B parameters
recording rate15 frames a second

Round 1, fifty demos

Recording the demos

To record a demo, the leader arm is moved by hand, and the follower arm copies every move. The teleop clip shows one demo as it is recorded, with a view of the rig on the left and the two robot cameras on the right.

One demo being recorded. The leader arm, next to the overhead and wrist cameras. All three are the same 17 seconds.

A demonstration is not stored as a single video. Instead, it is stored in the LeRobot dataset format, as shown in the storage figure. The robot’s data is stored in Parquet files, with one row per frame at 15 frames per second. Each row contains a timestamp, the follower’s joint positions (the state), and the leader’s joint positions (the action). The action serves as the label that the network learns to predict.

Camera recordings are stored separately as video files, one per camera. Multiple demonstrations can share the same Parquet file and camera videos. Each demonstration records its starting position in the videos, allowing the corresponding camera frames for any row to be located using its start time and timestamp.

How a demo is stored. The numbers live in a Parquet table, the images in one video per camera, and the timestamp joins them. Move the slider or press Play to walk the rows of a real demo. Switch to the second demo to see it continue the same table and start partway into the same videos. The frames shown are every third one.

The first round consisted of 50 demonstrations, each showing a successful grasp and drop. The grid plays all 50 demonstrations simultaneously.

The 50 round 1 demos at once, at 2x speed. Each tile is the overhead camera, with the wrist camera at its bottom right, still frames cut for this video. A tile dims when its demo ends.

Training

Training starts from the released GR00T weights and adjusts them on our demos. Training also runs on the Thor. It is slow compared with a data-centre GPU and would not suit a large dataset, but it is enough for a dataset this size. One step takes about a second on the Thor.

settingvalue
starting weightsGR00T N1.7-3B
batch size8
peak learning rate1e-4 for the first run, 5e-5 for each run after it
schedule5% warmup, then cosine decay to zero
image size256 x 256 per camera
speed on the Thorabout 0.96 steps a second

Both cameras have to reach the model as 256 x 256 squares. The overhead frame is wide, and the arm enters it from the right edge. A centre crop would cut the arm out of the picture, so we pad the frame with black bars instead, as the letterbox figure shows.

Left, an overhead frame with a square centre crop outlined in red, and both sides faded out, including the arm on the right. Right, the same frame shrunk into a black square, with black bars above and below.
Pad the frame, do not crop it. The black bars waste some pixels, but nothing the policy needs is lost.

The first run trained for 15,000 steps. On the arm it often carried the cube past the green box, as the arm tests below show. To see whether more training would fix this, a second run continued from the first run’s weights, using the same demos but a fresh learning rate schedule, for a total of 30,000 steps. The round 1 runs show both training runs.

Three boxes joined by arrows. Base model, then 15k on 50 demos, then 27.5k after 15k more steps on the same demos, with a note that more steps on the same demos stopped helping.
Round 1, two runs on the same 50 demos. The best checkpoint of the second run was at 27.5k steps.

The loss plot shows both runs. The second one starts its learning rate schedule over, so its loss jumps a little and then falls again. It ends slightly lower, about 0.044 against 0.047.

Training loss of the two round 1 runs. Log scale. Hover to read the loss and learning rate at any step.

Testing, open-loop

The simplest way to evaluate a policy is through open-loop testing. We feed it recorded camera frames from a demonstration and compare its predicted action chunks against the recorded actions. Because this requires no physical robot, it is cheap, repeatable, and fast enough to run after every training checkpoint. It helps us track whether the policy is learning to reproduce the demonstrated behaviour and catch regressions before testing on hardware.

The table below gives the open-loop error of each round 1 checkpoint on 6 of the round 1 demos, over the 8 steps of a chunk the arm runs and the 8 it throws away. This test was run again retrospectively, after round 2, so the demos have their still frames cut, as described in the still-frame cleanup. Every checkpoint is scored on exactly the same frames. The error is the mean squared gap between the predicted joint angles and the recorded ones, in the units the motors report. It is about two and a half times larger on the last 8 steps than on the first 8. This is the reason we run only the first 8.

checkpointsteps 0 to 7
run on the arm
steps 8 to 15
thrown away
all 16 steps
10k15.7242.0528.88
12.5k15.1338.4626.80
15k17.1739.0128.09
25k14.8735.5525.21
27.5k13.1831.3322.25
30k12.9934.4323.71

We kept 27.5k, which scored lowest in the open-loop test run at the time. On these demos 30k scores about the same over the 8 steps the arm runs, and 27.5k is lowest over the whole chunk.

Testing, on the arm

On the arm, both round 1 checkpoints struggled with picking and placing. The gripper often hit the top of the cube before closing, and the arm often carried the cube past the green box before releasing it. The clip of the 15k checkpoint shows this. The first three attempts put the cube in the box, but not cleanly, and on the fourth the arm carries the cube past the box and out of the frame.

The 15k checkpoint on the arm, at 4x speed. Three untidy successes, where the arm hits the top of the cube before picking it up and pushes the green box out of place, then an overshoot past the box. The labels mark each attempt and its result.

The extra training did not fix this. The 27.5k checkpoint, the best one open-loop, still overshot.

Open-loop testing cannot see this kind of failure, and the open-loop diagram shows why. In an open-loop test the next frame always comes from the demo, whatever the policy predicted. On the arm the next frame comes from what the policy just did, mistakes included.

Two loops side by side. Left, open-loop, a recorded frame goes into the policy and its chunk is compared with the demo. Right, on the arm, a live camera frame goes into the policy, the arm moves, and a red arrow brings the changed scene back to the camera.
What open-loop testing can and cannot see. Only on the arm do the policy’s own mistakes decide what it sees next.

A small mistake can push the arm into a pose that never appeared in the demonstrations. None of the round 1 demos shows how to recover from such a pose. The policy therefore has no demonstrated behaviour to imitate, making its next prediction less reliable and often leading to larger errors. Ross and colleagues showed that over a task of TT steps, the total error of plain behaviour cloning can grow quadratically with the task length, O(T2)O(T^2), rather than linearly, O(T)O(T)[5]. The drift figure illustrates this effect using a toy model.

Small errors pile up. A toy model, not the arm. Runs that leave the band the demos covered keep drifting. Tick the box to give the policy examples of getting back.

More training on the same demos cannot fix this. The next two rounds add data instead.

Round 2, human corrections

Round 2 adds recordings of the policy’s own mistakes being fixed. It also cleans up the demos by cutting long still stretches.

Learning from mistakes with DAgger

DAgger, short for dataset aggregation, collects data from the places the policy actually goes[5]. Let the policy drive, ask a person what they would have done in the states it reached, add those labels to the demos, and train again. The DAgger diagram shows one round.

Four boxes in a loop. Run, the policy drives. Label, what would a person do. Add, to the demos. Retrain, on everything. An arrow returns from retrain to run.
DAgger, one round. The new labels come from the states the policy reaches.

Labelling every step is slow, and a person watching the arm without steering it gives poor labels. HG-DAgger, short for human-gated DAgger, fixes both problems[6]. The human decides when to step in. The policy drives, and the person takes over only when it starts to go wrong. Only the takeover is saved, as the takeover diagram shows.

Two timelines. Plain DAgger, the policy drives the whole time and every step gets a label. HG-DAgger, the policy drives, then at a red line where it starts to go wrong the person drives, then the policy again. Only the person's part is shaded as saved.
Who decides when the person steps in. In HG-DAgger the person is really driving, so the labels are as good as a demo.

On our rig the 27.5k checkpoint drives the follower arm while the leader arm is held at the follower’s pose. When the arm starts to go wrong, pressing Tab hands control back to the leader. From then on the follower copies the leader, as in a demo. Each correction is saved as its own episode, starting 1 second before the takeover, as the correction diagram shows. The extra second is kept for reference but excluded from training, since those actions were generated by the policy rather than the person. As a result, each training example starts at the takeover point, from a pose that never appears in the clean demos.

A timeline of one 220-frame episode. A short purple segment of 1 second where the policy drives, a red dashed line labelled press Tab, the person takes over, then a long green segment where the person drives to the end of the task.
One correction. The first second is the policy’s mistake, kept for context and cut before training. The rest is the fix.

There were 12 corrections, and the correction grid plays them all.

The 12 corrections, in real time. Each tile is the overhead camera, with the wrist camera at its bottom right. Every one starts mid-task, from the pose the policy had got itself into.

A cleanup, cutting the still frames

Every demo contains dead time, such as a wait before the first move and a hold at the end. NVIDIA’s guidance for fine-tuning GR00T recommends trimming these idle frames. A pause longer than an action chunk gives the policy no indication of when to resume moving, so round 2 included a cleanup step to remove them.

A detector identifies these stretches using the leader arm’s joint readings. A frame counts as still when no joint moves more than its natural resting jitter. Stretches lasting at least half a second are removed, with a few exceptions. The half-second lead-in before the first move and one second at the end are preserved. Brief pauses during grasping and releasing are also kept because they are part of the task. The still-frame figure shows the result on one demo.

Finding the still frames in one demo. The shaded stretches are cut. A pause in the middle is cut and the two sides joined, so the demo stays in one piece.

Across the demos this removed 4.6% of the frames.

Training on the corrections

Twelve corrections against 50 demos is a small amount of data, so each correction was used three times in training. The third run continued from 27.5k, the round 1 checkpoint we kept, for 10,000 steps on the cleaned demos plus the corrections, as the round 2 runs show.

The round 1 chain of base model, 15k and 27.5k, with a green arrow down from 27.5k to a new 37.5k run that adds the corrections and cuts the still frames.
Round 2 adds corrections and cleaner demos. New data instead of more steps.

On the same 6 round 1 demos as the round 1 table, the open-loop error fell on both halves of the chunk.

checkpointtrained onsteps 0 to 7
run on the arm
steps 8 to 15
thrown away
all 16 steps
27.5k50 demos13.1831.3322.25
37.5k50 cleaned demos, 12 corrections used 3 times12.0628.3020.18

Round 3, a wider spread

The first 50 demos had a quieter problem. The cube started in almost the same spot every time. The cube map shows where the cube started in every demo, drawn on the overhead view.

Where the cube started. Each dot is one demo. The first batch sits in one small cluster. For the second batch the cube was moved around the whole mat.

A policy trained only on the first cluster has never seen the cube anywhere else. So a second batch of 50 demos was recorded with the cube spread across the mat, about five times wider, as the round 3 grid shows.

The 50 round 3 demos at once, at 2x speed. The cube starts somewhere different in almost every tile, where in round 1 it barely moved.

The fourth run continued from 37.5k for another 30,000 steps on all 100 demos plus the corrections, as the round 3 runs show. The mix diagram shows what that final model trained on.

The chain of base model, 15k, 27.5k and 37.5k, with a final green arrow from 37.5k to 62.5k, which adds 50 wider demos and is the one on the arm.
Round 3 adds 50 demos with a wider spread. The best checkpoint, at 62.5k steps, is the one on the arm.
A single bar split into three parts. 42.7 percent first-batch demos in green, 50.0 percent second-batch demos in blue, and 7.4 percent corrections used three times in red.
What the final model trained on. Shares of the 44,770 training frames. Both batches have 50 demos, but the second batch’s demos run longer, about 30 s against 26 s, so they make up half the frames.

The checkpoint chart measures every checkpoint separately on old and new demos. Every model up to 37.5k had never seen the second batch, and its error on it was about 20 or higher. After the fourth run the best checkpoint, 62.5k, got 9.6 on the new demos and 11.5 on the old ones, so it learned the new spots without forgetting the old ones.

Open-loop error of every checkpoint. Green bars are the first batch of demos and blue bars are the second. Hover a checkpoint to read it.

The loss of all four runs puts the three rounds on one step axis.

Training loss of all four runs. Log scale. Each run starts a fresh learning rate schedule from the last one’s weights.

Results

The 62.5k checkpoint is the one on the arm. The rollout at the top is one five-minute run of it, with six attempts and six cubes in the box. Two of those cubes are purple. Every demo used a red cube, and the task text still says “red cube”.

The clip below is another, simpler run of the same checkpoint, filmed on a phone. The cube starts close to the same spot each time, and only red cubes are used. It is sped up about four times. On the arm each attempt takes 40 to 55 seconds, so the clip fits seven attempts into 80 seconds. It is played uncut, so every attempt can be checked.

Seven attempts, seven cubes in the box. A simpler run of the 62.5k checkpoint, uncut and sped up about 4x.
checkpointdataon the arm
15k50 demosovershot and let go late
27.5ksame demos, 15k more stepsstill overshot
37.5k+ 12 corrections, + still frames cutno overshooting at drop-off
62.5k+ 50 wider demos7 of 7 and 6 of 6 in the runs shown

Latency, where the time goes

The policy server runs the model in plain PyTorch. On the arm a new chunk starts every 0.70 seconds. Playing its 8 actions at 15 per second takes 533 ms (8 / 15 × 1000), so for the other 164 ms the arm holds still while the policy computes the next chunk, as the cycle diagram shows. Timed directly on the Thor, one call of the model with both camera frames takes about 159 ms, so almost all of that wait is the model itself.

A timeline of one chunk cycle. A long purple bar, play 8 actions at 15 Hz, 533 ms, with eight ticks. Then a short red bar, wait, about 164 ms.
One chunk cycle. Almost a quarter of the time the arm is waiting for the next plan.
Removing the wait with real-time chunking

One way to remove that wait is real-time chunking. It asks for the next chunk while the current one is still playing[7], and plans it to agree with the actions still to come, so the arm does not jump when it switches. The timing figure compares the two.

Waiting against planning ahead. The top row is what the client does today. The bottom row is real-time chunking, where the blue actions play while the next plan is computed. Red is the arm waiting. A toy timing model.

Wrapping up

This post took GR00T N1.7 from its released weights to a policy that picks up a cube and drops it in a box on a real SO-101 arm.

The main takeaway is that pretrained models like GR00T are already a strong starting point. With a small amount of data, recorded in a few hours, a policy reaches reasonable performance on a robot arm in a controlled setting. When it fails, approaches like DAgger fix it with a handful of corrections. Imitation learning and DAgger alone go a long way.

A second lesson is that a good open-loop score does not mean the policy works on the arm. Its mistakes only show up once they decide what the cameras see next, so most of the progress came from collecting the right data rather than from more training.

Several things are worth trying next. Real-time chunking and a quantized model would cut the pause between chunks. More varied scenes, with cubes of several colours on the mat and different drop-off spots, would need more demos and a task text that names the target cube.

Thanks for reading.

References