Manuscript Offprint
arXiv:2611.00297Teach, Abstract, Apply: A Framework for Dialogue-Driven Task Learning with Collaborative Robots
ABSTRACT
Collaborative robots (cobots) are designed to be safer and more interactive than traditional industrial robots, share the same workspace as humans, and assist them in a range of shop-floor tasks such as palletization, joint assembly, and part inspection. Many of these tasks involve repetitive workflows that may evolve with changes in production environments and task specifications. These requirements motivate the need for intuitive interfaces that allow workers to modify workflows on the shop floor and generalise these routines for future use. This work introduces the Teach-Abstract-Apply (TAA) framework, which enables human operators to (a) teach new workflows to cobots in natural language, (b) abstract the taught workflows into skills for later use, and (c) apply these skills in different settings. As a case study, we apply the TAA framework to a collaborative structure-building task and evaluate it with both open-weight (Qwen3-Coder) and closed (GPT5.2-Codex) models in self-play and cross-model configurations. Our results show that skill abstraction improves task success rates and reduces interaction cost. Beyond automated evaluation, a preliminary human-in-the-loop study suggests that the pipeline also works with human instructions.
Keywords: collaborative dialogue systems, human-robot interaction, natural language dialogue, skill learning, skill reuse, program synthesis
1 INTRODUCTION
Industry 4.0 (Rüßmann et al., 2015; Xu et al., 2018) suggests a transformation from conventional automation to the use of smart machines and smart factories in manufacturing. Its vision includes collaborative robots (cobots) assisting human coworkers (Colgate et al., 1996) on factory floors to enhance productivity, flexibility and efficiency. Unlike traditional industrial robots, these cobots are designed with enhanced safety mechanisms (Wannasuphoprasit et al., 1997; Akella et al., 1999) and simplified programming requirements (Stopp et al., 2001; Estable et al., 2002) that enable them to work alongside human coworkers in the same workspace and reduce the need for expert robot programmers in operating them. However, real-world human-robot interaction is still far from achieving such seamless collaboration (Rodríguez-Guerra et al., 2021; Segura et al., 2025). Various research approaches (Andersen et al., 2016; Rosen et al., 2020;
Schoen et al., 2022; White and Mutlu, 2024) have therefore focused on lowering the barriers to using cobot interfaces. With many industrial robots deployed on assembly floors, it is important to enable effective collaboration (Aaltonen and Salmi, 2019; Sullivan et al., 2024) between humans and robots.
Recently, human-robot collaboration workflows have been improved by advancements in large language models (LLMs) (Zhang et al., 2023; Kim et al., 2024), with a focus on immediate, specific actions for “here and now” scenarios (Driess et al., 2023). These workflows usually operate by taking commands from users (Ichter et al., 2022), with the backend LLM analysing and reasoning about them (Liang et al., 2023), preparing a step-by-step plan (Huang et al., 2022; Wang et al., 2024) that considers the current environment, and generating a program (Singh et al., 2023) to perform the task. However, these methods focus primarily on executing the current task rather than retaining and reusing these behaviors, which is the core intent of teaching custom behaviors to the robot. Furthermore, in industrial environments, it is useful to teach a task as well as to capture the behavior so it can be re-deployed in new settings with minimal user intervention (Bauer et al., 2016; Villani et al., 2018; Robots, 2024; Sullivan et al., 2024). Without a mechanism to generalize and reuse learned behaviors, robots must be re-taught or re-programmed each time the environment changes, limiting scalability.
Teaching is often iterative, involving back-and-forth clarifications (Padmakumar et al., 2022) and corrections that lead to incremental refinement (Chiyah-Garcia et al., 2024). Prior work on conversational programming (Désilets, 2001; Rahit et al., 2019) addresses parts of this process by enabling programs to be iteratively specified and refined through dialogue (Cypher and Halbert, 1993). Building on this, we propose the “TAA: Teach, Abstract, Apply” framework that enables workers to talk to a robot in natural language (Lauria et al., 2002; Gorostiza and Salichs, 2011), iteratively refine the workflow (Thomason et al., 2019), and thereby teach new behaviors through a multi-turn dialogue (Ge et al., 2024). As the name suggests, the TAA framework consists of three stages: Teach, Abstract, and Apply. Teach refers to the process of a worker engaging in a multi-turn interaction with the robot, with the robot extracting relevant information from the interaction. Abstract refers to the process of capturing and generalising the extracted information into a behavior that can be applied across different environments. Apply refers to the process of applying these learned behaviors in different settings with minimal user intervention.
We test the TAA framework in a controlled setting through a collaborative structure-building task (see Figure 1) inspired by real-world industrial assembly scenarios, in which a worker converses with the robot to build a structure in a grid-based environment. These structures are composed of components such as washers, nuts, screws, and bridges. During the Teach step, the worker communicates the structure to be built in natural language in a step-by-step fashion, and the robot semantically translates these instructions into executable code. The outcome of the Teach step is an interaction trace consisting of a set of instruction-action pairs, which are then used by the Abstract step to capture and generalise the code into a persistent function that can be adapted to different environments. The Apply step focuses on evaluating how well the robot can reuse these persistent functions in different settings without requiring the worker to teach it again from scratch. To isolate the effectiveness of this framework, the task is evaluated in a controlled environment without a physical robot. An instruction-tuned Code LLM generates executable code snippets for robot manipulation, which are executed in a virtual simulator, thereby for now avoiding the perception and control issues of a real robot.
With this controlled task setting, we investigate the following research questions: (R1) Can LLM-based interpretation together with a dialogue management framework realise acquisition of executable behaviours through multi-turn natural-language dialogue? (R2) Can LLM-based interpretation be used to abstract from the concrete teaching situation a function that generalises to new spatial contexts and reused
Frontiers
Figure 1. Overview of the Teach and Abstract steps represented through the structure building task in a simulated environment. Teach: the worker uses natural-language to teach the Cobot an assembly arrangement; Abstract: successful interaction traces are abstracted into a reusable skill.
① Teach: Situated Conversation

② Abstract: Interaction Abstraction

without re-specification? (R3) Can learned behaviors improve task success and reduce interaction cost compared to teaching from scratch? Our contributions are threefold: (1) we present TAA, a dialogue-based framework for teaching new behaviors grounded in executable programs; (2) we introduce a behavior abstraction mechanism that generalises demonstrated behaviors into reusable functions; and (3) we provide a comprehensive evaluation, including reconstruction, reuse, and repeat experiments, along with a pilot human study, demonstrating that learned behaviors enable persistent reuse, reduce interaction cost, and improve task performance compared to context-only conversational programming.
2.1 Collaborative Dialogue Systems
Human-robot collaboration systems have evolved from instruction-only style (Lauria et al., 2002) to interactive style (Foster et al., 2006; Gorostiza and Salichs, 2011) that showcases the necessity of back-and-forth negotiation. Chai et al. (2016, 2018) discuss the inherently ambiguous nature of human instructions, which motivates the need for correction and clarification as core interaction patterns (Thomason et al., 2019; Kane et al., 2022; Chiyah-Garcia et al., 2024), the robot must actively seek and incorporate feedback across
Frontiers
Figure 2. Overview of the Apply step represented through the structure-building task in a simulated environment. Reuse: refers to using an existing skill at a new location; Repeat: refers to using an existing skill with new properties — the washer color is set to 'green' and the skill is repeated across a set of locations in a pattern.

turns. More recently Bonial et al. (2024) explores establishing common ground across different modalities of information in human-robot dialogue. Although these systems advance collaborative interaction, the knowledge learned through dialogue is not retained as an executable representation. Our work builds on these systems by extracting and persisting learned knowledge as reusable executable behaviors.
2.2 Conversational Programming
Prior work (Heidorn, 1976; Leggett and Williams, 1984; Désilets, 2001) proposed using different modalities for translating natural language instructions into programs. With recent advancements in LLMs, program synthesis has become widely explored (Chen et al., 2021; Austin et al., 2021; Hou et al., 2024). Nijkamp et al. (2023) explore multi-turn interactions for improving overall program synthesis quality. Several works (Huang et al., 2022; Ichter et al., 2022; Liang et al., 2023; Singh et al., 2023; Töberg and Cimiano, 2023; Macaluso et al., 2024; Kim et al., 2026) extend these ideas to generate executable robot tasks and plans from natural language instructions. However, these works focus primarily on context-bound execution and often assume users with programming knowledge. Our work instead targets factory workers, who may lack programming background but have domain expertise (Aaltonen and Salmi, 2019; Bauer et al., 2016; Villani et al., 2018; Sullivan et al., 2024). Furthermore, the outcome of the dialogue is captured as a persistent, reusable skill representation in the form of an executable program.
Frontiers
2.3 Reusable Skills
Once deployed in the real world, collaborative robot routines evolve over time, which traditionally involves re-programming (Lozano-Perez, 1983; Biggs et al., 2003; Villani et al., 2018; Ajaykumar et al., 2021a; Giberti et al., 2022). To reduce this burden, Konidaris et al. (2012) proposed segmenting demonstrations into reusable skill trees that allow users to build new sets of skills. Lioutikov et al. (2017) learn a library of movement primitives using probabilistic methods. Although these approaches aim to discover reusable primitives from demonstrations, they still depend on physical robot access and predefined model structures and representations. Leveraging recent LLM progress, several works use them to generate robot programs (Mu et al., 2024; Hu et al., 2024). Wang et al. (2024) demonstrate building a skill library that allows reusing learned skills; however, the stored skills are specialized rather than generalized. Tziafas and Kasaei (2024) extend this to generalizable skills in lifelong learning. Moreover, recent advances in coding agents have introduced user-editable skills in text files with recipes for task development. This has led to the evolution of an open-standard (SKILL.md¹) file that describes a skill and its associated tools and workflows. Similar ideas have been explored in robotics, to generate, refine and reuse robotic behaviors (Lu et al., 2026; Hu et al., 2026; Fu et al., 2026). While TAA shares the idea of maintaining persistent skills with these works, it differs in how these skills are systematically evaluated across different application settings through reuse and repeat tasks. This is a necessary assessment because the goal is not only to acquire a skill through teaching, but also to redeploy it in new settings.
Taken together, these lines of research establish the building blocks for TAA. Collaborative dialogue systems demonstrate the usefulness of multi-turn interaction for clarifying and grounding user intent, but they do not retain what is learned. Conversational programming shows how natural-language interactions can be used to iteratively specify and refine executable programs, but primarily focuses on generating programs for the current task. Works on skill reuse demonstrate the value of persistent, reusable robot behaviors, but does not evaluate how these skills transfer under systematic task modifications. TAA brings them together by enabling users to teach robots new behaviors through multi-turn dialogue, abstracting the interaction into persistent executable skills, and evaluating their reuse across systematic task modifications.
3 METHODOLOGY
3.1 TAA: Teach, Abstract, Apply
Building on human–robot collaborative dialogue systems (Foster et al., 2006; Gorostiza and Salichs, 2011; Giberti et al., 2022; Kane et al., 2022; Bonial et al., 2024), we formulate the Teach-Abstract-Apply (TAA) framework as three distinct and sequential steps: Teach, Abstract, and Apply, where the outcome of each preceding step provides input to the next step.
The Teach step begins with a goal that is known only to the worker and may be represented in different forms, such as an image (e.g., a schematic diagram), text (e.g., a design document), voice note (e.g., a description of the required functionality), or a combination of one or more of these modalities. The worker interacts with the robot in natural language and incrementally guides the robot towards the goal. The interactions usually span multiple turns and include clarifications, corrections and acknowledgments from both the worker and the robot. We frame this interaction as a programming process which is refined iteratively. The outcome of the Teach step is an interaction trace that encodes the workflow. This is followed by the Abstract step, which generates a persistent representation of the workflow. Necessary
¹https://github.com/agentskills/agentskills
Frontiers information from the interaction trace is extracted and generalised so that the retained representation can be extended to different environments. The outcome of the Abstract step is a skill (e.g., a program, a .md file etc.) that is available for later use. And the Apply step follows, which applies the skills from the previous step in new settings. The robot is equipped with these new skills and the evaluation focuses on whether the skills can be adapted and applied to the new settings (e.g., changing the attributes in a workflow, repeating the workflow in different patterns, or building a new workflow using the current workflow etc.) without teaching from scratch.
3.2 Structure Building Task
Kranti et al. (2024) proposed a structure-building task (SARTCo) in which an instruction giver (Programmer) collaborates with an instruction follower (Cobot) to reconstruct a goal structure, which consists of different industrial-assembly-style configurations. The Programmer receives the goal structure, represented on a , grid, and instructs the Cobot in natural language on how to reconstruct it. The grid is represented as a Python array, and each grid cell can be accessed using its row and column values, e.g., [1,2] or [3,4]. The Cobot translates the instructions into code snippets, which, when executed in a simulator, generate the resulting structure on the grid. They explore generating first-order (primitive code) and higher-order (abstract programs) programs from single-turn instructions. We use this dataset for our experiments.
3.3 Realising TAA Framework
Our objective is to enable workers to teach robots persistent workflow representations through natural language using TAA. For this purpose, we instantiate TAA through the structure building task in a controlled setting. We use instruction-tuned Code LLMs as both the Programmer and the Cobot. The LLM powering the Programmer receives the goal structure in textual form and instructs the Cobot in natural language. The Cobot receives Programmer's instruction along with the current state of the reconstructed board in textual form and generates code snippets. These code snippets are executed in the simulator, and the resulting structure is returned to the Programmer in textual form as a follow-up response. We use the clem:todd framework (Kranti et al., 2025) to facilitate these interactions which follow a specific JSON schema (e.g., code, clarification, acknowledgment). At the end of the interaction, the resulting instruction-code pairs are used to generate a higher-order Python function that is saved as a skill. These saved skills are evaluated for their extendability to new tasks. As mentioned in Section 1, we do not use a physical robot in this controlled evaluation.
3.3.1 Teach: Teaching through Dialogue
A conversation demonstration (see Figure 3) refers to an incremental teaching process through which the worker teaches the cobot new manipulation routines for building a given goal structure (also referred as a board). The Programmer may be a human, LLM, or rule-based generator, while the Cobot may be a human or LLM, are treated as the two players in the structure building task, and the Game Master (GM) coordinates the turn-level interaction between them. The task concludes when Programmer responds with DONE, or when the maximum turn limit (15) is reached.
²A 2D grid with vertical stacking.
Frontiers
Figure 3. An example interaction trace showing how the conversation proceeds. At Turn 1, the Programmer instructs the Cobot to place a red screw on top of a yellow washer at position [1,3]. However, the Cobot responds with an action that places only a washer and also uses the wrong color. The Programmer corrects the color and proceeds with the next step. At Turn 3, the Cobot asks for clarification about the screw color, although it was already specified in Turn 1. In the next turn, the Programmer repeats the details. The shared context shows how the reconstructed board is updated after each Cobot action. When the Programmer responds with DONE, the interaction is completed.

