Phase 7: Evaluate and iterate

This phase is optional. Phase 6 already gave you a working policy that stacks a block with no human input; here you make it measurably better. You run a batch of scored rollouts, find where the policy fails, record demonstrations aimed at those failures, retrain, and compare.

Add the episode runner

Sending start and stop by hand works for one run, but scoring ten runs that way means tracking every result yourself. The capture-control webapp’s Policy session does it for you: it starts each rollout, records it as a data sequence, and tags it with the result you give it. It needs one more service, the episode runner, from the viam-labs:capture-control-webapp module, version 0.3.0 or later.

  1. On the CONFIGURE tab, click + and select Blocks.
  2. Search for episode-runner and select the generic / capture-control:episode-runner result. If you didn’t add the viam-labs:capture-control-webapp module in Phase 3, this adds it.
  3. Name it episode-runner and click Add.
  4. Paste these attributes:
{
  "executor": "act-controller",
  "capture_sensor": "demo-capture",
  "teleop": "teleop",
  "teleop_safe_takeover": false
}
  • executor is the controller from Phase 6. The runner sends it start and stop, and reads its status to notice when a run fails.
  • capture_sensor is the demo-capture sensor from Phase 3. Each rollout is captured at 10 Hz from the same cameras and components as your demonstrations, so you can watch a rollout the same way you watch an episode.
  • teleop lets the runner stop teleop before each rollout, so the leader never drives the xArm while the policy does.
  • teleop_safe_takeover: false turns off the Take over key. Taking over hands the xArm back to the leader mid-run, and that’s only safe when teleop starts from the xArm’s current pose instead of jumping to the leader’s. Leave it off.

Save. The webapp’s start screen now shows a Policy session button.

Checkpoint

The episode-runner service shows as ready on the CONFIGURE tab, and the webapp’s start screen offers Policy session.

Choose your start positions

A score only means something if every model faces the same starts. Use the five start regions from Phase 3: center, left, right, near the arm’s base, and far from it. Pick one red and one green position in each region, and photograph or mark them, so you can set up each start again for the next model.

Measure

Run 10 rollouts, two from each start, every one the same way.

  1. Open the webapp and click Policy session. Use the same browser you recorded with in Phase 3, because the webapp keeps its task list in the browser.
  2. Under Task, select stack the red block on the green block.
  3. Under Checkpoint, enter the model version you deployed, for example 2026-12-02T18-32-33 from the Viam app or 1 from the CLI. The runner tags every rollout with checkpoint: and this value, so you can tell the models apart later.
  4. Leave FPS at 10, and click Start session.
  5. Press H to home the xArm, and place the blocks at the first start.
  6. Press Space to start the rollout. The runner stops teleop, starts the capture, and sends start to act-controller.
  7. Watch the arm, with a hand near the emergency stop. When it finishes the stack, press S for success. If it fails, press F as soon as it’s clear the run won’t recover. Either key stops the policy and ends the capture.
  8. Note the failure type next to the start, then repeat from step 5 for the next start.
A Policy session running in the capture-control webapp: both camera views outlined in red, the episode timer, the session tally of successes and failures, and the Success, Failure, Take over, Home, and End session buttons.

Keep the Policy session tab visible while a rollout runs. The webapp sends the runner a heartbeat about twice a second, and the runner stops the arm if the heartbeat stops. Browsers slow down background tabs, so switching tabs can stop a run. Press Esc to stop everything and end the session.

Call a rollout a success only if the red block rests on the green block when the arm stops. For each failure, note one failure type:

  • Missed grasp: the gripper closed without the block, or a finger hit the top of it.
  • Dropped: the arm grasped the block, then lost it on the way.
  • No release: the arm held the red block over the green one and never let go.
  • Misaligned stack: the red block landed on the green block but fell off or sits crooked.
  • Froze: the arm stopped moving partway through the task.

The webapp counts successes and failures for the session as you go. Your success rate is the number of successes divided by 10. Write it down: it’s the baseline for your first model.

Every rollout lands in your data as a sequence tagged source:policy, with its checkpoint: and episode: number. When you open Review session, the webapp also tags each one outcome:success or outcome:failure. On the DATA page’s SEQUENCES tab, filter by source:policy and a checkpoint: tag to see one model’s rollouts.

The SEQUENCES tab filtered by source:policy, listing rollouts tagged with their task, session, episode, source, checkpoint, and fps.

