Rational Inverse ReasoningFew-Shot Imitation by Inferring
Programmatic Intent through Planning

Anonymous Authors

Supplementary material

From demonstrations to intent, then to new actions.3:18 · Silent video Download

A few demonstrations show what happened.
RIR infers why it happened, then plans what to do in a new scene.

Abstract

Humans learn a manipulation task from one or two demonstrations, and perform it in a new room, with new objects, under new constraints. This requires identifying which object roles, subgoal orderings, and constraints should persist when the scene changes, as opposed to cloning object motions. We present Rational Inverse Reasoning (RIR), which infers this task structure as an explanation program: a compact, executable description of intent that maps an object-centric scene to a task-and-motion planning (TAMP) specification of goals, subgoals and constraints. This allows the robot to generate new actions for new objects and layouts, while preserving the demonstrator’s intent.

A vision-language model proposes candidate programs, a planner-derived score evaluates whether each candidate makes the demonstrated behavior rational, relative to alternative strategies. These scores guide iterative program refinement. We evaluate RIR on 30 simulated, and four real-world tabletop tasks (using a Franka FR3), and 35 two-dimensional reasoning tasks. In all cases, RIR recovers transferable task structure from only 1–3 demonstrations. Generalizing to new layouts and object sets, it outperforms VLM, planning and few-shot learning baselines that lack explicit rationality and planning-grounded inference.

Method

Infer the intent. Re-plan the motion.

An explanation program captures what should stay the same when the objects, layout, and geometry change.

RIR pipeline: scene reconstruction and teleoperated demonstrations, VLM program proposals, planner-generated trajectories, rational-likelihood ranking and feedback, and test-time generalization.
Figure 1. Demonstrations and object-centric scene states guide candidate programs. Planning supplies evidence for ranking and refinement. The selected program defines the task in a new scene, where the planner generates a new trajectory.
01

Propose explanations

A vision-language model uses the demonstrations and scene states to propose Python programs specifying object roles, goals, ordered subgoals, and constraints.

02

Reason with a planner

Compare demonstrated and alternative strategies. Planner-derived scores and diagnostics guide revisions to a finite pool of candidate explanations.

03

Generalize through planning

Run the selected program on a new scene, re-ground its goals and constraints, and plan a new sequence of actions that preserves the inferred intent.

Why did the demonstrator choose this behavior?

Several programs can fit the same demonstration. RIR asks whether the observed strategy is a sensible choice under each explanation, whether its motion is feasible and efficient, and whether its constraints explain the behavior’s specificity.

Planner-grounded evidence comparing demonstration-consistent plans, counterfactual strategies, and the specificity of nested task constraints.
Figure 3. Demonstration-consistent and counterfactual plans provide evidence about intent. The practical score is a planner-dependent approximation to the rational likelihood.

Evaluation

Learning from 1–3 demonstrations

From continuous robot manipulation to geometric and algorithmic reasoning.

30simulated tabletop tasks
4real-world task families
352D reasoning tasks

Simulated manipulation

Same intent, different scene

Thirty tabletop tasks in IsaacSim span more than 300 objects and 90 held-out scenes. Tasks require object selection, ordered subgoals, and geometric constraints, with changes in object identity, count, layout, and clutter.

RIR reports 1.4× comprehension and 1.3× overall success relative to its nearest baseline, Reasoning without Rationality (Rw/oR), across the one- and three-shot settings.

Rw/oR uses the same VLM and proposal budget, with self-refinement in place of planner-derived rational feedback.

Teaching scene, simplified explanation program, and new evaluation scenes for placing clutter in a box and lining up fruit by hue.
Figure 4. Tidy the clutter, then line up the fruit by hue.
Three simulation result plots showing comprehension, trajectory success, and execution success for RIR, Rw/oR, VLM-ORION, and VLM-VLA with one or three demonstrations.
Figure 5. Comprehension, trajectory success, and execution success are evaluated separately. Solid and dashed lines distinguish demonstrations from one scene and across scenes. Error bars show ±1 standard error.

Real-world manipulation

From teleoperation to new tabletop scenes

A Franka FR3 learns long-horizon tasks from teleoperated demonstrations. A real-to-sim pipeline reconstructs object-centric scenes so the inferred programs can transfer to new objects, layouts, and distractors.

75%

Intent comprehension

With one or three demonstrations, measured as program equivalence.

42% → 57%

Trajectory success

One to three demonstrations on held-out scenes; three-shot Rw/oR achieves 10%.

13 / 20

Physical task completion

A separate execution case study on a learned explanation program.

Real-world teaching scenes and generalization to different objects, layouts, and distractors; comprehension and behavioral success plots; a 20-run execution breakdown with 13 successes.
Figure 6. Scene transfer (a), comprehension and trajectory success (b), and the separate physical execution case study (c). Its seven failures comprise one reconstruction failure, two refinement failures, and four missed grasps.

2D reasoning

Recover spatial and algorithmic structure

The 35-task corpus includes 25 spatial tasks and 10 additional tasks involving filtering, counting, and conditionals. Even simple demonstrations can admit several explanations, making both proposing and ranking the intended program important.

Top-1 execution success with three demonstrations
Task groupRw/oRRIR
Spatial22.4%58.9%
Spatial + algorithmic14.5%24.0%
Triangle-sorting demonstrations and explanation program alongside spatial and algorithmic reasoning comprehension and execution results, including human top-1 comprehension.
Figure 7. Move the largest triangle to the top-right, then the remaining triangles to the bottom-left. RIR’s top-5 comprehension approaches human top-1 performance, while its top-1 comprehension remains lower. Execution is evaluated in noiseless simulated rollouts.
How to interpret the results

Three metrics answer different questions. Comprehension measures whether the program recovers the intended task; trajectory success checks planned behavior in a held-out scene; execution success measures task completion during a physical or simulated rollout.

Current limitations. RIR uses an approximate, planner-dependent score and searches a finite pool of VLM-generated programs. Perception and planning can fail, and real-robot plans currently execute open-loop. In the physical case study, missed grasps caused four of seven failures.

See Sections IV–V and the appendices of the paper for the full protocol and limitations. Numerical summaries on this page follow the supplied manuscript.

BibTeX

Citation for the anonymous manuscript.

@misc{anonymous2026rir,
  title = {Rational Inverse Reasoning: Few-Shot Imitation
           by Inferring Programmatic Intent through Planning},
  author = {Anonymous Authors},
  year = {2026},
  note = {Anonymous manuscript}
}

Scroll to inspect the figure. Press Escape to close.