3.3.1.1 Programmer: Instruction Giver
In line with existing work (Chalamalasetti et al., 2023; Kazi et al., 2024), we use LLMs to simulate instructors. We conducted multiple ablation studies to design the final prompt structure (details in Section 4.2). Programmer is prompted ³ in a zero-shot setting with information about the environment, the task constraints, and the goal board to reconstruct. The goal board is represented in textual format for a text-based LLM and describes the stacking order and cell-level details, including the occupied elements and their colors. Based on the ablation studies, the prompt included a difference board, that shows the difference between the goal board and the current reconstruction board for each cell and stacking level. In the first turn, the difference board is None; in subsequent turns, it is updated with the relevant differences.
When instructions are ambiguous or incomplete, Cobot requests clarification, and Programmer elaborates or corrects the description. If Cobot makes an error, such as placing unintended shapes in the grid, colors,
³Refer to the Supplementary Material for detailed prompts.
Frontiers or spatial positions, Programmer provides corrective feedback so that subsequent outputs align with the intended goal. Through this iterative process, Programmer and Cobot collaboratively reconstruct the goal board.
3.3.1.2 Cobot: Instruction Follower
Cobot translates user instructions into executable code. We use instruction-tuned code LLMs for this purpose. Cobot is prompted with information about the environment, the task constraints, and the current state of the reconstruction board. Similar to Programmer, the current reconstruction board is represented in textual format, describing the stacking order and cell-level details, including the occupied elements and their colors.
For a given input instruction, Cobot is expected to either produce the corresponding action sequence (e.g., input: “place a red washer in cell 4,3”; output: put (board, washer, red, x=4, y=3)) or ask for clarification (e.g., “there is already a nut present in the same location. do I need to remove the nut before placing a washer or stack on it?”). The generated action sequences are executed in a virtual simulator. If execution fails, Cobot receives feedback about the error and either corrects the code or asks for clarification when the error cannot be resolved without additional context from Programmer. If execution continues to fail after three attempts, the interaction is terminated and the test instance is treated as a failure. Cobot can also acknowledge Programmer queries (e.g., input: “do you know how to place a washer?”; output: “Yes, I know!”).
3.3.1.3 Game Master: Interaction Coordinator
The Game Master (GM) manages the turn-level interaction between Programmer and Cobot. At the beginning of each turn, GM provides Programmer with the goal board and the difference board. Programmer then gives a natural language instruction to guide the reconstruction, and Cobot responds by translating the instruction into executable Python code, asking for clarification, or providing an acknowledgment when appropriate. GM validates each player response to ensure that it follows the required format; if a response does not satisfy the format requirements, the interaction is aborted. GM also executes Cobot’s generated code in the virtual simulator and shares the updated reconstruction board with both players in the subsequent turn. When execution fails, GM forwards the error to Cobot, which can revise the code or ask Programmer for clarification. The interaction continues until Programmer responds with DONE, the maximum turn limit (15) is reached, or execution fails after three attempts. Once Programmer responds with DONE, GM evaluates task success by comparing the reconstructed board with the goal board at each cell location, including component color and stacking order. If the reconstruction is successful, GM forwards the instruction-code pairs, consisting of each Programmer instruction and its corresponding Cobot-generated action, to the Optimizer module for further processing. The prompt structure, number of execution retries, and overall task interaction are based on the ablation studies, discussed in Section 4.2.
3.3.2 Abstract (Optimizer): Generalisable Function Generator
Only successful reconstruction interactions are used for optimization, since they correspond to cases where the goal board was reconstructed correctly. Unsuccessful or incorrect interactions are excluded. Optimizer receives the sequence of instruction-response pairs collected during reconstruction, where each Programmer instruction is paired with the corresponding Cobot-generated action as shown in Figure 4.
Frontiers
Figure 4. Overview of reusable function generation. Given the instruction-response pairs and a predefined function signature, the Code LLM abstracts the primitive code snippets into a reusable higher-order function. The generated function is then evaluated by comparing the structure it reconstructs with the structure produced by the input code snippets, evaluating each cell for component type, color, and stacking level.

The Cobot output contains primitive placement sequences and may also reflect clarifications or corrections made during the interaction. Although these sequences are sufficient to reconstruct the goal board, they cannot be reused in later tasks unless they are converted into a reusable representation. We therefore abstract recurring action patterns into higher-order Python functions that produce the same goal board state as the primitive code sequences.
Optimizing code into reusable abstractions is often time-consuming and requires human expertise. Prior work (Yang et al., 2023; Tapia et al., 2025; Cynthia, 2025) has shown that LLMs can support optimization processes. Building on this, we follow a similar LLM-as-optimizer paradigm and use an instruction-tuned code LLM to iteratively transform the generated code into a reusable skill function. The optimizer is queried in a zero-shot setting with a prompt that includes information about the environment, task constraints, and instruction-response pairs from the reconstruction task. The output is a Python function, referred to as a skill, that encapsulates the manipulation routine in a reusable form for subsequent tasks.
The optimizer receives the full sequence of instruction-response pairs without pre-processing (see Figure 4). Since the sequence may include instructions that correct or clarify earlier ones, the optimizer is prompted to read the entire interaction, identify which code reflects the final intended actions, and discard any code that was later replaced or fixed. For example, an instruction may place a washer using put (board, 'washer', 'red', x=1, y=3). If a later instruction corrects the washer color to yellow with put (board, 'washer', 'yellow', x=1, y=3). The final code used for optimization would therefore include only put (board, 'washer', 'yellow', x=1, y=3). The prompt also instructs the optimizer to follow a predefined function signature. For illustration, a generated skill may be defined as def <object_name>(board, colors, x, y) and be used as
Frontiers ws(board, ['yellow', 'red'], 1, 3). The generated function can then be stored and reused in subsequent tasks (Sections 3.3.3.1 and 3.3.3.2).
For a given input, Optimizer is expected to generate a Python function that produces the same board state as the input primitive code sequences when executed in the virtual simulator. Equivalence is determined by comparing the final board states produced by the generated function and the primitive code sequences. If the Optimizer output fails to execute, it receives feedback about the error and can revise the code. If it cannot correct the error within three attempts, the task is aborted and the test instance is treated as a failure. The task is considered successful when the Optimizer output replicates the board state and is considered failed when the maximum turn limit (10) is reached.
3.3.3 Apply
3.3.3.1 Reuse: Systematic Evaluation of Skill Generalisability
Once cobots are deployed in the real world, onsite requirements may differ from their pre-programmed routines due to customization needs or changing task constraints. These changes can include a new product variant, a change in assembly geometry, such as a V-shape instead of a T-shape, or an added inspection step, such as checking alignment before fastening. Adapting to such changes often requires a programming expert (Ajaykumar et al., 2021a; Giberti et al., 2022) or the use of complex interfaces (Akkaladevi et al., 2019; Dmytriyev et al., 2022; George et al., 2023; Ayalew et al., 2025), which can be costly (Barravecchia et al., 2023) and slow (Ajaykumar et al., 2021a).
We design the reuse task to study whether skills generated by the Optimizer can be adapted under controlled modifications. Specifically, we evaluate changes in color and spatial information, reflecting incremental adjustments common in assembly workflows. We are interested in: (a) can the model identify the required skill from the list of available skills? and (b) can the model use the selected skill with the correct modifications for the new requirement?
Similar to reconstruction, the reuse task consists of two players, Programmer and Cobot, interacting over a multi-turn dialogue to replicate a goal board. The skills generated by the Optimizer are made available in Cobot's context. Each skill is represented by its function signature and a single-line description of the object it builds. Programmer is prompted to ask whether Cobot is aware of the relevant skill before guiding it to build the modified object using the available skills. Cobot is expected to identify the relevant skill from its context and generate a function call with the correct arguments. This function call is executed in the virtual simulator using the corresponding skill definition learned during optimization. If the corresponding skill is not available in the library, we use the ground truth function definition to execute the function call.
If Cobot cannot identify a suitable skill, Programmer provides step-by-step instructions, and the interaction falls back to the Teach reconstruction loop. The task is completed when Programmer signals completion or when the maximum turn limit (15) is reached. Once Programmer responds with DONE, GM evaluates task success by comparing the reconstructed board with the goal board at each cell location, including component color and stacking order.
3.3.3.2 Repeat: Systematic Evaluation of Repeated Skill Use
As robots are often used for repetitive tasks, we extend our study to examine how learned skills generalize to goal boards with repeated spatial patterns. The repeat task consists of goal boards where a single object
Frontiers is repeated across the grid in different patterns. Similar to the reuse task 3.3.3.1, the objects used in the goal boards are modified versions of the skills generated by the Optimizer. In the repeat task, these objects are placed multiple times across the board in structured patterns, requiring the models to recognize and generalize the repetition. We are interested in: (a) whether the models can identify the correct repetition pattern, including spatial arrangement, order, and frequency, to accurately replicate it; and (b) whether the models can express this pattern using appropriate programming abstractions, such as loops or nested loops.
The repeat task follows the same two-player, multi-turn interaction as the reuse task. Cobot is equipped with the learned skill set and is expected to select the relevant skill, generate the corresponding function calls, and use suitable programming abstractions to place the object repeatedly across the grid. If Cobot cannot identify a suitable skill, Programmer provides step-by-step instructions, and the interaction falls back to the Teach reconstruction loop. The task is completed when Programmer responds with DONE or when the maximum turn limit (30) is reached. Once Programmer responds with DONE, GM evaluates task success by comparing the reconstructed board with the goal board at each cell location, including component color and stacking order.
4 EXPERIMENTAL SETUP
As the TAA framework follows two-player interaction, both players are prompted in a zero-shot setting and receive the full interaction history at every turn. More details about the prompt context are available in the Supplementary Material.
4.1 Dataset
To evaluate the proposed approach, we require an environment that mimics a manipulation setting and allows collaboration over multiple turns. The tasks also require semantic representations expressed in code so that outputs can be evaluated objectively. We use the SARTCo (Kranti et al., 2024) dataset for our experiments. The SARTCo dataset is an 8×8 2.5D (a two-dimensional grid with vertical stacking) grid-world environment in which objects are arrangements of connected components of nuts, washers, screws, and bridges. A grid containing one or more such objects is referred to as a board. For the reconstruction and reuse tasks, the goal boards contain single objects, whereas the repeat task uses goal boards with multiple objects. Since the publicly released dataset contains a limited number of test samples (130), we generated a new set of samples using the same framework, producing a training set of 165 samples and validation and test sets of 495 samples each. The training set is used in the reconstruction task for teaching the skills. The validation and test sets contain three instances (that differ in colors and locations) for each of the 165 unique skills in the training set without any overlap. This setup is designed to evaluate whether the learned skills can generalize to unseen variations.
4.2 Ablation Studies
We conducted multiple ablation studies to design the prompt. This required several design decisions, including the number of turns before stopping the interaction, whether the cobot should ask clarification questions, whether execution error feedback improves reconstruction and overall success, and the number of turns allowed for the optimization step. Together, these decisions determine our final configuration. The detailed ablation results are available in the supplementary material.
Frontiers
4.3 Evaluation with a Human Programmer
To evaluate the performance of the proposed pipeline under natural human instructions, we conducted a preliminary human-in-the-loop evaluation on a subset of the test set. We randomly selected 50 test instances (seed = 76) and employed a human participant as the Programmer, while the Cobot was evaluated on the reuse and repeat tasks. In these experiments, the Cobot was powered by Qwen3-Coder using the skill-set generated by Qwen3-Coder. The participant was a student assistant in the department who was familiar with the experimental setup but had not worked on this paper.
4.4 Model Selection
We experiment with both an open-weight model (Qwen3 Coder 30B A3B Instruct 4) and a closed model (GPT5.2-Codex 5). These models were chosen based on their competitive performance on code generation benchmarks, representing both open-weight and closed model paradigms. We also investigate whether our approach can be realised with an open-weight model that can potentially be self-hosted and has latency advantages, by comparing it to a proprietary model that incurs usage-based costs. Hence as a case-study, we evaluate one model from each paradigm. The experiments include using the same model for both the Programmer and the Cobot, as well as cross-model pairings (using GPT5.2-Codex as the Programmer and Qwen3-Coder as the Cobot, and vice versa). The rationale for the cross-model pairings is to understand the sensitivity of the Cobot to the choice of the Programmer and its impact on task success. The open-weight model is hosted locally on a single A100 GPU and is accessed through a local API endpoint. The closed model is accessed via Azure APIs. Both models are run with a temperature of 0 to reduce output variance, with a max_new_tokens limit of 1000 for reconstruction and reuse tasks and 2000 for the repeat task.
4.5 Evaluation Metrics
As the dataset provides a known target configuration along with its semantic representation, we conduct a detailed evaluation of the model responses.
Reconstruction task: We use execution success to compare the reconstructed board state with the goal board in terms of the occupied cells (element type, color, location, and stacking order). In addition, we compute dialogue-level metrics, including success rate and clarification and correction rates normalized by the number of elements in the object, and the number of turns required to complete the reconstruction.
Optimization task: We use execution success to compare the board state produced by the generated optimized function with the goal board in terms of the occupied cells, measuring optimization accuracy. We also compute several structural metrics using Python's abstract syntax tree (AST), including whether the generated code contains a valid function definition, the reduction in put calls relative to the input, and the presence of loops indicating abstraction rather than repetition. We further measure the bytecode length before and after optimization using Python's dis module to assess structural compression.
Reuse and Repeat tasks: For the reuse and repeat tasks, we use execution success to compare the generated board with the ground truth board in terms of the occupied cells (element type, color, location, and order), measuring task accuracy when using learned skills. In addition, we measure the rate at which the model selects the correct function from the available skill set and the rate at which it applies this
⁴https://qwen.ai/blog?id=qwen3-coder
⁵https://developers.openai.com/api/docs/models/gpt-5.2-codex
Frontiers function with the correct arguments. We also compute the token-based cost for both No-skills and Skills-Used settings across self-play and cross-model pairings, analysing the trade-off between task success and computational cost.
5 RESULTS
We present our results based on the research questions presented in Section 1, covering the talk–teach interaction, skill generation through optimization, and the reuse, repeat of learned skills in new contexts, providing both quantitative and qualitative analysis.
Table 1. Performance comparison between Qwen3-Coder and GPT5.2-Codex on reconstruction and optimization tasks, reporting success rates for each component and overall performance along with token cost; Overall = Reconstruction x Optimization success; Token cost is the total across all test instances.
| Model | Success Rate | Overall | Token Cost ($) | |
|---|---|---|---|---|
| Reconstruction | Optimization | |||
| Qwen3-Coder | 0.69 | 0.93 | 0.64 | 1.41 |
| GPT5.2-Codex | 0.93 | 1.00 | 0.93 | 10.43 |
5.1 Reconstruction Task
Can we through this methodology teach new behaviors through multi-turn natural language dialogue? This question examines the teach stage of the TAA pipeline, where the Cobot learns to reconstruct a goal board through multi-turn dialogue with the Programmer.
Table 1 shows the success rate of teaching new skills. We first compute the reconstruction success rate, where the Programmer collaborates with the Cobot to accurately reconstruct the board while generating the primitive code snippets. The results show that reconstruction success is higher for the closed model (GPT5.2-Codex) than for the open-weight model (Qwen3-Coder). Some of the failures in Qwen3-Coder are due to the model repeatedly responding with “Yes, I know” without generating code snippets, or continuing to ask clarification questions without correcting misplacements caused by using the wrong colors or incorrect locations. Although reconstruction success varies between the models, both models show higher optimization success rates for successful reconstructions. The token cost is computed based on the number of tokens used and pricing information from OpenRouter⁶, and is reported for reference only⁷ as pricing is subject to change by API providers.
These results indicate that it is possible to acquire new executable behaviors through the proposed framework, and that the success rate depends on the model’s capabilities. We now examine the performance drops through the lens of object complexity and how it affects interaction behavior and reconstruction success. Specifically, we analyze how the success rate changes with the number of elements in the object, and whether clarification and correction rates change with increasing object complexity. Figure 5 shows that for Qwen3-Coder, clarifications and corrections appear to increase with the number of elements. In contrast, GPT5.2-Codex shows an almost flat trend in clarifications and only a few instances of corrections for objects with four elements, while all other cases show zero corrections. For both models,
⁷Qwen3-Coder is hosted on a local GPU; however, the token price is computed to show comparison with commercial model usage.
Frontiers
Figure 5. Performance of Qwen3-Coder and GPT5.2-Codex as task complexity increases (measured by the number of elements per object). The plots show average number of clarification and correction turns, and overall success rate for reconstruction task with varying structural complexity.