Find the pattern

Sort your failures by start and by type. To see why a rollout failed, open Episodes in the webapp, filter by source:policy, and play it back from both cameras.

  • Failures that cluster at one start point to missing coverage: the policy hasn’t seen enough starts like that one. On the reference cell, one of the first model’s failed rollouts started with the red block near the arm’s base, a region the demonstrations rarely used.
  • Failures at the grasp (missed grasps, drops) point to precision. Add demonstrations with slower, more deliberate grasps.
  • No release means the policy never learned a clear moment to let go. Add demonstrations where you line the red block up over the green one, lower it until it rests there, pause, then open the gripper in one motion.
  • Froze may be the gripper latency described in the Phase 6 troubleshooting table. If the arm pauses for seconds at each gripper change, more data won’t fix it.

Record targeted demonstrations

Record 15 to 20 more episodes aimed at your failure cases. For example, if both rollouts near the base failed, record several episodes that start near the base. Use the same task, stack the red block on the green block, and leave FPS at 10, so the new episodes match the old ones. Training works best when every sequence shares the same rate.

End the policy session with Esc, so only one thing drives the xArm. Then press T to start teleop. Follow Phase 3 to record, and review the new episodes the way you did in Phase 4: tag each one review:keep or discard it.

Version the dataset

Create a new dataset named xarm-stacking-v2, holding all the kept episodes from v1 plus the new keepers. Don’t overwrite or edit xarm-stacking-v1. Keeping v1 intact means you can still reproduce model version 1, and the comparison stays honest.

Use the script from Phase 4. Change the dataset name from xarm-stacking-v1 to xarm-stacking-v2, or create it in the Viam app the same way. The script keeps every demonstration tagged review:keep for the task, which now includes your new episodes. It skips the rollouts, which are tagged source:policy, so the policy never trains on its own mistakes.

Retrain

Submit the same training job as Phase 5, with two changes: select xarm-stacking-v2 (or pass its dataset ID with the CLI) and give the model a new version (for example --model-version=2 with the CLI; the app names the version for you). Keep every other argument the same, so the dataset is the only variable. Every --model-version must be new.

Compare

When the job finishes, point the policy at the new model.

  1. In your machine’s JSON config, change the version of the xarm-stacking package to the version your retrain produced, as in Phase 6.
  2. Save, and wait until act-policy reports "state": "ready" from status.
  3. Start a new policy session with the new version in the checkpoint field.
  4. Run the same 10 rollouts, from the same starts, and compute the success rate.

Checkpoint

You have a success rate for your first model and one for your retrained model, from the same 10 starts.

Ten rollouts is a small sample, and a difference of one rollout can be noise. Look at which failure types went away, not only the total.

Other knobs

If more demonstrations don’t help, or you want to tune something else, try these settings.

  • Chunk size: The extra flags in Phase 5 set a 20-action chunk, 2 seconds at 10 Hz. A shorter chunk reacts to the cameras more often, but needs faster inference. A longer one runs longer without new camera input. Change both --policy.chunk_size and --policy.n_action_steps, then retrain. See How the controller paces the chunks.
  • Training steps and early_stop_patience: Phase 5 caps the job at 20,000 steps and stops it after three evaluations without improvement. If the job ran all 20,000 steps and eval_loss was still falling, the model is underfit: raise steps. Each 10,000 steps at batch_size=32 takes about 40 minutes on the training job’s GPUs. Raise early_stop_patience if the job stops while eval_loss is still drifting down.
  • state_noise_std and state_dropout: These perturb the joint state during training, so the policy relies more on the cameras. Phase 5 sets state_noise_std=0.2. If the policy still replays a memorized path instead of reacting to where the blocks are, raise it, or add state_dropout=0.25.
  • image_size: Without it, each camera trains at its own size. Set it, for example to 224, to downscale the images and shorten training, at the cost of detail such as the block edges.
  • Fine-tune instead of starting over: pretrained=viam:<org-id>/xarm-stacking@<model-version> starts the retrain from an earlier model version instead of from scratch. Comparisons stay fairest when every version trains from scratch, so use this when training time matters more than a clean comparison.
  • More demonstrations or more steps: When failures cluster by situation, more demonstrations usually beat more steps. More steps on the same data can’t teach the policy situations it never saw.