arXiv:2610.28311cs.CLOct 2026

Manuscript Offprint

arXiv:2610.28311

From Abstraction to Action: DSLs for Natural Language Abstraction Interpretation and Execution

Amit Lisha, Reut Tsarfaty

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Natural-language instructions often rely on high-level abstractions, such as asking an agent to “stack blocks in a pyramid.” Interpreting abstract instructions requires models to both identify the abstraction intended by the speaker, and unroll it into the many concrete actions that instantiate it. Language models struggle here: prior work has shown that performance degrades as the level of abstraction in the instruction rises. To bridge the gap between natural language abstraction and concrete actions, we propose to borrow from coding environments the notion of a domain-specific language (DSL), an explicit representation layer whose documented primitives name recurring abstractions that expand into concrete actions. We demonstrate the efficacy of DSLs for NL interpretation on HEXAGONS, a visually-grounded instruction-following task graded for abstraction. We further ask whether language models can induce such DSLs themselves from domain data. Our results show that while code generation consistently improves over direct inference, code generation over a human-curated DSL yields dramatic gains, up to 10 absolute F1 points, reaching the human skyline, with gains concentrated at higher abstraction levels. We confirm a similar pattern on the TEXT2CAD benchmark. At the same time, model-induced DSLs recover only part of this gain, remaining inconsistent across runs and short of their human-curated counterpart. Overall, the right representation closes much of the gap caused by high abstraction — but inducing that layer of representation automatically is where models still fall short, and where we see a strong opportunity for the community to make progress. 1^{1}

1 Introduction

Language models are increasingly deployed as agents that must act on natural-language instructions: editing, drawing, operating software, manipulating an environment, and a lot more. However, the instructions users write are rarely explicit sequences of actions. A user asking an agent to “add a ‘total’ row to each table in the report” expects it to recover the many concrete edits compressed into this phrase, rather than be instructed for each one.

This tendency for compression is unsurprising: human speakers typically provide the minimal amount of information that is needed for a successful interpretation (Grice, 1975). Speakers thus convey multiple actions through abstraction, defined by Wing (2010) as “the representation of many instances through a single higher-level object, capturing essential structure while suppressing lower-level details.”

For a language model to carry out abstract instructions, it must identify the abstract concepts and reconstruct the sequence of actions they leave implicit (MacMahon et al., 2006; Artzi and Zettlemoyer, 2013). Models are unevenly good at this: performance declines as instructions grow more abstract (Shridhar et al., 2020; Ruis et al., 2020; Wu et al., 2021; Ahn et al., 2022), particularly evident in HEXAGONS (Lachmy et al., 2022), where instructions are annotated with abstraction levels.

This suggests a simple hypothesis: if the gap between language and action arises because abstract instructions leave task-relevant steps implicit, then unfolding those abstractions explicitly should help bridge it. Code generation is a natural first step to explore (Chen et al., 2021; Liang et al., 2022): programming languages provide built-in mechanisms for unfolding abstraction — variables, loops, functions, conditions — so mapping instructions to code gives the model computational structure that exposes the structures implicit in language.

However, general-purpose code may not suffice: the model may still need to recover task-specific abstractions from scratch, e.g., what counts as a “table” or a “header” in a document, and reflect them as concrete operations.

1^{1}We open-source our data, code, DSLs for future research.

Figure

Figure 1: Abstract instructions compress many low-level drawing actions on the board. (a) Direct prediction must recover this structure directly, in an end-2-end fashion. (b) HEXAGEN makes task-relevant abstractions explicit, letting the model generate code that executes to the correct output.

In business environments, such recurring domain concepts are often provided as reusable operations through a domain-specific language (DSL) (Mernik et al., 2005) that is then used in code to map abstraction to action. In this work we ask: (i) can language models use task-specific DSLs to effectively follow natural language instructions? and, moreover, (ii) may language models come up with such DSLs themselves?

Our primary empirical investigation focuses on HEXAGONS, a visually grounded instruction-following benchmark designed to elicit abstraction in natural language. Its instructions refer to higher-level structures: complex objects, patterns, arrangements; and successful execution depends on producing the right low-level actions (Figure 2). Furthermore, HEXAGONS's abstraction-level annotation lets us control performance on abstraction, and isolate where the interpretation breaks down.

We investigate the first question via a three-way comparison of strategies to solve the HEXAGONS board: direct inference, unrestricted Python generation, and Python generation over a DSL. In particular, we assess performance given HEXAGEN, a human-authored Python DSL we designed for this purpose, which defines decomposable abstractions on top of the HEXAGON tiles: named shapes, spatial queries and geometric transformations. The model may write an ordinary Python program and invoke DSL functions as needed, retaining full interpretive responsibility while offloading low-level domain-specific reasoning to the DSL (Figure 1).

Our results show that a human-curated DSL indeed leads to substantial performance gains, closing much of the gap with the human skyline, an effect we show on both HEXAGON (Section 5) and a TEXT2CAD real-world scenario (Section 6). This success begs our second question, namely, can LLMs induce such DSLs themselves?

We investigate this by augmenting the HEXAGONS task training data, instructions paired with the denotations on the board, with a minimal API covering only low-level drawing actions. Models are asked to identify recurring patterns and implement respective DSL functions, producing executable Python code and documentation for downstream use. Replacing HEXAGEN with such induced DSLs shows mixed results relative to a minimal-API baseline, with improvements varying across models, but consistently underperforming the human-curated DSL counterpart.

Taken together, our experiments show that interpreting and executing natural language instruction using a curated DSL consistently outperforms both direct inference and unrestricted code generation, with the largest gains where interpretation is hardest: at higher abstraction levels. At the same time, we demonstrate that current LLMs fall short of human experts on the task of reliably inducing such abstraction layers themselves from natural language domain-specific data — leaving the automatic discovery of task-relevant abstraction layers from natural language texts as an open challenge for further investigation.