the reconstruction success rate declines as the number of elements in the object increases. The drop is higher for Qwen3-Coder, whereas GPT5.2-Codex appears less affected, although a slight decrease is still observed.
5.1.1 Abstract: Reusable Function Generation
After a successful Teach step, we now proceed with the Abstract step, to abstract the primitive action sequences. We evaluate how accurately models can abstract the given code snippets into a higher-order function. Table 1 shows that both the models achieve higher optimization rates. That indicates the abstracted functions reproduce the behavior of the input primitive sequences. We next analyse how well these functions are structurally optimized. This question is important as the goal is not only successful reconstruction but also generating a function that is both optimized and reusable, capable of reproducing the learned behavior in new contexts. Figure 6 shows the analysis across model configurations.
We first check whether the output contains a valid function definition with the correct object name. We then examine how the primitive sequences are structured within the generated function. As the input consists of multiple put () calls, recurring patterns may be present, and an effective optimizer should abstract such patterns. We therefore evaluate whether a loop is present in the generated output and whether the overall number of put () calls is reduced, since loop alone does not guarantee correct abstraction. Finally, we compute whether the bytecode length is reduced after optimization. Both models consistently generate the correct function signature. GPT5.2-Codex effectively uses loops and reduces the number of put () calls, while Qwen3-Coder shows competitive performance on both metrics. However, neither model shows a significant reduction in bytecode length, although GPT5.2-Codex performs slightly better. This is because Python's loop constructs and data structures such as list definitions, zip, and tuple unpacking introduce compilation overhead that can offset or exceed the savings from fewer put () calls.
Frontiers
Figure 6. Success rate of Qwen3-Coder and GPT5.2-Codex on code optimization objectives. Each point represents the proportion of test instances where the model correctly applied the required transformation, including using correct function names, using loop constructs, reducing put () calls, and minimizing output byte length; Vertical lines connect the two models scores to highlight the gap.

Overall, this shows that the optimizer able to abstract the code that is not only functionally correct but also structurally optimized.
Taken together, the results suggest that Teach and Abstract steps enable the acquisition of new executable behaviors through multi-turn natural-language dialogue and their abstraction into reusable skills. The generalisability of these abstracted skills is further evaluated through the reuse and repeat tasks.
5.2 Reuse
With the generation of reusable skills, the next step is to evaluate whether these skills can be applied in new scenarios. We evaluate three settings: the test set without any skills (no-skills), which effectively reduces the reuse task to a reconstruction-style test and acts as the baseline; the test set using the skill set learned by Qwen3-Coder (Qwen skills); and finally using the skill set learned by GPT5.2-Codex (Codex skills). This allows us to study the impact of having learned skills on overall task success and associated cost. We additionally evaluate cross-pairings of the models to examine whether the choice of Programmer (instruction giver) influences the Cobot (instruction follower) model. In cases where a corresponding skill is unavailable, as not all reconstruction instances are successful, these instances fall back to the reconstruction-style task.
Impact of Skill Usage: As shown in Figure 7, using learned skill sets improves task success compared to the no-skill baseline. For the Qwen3-Coder Cobot using the same model as programmer (Q-Q), the success rate increases from 0.72 without skills to 0.86 when using the Qwen3-Coder skill set and to 0.87 when using the GPT5.2-Codex skill set. When the programmer is changed to GPT5.2-Codex (G-Q), the success rate increases to 0.99 for both skill sets (Qwen3 skills: 0.99; Codex skills: 0.99). We further observe that using skill sets reduces overall token cost compared to the no-skill baseline. Without skills,
Frontiers
Figure 7. Cost-performance trade-off for the reuse task. Each point represents a model configuration, comparing success rate and token cost when responses are generated without skills, with Qwen skills, or with Codex skills; G-Q, Q-Q etc. Labels denote Programmer–Cobot pairs; G-Q: GPT as Programmer and Qwen as Cobot; Q-G: Qwen as Programmer and GPT as Cobot; The y-axis is truncated to the range 0.6-1.0 to highlight differences among performance scores.

the cost is 7.96 for G–Q. With skill reuse, the cost becomes 4.88 for G–Q when using Qwen3 skills, and 4.96 for G–Q when using Codex skills.
While the Qwen3-Coder Cobot shows a larger improvement in success rate with the use of skills (Q–Q), the GPT5.2-Codex Cobot (G–G) shows a smaller increase, though with a more substantial cost reduction. For GPT5.2-Codex, the success rate increases from 0.93 without skills to 0.97 when using the Qwen3 skill set and to 0.99 when using the Codex skill set. The reduction in cost is larger, decreasing from 28.82 with the Qwen3 skill set and to 54.62 in the no-skill setting compared to $31.44 for G–G. This behavior is largely due to ambiguous instructions that trigger additional clarification questions, resulting in longer interactions, increased token usage, and slightly lower reconstruction success.
These results demonstrate that skills generated during the reconstruction task are model-agnostic and can be reused by cobots powered by different models for subsequent tasks resulting in improved success rates and reduced costs. We next evaluate the applicability of these reusable skills in the Repeat test.
5.3 Repeat
Similar to the reuse task evaluation, the repeat task examines whether the models can use learned skills to reconstruct boards that contain repeated placements of the same object across the grid. The experiments
Frontiers consider three settings: (a) no-skills, where the models perform the task without access to any learned skills; (b) Qwen3-Coder skills, a skill set learned by the Qwen3-Coder Cobot; and (c) GPT5.2-Codex skills, a skill set learned by the GPT5.2-Codex Cobot. The models are evaluated in both self-play and cross-pairing settings.
Impact of Skill Usage: As shown in Figure 8, the repeat task also shows benefits from the use of learned skills for the Qwen3-Coder Cobot. In self-play, the success rate increases from 0.46 without skills to 0.73 and 0.70 when using the Qwen3-Coder and GPT5.2-Codex skill sets respectively, while the cost is reduced from 11.84 and 67.40 to 23.65. The higher cost in the repeat task compared to other tasks is due to repeated placements of the same object, which lead to multiple instructions, clarification requests, or corrections, and therefore increased token usage.
Figure 8. Trade-off between token cost and repeat task success rate across model configurations. Results compare responses generated without skills, with Qwen skills, and with Codex skills, showing that skill usage significantly improves success rates while maintaining relatively low token cost; The y-axis is truncated to the range 0.4 – 1.0 to highlight differences among performance scores.

In contrast, the GPT5.2-Codex Cobot shows similar success rates across the no-skill and skill settings. The success rate changes from 0.98 without skills to 0.97 with the Qwen3-Coder skill set and 0.99 with the GPT5.2-Codex skill set, while the cost decreases from 28.89 and $19.90 respectively. The decrease in success rate in the cross-pairing case is due to ambiguous instructions, similar to the reuse scenarios. This effect is more in the repeat task compared to the reuse task because the reuse task involves
Frontiers a single object placement, whereas the repeat task requires placing the same object multiple times on the grid.
Together, the Reuse and Repeat evaluations show that the skills learned from Teach and Abstract steps can be Applied to new contexts across different model configurations. The learned skills are transferable across models, can improve task performance, and reduce the associated costs.
5.4 Skill Retrieval Analysis
Sections 5.2 and 5.3 show that skill usage improves the overall task performance, we next analyse how much skill use contributed to success and how much success comes from the fallback reconstruction flow.
Table 2. Skill retrieval rate across model configurations for Reuse and Repeat tasks. The highlighted values indicate the higher-performing configuration when using the corresponding skill set. Labels denote Programmer–Cobot pairs; G-Q: GPT as Programmer and Qwen as Cobot; Q-G: Qwen as Programmer and GPT as Cobot; OTSR: Overall Task Success Rate; SRSR: Skill-retrieval Success Rate; FRSR: Fall-back Reconstruction Success Rate.
| Evaluation Task | Skill-Set | Model | OTSR | SRSR (%) | FRSR (%) |
|---|---|---|---|---|---|
| Reuse | Qwen | Q-Q | 0.865 | 83.64 | 16.35 |
| G-Q | 0.994 | 93.90 | 6.10 | ||
| G-G | 0.970 | 86.67 | 13.33 | ||
| Q-G | 0.943 | 88.65 | 11.35 | ||
| Codex | Q-Q | 0.863 | 89.23 | 10.77 | |
| G-Q | 0.992 | 94.50 | 5.50 | ||
| G-G | 0.992 | 97.35 | 2.65 | ||
| Q-G | 0.980 | 96.70 | 3.30 | ||
| Repeat | Qwen | Q-Q | 0.731 | 96.13 | 3.87 |
| G-Q | 0.927 | 93.25 | 6.75 | ||
| G-G | 0.996 | 81.95 | 18.05 | ||
| Q-G | 0.840 | 88.22 | 11.78 | ||
| Codex | Q-Q | 0.693 | 98.25 | 1.75 | |
| G-Q | 0.929 | 96.30 | 3.70 | ||
| G-G | 1.000 | 96.97 | 3.03 | ||
| Q-G | 0.871 | 96.52 | 3.48 |
5.4.1 Skill Retrieval Rate
Reuse Task: Table 2 show the results. These results indicate that models retrieve the correct skill from context in most cases, and that the Qwen3-Coder Cobot is more sensitive to the choice of Programmer and has more impact on the retrieval rate than on GPT5.2-Codex, although a slight decrease is also observed for GPT5.2-Codex in cross-pairing settings. Moreover, irrespective of the number of available skills (Qwen skill set: 315; Codex skill set: 415), the task success rate and skill retrieval rate are similar across skill sets for the Qwen3-Coder Cobot: 0.865, 83.64% for the Qwen skill set, and 0.863, 89.23% for the Codex skill set. The drop in success rates are likely due to difficulty in extracting the correct skill name from instructions and matching it with the available skill set.
Frontiers
Repeat Task: Similar to the reuse task, we further analyse how skill usage affects the repeat success rate. Table 2 shows these statistics across model configurations using the Qwen skill set and the Codex skill set. Unlike Reuse task, the skill retrieval rate is similar for the Qwen3-Coder Cobot, irrespective of the Programmer and the skill-set. However, its overall task success rate improves to 0.927, 0.929 for Qwen and Codex skill set respectively, when paired with the GPT5.2-Codex Programmer. In contrast, the overall task performance of the GPT5.2-Codex Cobot drops from 0.996 to 0.840 for the Qwen skill set and from 1.000 to 0.871 for the Codex skill set in cross-pairing. This once again highlights the sensitivity of the Cobot to the Programmer used and its impact on overall task performance.
Overall, these results suggest that the models retrieve the correct skill from context in most cases and the skill retrieval rates drive the overall task success rates across model configurations.
Table 3. Skill hallucination percentages across model configurations for Reuse and Repeat tasks computed as the ratio of hallucinated skills to the total retrieved skills. Labels denote Programmer–Cobot pairs; G-Q: GPT as Programmer and Qwen as Cobot; Q-G: Qwen as Programmer and GPT as Cobot;
| Evaluation Task | Skill-Set | Model | Hallucinated (%) |
|---|---|---|---|
| Reuse | Qwen | Q-Q | 29.61 |
| G-Q | 34.41 | ||
| G-G | 24.76 | ||
| Q-G | 26.09 | ||
| Codex | Q-Q | 7.87 | |
| G-Q | 6.47 | ||
| G-G | 4.18 | ||
| Q-G | 3.62 | ||
| Repeat | Qwen | Q-Q | 31.89 |
| G-Q | 33.18 | ||
| G-G | 22.28 | ||
| Q-G | 25.34 | ||
| Codex | Q-Q | 7.12 | |
| G-Q | 5.87 | ||
| G-G | 3.75 | ||
| Q-G | 3.85 |
5.4.2 Skill Hallucination:
Skill retrieval analysis in Section 5.4.1 shows that the models are able to retrieve most of the skills across different configurations. However, during a random manual analysis of skill usage, we observed scenarios, where the model generates a skill that is not available (the skill was not learned during reconstruction) in the model context. We refer to these scenarios as skill hallucinations and analyse their impact on the task success. However, these are not random hallucinations as the generated function call follows the correct function signature, with the correct skill name and relevant arguments. As a design choice, we execute these generated skills in the virtual simulator using the ground truth function definition. This choice allows
Frontiers us to isolate and evaluate the Cobot's ability to correctly predict skill usage, specifically the correct object name, colors, locations, regardless of whether the skill exists in the library.
Table 3 shows the percentage of hallucinated skills across skill sets and model configurations. The hallucination percentages are higher when the Qwen skill set is used, as only 315 skills are available for the 495 test instances, compared to the Codex skill set, for which 415 skills are available. We also compute the success rate for these hallucinated instances and the success rate is 1.0 regardless of the model configuration, further confirming that the models generally predict task-relevant skills.
Overall, these results demonstrate that skills generated during the reconstruction task are model-agnostic and consistently improve task performance when successfully retrieved. The impact of skill reuse varies by model: for Qwen3-Coder, skill reuse primarily improves success rates, while for GPT5.2-Codex, the benefit is more in terms of cost reduction. Skill retrieval rates are high across all configurations. In cases where skills are unavailable, models tend to hallucinate skills that align with the context. Regardless of hallucination, the predicted skills align with the input context, confirming that the models generally predict task-relevant skills. When retrieval doesn't succeed, the interaction falls back to reconstruction, where success rates vary considerably across model configurations. We also observe that both Cobots are sensitive to the choice of Programmer and this has an impact on retrieval rates. Together, these findings highlight that reliable skill retrieval and context-aware skill prediction become increasingly important as task complexity grows.
5.5 Qualitative Analysis
The qualitative examples in Figure 9 highlight different behaviors across the reconstruction and reuse settings. In reconstruction, the interaction supports clarification and correction. When Cobot cannot infer the instruction, it asks Programmer for additional information. Programmer then elaborates the instruction, and later corrects an error in the generated code by specifying that the washer should be red. This example shows how the multi-turn setup allows the task to continue even when the initial instruction is incomplete or when the generated code contains a mismatch.
The reuse examples show that skill availability alone does not guarantee correct skill use. In one case, Cobot misinterprets the object description by treating the two halves of a bridge as separate components, which leads to an incorrect function call. This suggests that reuse errors can also arise from Cobot interpretations. In another case, although the relevant skill is available in the context, Cobot fails to call it and instead generates primitive code. The interaction then falls back to the reconstruction loop, where Programmer continues with step-by-step instructions and corrections.
The reuse scenario also showcases a different failure mode, where Cobot calls a hallucinated skill that is not present in the available skill library. However, the generated call still uses the correct colors and location arguments, indicating that the model can sometimes infer the intended structure even when it is not available in the context. Together, these cases suggest that TAA's multi-turn design helps recover from ambiguity and local execution errors, while reuse failures often arise from skill grounding issues, instruction misinterpretation, and incorrect selection or application of learned skills.
5.6 Evaluation with a Human Programmer
As mentioned in Section 4.3, we randomly selected 50 test instances for the reuse and repeat tasks and evaluated with one human Programmer as a pilot evaluation. This evaluation (see Table 4) measures the performance of the Apply step when natural language instructions are provided by a human Programmer
Frontiers
Figure 9. Qualitative examples (Q-Q setup) showing clarification and correction during reconstruction, misinterpretation during skill reuse, fallback from reuse to reconstruction, and hallucinated skill use. These showcase how Programmer and Cobot interact across task settings, how errors arise from ambiguous or incorrect skill selection, and how the system either continues through correction, falls back to primitive reconstruction; Q-Q: Qwen3-Coder is used as both Programmer and Cobot.

Table 4. Success rates on reuse and repeat tasks across model configurations, including a human baseline for the evaluated subset using Qwen skill set. Results highlight how configuration choices impact performance, with best results per task shown in bold.
| Model Configuration | Reuse | Repeat |
|---|---|---|
| Human-Q | 0.96 | 0.94 |
| Q-Q | 0.88 | 0.78 |
| G-Q | 1.00 | 0.94 |
and the Cobot is powered by Qwen3-Coder. Overall, the Cobot is able to interpret human instructions and achieves comparable success rates to the model-based Programmer configurations for both the reuse and repeat tasks. The human Programmer achieves higher success rates than the Qwen3-Coder Programmer in the same Cobot configuration, suggesting that the Cobot is able to interpret human instructions effectively.
We analyse the episodes where clarification questions are present and whether the interaction behavior differs between human and model-based Programmers. Figure 10 plot (a) shows how many episodes contain clarification questions for each model configuration in the reuse task. Q-Q has only one instance with a clarification question for a 5-element object, while G-Q has four instances for 5-element objects. H-Q has one episode each for three and four element objects. For the repeat task, the number of clarification episodes is slightly higher, with Q-Q peaking at 10 episodes for 4-element objects. We also analyse the
Frontiers
Figure 10. Reuse Task: Clarification behavior under skill reuse settings as a function of task complexity. (a) Clarification episodes remain sparse across all model configurations, with occasional increases for G-Q at higher complexity, while Q-Q and H-Q exhibit minimal clarification needs overall. (b) Median dialogue turns for successful instances are nearly constant, with H-Q consistently requiring two turns, and both Q-Q and G-Q completing interactions in approximately a single turn. Model Configuration: Q-Q (Qwen3-Coder-Qwen3-Coder), G-Q (GPT5.2-Codex-Qwen3-Coder), and H-Q (Human-Qwen3-Coder).

(a) clarification rate

(b) successful instances
median number of turns for all successful instances for each configuration. For the reuse task, the human Programmer consistently takes two turns while model-based Programmers take one turn. For the repeat task, the human Programmer takes three turns compared to one turn for model-based Programmers, suggesting that human instructions require more interaction to complete successfully.
Although this is a pilot study and the number of test instances are limited, this evaluation suggests that the pipeline can be extended to human Programmers, and that the Cobot can retrieve and apply skills even when instructions are human-written rather than generated by another model.
6 CONCLUSION
In this work, we propose the Teach-Abstract-Apply (TAA) framework, which enables users to teach collaborative robots new spatial manipulation routines through multi-turn natural language dialogue. The framework defines a three-stage pipeline: Teach, where a user interacts with the robot and iteratively refines the workflows; Abstract, where the resulting interaction trace is abstracted into a generalised behavior (skill); and Apply, where the abstracted skills are applied in different settings. We then test the TAA framework through a collaborative structure-building task, in which a Programmer instructs the Cobot to reconstruct a goal board through dialogue, the resulting interaction is abstracted into a reusable Python skill function and these abstracted skills are applied to new scenarios through reuse and repeat tasks. Our evaluation using both open-weight (Qwen3-Coder) and closed (GPT5.2-Codex) models in self-play and cross-model configurations on the SARTCo dataset demonstrates that:
- Abstracted skills are model-agnostic and consistently improve task success rates while reducing interaction cost compared to the no-skill baseline.
Frontiers
Figure 11. Repeat Task: Clarification behavior across model configuration as a function of task complexity. (a) Number of clarification episodes increases with the number of elements, with Q-Q and H-Q showing stronger sensitivity compared to G-Q. (b) Median dialogue turns for successful instances remain relatively stable, with H-Q requiring consistently more turns, while G-Q maintains minimal interaction length across all settings. Model Configuration: Q-Q (Qwen3-Coder-Qwen3-Coder), G-Q (GPT5.2-Codex-Qwen3-Coder), and H-Q (Human-Qwen3-Coder).

(a) clarification rate

(b) successful instances
-
Skill retrieval rates are high across all configurations, with models demonstrating strong context-awareness in identifying and applying relevant skills.
-
Models tend to hallucinate skills that align with the task context, and these hallucinated skills achieve a 1.0 success rate, confirming that models correctly predict skill usage even when the exact skill is absent from the library.
-
The benefit of skill reuse varies by model capability, with smaller models benefiting more in terms of success rate improvement and larger models benefiting more in terms of cost reduction.
-
A preliminary human evaluation suggests that the pipeline also works with human instructions without requiring changes to the system.
These findings demonstrate the potential of combining dialogue-based teaching with program synthesis for scalable, reusable robot skill learning. Future work will focus on expanding the human evaluation to a more diverse participant pool, and evaluating the framework on diverse tasks and modalities. Additionally, incorporating safety mechanisms for real-world deployment and exploring the integration of TAA with a physical robot arm remain important directions for future work.
7 LIMITATIONS
Our proposed TAA framework demonstrates promising results for dialogue-based robot skill acquisition, but several limitations remain.
Physical Robot: Our proposed setup uses a virtual simulator in a controlled setting. As a design choice, we did not include the physical robot in the current setup, as perception, motion planning and low-level control may introduce additional failures (Kim et al., 2026) beyond these associated with TAA components.
Frontiers
We view this as a realistic starting point for evaluating the feasibility of TAA independently, with the potential to extend it to real-world settings involving a physical robot.
Evaluation of Skill Quality: The optimizer's correctness is currently judged by board state reproduction and structural metrics. While execution success confirms robustness and structural metrics assess minimality, the current evaluation does not assess higher-order properties such as skill composability beyond the reuse and repeat tasks.
Baselines: The primary comparison is against a no-skill baseline within the TAA framework. To our knowledge, no existing baseline combines dialogue-based teaching with persistent skill reuse, making direct comparison with prior work challenging.
Safety: The current framework operates in a controlled simulation environment. Scaling to real-world deployment would require additional safety mechanisms, such as ambiguity detection, formal verification of generated code, or constrained APIs with whitelisted operations, to mitigate risks associated with hallucinated skills or ambiguous instructions.
Dataset Scale: The experiments are conducted on the SARTCo dataset, which covers a specific grid-world environment. Evaluating TAA on larger and more diverse datasets with varied object types, spatial configurations, and task complexities would strengthen the generalizability of the findings.
Model Dependence: The results show that the benefit of skill reuse depends on the underlying model. Smaller open-weight models such as Qwen3-Coder benefit more in terms of success rate improvement, while larger closed models such as GPT5.2-Codex benefit more in terms of cost reduction. This suggests that the framework's effectiveness may vary with model capability.
Human Evaluation Scale: The human-in-the-loop evaluation was conducted as a pilot study with a single participant, limiting the statistical generalizability of the findings. A broader user study with a larger and more diverse participant pool, incorporating objective measures such as turns-to-success, clarification rates, and task completion time, remains an important direction for future work.
CONFLICT OF INTEREST STATEMENT
The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.
AUTHOR CONTRIBUTIONS
CK: coded the framework, analysed the results and wrote the original draft.; SH: contributed to the conceptualization and reviewed and edited parts of the paper. ; DS: conceived the idea, managed the project and reviewed and edited parts of the paper.
FUNDING
Kranti has been funded by the Bundesministerium für Bildung und Forschung (BMBF, German Federal Ministry of Research), project "COCOBOTS" (01IS21102A) and Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) grant 423217434 ("RECOLAGE"), Completion Scholarship from Department of Linguistics and the Gertrud-Feiertag-Stipendium from the University of Potsdam.
Frontiers
ACKNOWLEDGMENTS
This is a short text to acknowledge the contributions of specific colleagues, institutions, or agencies that aided the efforts of the authors.
SUPPLEMENTAL DATA
Supplementary Material should be uploaded separately on submission, if there are Supplementary Figures, please include the caption in the same file as the figure. LaTeX Supplementary Material templates can be found in the Frontiers LaTeX folder.
DATA AVAILABILITY STATEMENT
The data, framework implementation and other resources are available at: https://github.com/clp-research/cobotprogsynthesis-coderep.
REFERENCES
Aaltonen, I. and Salmi, T. (2019). Experiences and expectations of collaborative robots in industry and academia: barriers and development needs. Procedia Manufacturing 38, 1151–1158. doi:https://doi.org/10.1016/j.promfg.2020.01.204. 29th International Conference on Flexible Automation and Intelligent Manufacturing (FAIM 2019), June 24-28, 2019, Limerick, Ireland, Beyond Industry 4.0: Industrial Advances, Engineering Education and Intelligent Manufacturing
Ajaykumar, G., Steele, M., and Huang, C.-M. (2021a). A survey on end-user robot programming. ACM Comput. Surv. 54. doi:10.1145/3466819
Ajaykumar, G., Stiber, M., and Huang, C.-M. (2021b). Designing user-centric programming aids for kinesthetic teaching of collaborative robots. Robotics and Autonomous Systems 145, 103845. doi:https://doi.org/10.1016/j.robot.2021.103845
Akella, P., Peshkin, M. A., Colgate, J. E., Wannasuphoprasit, W., Nagesh, N., Wells, J., et al. (1999). Cobots for the automobile assembly line. In 1999 IEEE International Conference on Robotics and Automation, Marriott Hotel, Renaissance Center, Detroit, Michigan, USA, May 10-15, 1999, Proceedings (IEEE Robotics and Automation Society), 728–733. doi:10.1109/ROBOT.1999.770061
Akkaladevi, S. C., Pichler, A., Plasch, M., Ikeda, M., and Hofmann, M. (2019). Skill-based programming of complex robotic assembly tasks for industrial application. Elektrotech. Informationstechnik 136, 326–333. doi:10.1007/S00502-019-00741-4
Andersen, R. S., Madsen, O., Moeslund, T. B., and Amor, H. B. (2016). Projecting robot intentions into human environments. In 2016 25th IEEE International Symposium on Robot and Human Interactive Communication (RO-MAN). 294–301. doi:10.1109/ROMAN.2016.7745145
Austin, J., Odena, A., Nye, M. I., Bosma, M., Michalewski, H., Dohan, D., et al. (2021). Program synthesis with large language models. CoRR abs/2108.07732
Ayalew, T. W., Wang, J., Littman, M. L., Ur, B., and Sebo, S. (2025). Enabling end users to program robots using reinforcement learning. In 20th ACM/IEEE International Conference on Human-Robot Interaction, HRI 2025, Melbourne, Australia, March 4-6, 2025 (IEEE), 767–777. doi:10.1109/HRI61500.2025.10974035
Frontiers
Barravecchia, F., Mastrogiacomo, L., and Franceschini, F. (2023). A general cost model to assess the implementation of collaborative robots in assembly processes. The International Journal of Advanced Manufacturing Technology 125, 5247–5266
Bauer, W., Bender, M., Braun, M., Rally, P., and Scholtz, O. (2016). Lightweight robots in manual assembly—best to start simply. Fraunhofer Institute for Industrial Engineering and Organization IAO, Stuttgart 1
Beschi, S., Fogli, D., and Tampalini, F. (2019). Capirci: a multi-modal system for collaborative robot programming. In International symposium on end user development (Springer), 51–66
Biggs, G., MacDonald, B., et al. (2003). A survey of robot programming systems. In Proceedings of the Australasian conference on robotics and automation. vol. 1, 1–3
Bonial, C., Lukin, S. M., Abrams, M., Baker, A., Donatelli, L., Foots, A., et al. (2024). Human–robot dialogue annotation for multi-modal common ground: Human–robot dialogue annotation... Lang. Resour. Eval. 59, 1525–1575. doi:10.1007/s10579-024-09784-2
Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., and et al (2020). Language models are few-shot learners. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, eds. H. Larochelle, M. Ranzato, R. Hadsell, M. Balcan, and H. Lin
Chai, J. Y., Fang, R., Liu, C., and She, L. (2016). Collaborative language grounding toward situated human-robot dialogue. AI Magazine 37, 32–45. doi:https://doi.org/10.1609/aimag.v37i4.2684
Chai, J. Y., Gao, Q., She, L., Yang, S., Saba-Sadiya, S., and Xu, G. (2018). Language to action: towards interactive task learning with physical agents. In Proceedings of the 27th International Joint Conference on Artificial Intelligence (AAAI Press), IJCAI'18, 2–9
Chalamalasetti, K., Götze, J., Hakimov, S., Madureira, B., Sadler, P., and Schlangen, D. (2023). clembench: Using game play to evaluate chat-optimized language models as conversational agents. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, eds. H. Bouamor, J. Pino, and K. Bali (Singapore: Association for Computational Linguistics), 11174–11219. doi:10.18653/v1/2023.emnlp-main.689
Chen, M., Tworek, J., Jun, H., Yuan, Q., de Oliveira Pinto, H. P., Kaplan, J., et al. (2021). Evaluating large language models trained on code. CoRR abs/2107.03374
Chiyah-Garcia, J., Suglia, A., and Eshghi, A. (2024). Repairs in a block world: A new benchmark for handling user corrections with multi-modal language models. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, eds. Y. Al-Onaizan, M. Bansal, and Y.-N. Chen (Miami, Florida, USA: Association for Computational Linguistics), 11523–11542. doi:10.18653/v1/2024.emnlp-main.643
Colgate, J. E., Wannasuphoprasit, W., and Peshkin, M. A. (1996). Cobots: Robots for collaboration with human operators. In ASME international mechanical engineering congress and exposition (American Society of Mechanical Engineers), vol. 15281, 433–439
Cynthia, S. T. (2025). Identification and optimization of redundant code using large language models. In 2025 IEEE/ACM 4th International Conference on AI Engineering – Software Engineering for AI (CAIN). 261–263. doi:10.1109/CAIN66642.2025.00042
Cypher, A. and Halbert, D. C. (1993). Watch what I do: programming by demonstration (MIT press)
Désilets, A. (2001). Voicegrip: A tool for programming-by-voice. Int. J. Speech Technol. 4, 103–116. doi:10.1023/A%3A1011323308477
Frontiers
Dmytriyev, Y., Carnevale, M., Giberti, H., and Todeschini, G. (2022). On cobot programming in industrial tasks: a test case. In 2022 International Congress on Human-Computer Interaction, Optimization and Robotic Applications (HORA). 1–9. doi:10.1109/HORA55278.2022.9800018
Driess, D., Xia, F., Sajjadi, M. S. M., Lynch, C., Chowdhery, A., Ichter, B., et al. (2023). Palm-e: An embodied multimodal language model. In International Conference on Machine Learning, ICML 2023, 23-29 July 2023, Honolulu, Hawaii, USA, eds. A. Krause, E. Brunskill, K. Cho, B. Engelhardt, S. Sabato, and J. Scarlett (PMLR), vol. 202 of Proceedings of Machine Learning Research, 8469–8488
El Zaatari, S., Marei, M., Li, W., and Usman, Z. (2019). Cobot programming for collaborative industrial tasks: An overview. Robotics and Autonomous Systems 116, 162–180. doi:https://doi.org/10.1016/j.robot.2019.03.003
Estable, S., Ahms, I., Backhaus, H., El Zubi, O., and Muenstermann, R. (2002). Intuitive teaching and surveillance for production assistants. In Proceedings. 11th IEEE International Workshop on Robot and Human Interactive Communication. 474–481. doi:10.1109/ROMAN.2002.1045667
Fogli, D., Gargioni, L., Guida, G., and Tampalini, F. (2022). A hybrid approach to user-oriented programming of collaborative robots. Robotics and Computer-Integrated Manufacturing 73, 102234. doi:https://doi.org/10.1016/j.rcim.2021.102234
Foster, M. E., By, T., Rickert, M., and Knoll, A. (2006). Human-robot dialogue for joint construction tasks. In Proceedings of the 8th International Conference on Multimodal Interfaces (New York, NY, USA: Association for Computing Machinery), ICMI '06, 68–71. doi:10.1145/1180995.1181009
Fu, L., Yu, J., El-Refai, K., Kou, E., Xue, H., Huang, H., et al. (2026). CaP-x: A framework for benchmarking and improving coding agents for robot manipulation. In Proceedings of the 43rd International Conference on Machine Learning, eds. T. Zhang, M. Dudik, M. Jaggi, A. Agarwal, S. Li, D. Schuurmans, J. Zhu, F. Berkenkamp, H. Dong, and A. Bietti (PMLR), vol. 306 of Proceedings of Machine Learning Research, 32155–32212
Ge, Y., Dai, Y., Shan, R., Li, K., Hu, Y., and Sun, X. (2024). Cocobo: Exploring large language models as the engine for end-user robot programming. In 2024 IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC), Liverpool, UK, September 2-6, 2024 (IEEE), 89–95. doi:10.1109/VL/HCC60511.2024.00020
George, P., Cheng, C.-T., Pang, T. Y., and Neville, K. (2023). Task complexity and the skills dilemma in the programming and control of collaborative robots for manufacturing. Applied Sciences 13, 4635
Giberti, H., Abbattista, T., Carnevale, M., Giagu, L., and Cristini, F. (2022). A methodology for flexible implementation of collaborative robots in smart manufacturing systems. Robotics 11. doi:10.3390/robotics11010009
Gorostiza, J. F. and Salichs, M. A. (2011). End-user programming of a social robot by dialog. Robotics and Autonomous Systems 59, 1102–1114. doi:https://doi.org/10.1016/j.robot.2011.07.009
Heidorn, G. E. (1976). Automatic programming through natural language dialogue: A survey. IBM Journal of Research and Development 20, 302–313. doi:10.1147/rd.204.0302
Hou, X., Zhao, Y., Liu, Y., Yang, Z., Wang, K., Li, L., et al. (2024). Large language models for software engineering: A systematic literature review. ACM Trans. Softw. Eng. Methodol. 33, 220:1–220:79. doi:10.1145/3695988
Hu, J., Martin-Martin, R., Stone, P., Duan, R., Jiang, Z., and Shi, G. (2026). Simex: Simulation-integrated robotics autoresearch. arXiv preprint arXiv:2609.38982
Hu, Z., Li, J. J., Guha, A., and Biswas, J. (2024). Robo-instruct: Simulator-augmented instruction alignment for finetuning codellms. CoRR abs/2405.20179. doi:10.48550/ARXIV.2405.20179
Frontiers
Huang, W., Abbeel, P., Pathak, D., and Mordatch, I. (2022). Language models as zero-shot planners: Extracting actionable knowledge for embodied agents. In International Conference on Machine Learning, ICML 2022, 17-23 July 2022, Baltimore, Maryland, USA, eds. K. Chaudhuri, S. Jegelka, L. Song, C. Szepesvári, G. Niu, and S. Sabato (PMLR), vol. 162 of Proceedings of Machine Learning Research, 9118–9147
Ichter, B., Brohan, A., Chebotar, Y., Finn, C., Hausman, K., Herzog, A., et al. (2022). Do as I can, not as I say: Grounding language in robotic affordances. In Conference on Robot Learning, CoRL 2022, 14-18 December 2022, Auckland, New Zealand, eds. K. Liu, D. Kulic, and J. Ichnowski (PMLR), vol. 205 of Proceedings of Machine Learning Research, 287–318
Ionescu, T. B. and Schlund, S. (2023). Programming cobots by voice: a pragmatic, web-based approach. International Journal of Computer Integrated Manufacturing 36, 86–109
Kane, B., Gervits, F., Scheutz, M., and Marge, M. (2022). A system for robot concept learning through situated dialogue. In Proceedings of the 23rd Annual Meeting of the Special Interest Group on Discourse and Dialogue, eds. O. Lemon, D. Hakkani-Tur, J. J. Li, A. Ashrafzadeh, D. H. Garcia, M. Alikhani, D. Vandyke, and O. Dušek (Edinburgh, UK: Association for Computational Linguistics), 659–662. doi:10.18653/v1/2022.sigdial-1.64
Karli, U. B., Chen, J.-T., Antony, V. N., and Huang, C.-M. (2024). Alchemist: Llm-aided end-user development of robot applications. In Proceedings of the 2024 ACM/IEEE International Conference on Human-Robot Interaction (New York, NY, USA: Association for Computing Machinery), HRI '24, 361–370. doi:10.1145/3610977.3634969
Kazi, T., Lyu, R., Zhou, S., Hakkani-Tür, D., and Tur, G. (2024). Large language models as user-agents for evaluating task-oriented-dialogue systems. In IEEE Spoken Language Technology Workshop, SLT 2024, Macao, December 2-5, 2024 (IEEE), 913–920. doi:10.1109/SLT61566.2024.10832298
Khattab, O., Singhvi, A., Maheshwari, P., Zhang, Z., Santhanam, K., Vardhamanan, S., et al. (2023). Dspy: Compiling declarative language model calls into self-improving pipelines. CoRR abs/2310.03714. doi:10.48550/ARXIV.2310.03714
Kim, C. Y., Lee, C. P., and Mutlu, B. (2024). Understanding large-language model (llm)-powered human-robot interaction. In Proceedings of the 2024 ACM/IEEE International Conference on Human-Robot Interaction, HRI 2024, Boulder, CO, USA, March 11-15, 2024, eds. D. Grollman, E. Broadbent, W. Ju, H. Soh, and T. Williams (ACM), 371–380. doi:10.1145/3610977.3634966
Kim, C. Y., White, N. T., He, E., Sala, F., and Mutlu, B. (2026). Robocritics: Enabling reliable end-to-end llm robot programming through expert-informed critics (New York, NY, USA: Association for Computing Machinery), HRI '26, 914–923. doi:10.1145/3757279.3785550
Konidaris, G. D., Kuindersma, S., Gruppen, R. A., and Barto, A. G. (2012). Robot learning from demonstration by constructing skill trees. Int. J. Robotics Res. 31, 360–375. doi:10.1177/0278364911428653
Kranti, C., Hakimov, S., and Schlangen, D. (2024). Towards no-code programming of cobots: Experiments with code synthesis by large code models for conversational programming. arXiv preprint arXiv:2409.11041
Kranti, C., Hakimov, S., and Schlangen, D. (2025). clem:todd: A framework for the systematic benchmarking of LLM-based task-oriented dialogue system realisations. In Proceedings of the 26th Annual Meeting of the Special Interest Group on Discourse and Dialogue, eds. F. Béchet, F. Lefèvre, N. Asher, S. Kim, and T. Merlin (Avignon, France: Association for Computational Linguistics), 62–92
Frontiers
Kuhail, M. A., Farooq, S., Hammad, R., and Bahja, M. (2021). Characterizing visual programming approaches for end-user developers: A systematic review. IEEE Access 9, 14181–14202. doi:10.1109/ACCESS.2021.3051043
Lai, Y., Yuan, S., Li, P., Zhang, B., Kiefer, B., Deng, T., et al. (2026). Fam-hri: Foundation-model assisted multimodal human–robot interaction combining gaze and speech. IEEE Transactions on Automation Science and Engineering 23, 10521–10534. doi:10.1109/TASE.2026.3695438
Lauria, S., Bugmann, G., Kyriacou, T., and Klein, E. (2002). Mobile robot programming using natural language. Robotics Auton. Syst. 38, 171–181. doi:10.1016/S0921-8890(02)00166-5
Leggett, J. and Williams, G. (1984). An empirical investigation of voice as an input modality for computer programming. International Journal of Man-Machine Studies 21, 493–520. doi:https://doi.org/10.1016/S0020-7373(84)80057-7
Liang, J., Huang, W., Xia, F., Xu, P., Hausman, K., Ichter, B., et al. (2023). Code as policies: Language model programs for embodied control. In IEEE International Conference on Robotics and Automation, ICRA 2023, London, UK, May 29 - June 2, 2023 (IEEE), 9493–9500. doi:10.1109/ICRA48891.2023.10160591
Lioutikov, R., Neumann, G., Maeda, G., and Peters, J. (2017). Learning movement primitive libraries through probabilistic segmentation. Int. J. Robotics Res. 36, 879–894. doi:10.1177/0278364917713116
Liu, P., Yuan, W., Fu, J., Jiang, Z., Hayashi, H., and Neubig, G. (2023). Pre-train, prompt, and predict: A systematic survey of prompting methods in natural language processing. ACM Comput. Surv. 55, 195:1–195:35. doi:10.1145/3560815
Lozano-Perez, T. (1983). Robot programming. Proceedings of the IEEE 71, 821–841. doi:10.1109/PROC.1983.12681
Lu, R., Wu, Y., Kou, E., Fu, L., Xiao, W., Mandlekar, A., et al. (2026). ASPIRE: agentic /skills discovery for robotics. CoRR abs/2607.00272. doi:10.48550/ARXIV.2607.00272
Macaluso, A., Cote, N., and Chitta, S. (2024). Toward automated programming for robotic assembly using chatgpt. In IEEE International Conference on Robotics and Automation, ICRA 2024, Yokohama, Japan, May 13-17, 2024 (IEEE), 17687–17693. doi:10.1109/ICRA57147.2024.10610554
Mu, Y., Chen, J., Zhang, Q.-L., Chen, S., Yu, Q., Ge, C., et al. (2024). RoboCodeX: Multimodal code generation for robotic behavior synthesis. In Proceedings of the 41st International Conference on Machine Learning, eds. R. Salakhutdinov, Z. Kolter, K. Heller, A. Weller, N. Oliver, J. Scarlett, and F. Berkenkamp (PMLR), vol. 235 of Proceedings of Machine Learning Research, 36434–36454
Nijkamp, E., Pang, B., Hayashi, H., Tu, L., Wang, H., Zhou, Y., et al. (2023). Codegen: An open large language model for code with multi-turn program synthesis. In The Eleventh International Conference on Learning Representations, ICLR 2023, Kigali, Rwanda, May 1-5, 2023 (OpenReview.net)
Padmakumar, A., Thomason, J., Shrivastava, A., Lange, P., Narayan-Chen, A., Gella, S., et al. (2022). Teach: Task-driven embodied agents that chat. In Thirty-Sixth AAAI Conference on Artificial Intelligence, AAAI 2022, Thirty-Fourth Conference on Innovative Applications of Artificial Intelligence, IAAI 2022, The Twelfth Symposium on Educational Advances in Artificial Intelligence, EAAI 2022 Virtual Event, February 22 - March 1, 2022 (AAAI Press), 2017–2025. doi:10.1609/AAAI.V36I2.20097
Rahit, K. M. T. H., Nabil, R. H., and Huq, M. H. (2019). Machine translation from natural language to code using long-short term memory. CoRR abs/1910.11471
[Dataset] Robots, U. (2024). Why cobots? all the benefits of collaborative robots
Rodríguez-Guerra, D., Sorrosal, G., Cabanes, I., and Calleja, C. (2021). Human-robot interaction review: Challenges and solutions for modern industrial environments. IEEE Access 9, 108557–108578. doi:10.1109/ACCESS.2021.3099287
Frontiers
Rosen, E., Whitney, D., Phillips, E., Chien, G., Tompkin, J., Konidaris, G., et al. (2020). Communicating robot arm motion intent through mixed reality head-mounted displays. In Robotics Research, eds. N. M. Amato, G. Hager, S. Thomas, and M. Torres-Torriti (Cham: Springer International Publishing), 301–316
Rüßmann, M., Lorenz, M., Gerbert, P., Waldner, M., Justus, J., Engel, P., et al. (2015). Industry 4.0: The future of productivity and growth in manufacturing industries. Boston consulting group 9, 54–89
Schoen, A., White, N., Henrichs, C., Siebert-Evenstone, A., Shaffer, D., and Mutlu, B. (2022). Coframe: A system for training novice cobot programmers. In 2022 17th ACM/IEEE International Conference on Human-Robot Interaction (HRI). 185–194. doi:10.1109/HRI53351.2022.9889345
Segura, P., Lobato-Calleros, O., Soria-Arguello, I., and Hernández-Martínez, E. G. (2025). Work roles in human–robot collaborative systems: Effects on cognitive ergonomics for the manufacturing industry. Applied Sciences 15, 744
Singh, I., Blukis, V., Mousavian, A., Goyal, A., Xu, D., Tremblay, J., et al. (2023). Progprompt: Generating situated robot task plans using large language models. In IEEE International Conference on Robotics and Automation, ICRA 2023, London, UK, May 29 - June 2, 2023 (IEEE), 11523–11530. doi:10.1109/ICRA48891.2023.10161317
Stopp, A., Horstmann, S., Kristensen, S., and Lohnert, F. (2001). Towards interactive learning for manufacturing assistants. In Proceedings 10th IEEE International Workshop on Robot and Human Interactive Communication. ROMAN 2001 (Cat. No.01TH8591). 338–342. doi:10.1109/ROMAN.2001.981926
Sullivan, D., White, N. T., Schoen, A., and Mutlu, B. (2024). Making informed decisions: Supporting cobot integration considering business and worker preferences. In Proceedings of the 2024 ACM/IEEE International Conference on Human-Robot Interaction (New York, NY, USA: Association for Computing Machinery), HRI '24, 706–714. doi:10.1145/3610977.3634937
Tapia, E., Lopez-Novoa, U., Sastoque-Pinilla, L., and López-de Lacalle, L. N. (2025). An evaluation of large language models for code optimization. In 2025 10th International Conference on Smart and Sustainable Technologies (SpliTech). 1–5. doi:10.23919/SpliTech65624.2025.11091799
Thomason, J., Padmakumar, A., Sinapov, J., Walker, N., Jiang, Y., Yedidision, H., et al. (2019). Improving grounded natural language understanding through human-robot dialog. In 2019 International Conference on Robotics and Automation (ICRA) (IEEE Press), 6934–6941. doi:10.1109/ICRA.2019.8794287
Töberg, J. and Cimiano, P. (2023). Generation of robot manipulation plans using generative large language models. In Seventh IEEE International Conference on Robotic Computing, IRC 2023, Laguna Hills, CA, USA, December 11-13, 2023 (IEEE), 190–197. doi:10.1109/IRC59093.2023.00039
Tsarouchi, P., Makris, S., and Chryssolouris, G. (2016). Human–robot interaction review and challenges on task planning and programming. International Journal of Computer Integrated Manufacturing 29, 916–931
Tziafas, G. and Kasaei, H. (2024). Lifelong robot library learning: Bootstrapping composable and generalizable skills for embodied control with language models. In IEEE International Conference on Robotics and Automation, ICRA 2024, Yokohama, Japan, May 13-17, 2024 (IEEE), 515–522. doi:10.1109/ICRA57147.2024.10611448
Villani, V., Pini, F., Leali, F., and Secchi, C. (2018). Survey on human–robot collaboration in industrial settings: Safety, intuitive interfaces and applications. Mechatronics 55, 248–266. doi:https://doi.org/10.1016/j.mechatronics.2018.02.009
Wang, G., Xie, Y., Jiang, Y., Mandlekar, A., Xiao, C., Zhu, Y., et al. (2024). Voyager: An open-ended embodied agent with large language models. Trans. Mach. Learn. Res. 2024
Frontiers
Wannasuphoprasit, W., Gillespie, R., Colgate, J., and Peshkin, M. (1997). Cobot control. In Proceedings of International Conference on Robotics and Automation. vol. 4, 3571–3576 vol.4. doi:10.1109/ROBOT.1997.606888
Wei, J., Wang, X., Schuurmans, D., Bosma, M., Ichter, B., Xia, F., et al. (2022). Chain-of-thought prompting elicits reasoning in large language models. In Advances in Neural Information Processing Systems 35: Annual Conference on Neural Information Processing Systems 2022, NeurIPS 2022, New Orleans, LA, USA, November 28 - December 9, 2022, eds. S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh
White, N. T. and Mutlu, B. (2024). End user interfaces for human-robot collaboration. In Companion of the 2024 ACM/IEEE International Conference on Human-Robot Interaction, HRI 2024, Boulder, CO, USA, March 11-15, 2024, eds. D. Grollman, E. Broadbent, W. Ju, H. Soh, and T. Williams (ACM), 157–159. doi:10.1145/3610978.3638362
Xu, L. D., Xu, E. L., and Li, L. (2018). Industry 4.0: state of the art and future trends. International journal of production research 56, 2941–2962
Yang, C., Wang, X., Lu, Y., Liu, H., Le, Q. V., Zhou, D., et al. (2023). Large language models as optimizers. CoRR abs/2309.03409. doi:10.48550/ARXIV.2309.03409
Zhang, C., Chen, J., Li, J., Peng, Y., and Mao, Z. (2023). Large language models for human–robot interaction: A review. Biomimetic Intelligence and Robotics 3, 100131. doi:https://doi.org/10.1016/j.birob.2023.100131
Frontiers
8 APPENDIX
8.1 Interaction Framework
As mentioned in Section 3.3 of the main content, the TAA interaction framework follows the clem:todd (Kranti et al., 2025) player interaction. The Game Master orchestrates the interaction between both players: the Programmer and the Cobot. Both players are text-based LLMs. In self-play, the same LLM plays the roles of both the Programmer and the Robot, while in cross-play, different models are used as the Programmer and the Robot. While the Programmer is instructed to respond with the follow-up instruction in string format, the Robot is instructed to respond with a JSON object containing the keys status and details. The status can have the values code, clarification, or acknowledgement. The details will vary depending on the status. If the status is code, the details will contain executable code, or a string if it is clarification or acknowledgement. The Game Master receives the information from each player, strips off the anchors, and routes the response to the next step. In the case of a Robot response, it also validates whether the expected structure is followed, i.e., whether the status and details keys exist and hold only the expected values. If the status is code, the Game Master passes the player-generated code to the virtual simulator for execution, and if it is clarification or acknowledgement, it passes the response to the Programmer. If there are any errors in the code execution, the error feedback is passed to the Robot. The Robot may either correct the code or chose to ask for clarification from the Programmer if there are any ambiguities.
8.1.1 Virtual Simulator
The virtual simulator is used to execute the Robot-generated code to update the placement of components in the grid-based environment. As mentioned in Section 3 of the main content, the grid-based environment uses a 2.5D grid of size 8x8, where each grid cell allows component placement and stacking. If the code execution is successful, the resultant world is returned with cell-by-cell stacking details to the Game Master, which are then added to the Programmer's prompt in the next turn. If there are failures during execution, the error information is passed to the Robot for further processing.
8.2 Prompt Structure
We follow the standard (Brown et al., 2020; Wei et al., 2022; Liu et al., 2023) prompting approaches to structure our Programmer and Cobot prompts. Both players are prompted in zero-shot settings. Each prompt consists of a system message, task description, environment information along with the constraints, followed by the expected response structure and the dialogue history up to that turn. Additionally, Programmer's prompt consists the difference board (i.e., the cell-level differences between the goal board and the Robot's reconstructed board) which can guide the Programmer in generating the follow-up instruction. In order to ensure consistent boundaries for the model inputs and outputs, we added response anchors (inspired by DSPy (Khattab et al., 2023)) [[ ## prompt ## ]] and [[ ## completed ## ]] at the beginning and end of each prompt. The interaction will be aborted if any of the players' responses do not follow the response constraints and will continue until the Programmer responds with DONE or the maximum number of turns (15) is reached. More details about the prompt ablation studies are available in the supplementary material.
8.3 Prompt Ablation Studies
We conducted multiple experiments to refine the prompt templates and response constraints. We began by varying the number of turns required for the interaction from 1 to 20 and, based on the results (see Table 5), fixed it at 15 turns. We then continued the ablations for the number of optimization turns and retry turns
Frontiers and chose 10 and 3, respectively, based on the results (see Tables 6 and 7). The next set of ablations focused on the necessity of including the difference grid, error feedback, and clarification questions. Table 8 shows that the success rate decreased when these were not included in the prompt, and hence we retained them in the final prompt structure. Figures 12-to-30 shows the prompt structure used across the experiments for both the players.
Table 5. Overview of ablation results for the optimal number of turns required for the player interaction; A higher success rate indicates better performance.
| Ablations | Abort Rate | Failure Rate | Success Rate |
|---|---|---|---|
| 0.013 | 0.642 | 0.345 | |
| 0.006 | 0.558 | 0.436 | |
| 0.006 | 0.448 | 0.545 | |
| 0.012 | 0.424 | 0.564 | |
| 0.0 | 0.382 | 0.618 | |
| 0.0 | 0.380 | 0.620 |
Table 6. Overview of ablation results for the optimal number of turns required for the abstraction; A higher success rate indicates better performance.
| Ablations | Abort Rate | Failure Rate | Success Rate |
|---|---|---|---|
| 0.006 | 0.552 | 0.442 | |
| 0.018 | 0.352 | 0.630 | |
| 0.000 | 0.376 | 0.624 |
Table 7. Overview of ablation results for the optimal number of turns required for the Robot to retry in case of execution errors; A higher success rate indicates better performance.
| Ablations | Abort Rate | Failure Rate | Success Rate |
|---|---|---|---|
| 0.182 | 0.224 | 0.594 | |
| 0.039 | 0.276 | 0.685 | |
| 0.000 | 0.309 | 0.691 |
Table 8. Overview of ablation results for including various types of feedback in the interaction; A higher success rate indicates better performance.
| Ablations | Abort Rate | Failure Rate | Success Rate |
|---|---|---|---|
| No difference grid | 0.182 | 0.224 | 0.594 |
| No error feedback | 0.594 | 0.055 | 0.352 |
| No clarification questions | 0.455 | 0.097 | 0.448 |
Frontiers
Figure 12. Part-1 of prompt template used for the Programmer in the Teach step.
TEMPLATE 8.3.1
Your input fields are:
1. `prompt` (str): Prompt with grid_size, skillname, goal grid, difference_grid
Your output fields are:
1. `instruction` (str): Natural-language instruction for the robot
All interactions will be structured in the following way, with the appropriate values filled in.
[[" ## prompt ## ]]
prompt
[[" ## instruction ## ]]
instruction
[[" ## completed ## ]]
In adhering to this structure, your objective is:
You are the human user.
Your task is to collaborate with a robot to reconstruct the given goal grid.
Preferred Instruction Style:
* Describe shapes, regions, and patterns.
* Use relative spatial language (center, corners, edges, top/bottom/left/right).
* Use symmetry, repetition, and grouping where possible.
* Describe what the grid should look like, and how to reconstruct it
Communication Strategy:
* Focus on completing one meaningful pattern or region at a time.
* Assume the follower understands shapes and patterns.
Stacking constraints:
* Instructions must respect stacking dependencies.
* Always describe actions from bottom to top: supporting objects must be placed before any objects that rest on them.
* Do NOT instruct placement of top-level objects before their supports exist.
* Violating this order may lead to incorrect reconstruction.
Rules:
* Use the difference_grid to identify which high-level patterns or regions are incomplete.
* If a region or pattern is already correct, do not mention it.
* Generates the instructions to build incorrect or missing elements.
* If clarification input is non-empty, address it directly and clearly.
* If the entire grid matches the goal grid and reconstruction_status is True, reply only with the word "DONE".
* Otherwise, generate instructions that advances the reconstruction
* Always output either an instruction or "DONE" | nothing else.
Frontiers
Figure 13. Part-2 of prompt template used for the Programmer in the Teach step.
TEMPLATE 8.3.2
Examples: "Create a vertical stack with a red washer below a blue screw." "Attach a yellow nut to the right side of green horizontal bridge." "Mirror the structure on the left side onto the right side." "First place the nut, then place screw on top of it."
Inputs:
- prompt: Prompt with the following details:
- grid_size: The grid is of size grid_size.
- goal_grid: The goal configuration of the grid
- difference_grid: The difference between the grid filled by the robot and goal grid
- clarification: Optional question received from the robot; may be empty.
- acknowledgment: Optional message received from the robot; may be empty.
- reconstruction_status: True if the current grid matches the goal grid, False otherwise.
Respond with the corresponding output fields, starting with the field [[ ## instruction ## ]], and then ending with the marker for [[ ## completed ## ]].
Figure 14. An example goal board representation.
TEMPLATE 8.3.3
Grid size: 8x8 Object name: wn Colors: ['red', 'green'] Location: [3, 1]
Goal: Grid levels (bottom to top): Level 1: row: 3, col: 1: 'shapes': ['washer'], 'colors': ['red'] Level 2: row: 3, col: 1: 'shapes': ['nut'], 'colors': ['green']
Frontiers
Figure 15. An example difference board representation.
TEMPLATE 8.3.4
Goal:Grid levels (bottom to top): Level 1: row: 3, col: 1: 'shapes': ['washer'], 'colors': ['red'] Level 2: row: 3, col: 1: 'shapes': ['nut'], 'colors': ['green']
Difference grid: Differences between target grid and player's grid (bottom to top): Level 1:
- Expected: 'shapes': ['washer'], 'colors': ['red']
- Current Status: 'shapes': ['screw'], 'colors': ['red'] Level 2: row: 1, col: 3:
- Missing: 'shapes': ['nut'], 'colors': ['green']
Frontiers
Figure 16. Part-1 of prompt template used for the Robot in the Teach step.
TEMPLATE 8.3.5
Your input fields are:
prompt(str): Prompt with Instruction from User and current grid state
Your output fields are:
player_response(str): A JSON object with keys 'status' and 'details' as described above
All interactions will be structured in the following way, with the appropriate values filled in. [### prompt ## ] prompt [### player_response ## ] player_response [### completed ## ]
In adhering to this structure, your objective is: You are the robot (the instruction follower) in a collaborative grid-filling game.
Interpretation Mode:
- Instructions may describe patterns, regions, relationships, or rules rather than exact cells.
- Ground high-level instructions using shared spatial and stacking conventions.
Spatial Conventions:
- "to the right of X" = horizontally adjacent in the same row
- "to the left of X" = horizontally adjacent in the same row
- "above X" / "below X" = vertically adjacent in the same column
- "stacked on X" = same cell, higher level
- "attached to X" = adjacent, not stacked
- If a spatial relation is unclear, ask for clarification.
Ordering Constraints (MANDATORY): • Actions must respect stacking dependencies.
- Always place supporting (lower-level) shapes before shapes that rest on them.
- Never place a top-level shape before its support exists.
- If an instruction implies an invalid order, ask for the clarification
- Assume instructions are executed immediately; do not anticipate future steps.
Examples: Instruction: "Place screws on top of washers"
Correct: First place washers, then place screws on top of them
InCorrect (order violation): screws placed before washers exist
Frontiers
Figure 17. Part-2 of prompt template used for the Robot in the Teach step.
TEMPLATE 8.3.6
Input Instruction Examples: You receive an instruction such as: "Place a washer with a nut stacked on top." or "Attach a yellow nut to the right of each green horizontal bridge." • If coordinates are explicitly given, use them directly. • If instructions are high-level (patterns, regions, relations), infer coordinates using the current grid state and shared spatial conventions. • If inference is ambiguous, request clarification instead of guessing.
Clarification policy: • If an instruction is underspecified (location, count, or relation unclear) or ambiguous, respond with status="clarification" before executing. • Do NOT invent coordinates, colors, types or quantities. • Request clarification only when the required information is not recoverable from the current grid state or prior instructions. • If an instruction contradicts stacking or physical constraints, request clarification instead of repairing it.
Examples: Instruction: "Place screw under the nut" Correct: Ask for clarification because the instruction violates stacking order. Example clarification: "Placing a screw under a nut would require placing the nut first, which violates the bottom-to-top rule. Did you intend the screw to be stacked on top of the nut?" InCorrect (order violation): DO NOT DO THIS Placing the nut first and then stacking a screw under it Silently reversing the order without asking
Instruction: "Stack a horizontal bridge" Correct: If the current grid does NOT satisfy the depth requirements for placing a horizontal bridge at the intended span, ask for clarification. Example clarification: "I don't see any span where the depth requirements for a horizontal bridge are met. Can you clarify the intended placement?" InCorrect (depth violation): DO NOT DO THIS Choosing a random shape to stack the bridge on Assuming default depth support and placing the bridge
Frontiers
Figure 18. Part-3 of prompt template used for the Robot in the Teach step.
TEMPLATE 8.3.7 Available APIs:
- put(board: np.ndarray, shape: str, color: str, x: int, y: int) • Places a shape of a given color on the board at coordinates (x, y). • Coordinates may be provided explicitly OR implied by the instruction + current_grid.
- If the instruction explicitly specifies row/column/cell indices, use them directly.
- If the instruction specifies a relative location (e.g., "to the right of X", "above X", "in the top-left corner", "center", "top row", "leftmost column"), infer (x, y) from instruction and current_grid using the spatial conventions.
- If multiple (x, y) satisfy the instruction or the intended location is unclear, DO NOT guess. Ask for clarification.
• Examples of inference:
- "to the right of the green washer at (r,c)" → (x,y) = (r, c+1)
- "top-left corner" → (x,y) = (1,1)
- "top row, third cell" → infer as (x=top_row (1), y=3)
- "bottom-right corner" → (x,y) = (8,8)
- move(board: np.ndarray, x1: int, y1: int, x2: int, y2:int, shapes_list: List = None) • To move a shape (or stack of shapes) from coordinates (x1, y1) to coordinates (x2, y2) on the board • Coordinates may be provided explicitly OR implied by the instruction + current_grid.
- If the instruction explicitly specifies row/column/cell indices, use them directly.
- If the instruction specifies a relative location (e.g., "to the right of X", "above X", "in the top-left corner", "center", "top row", "leftmost column"), infer (x, y) from instruction and current_grid using the spatial conventions.
- If multiple (x, y) satisfy the instruction or the intended location is unclear, DO NOT guess. Ask for clarification.
• Examples of inference:
- "to the right of the green washer at (r,c)" → (x,y) = (r, c+1)
- "top-left corner" → (x,y) = (1,1)
- "top row, third cell" → infer as (x=top_row (1), y=3)
- "bottom-right corner" → (x,y) = (8,8) • Do not use same coordinates for source and destination • Do not use this function to remove shapes from the board, use removeshape instead • Use x1, y1 as source coordinates and x2, y2 as destination coordinates • Use x1, y1, x2 and y2 do not use same names for source and destination • x1, x2: Row values • y1, y2: Column values • Examples: move it from 1st column to last column in the 5th row then x1=5, y1=1, x2=5, y2=8 move it from 3rd to next row, then x1=3, x2=4 move it from 7th column to 8th column, then y1=7, y2=8 move it to 8th column, then y2=8 • shape_list: (List, optional): List of shapes from bottom → top to move. If None, only the topmost shape in the stack is moved.
Frontiers
Figure 19. Part-4 of prompt template used for the Robot in the Teach step.
TEMPLATE 8.3.8
- removeshape(board: np.ndarray, x: int, y: int, shape, color)
• To remove a shape from coordinates (x1, y1) on the board
• Coordinates may be provided explicitly OR implied by the instruction + current_grid.
- If the instruction explicitly specifies row/column/cell indices, use them directly.
- If the instruction specifies a relative location (e.g., "to the right of X", "above X", "in the top-left corner", "center", "top row", "leftmost column"), infer (x, y) from instruction and current_grid using the spatial conventions.
- If multiple (x, y) satisfy the instruction or the intended location is unclear, DO NOT guess. Ask for clarification.
• Examples of inference:
- "to the right of the green washer at (r,c)" → (x,y) = (r, c+1)
- "top-left corner" → (x,y) = (1,1)
- "top row, third cell" → infer as (x=top_row (1), y=3)
- "bottom-right corner" → (x,y) = (8,8)
• Do not use this function to move shapes, use move instead
• Use this function only when there is a placement error. If a shape already exists in the target cell, ask whether it should be removed before placing a new one. In most cases, you will be stacking a new shape in the same cell, which doesn't require removeShape(); just call put() for the new shape.
• The shape and color must match the topmost shape in the stack at (x, y)
• x: Row (If the human says "row = 3", then use x = 3)
• y: Column (If the human says "column = 1", then use y = 1)
• If human says remove it from 6th row, then x=6
• If human says remove it from 1st column, then y=1
• shape_list: (List, optional): List of shapes from bottom → top to move. If None, only the topmost shape in the stack is moved.
- clear(board: np.ndarray)
• To clear all the shapes on the board
- undo(board: np.ndarray)
• To undo last placement action(s) on the board
• If multiple shapes were placed as part of the previous operation, all of them will be cleared from the board.
You receive an instruction such as: "Place a washer and nut (green and blue) in cell (1, 8)."
--- AVAILABLE SHAPES
- washer
- nut
- screw
- bridge (vertical, horizontal) ← special shape
• Use **'bridge-h'** for horizontal bridges and **'bridge-v'** for vertical ones.
Frontiers
Figure 20. Part-5 of prompt template used for the Robot in the Teach step.
TEMPLATE 8.3.9
AVAILABLE COLORS
- green
- red
- blue
- yellow
SHAPE OCCUPANCY
- All shapes occupy exactly one cell, except the "bridge".
- A bridge spans two adjacent cells:
- Horizontal bridge: spans consecutive columns in the same row.
- Vertical bridge: spans consecutive rows in the same column.
- A bridge requires two other shapes underneath it (referred as depth) for support while stacking, one under each end of the bridge.
BRIDGE REPRESENTATION RULES
-
Bridges span two cells and appear in the target grid as:
-
bridge-v-top / bridge-v-bottom → one vertical bridge
-
bridge-h-left / bridge-h-right → one horizontal bridge
-
'bridge-h-left' and 'bridge-h-right' are display labels representing the two halves of a single horizontal bridge (bridge-h). A horizontal bridge always occupies two adjacent cells in the same row. When generating code or interpreting grid, always refer to the shape as bridge-h, not the left/right variants.
-
Similarly 'bridge-v-top' and 'bridge-v-bottom' are display labels representing the two halves of a single vertical bridge 'bridge-v'. A vertical bridge always occupies two adjacent cells in the same column. When generating code or interpreting grid, always refer to the shape as bridge-v, not the top/bottom variants.
-
Example: Instruction: Place a green horizontal bridge at the bottom left corner → Code: put(board, 'bridge-h', 'green', 8, 1) → Current-Grid would become: Grid levels (bottom to top): Level 1: row: 8, col: 1: 'shapes': ['bridge-h-left'], 'colors': ['green'] row: 8, col: 2: 'shapes': ['bridge-h-right'], 'colors': ['green'] → To remove this shape: removeshape(board, x=8, y=1, shape='bridge-h', color='green') Instruction: Stack a blue vertical bridge at (2,8) → Code: put(board, 'bridge-v', 'blue', 2, 8) → Current-Grid would become: Grid levels (bottom to top): Level 1: row: 2, col: 8: 'shapes': ['bridge-v-top'], 'colors': ['blue'] row: 3, col: 8: 'shapes': ['bridge-v-bottom'], 'colors': ['blue'] → To remove this shape: removeshape(board, x=2, y=8, shape='bridge-v', color='blue')
Frontiers
Figure 21. Part-6 of prompt template used for the Robot in the Teach step.
TEMPLATE 8.3.10
STACKING & DEPTH RULES • Shapes can be stacked vertically within the same cell. • Stacking is only allowed if all shapes share the same depth.. • Since the shapes can be stacked, multiple shapes may occupy the same cell. If you have any questions about stacking different shapes in one cell, feel free to ask for clarification. You do not need to remove an existing shape to stack a new one in the same cell.
Example: Instruction: Place a red washer in top left corner Correct: put (board, shape='washer', color='red', x=1, y=1)
Instruction: Stack a green nut in top left corner Correct: put (board, shape='nut', color='green', x=1, y=1) Incorrect: put (board, shape='washer', color='red', x=1, y=1) removeshape(board, x=1, y=1, shape='washer', color='red') put (board, shape='nut', color='green', x=1, y=1)
Instruction: Place a blue horizontal bridge in the middle of the grid Correct: put (board, shape='bridge-h', color='blue', x=4, y=4)
Instruction: Stack the bridge with a yellow screw on the left Correct: put (board, shape='screw', color='yellow', x=4, y=4) Incorrect: put (board, shape='bridge-h', color='blue', x=4, y=4) removeshape(board, x=4, y=4, shape='bridge-h', color='blue') put (board, shape='screw', color='yellow', x=4, y=4)
Instruction: Place a yellow vertical bridge in bottom right corner Correct: put (board, shape='bridge-v', color='yellow', x=7, y=8)
Instruction: Stack a green washer in the bottom Correct: put (board, shape='washer', color='green', x=8, y=8) Incorrect: put (board, shape='bridge-v', color='yellow', x=7, y=8) removeshape(board, x=7, y=8, shape='bridge-v', color='yellow') put (board, shape='washer', color='green', x=8, y=8)
• When multiple shapes are placed in a single cell:
- The first mentioned shape is placed at the bottom..
- Later shapes stack on top.. • Do not stack same shapes in the same cell. Example:
Correct: put (board, shape='washer', color='red', x=1, y=1) put (board, shape='nut', color='green', x=1, y=1)
Incorrect: put (board, shape='washer', color='red', x=1, y=1) put (board, shape='washer', color='green', x=1, y=1)
Frontiers
Figure 22. Part-7 of prompt template used for the Robot in the Teach step.
TEMPLATE 8.3.11
IMPLEMENTATION DETAILS
• When placing multiple shapes, use loops or repeated 'put' calls as needed.
Example:
for row in [1,4]: put(board, shape, color, row, y) for col in [2,5]: put(board, shape, color, x, col) for row in [1,3]: for col in [1,4]: put(board, shape, color, row, col) • Do not assume any unspecified details (e.g., color, orientation, or position).
If an instruction is ambiguous, ask Player 1 for clarification instead of guessing.
CURRENT GRID
• The current grid lists the current status of reconstruction
• Each cell may be marked as one of the shapes: 'washer', 'nut', 'screw', 'bridge-h-left', 'bridge-h-right', 'bridge-v-top', and 'bridge-h-bottom'
-
'bridge-h-left' and 'bridge-h-right' are display labels representing the two halves of a single horizontal bridge (bridge-h). A horizontal bridge always occupies two adjacent cells in the same row. When interpreting instructions/current grid/interpreting actions (put / remove / move), always refer to the shape as bridge-h, not the left/right variants.
-
Similarly 'bridge-v-top' and 'bridge-v-bottom' are display labels representing the two halves of a single vertical bridge 'bridge-v'. A vertical bridge always occupies two adjacent cells in the same column. When interpreting instructions/current grid/interpreting actions (put / remove / move), always refer to the shape as bridge-v, not the top/bottom variants.
• Do not assume any unspecified details (e.g., color, orientation, or position).
If an instruction is ambiguous, ask Player 1 for clarification instead of guessing.
Given:
-
prompt: Prompt with the following details:
-
grid_size: The grid is of size grid_size.
-
The instruction from the user describing what to do
-
current_grid: The current filled cells of the grid, None if empty
Frontiers
Figure 23. Part-8 of prompt template used for the Robot in the Teach step.
TEMPLATE 8.3.12
Produce:
- Respond with a JSON object: Format: "status": "<string>", # e.g. "clarification" or "code" "details": "<string>", # Python code when status="code", or plain text when status="clarification" If clarification needed: "status": "clarification", "details": "Which color washer should I use?" If providing acknowledgement: "status": "acknowledgement", "details": "Yes, I know" If executing code: "status": "code", "details": "put(board, 'washer', 'green', x=1, y=1) put(board, 'nut', 'blue', x=3, y=2)" Make sure the JSON is valid and parsable by Python json.loads(). Respond with the corresponding output fields, starting with the field '[ [ ## player_response ## ] ], and then ending with the marker for '[ [ ## completed ## ] ]'.
Frontiers
Figure 24. Part-1 of prompt template used in the Abstract step.
TEMPLATE 8.3.13
Your input fields are:
- 'prompt' (str): Prompt with function name, usage, instruction-code pairs, and optional error feedback. Your output fields are:
Your output fields are:
- 'optimized_function' (str): A single optimized Python function as a string. All interactions will be structured in the following way, with the appropriate values filled in.
[[" ## prompt ## ]] prompt [[" ## optimized_function ## ]] optimized_function [[" ## completed ## ]]
In adhering to this structure, your objective is: Given multiple instruction{code pairs, generate a single reusable and optimized Python function that performs all described operations in one call.
The optimized function should:
- Use the provided function definition exactly as given.
- Always use board as first argument to the function and followed by colors (a list of colors) and x, y (the starting/reference point row and column).
- Do not use shapes as parameters. Keep shapes as fixed attributes (e.g., shapes like 'washer', 'nut', 'bridge') and use them only inside the function. Use the exact shape names as in the code snippets.
- Do not hardcode color values inside the function.
- Use lists for parameters when multiple values of the same type are needed (e.g., multiple colors).
- All put() operations are relative to the starting position (x, y) specified in the first instruction. Use that as the reference point and as an input parameter to the function. The function should compute the relative offsets of all other shapes based on how their coordinates differ from the first placement.
- If the first instruction places a shape at (2, 3) and another places one at (2, 4), then the function input should be (x=2, y=3).
- The second shape's position is relative to the first by an offset of (dx=0, dy=1), which should be computed and applied inside the function.
- After determining the relative offsets for each placement, factor out repetition.
- Use a concise loop to iterate through corresponding shapes, colors, and offsets, rather than writing separate put() statements for each shape.
- Do not change the order of operations
- Do not change the signature of the function in the input code
- Here is the signature of put(): put(board, shape, color, x, y)
- Wherever multiple put() calls can be combined use loops. Do not repeat similar lines of code.
Frontiers
Figure 25. Part-2 of prompt template used in the Abstract step.
TEMPLATE 8.3.14
- When executed once, it should perform all of the described actions together.
- Use clean, valid Python syntax (PEP-8 compliant).
- Maintain semantic equivalence with all provided code snippets.
- Do not reuse the input code(sequence pairs as they are; the sequence is meant to be optimized.
- Output a valid standalone Python optimized function.
API Interpretation
- The input code snippets contains some or all of these APIs. - put(board: np.ndarray, shape: str, color: str, x: int, y: int): places a shape on the board at (x1,y1) - move(board: np.ndarray, x1: int, y1: int, x2: int, y2:int, shapes_list: List = None): moves a shape from (x1,y1) to (x2,y2)
- removeshape(board: np.ndarray, x: int, y: int, shape, color): removes a shape from (x1,y1) - clear(board: np.ndarray): clears/removes all shapes from the board - undo(board: np.ndarray): reverses the last action(s)
- You must treat the snippet as a sequence of actions executed on an initially empty board.
- Step through the actions in order and reason about how each one changes the board.
- Actions like remove(), move(), undo(), and clear() can cancel or override earlier put() calls.
- Any shape that is removed, moved away, undone, or cleared should NOT appear in the final board state. Earlier put() calls that get canceled in this way should be ignored.
- Figure out which shapes actually remain at the end.
- Your goal is to figure out what shapes are on which cells *after the entire sequence has finished*.
- For example:
put(board, 'washer', 'red', 1, 1)
remove(board, 1, 1, 'washer', 'red')
put(board, 'nut', 'blue', 1, 1)
At the end, only a blue 'nut' remains at (1, 1). The red 'washer' should NOT be included in the final result.
put(board, 'bridge-h', 'green', 2, 7)
put(board, 'screw', 'yellow', 6, 3)
move(board, 6, 3, 8, 4, ['screw'])
At the end, bridge-h is at (2,7) and screw is at (8,4). There is no screw at (6,3)
- After you have inferred the final board state, generate an optimized function that: - Uses ONLY put() calls
- Do NOT use move(), remove(), undo(), or clear() in the optimized function.
Frontiers
Figure 26. Part-3 of prompt template used in the Abstract step.
TEMPLATE 8.3.15
SHAPE OCCUPANCY - All shapes occupy exactly one cell, except the "bridge".
- A bridge spans two adjacent cells:
- Horizontal bridge: spans consecutive columns in the same row.
- put(board, 'bridge-h', 'red', x=0, y=0): This places bridge-h in cells (0,0) and (0,1): Same row, consequent columns
- Vertical bridge: spans consecutive rows in the same column.
- put(board, 'bridge-v', 'red', x=0, y=0): This places bridge-v in cells (0,0) and (1,0): Consequent rows, same columns
- A bridge requires two other shapes underneath it for support while stacking, one under each end of the bridge.
STACKING & DEPTH RULES
- Shapes can be stacked vertically within the same cell.
- Stacking is only allowed if all shapes share the same depth**.
- When multiple shapes are placed in a single cell:
- The first mentioned shape is placed at the bottom**.
- Later shapes stack on top**. - Do not stack same shapes in the same cell.
Example: Correct: put(board, shape='washer', color='red', x=0, y=0) put(board, shape='nut', color='green', x=0, y=0)
Incorrect: put(board, shape='washer', color='red', x=0, y=0) put(board, shape='washer', color='green', x=0, y=0)
Given:
- prompt: Prompt with the following details:
- function signature: signature of the function including its name. use only this signature.
- function usage: how the function will be used
- instruction-code snippets across turns: a list of code snippets corresponding to different instructions
- optional error feedback from previous attempts Produce:
- A single optimized Python function as a string.
- Do not generate any other reasoning traces as it will fail code execution. Make sure the Python function is valid and executable by executing
exec()on it.
Respond with the corresponding output fields, starting with the field [["# optimized_function ## ]], and then ending with the marker for [[" ## completed ## ]].
Frontiers
Figure 27. Prompt template used for the Programmer in the Reuse step.
TEMPLATE 8.3.16
Your input fields are:
1. `prompt` (str): Prompt with grid_size, skillname, goal grid, difference_grid
Your output fields are:
1. `instruction` (str): Natural-language instruction for the robot
All interactions will be structured in the following way, with the appropriate values filled in.
[[" ## prompt ## ]]
prompt
[[" ## instruction ## ]]
instruction
[[" ## completed ## ]]
In adhering to this structure, your objective is:
You are the human user.
Your task is to collaborate with a robot to reconstruct the given goal grid
You are reconstructing an object that was previously reconstructed by robot with different attributes. The object's internal structure is unchanged. Confirm whether the robot knows how to reconstruct the object. If so, specify only what differs (e.g., location, colors). If the robot indicates it doesn't know how to reconstruct the object, you may then explain the reconstruction steps. The structure of the object to be described explicitly is mentioned under Layerwise Representation. **DO NOT** explain explicit placement steps unless the robot indicates that it does not know how to reconstruct the object.
The rest of the prompt (from Preferred Instruction Style to Rules) is the same as in the Teach step.
Decision Protocol:
- Assume that the robot is aware of reconstructing the object using the existing skills. → Output an instruction to reconstruct <object_name> specifying the exact color values and placement location necessary to build the target object. You **MUST NOT** explain shape-wise/layer-wise placement steps.
- If the robot is not aware (e.g., the robot responds with "No, I don't know about the xxx object/skill") → Output: The reconstruction process layer by layer (from bottom to top), by including the colors and location information. **DO** this only when robot has explicitly confirmed it does not know how to reconstruct the object.
The rest of the prompt (from Inputs onwards) is the same as in the Teach step.
Frontiers
Figure 28. Prompt template used for the Robot in the Reuse step.
TEMPLATE 8.3.17
Your input fields are:
prompt(str): Prompt with Instruction from User and current grid state
Your output fields are:
player_response(str): A JSON object with keys 'status' and 'details' as described above
All interactions will be structured in the following way, with the appropriate values filled in. [["# prompt ## ]] prompt [["# player_response ## ]] player_response [["# completed ## ]]
Your updated objective is: You are reconstructing an object that was previously built, with some properties (e.g., location or colors) changed. If a relevant skill is available (under LEARNED SKILLS), you MUST use it. If no suitable skill exists, acknowledge the same to user and follow the user instructions.
The rest of the prompt (from Interpretation Mode onwards until Correction) is the same as in the Teach step.
LEARNED SKILLS $LEARNEDSKILLS
The rest of the prompt (from Available APIs onwards) is the same as in the Teach step.
Frontiers
Figure 29. Prompt template used for the Programmer in the Repeat step.
TEMPLATE 8.3.18
Your input fields are:
1. `prompt` (str): Prompt with grid_size, skillname, goal grid, difference_grid
Your output fields are:
1. `instruction` (str): Natural-language instruction for the robot
All interactions will be structured in the following way, with the appropriate values filled in.
[ [ ## prompt ## ] ]
prompt
[ [ ## instruction ## ] ]
instruction
[ [ ## completed ## ] ]
In adhering to this structure, your objective is:
You are the human user. Your task is to collaborate with a robot to reconstruct the given goal grid.
The rest of the prompt (from Preferred Instruction Style to Rules) is the same as in the Teach step.
Decision Protocol:
- Assume that the robot is aware of reconstructing the object using the existing skills. → Output an instruction to reconstruct <object_name> specifying the exact color values and placement location necessary to build the target object. You **MUST NOT** explain shape-wise/layer-wise placement steps.
- When generating instructions to describe the pattern, list the colors in the same order as provided under Colors in the prompt. The order must follow the structure of the object: all bottom-layer cells first, followed by the cells in the upper layers. Do not change this order.
- If the robot is not aware (e.g., the robot responds with "No, I don't know about the xxx object/skill") → Output: The reconstruction process layer by layer (from bottom to top, not cell by cell), by including the colors and location information. **DO** this only when robot has explicitly confirmed it does not know how to reconstruct the object.
- When robot has explicitly confirmed it does not know how to reconstruct the object, explain the object layer by layer, proceeding from bottom to top. When multiple layers are present, describe all relevant shapes in the bottom layer first across the full structure before moving to the next layer. Do not describe on cell basis from bottom to top before describing the other bottom cells, as this can lead to mistakes and misinterpretation.
- When answering clarification questions, ensure that the robot's concern is aligned with the goal specification. Verify whether the locations or colors identified as conflicting actually match the goal. If not, correct the misunderstanding.
- If the robot cannot resolve the error after multiple attempts, guide it to clear the current grid and restart by using the appropriate skill API.
The rest of the prompt (from Inputs onwards) is the same as in the Teach step.
Frontiers
Figure 30. Prompt template used for the Robot in the Repeat step.
TEMPLATE 8.3.19
Your input fields are:
prompt(str): Prompt with grid_size, skillname, goal grid, difference_grid
Your output fields are:
instruction(str): Natural-language instruction for the robot All interactions will be structured in the following way, with the appropriate values filled in.
[[" ## prompt ## ]] prompt [[" ## instruction ## ]] instruction [[" ## completed ## ]] In adhering to this structure, your objective is: You are the human user. Your task is to collaborate with a robot to reconstruct the given goal grid
The rest of the prompt (until Current Grid) is the same as in the Reuse step.
Error Handling and Code Generation Rules
- If executing the generated code triggers a compilation error and resolving it requires additional information, ask the user for clarification.
- Do not repeatedly generate the same code across multiple turns. If the error message indicates the issue (e.g., placing a shape outside the grid), fix the problem by consulting with the user before generating new code.
Grid State Awareness
- The generated code runs on top of the current grid state.
- Before generating new code, check what already exists in the grid and generate only the required changes.
- Do not regenerate shapes that already exist unless modification is required.
Sequential Execution Awareness
- Each line of generated code modifies the grid state.
- After line 1 executes, the grid is already updated.
- Ensure that later lines do not conflict with changes introduced by earlier lines.
Skill Name Accuracy and Usage
- Skill names are sensitive. Example: wn, wns, and wb are different skills.
- If a skill appears unavailable: Verify that the skill name matches the instruction. If the name is correct but still unavailable, ask the user how to build it. Do not continue using an incorrect skill.
- Do not import any additional skill libraries. Use the skill API directly with the correct arguments. Ensure that the number of colors equals the number of shapes specified in the function or object description.
The rest of the prompt (from Given onwards) is the same as in the Teach step.
Frontiers