---
title: "NL2Bash — paper by Lin et al. (2018) — summary and ideas"
description: "NL2Bash pairs English descriptions with Bash commands and tests how well different parsers recover the intended command and its arguments."
canonical: "https://research.elamur.ai/free/en/papers/lin-2018-nl2bash-corpus-semantic-parser-natural/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/lin-2018-nl2bash-corpus-semantic-parser-natural/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2018](https://md.research.elamur.ai/free/en/papers/2018/) / NL2Bash: A Corpus and Semantic Parser for Natural Language Interface to the Linux Operating System

# NL2Bash: A Corpus and Semantic Parser for Natural Language Interface to the Linux Operating System

Paper · 2018 · Xi Victoria Lin, Chenglong Wang, Luke Zettlemoyer et al.

**Authors:** [Xi Victoria Lin](https://md.research.elamur.ai/free/en/authors/xi-victoria-lin/), [Chenglong Wang](https://md.research.elamur.ai/free/en/authors/chenglong-wang/), [Luke Zettlemoyer](https://md.research.elamur.ai/free/en/authors/luke-zettlemoyer/) and Michael D. Ernst · **Year:** 2018 · **Venue:** Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018) · **Licence:** [CC BY-NC 4.0 (ELRA, LREC proceedings)](https://creativecommons.org/licenses/by-nc/4.0/)

[**37** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W2788109215) · [Cited by **57** papers in our library of more than 163,000 papers whose bibliographies we read](https://md.research.elamur.ai/free/en/papers/lin-2018-nl2bash-corpus-semantic-parser-natural/cited-by/) · [Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018)](https://aclanthology.org/volumes/L18-1/) · [licence](https://creativecommons.org/licenses/by-nc/4.0/)

- [Publisher's page](https://aclanthology.org/L18-1491/)
- [PDF](https://aclanthology.org/L18-1491.pdf)
- [DOI 10.63317/42er6x4bacdf](https://doi.org/10.63317/42er6x4bacdf)
- [arXiv 1802.08979](https://arxiv.org/abs/1802.08979)
- [OpenAlex](https://openalex.org/W2788109215)

Citations: OpenAlex, 2026-10-14.

## Summary

A person can know which files they want to find without knowing how to express the search in Bash. NL2Bash studies whether software can bridge that gap by turning an English description into a shell command. The research treats this as [semantic parsing](https://md.research.elamur.ai/free/en/concepts/semantic-parsing/). The output must express the intended operation in a formal language, including which utility to invoke, which options to select, and which values to supply. The authors start with one-line commands. This gives them a way to study familiar tasks such as file search and text processing while setting aside constructs that often depend on a surrounding script.

The authors hired 10 people with shell-scripting experience to gather examples from sources such as forums, tutorials, technical blogs, and course materials. Each example paired a command with a description limited to a single sentence. Filtering and cleaning reduced the original 12,609 pairs to 9,305, covering 102 utilities and 206 flags. The authors organized the training, development, and test splits to avoid reusing a description or command across them. The corpus contains short examples by length, with a mean of 11.7 words per description and 7.7 tokens per command, but stretches across many operations and includes precise values such as filenames that may appear only once. Its utility distribution also reflects how it was collected. The authors report 6,268 appearances of `find` and 1,047 of `xargs`.

The experiments compare ordinary sequence generation, generation that can copy material from the input, and Tellina, which predicts the command structure before filling in its arguments. The strongest approach for complete commands was CopyNet with sub-tokens, which let it reuse useful pieces of a filename or pattern and generate the punctuation needed around them. On the full test set, its first-ranked suggestion had the correct structure for 49% of instances and was a correct full command for 36%. It surpassed Tellina on full-command accuracy with less hand-designed processing. Tellina retained a modest advantage on command structure.

Several commands can implement the same request, so the evaluation called on people with shell experience to judge candidate commands instead of requiring the wording or syntax of a recorded answer. A separate review of 100 training pairs put annotation accuracy at roughly 85%. Many of the errors were local, such as a misread option or a typo in a value, but could still change what the command would do. The authors released the corpus, its cleaning scripts, and their baseline implementation. Together, the resource and the experiments show where English-to-Bash translation can succeed and where short requests still pose difficulties, including rare options, precise argument formatting, and descriptions that leave part of the intended behavior uncertain.

## Deep dive: NL2Bash: A Corpus and Semantic Parser for Natural Language Interface to the Linux Operating System

NL2Bash pairs English descriptions with Bash commands and tests how well different parsers recover the intended command and its arguments. · about 36 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### What a short request has to specify

Someone asking a computer to locate files can describe the desired result in ordinary language. The shell expects something more precise. It needs the name of a utility, the inputs that utility should operate on, and the conditions under which it should keep or discard results. An English request might put the search location first or last. A utility can require it in a particular position. A phrase about matching filenames may have to become a flag followed by a pattern, even when the user expressed the flag’s meaning without naming it. Turning a request into Bash calls for both choosing the operation and expressing its details in the conventions of the chosen utility. This is the aspect of natural language programming that NL2Bash makes measurable. [Code & programming languages](https://md.research.elamur.ai/free/en/topics/code-and-programming/)

The paper distinguishes three basic parts of a shell command. A utility identifies the program to call. Option flags alter its behavior. Arguments supply the values or objects on which it operates, such as a filename or text to search for. These categories are easy to state, but their relationship varies by utility. A flag may expect a value, and the value may have a special internal format. A utility can even accept a fragment that invokes another utility. Knowing that a string is an argument therefore leaves open how to write it, which option it belongs to, and where it goes.

The language also has two kinds of structure that a translator must bring together. Bash has high-level syntax for composing operations, including pipelines that pass output from one stage to another. Within each stage, a utility has conventions for interpreting its own options. The authors describe the shell grammar as shallow and emphasize that the options lack a common syntax tree of the kind used in some earlier code-generation systems. A tree that locates the stages of a pipeline may capture useful facts about the command while leaving much of a utility’s local syntax unspecified. The issue is relevant to the earlier line of research exemplified by [A Syntactic Neural Model for General-Purpose Code Generation](https://md.research.elamur.ai/free/en/papers/yin-2017-syntactic-neural-model-general-purpose/).

The breadth of the target language makes those local conventions consequential. The paper describes shell work that ranges from filesystem management and text processing to network and process management. Even within file work, a request can combine a selection condition, a pattern, and an action. Learning how people describe one such combination gives a translator examples to draw on, but another utility may express the same condition in a different way. Choosing Bash as the target gives the benchmark common tasks with a range of syntax and meanings. It also creates a problem of how to gather enough examples for each part of that range.

The authors narrow the task to one-line commands. Their interest in this unit is practical as well as methodological. A single line can accomplish a meaningful operation and typically presents a smaller interpretation problem than a script with state carried across statements. The paper excludes features such as input and output redirection, variable assignment, and compound statements because their interpretation can depend on context. A line can still contain several operations, so the restriction leaves room to study composition alongside simpler utility invocations. The resulting task is to find a suitable command for a self-contained request.

#### Where NL2Bash fits among earlier tasks

As the authors describe it, making computers respond to instructions in everyday language is a longstanding ambition. They cite early work on using English as a programming medium and on English interaction with Unix. They also acknowledge the underlying difficulty that motivated criticism of the idea. Natural language allows people to leave details implicit, while the machine must operate on a definite interpretation. NL2Bash makes that tension concrete by pairing a relatively short description with something the shell can interpret. When the description leaves a detail implicit, a reviewer still has to decide whether the proposed command is a reasonable expression of it.

Earlier semantic-parsing research had already mapped sentences to formal representations for tasks such as database querying and spoken requests in a delimited application. The authors position NL2Bash alongside a more recent set of studies that use programming languages as the target. They discuss regular expressions, event-and-action recipes, and SQL queries. In recipe generation, a request can describe what event should trigger which action. In database querying, the task can call for recovering the operations and conditions needed to retrieve information. These are precedents for expressing a user’s intent as something a program can interpret. [Language to Code](https://md.research.elamur.ai/free/en/papers/quirk-2015-language-code-learning-semantic-parsers/) and [Seq2SQL](https://md.research.elamur.ai/free/en/papers/zhong-2017-seq2sql-generating-structured-queries-natural/)

Bash raises a combination of problems that the authors consider especially pronounced. There are many utilities, and their options differ. Filenames, dates, and other values draw from an open vocabulary, meaning a user can introduce a value that never occurred in the training examples. Sometimes the requested value is available directly in the description. Sometimes it must be rearranged or surrounded by shell punctuation. Finally, the relation between description and command can run in both directions. Several English sentences can describe one command, and a single English sentence can have several correct translations. The latter fact changes what it means to count a prediction as correct.

The corpus also belongs to a line of work on how to obtain programs paired with brief descriptions. The paper distinguishes examples prepared with human oversight, pairs extracted automatically from existing material, and examples synthesized by a grammar. A forum can offer many instances of text near code, but proximity leaves the alignment uncertain. Part of a question may refer to an earlier attempt, while the adjacent snippet may solve only one part of the problem. Automatic collection therefore needs a way to determine whether the text and code genuinely belong together. The authors see a tradeoff between the amount of material available online and the effort required to check the relationship in each pair.

A grammar offers a different route. Earlier work described in the paper generated related code and language expressions together and then asked people to paraphrase the language. This gives the collection process control over which structures the examples contain. It also makes the choice of grammar important. The approach depends on enumerating how the target forms can be constructed, and the authors argue that doing so is demanding beyond simple domain-specific languages. They present synthetic and naturally occurring data as complementary sources. For NL2Bash they chose practical snippets first and used people with shell experience to supply or select a description in context.

There is a related difference in how tasks can be evaluated. Some regular-expression research could compare the languages recognized by different expressions through a formal equivalence procedure. Some work on SQL and other executable outputs assessed the outcome of running a prediction. Bash commands can produce effects that depend on the environment, and there is no general decision procedure for equivalence in a Turing-complete language. NL2Bash therefore needed an evaluation protocol that could recognize a reasonable alternative even if it had a different surface form. Human judgment provides that flexibility, at the cost of time and possible disagreement.

### The method, step by step

#### Start with commands from practice

Corpus construction began with examples of Bash as it was already being used or taught. The authors asked collectors to search question-and-answer forums, tutorials, technical blogs, and course materials. A web interface brought together search, browsing, and data entry. The collectors took commands from those sources and paired them with descriptions. Depending on the source, a collector could reuse accompanying prose or write a sentence using the surrounding material and their own knowledge. This approach makes the command the starting point of each pair. The collector’s task is to determine and express what the existing command does.

The authors hired 10 Upwork freelancers with experience in shell scripting. They report an average collection rate of 50 pairs/hour per freelancer. The two brevity rules applied to different sides of the pair. The Bash had to fit on a single line, and the description had to fit in a single sentence. On a given page, a collector supplied one description for a command. The same command could be encountered elsewhere or selected by another collector. The resulting alternatives were useful as examples of how people can describe the same operation using different words or emphasis.

The inventory began with 135 utilities identified as useful in a Linux user group resource. The paper describes collection in stages. In the initial stage the authors gathered 5,413 commands containing `find` as a proof of concept. Such a command could contain other utilities as well. The authors then opened collection to examples containing any of the 135 selected utilities. A later stage with a broader inventory can add coverage and still preserve the concentration established by the initial stage. That history matters when interpreting which parts of Bash the corpus represents most densely.

Within the utility inventory, the authors also drew a syntactic boundary. They filtered out constructs such as redirection, assignment, and compound statements, as well as utilities typically used in scripts with multiple statements. They removed examples with interpreters whose arguments could embed another programming language. These restrictions serve the assumption that a reader can interpret the pair as a short, relatively self-contained unit. Each command still has the option conventions of its particular utilities, and composition within a line can still make an example demanding.

#### Clean the pairs and separate the splits

The cleaning procedure distinguishes between removing examples and repairing them. The filter discarded commands whose syntax violated the specifications used from the Linux manual pages and those that fell outside the selected scope. For prose, a probabilistic spelling checker corrected errors. The authors also manually corrected some issues in the descriptions and in the commands that automated cleaning missed. The release includes the unfiltered data, the filtered data, and the scripts used to clean it, so the materials preserve both the original collection and the benchmark version.

Other edits regularized the command presentation. A line copied from a tutorial can include the shell prompt, which is part of the display the reader sees. The authors stripped prompt characters from the beginning of collected commands. They also removed an initial `sudo` and reduced absolute paths used to identify utilities to the utility’s base name. That last operation concerns the name of the program being invoked. Paths that serve as arguments have a different role. A filename or location mentioned in a request may be exactly the value the translator needs to preserve.

The authors’ split procedure started with normalized descriptions. They applied lowercasing, removal of selected common words, and [stemming](https://md.research.elamur.ai/free/en/concepts/stemming/). A stemmer reduces words to simpler forms so that some inflected variants can be treated alike. Removing the words on a stop list and using consistent case likewise allows strings with superficial differences to receive the same representation. The authors then made a cluster for each resulting description. Every pair with that normalized description belonged to the same cluster. This matters when the corpus records several answers to the same request or when distinct surface forms converge after normalization.

They assigned clusters randomly to training, development, and test at a ratio of 10:1:1. The training split supplies examples for learning the translation, the development split supports choices about settings, and the test split is used for the final comparison. After the cluster assignment, the authors describe moving development and test pairs into training if their command appeared in training. The stated aim was that neither an identical description nor an identical command should recur across splits. The description clustering addresses the language side of that aim. The adjustment addresses the risk that a held-out request is paired with a command the translator already encountered during training.

The split operates on descriptions and commands as strings, after the relevant normalization. Holding out a whole string can still leave related utilities, flags, templates, and argument fragments in training. This is useful for the question the paper asks. A system can learn how a utility tends to be used and then try to apply that knowledge where a complete command differs. The partition does not require that test requests be drawn from completely new application domains.

#### Decide what the sequences contain

Before translation, both sides of a pair have to be expressed as sequences of units. On the English side, the authors used a regular-expression tokenizer and the Snowball stemmer. A tokenizer identifies the units the system receives, such as words or pieces of an expression. Closed-vocabulary words were lower-cased and the English preprocessing removed stop-list words. The authors excluded English tokens with fewer than four appearances from the vocabulary used in the token and sub-token settings. For Bash they used a parser adapted from Bashlex to identify the command tokens. This gave shell-aware handling of the output side rather than assuming that every separator behaves like a space in ordinary prose. [Tokenization](https://md.research.elamur.ai/free/en/concepts/tokenization/)

At token granularity, a utility and a flag can be separate units, and a complete argument can occupy a unit of its own. A translator can learn to emit a familiar utility or option directly. The difficulty is that a unique pathname may have no useful whole-token representation in the learned vocabulary. Copying that whole token can help if the request contains exactly the needed form. It is harder to use intact when the command needs only part of its spelling, or when the desired form adds material to it.

At character granularity, the system works with individual characters. It can construct unfamiliar strings by combining familiar characters. It must also build familiar units out of their constituent characters, and the sequence it has to process becomes longer. In this setting, producing a common flag involves getting its spelling right as a sequence. A character representation thus offers flexibility at the level of individual strings but puts more of the work of recovering command structure into sequence prediction.

Sub-tokens provide the intermediate representation. The authors split constants on both the English side and the Bash side. A run of letters stays together, a run of digits stays together, and other characters appear individually. For a pathname, this can preserve a readable name and the consecutive digits attached to it while separating slashes, the extension separator, and wildcard punctuation. The utility and flag names remain atomic. Two markers, `SUB_START` and `SUB_END`, mark the beginning and end of a split constant. The representation lets the system distinguish a series of pieces that belongs to one original value from units that surround the value in the command.

Sub-token boundaries also define what the copy mechanism can conveniently reuse. A literal name embedded in a path may keep the same letter sequences even if its position or neighboring punctuation changes. The translator can combine those pieces with generated pieces. Keeping a run of letters intact means the decoder has fewer decisions to make than if it had to emit each letter separately. Keeping punctuation separate means some changes of shell format can be represented as adding, removing, or replacing individual pieces.

#### Generate, copy, or fill argument slots

The comparison centers on three ways of producing a command. Seq2Seq reads the input and generates an output sequence. CopyNet adds a way to draw pieces directly from the input while generating that output. Tellina first predicts a command template and then fills its argument slots. The flow below follows the CopyNet path at sub-token granularity, beginning with the preparation of paired examples and ending with ranked candidate commands.

From paired examples to ranked CopyNet commands The steps in order.

Seq2Seq uses a recurrent encoder and decoder. A recurrent network carries forward information from earlier positions as it processes a sequence. The encoder reads the English input and supplies a representation for the decoder. The decoder generates the Bash sequence a step at a time. The experiment uses a bidirectional encoder, so its representation draws on a pass through the input in each direction. The recurrent units are gated recurrent units, or GRUs. Their gates regulate how information already carried in the network is updated as more input arrives.

The baseline assigns conditional probabilities to command sequences. Its ranking rule can be written as follows.

```
P(y ∣ x)
```

Here `x` is the input description in its chosen representation, and `y` is a candidate command sequence in the corresponding output representation. `P` denotes probability, and `∣` means that the probability for `y` is conditioned on `x`. The larger this probability for a candidate given the same description, the higher the preference for that candidate under the sequence formulation. The paper adopts the formulation from [Sequence to Sequence Learning with Neural Networks](https://md.research.elamur.ai/free/en/papers/sutskever-2014-sequence-sequence-learning-neural-networks/).

CopyNet uses the same general encoder–decoder arrangement. Its decoder can emit output through ordinary generation or by selecting material from the source. The two actions are available within the same decoding process, and the system is trained end to end on paired descriptions and commands. It can learn to emit an option associated with the meaning of a phrase and to copy the actual value mentioned nearby. The benefit depends in part on where the boundaries fall. A complete source token can be the right copying unit when the shell needs it intact. A portion of that token can be more useful when the target has another form. The mechanism comes from [Incorporating Copying Mechanism in Sequence-to-Sequence Learning](https://md.research.elamur.ai/free/en/papers/gu-2016-incorporating-copying-mechanism-sequence-sequence/).

Tellina makes a distinction between structure and arguments before generation. It identifies values in the English input and abstracts them to semantic types such as file or size. This turns a concrete mention into a marker of what kind of information it supplies. Tellina then translates to a command template, where the utility, flags, and their arrangement are specified and values are represented by slots. A learned alignment procedure matches source values to the slots. Formatting rules adapt those values to the syntax the command expects.

The paper uses the term *command template* more generally for a command in which arguments have been replaced by their types. A text search, for instance, can retain the chosen search utility and option while replacing a concrete pattern and file specification with a pattern slot and a file slot. Different search terms and locations can then share a template. A system can get that frame right while making a mistake in the pattern or file specification. This is why the authors judge command structure separately from the completed command.

Tellina gives that distinction a role in the architecture. CopyNet can learn the structure and the values in one sequential decoder, with the representation preserving atomic utility and flag names in the sub-token setting. These designs expose different dependencies. Tellina’s later filling stage uses the types and slots identified earlier. A wrong decision about what a source value represents can therefore affect what that stage receives. CopyNet can combine copied and generated material at the resolution of its sequence. Its choices about structure and values are still made as part of the same output process.

#### Fit the systems and rank candidates

For the sequence baselines, the decoder recurrent network has dimension 400. Each of the directional recurrent networks in the encoder has dimension 200. The authors trained with mini-batched [Adam](https://md.research.elamur.ai/free/en/papers/kingma-2014-adam-method-stochastic-optimization/), an optimization method that updates the learned parameters from gradients. The initial learning rate was 0.0001 and the mini-batch size was 128. A learning rate sets the scale of the updates, while a mini-batch is the group of examples used in a training update. The authors used the optimizer’s default momentum settings. They also applied variational recurrent dropout at a rate of 0.4 as a form of regularization. [A Theoretically Grounded Application of Dropout in Recurrent Neural Networks](https://md.research.elamur.ai/free/en/papers/gal-2015-theoretically-grounded-application-dropout-recurrent/)

At decoding time, the authors set the beam size to 100. Beam search keeps multiple promising partial outputs as generation proceeds. This makes it possible to retain a candidate that begins less promisingly but may form a better command after more of it is generated. It also yields a ranked set of completed suggestions, which the evaluation can examine at different depths. The authors selected hyper-parameters based on development performance and released the baseline implementation as part of the NL2Bash project.

### Experiments and results

#### What the corpus measures

The filtered corpus has 9,305 pairs and covers 102 distinct utilities and 206 flags. The language side contains 7,790 distinct words, and the command side contains 6,234 distinct tokens in the authors’ dataset comparison. A description averages 11.7 words, and a command averages 7.7 tokens. The median frequency is 1 for both an English word and a command token. An instruction can therefore be short and still contain a value that scarcely recurs. At the same time, the authors report that “files” appears in 5,871 sentences and “in” in 5,430. Familiar language about operations can coexist with highly specific arguments inside the same examples.

The utility frequencies show a different kind of imbalance. The authors count 6,268 appearances of `find`, followed by 1,047 of `xargs`. The 52 least frequent utilities account for 984 appearances altogether. These counts concern utilities within commands. A single command can include more than one utility, so the figures describe the frequency of uses across the material. The initial concentration on `find` makes the prominence of that utility partly a result of how the corpus was built. The later collection gives the system examples beyond that starting point, though the tail remains sparse.

The relation between the two sides also matters. Most of the recorded mappings are one-to-one, but the underlying task allows many-to-many mappings. A collector may describe a familiar action one way, and another collector may describe it using different words. Conversely, a request can be met by alternative formulations of the command. The corpus records some of those relationships. Its annotation process gives no reason to expect an exhaustive list of correct alternatives to a description. This is the basis for the authors’ decision to ask reviewers to judge translations for meaning.

#### How a prediction earns credit

For the full test evaluation, the paper groups pairs with the same normalized description into one test instance. A description linked to more than one recorded command therefore counts as one request when the authors calculate accuracy. The protocol uses three freelancers who know shell scripting. They independently assess a system’s 3 translations for each instance, and the majority vote determines the judgment on a candidate. The paper also examines pairwise agreement among the judges for both commands and templates. Grouping determines which requests enter the denominator, while voting determines the disposition of a candidate.

The structure criterion asks whether the candidate has the correct command template, allowing for errors in argument values. The full-command criterion asks whether the finished command is correct, including its arguments. In either case, the rank cutoff specifies how far down the returned list the evaluation will look. At the first rank, only the top choice can earn credit. At a deeper cutoff, a correct suggestion can earn credit even if the system placed another command ahead of it. The paper describes the two measures in terms of test instances with a correct item at the cutoff rank or higher.

```
Aꜰ(k) = percentage of test instances with a correct full command at rank k or better
```

Here `A` denotes an accuracy measure, the subscript `ꜰ` identifies the full-command criterion, and `k` is the largest numerical rank the evaluation considers. The parentheses show that the measure depends on that rank cutoff, and `=` states its definition. The percentage is computed over grouped test instances. A correct command at a better rank has a position earlier in the list.

```
Aᴛ(k) = percentage of test instances with a correct command template at rank k or better
```

Here `A` again denotes accuracy, the subscript `ᴛ` identifies the template criterion, and `k` sets the last rank considered. The parentheses mark the cutoff as the input to the measure, and `=` gives the rule for computing it. The unit is the percentage of grouped test instances that meet the template condition. A candidate can meet that condition even when a value supplied for an argument is wrong.

Reviewing candidates this way lets the evaluators accept answers that accomplish the task by another route. It also means that an executable command can fail the judgment when the described intent calls for different behavior. Conversely, a command with the right operations and options can receive template credit even when a particular pathname or pattern would have to be repaired. These evaluations answer questions about the suggestions as ranked, including whether a correct candidate appears early enough to be encountered in the portion examined.

#### Development comparisons and the final test

The development comparison covers 7 baselines. The authors ran Seq2Seq and CopyNet at token, character, and sub-token granularity and included Tellina. Because having people judge all systems on the entire development set was expensive, the manual comparison used 100 sampled development instances. The authors also computed automatic scores on the entire development split. This design provides a broad comparison across the variants and a more detailed judgment on a sample.

The principal pattern on that sample was a tradeoff between structure and finished commands. Token-level systems generally had stronger command structure accuracy. With atomic utility and flag names, units corresponding to recognizable pieces of command structure can be produced directly. Character and sub-token representations generally did better on full commands, where the ability to construct an unseen string can matter. The authors note that character-level Seq2Seq had competitive full-command accuracy in spite of considerably weaker structure accuracy. The result shows why the structure and full-command columns can lead to different assessments of the same system.

Adding copying improved full-command accuracy at token and sub-token granularity. The token-level comparison also showed a slight drop in template accuracy when copying was added. The authors suggest that alignment between the source values and the command may be harder when the correct argument requires reformatting. Copying at character granularity had a smaller effect. The paper connects this to the scarcity of unseen characters, which limits the amount of additional output coverage a character-copy action can offer.

Sub-token CopyNet, which the paper calls ST-CopyNet, emerged as the strongest system for full commands among the development baselines. Tellina placed second on full commands and second on structure in that comparison. The authors took these two systems forward for human evaluation on the entire test split. Both scored higher on the full test evaluation than on the manually judged development sample. The authors point out that different groups of programmers evaluated the two splits, so the increase has more than one possible explanation.

On the full test set, ST-CopyNet achieved 49% top-1 command template accuracy and 36% top-1 full-command accuracy. The chart shows its first-choice acceptance rate under the two judging settings. In each case the same suggestion is being assessed, with argument correctness required only in the full-command setting.

ST-CopyNet acceptance across judging settings on the full NL2Bash test set The first suggestion earns credit more often when the judgment allows errors in argument values.

**The numbers**

| System or setting | top-1 accuracy % |
| --- | --- |
| Command template judgment (this paper) | 49 |
| Full-command judgment | 36 |

ST-CopyNet retained its advantage over Tellina on full-command accuracy, while Tellina was somewhat stronger on structure. The comparison has a practical interpretation in the terms used by the authors. Predicting a useful frame for a command and correctly finishing that command are related accomplishments. Tellina can be competitive at establishing the frame, while the sub-token approach more often produces a complete answer that reviewers accept. The authors cite earlier Tellina findings in which users sometimes fixed a wrong argument in an otherwise useful suggestion. The NL2Bash translation scores measure what the system offers before a user makes such a repair.

#### What the automatic scores can detect

The appendix computes two fuzzy metrics over the full development split. TM measures overlap on closed-vocabulary command tokens, specifically utilities, flags, and reserved tokens. The candidate is compared with the recorded references, and the best percentage overlap is used. For a given rank cutoff, the authors take the maximum TM score among the candidates up to that cutoff. The metric offers a quick approximation to structural agreement by focusing on pieces whose identities tend to define the command frame.

For whole commands, the appendix uses the [BLEU score](https://md.research.elamur.ai/free/en/concepts/bleu/), a measure of overlap in sequences of tokens that originated in translation evaluation. For a rank cutoff, the authors report the best BLEU score among candidates at that cutoff or earlier. Token overlap can reward a prediction for sharing portions of a reference. In this setting, the meaning of the differing portions can be decisive. An incorrect condition or argument may change the requested behavior even when most of the surrounding command matches.

The automatic and manual comparisons agreed on which systems led on full commands and on command structure. Their rankings differed in other cases. The authors note, for example, that character-based systems had the second-best BLEU score in the automatic comparison. TM also put several systems close together. These observations delimit what can be learned from running the automatic evaluation on more examples. Its coverage of the full development split makes it easier to compare many variants, while its dependence on reference overlap makes some distinctions less reliable than human inspection.

### What the ablations show

#### Changing the unit of prediction changes the failure mode

The most direct comparisons vary the representation and the presence of copying. The comparison with Tellina varies more components at once. These experiments complement the manual analysis of errors. The representation comparisons show where scores shift. The error analysis examines the kinds of mistakes that could produce those shifts.

Across the representation settings, tokens tend to help the structure score. An intact flag corresponds directly to a selectable option in the output. A character system can produce a combination of characters that forms the same flag, but it must predict the combination and its boundary. This applies to familiar utility names as well. Working at character granularity makes it possible to spell novel arguments, while it also makes the decoder responsible for spelling the structure that token settings receive in larger units.

The full-command comparison brings the other side of that tradeoff into view. A complete token representation gives relatively few ways to adapt a previously unseen value. At the character level, the system has finer control, and the authors found competitive full-command accuracy even with ordinary Seq2Seq. Sub-tokens give some of that control while preserving entire utilities and flags. They still make the decoder handle more pieces than at token level. The paper links this demand to a pattern in the error review. Small discrepancies in arguments were common, and breaking arguments into pieces did not guarantee that all those pieces would be assembled correctly.

The copying comparisons help explain why sub-tokens were effective. With a token-level system, the copy option makes a direct difference when the requested value appears on the input side and can be used as written. At the sub-token level, copying can still contribute when only part of the value can be retained. The system can reuse some pieces and generate others as needed. The improvement in full-command accuracy at both levels is consistent with argument values benefiting from access to the input. The slight decline in token-level template accuracy shows that the gain in completed commands can accompany weaker performance on the separate structural criterion.

Copying changes less at character granularity. The paper’s explanation is that having to emit a character absent from the vocabulary is uncommon. In this setting, Seq2Seq already has access to most of the output symbols it needs. The main burden is selecting and combining the symbols correctly over a relatively long sequence. Copying can still assist with selection, but its ability to supply a previously unavailable output unit matters less.

#### What the comparison with Tellina can establish

Tellina and ST-CopyNet solve the formatting problem in different places. Tellina uses heuristics after it has determined a template and aligned the source values to slots. ST-CopyNet produces structural pieces and argument pieces within one output sequence and can mix generated material with copied material. The authors read the higher full-command accuracy of ST-CopyNet as evidence for learning string transformations from examples in this setting. They also note that the difference is especially apparent when looking across the 3 ranked suggestions.

The comparison leaves room for a structural role in future approaches. Tellina’s stronger test template result shows that explicit treatment of the command frame can accompany competitive performance. The two systems differ in abstraction, alignment, formatting, and output representation, so the comparison measures how the complete approaches behave. It does not isolate the effect of turning off a single heuristic. The authors propose using shallow command structure in a decoder, potentially with separate recurrent components for deciding the template and filling the arguments.

#### Where the two systems made the same mistakes

The authors read the first-ranked output of ST-CopyNet and Tellina for the 100 development instances used in their error analysis. Both systems made structure errors on 44% of that sample and full-command errors on 59%. These figures describe overlap in failures. A jointly missed instance need not have elicited the same incorrect command from both systems. When only one system made a mistake, Tellina had fewer template errors, and ST-CopyNet had fewer full-command errors. This echoes their relative behavior under the two accuracy criteria.

The most prominent error category for both was sparse training coverage. An English description could ask for a function attached to a utility or flag that the system had rarely encountered. The training examples may provide too little evidence to connect that function with the phrasing in the test request. This can remain a problem even when all the English words are familiar. The rarity belongs to the relationship between the language and a particular Bash operation, sometimes to a particular flag of a utility that is otherwise represented.

The authors also observed cases where a recurrent translator overlooked or misinterpreted a portion of the description. The resulting command could leave out an option, replace it with the wrong one, or omit an entire utility. The researchers found relatively few template errors that were themselves syntax errors. Often the erroneous output could still run. The meaning error was in what the command selected or did. Syntactic competence and fidelity to the request can therefore come apart even in a short candidate command.

Enumerations create another burden. A description may mention a series of objects or patterns, each of which has to survive translation. A system can recognize the general purpose of the request and still omit one member of the list, alter its value, or put it in the wrong slot. If many of the values are unfamiliar, a long sequence also provides a harder input for the recurrent encoder. The authors observed both argument extraction failures and more structure errors in these examples.

Complex requests can make a single sentence unwieldy even when a valid command fits on one line. The user may have to express several conditions and specify how they interact. The order and phrasing of those conditions can put pressure on a recurrent translator, especially when their relationship is conveyed indirectly. The authors observed failures involving information inside parentheses and long prose descriptions of regular expressions. They also found preprocessing errors and failures associated with unusual or ungrammatical language. Tellina had additional failure cases tied to limited coverage of its rules.

#### What the training-pair audit adds

The corpus audit asks a different question from the translation experiments. The authors sent 100 sampled training pairs to two freelancers who had not written the sampled annotations. The reviewers judged correctness and whether the description made the intended goal clear. They identified errors in 15 pairs, which the paper reports as approximately 85% annotation accuracy for the sampled training material. This concerns the quality of the examples used for learning. It is separate from the percentages earned by systems translating held-out requests.

In 3 cases the description was insufficiently specific about whether the targets included directories, a distinction that affected how the utility handled the objects. In 4 cases an annotator had mistyped a constant when transferring it from the command to the description. The remaining 8 concerned a misinterpreted or omitted flag or reserved token, or a syntax problem the annotator missed. In 13 of the 15 erroneous pairs the paper attributes the issue to the interpretation of a single command token. The audit illustrates how a modest-looking annotation error can alter the range of actions or objects implied by a pair.

Clarity and correctness also came apart. One reviewer marked 1 description unclear, while the other marked it clear. Reviewers could generally understand what the annotator appeared to intend and still find that the English and Bash expressed different behavior. The authors suggest automatic detection of mismatched constants as a way to catch some copying errors. They discuss eliciting examples or asking focused questions when the difficult part is expressing the intended operation itself. Those proposals address different kinds of problems observed in the audit.

### Limitations

#### Limits the authors identify

The study begins with a restricted selection of Bash uses. The authors intentionally set aside expressions that rely on script context, such as assignments and input or output redirection, and filter commands that embed another programming language. The evidence therefore applies most directly to the one-line tasks represented in the collection. The researchers chose that scope as a step toward broader interaction with an operating system, and they discuss longer scripts as a harder problem. A short command can still contain considerable structure, but its evaluation here starts from a request considered on its own.

The authors also identify coverage gaps within the selected utilities. In the appendix they compare the flags observed in training with the flags they extracted manually from GNU manual pages for the 10 most frequent and the 10 least frequent utilities. For most utilities in that comparison, the training data contains less than half of the estimated flags. The authors describe their manual inventories as lower bounds because of possible omissions and version differences. They also point out that short and long forms can count separately even when they express the same option. Normalizing those aliases could change the apparent coverage while leaving genuine gaps for options with no examples.

Sparesness is especially visible in the tail of the utility distribution. Among the 52 least frequent utilities, `dig` is the most frequent with 38 appearances in the corpus. The paper reports that 7 utilities occur 5 times or less. The authors argue that this amount of data cannot represent a reasonable range of uses for some utilities. Their discussion of using unlabeled commands or information from Linux manual pages is a proposal for supplementing the training signal. Learning to handle missing flags without paired examples also remains an open direction in the paper.

Judging candidate commands is another limit the authors state. Bash equivalence cannot be decided in general. The paper considers testing outputs in a virtual environment, where the results of running commands could be compared, but leaves this approach for later research. The comparison would depend on which environments and cases were chosen. The authors rely on human judgment for the reported translation accuracies and show that token-overlap proxies miss some distinctions the human protocol makes.

A final stated limit concerns how much information people can put into a single sentence. The authors report difficulty interpreting one-sentence descriptions in 4 out of 100 examples in their discussion of collection and analysis. They suggest interactive natural language programming where the system can obtain missing information across turns. The reported baselines receive the description as it stands. Their outputs reflect both how well they translate what is expressed and how reasonably they resolve details that may be unclear.

#### What follows from the experimental setup

The corpus contains language associated with commands that already exist. Even when a collector writes entirely new prose, the collector knows the reference command. A person approaching a shell interface may know the desired outcome and lack some of the categories that an experienced annotator would use to describe it. The sequence of information can also differ. A command with an explicit option invites a description of that option, whereas a user may discover that it matters only after seeing a result or being asked about it. The study measures performance on the type of request it collected. Its annotation review concerns expert-authored pairs, and the test scores do not measure how frequently unassisted users would give enough detail.

Holding out descriptions and commands offers a check against direct duplication. It leaves open how well the systems would handle new utility families or unfamiliar combinations of structure. Templates, individual options, and common forms of argument may all be shared between training and evaluation. There is also a distinction between the authors’ stated goal for all three splits and the procedure detailed in the paper. The described command adjustment explicitly concerns overlaps with training. The description of that procedure does not detail a separate command check between development and test. These boundaries matter when interpreting the kind of generalization the numbers represent.

Overall accuracy also gives frequent operations more influence than rare ones. A corpus dense with file search can reveal useful patterns about common file-search instructions, and the error analysis identifies rare operations as a substantial problem. The overall score alone cannot show whether the system is broadly competent across the long tail. The appendix’s flag and utility analyses explain why the data may be thin in that tail, but those counts are observations about exposure, distinct from a dedicated translation evaluation by utility or flag.

The two accuracy criteria are meaningful under the benchmark protocol. Template correctness can identify a promising suggestion, particularly for someone who already knows how to fix a value. Full-command correctness puts more weight on whether the system supplied everything needed to express the request. Neither figure by itself measures how users would choose among suggestions or whether they could detect an incorrect but executable command. The paper’s own error review makes that distinction concrete. Commands often remained executable even when reviewers found a semantic error.

The increase in scores from the development sample to the full test evaluation has limited interpretive force because both the data and the evaluator group changed. The sampled development comparison also covered a wider set of systems than the final test. The full test supports the authors’ comparison of ST-CopyNet with Tellina under that test protocol. The broader conclusions about granularity and copying come primarily from the development comparisons, supported by the manual error review.

Finally, the annotation-accuracy estimate comes from 100 training pairs. It shows that local mistakes remain after cleaning and illustrates what those mistakes look like. It does not establish the rate for each utility or for each split. The scope of the estimate matters because the distribution is uneven and the causes are varied. A typo in a supplied constant, an ambiguous distinction between files and directories, and an unrecognized syntax issue call for different kinds of correction.

### What came after

#### Collecting paired language and code in other domains

Citing studies carried the pairing problem into other settings. Spider is a human-labeled dataset for complex, cross-domain text-to-SQL. It places the natural language description alongside a database query, so the formal target expresses an information need over a database. The connection to NL2Bash is the use of paired examples to study a translation whose correctness depends on both its operations and their details. The domain difference changes what must be interpreted. Bash brings utility-specific flags and argument formats, while the Spider task is named around SQL and coverage across domains. [Spider](https://md.research.elamur.ai/free/en/papers/yu-2018-spider-large-scale-human-labeled/)

Learning to Mine Aligned Code and Natural Language Pairs from Stack Overflow takes up the collection problem itself. NL2Bash used people with shell experience to decide how a command and a sentence fit together. The citing work studies how to mine that alignment from an existing forum. This addresses an issue NL2Bash raises in its dataset comparison. A web source can be rich in prose and code while leaving the identity of the matching fragments unresolved. For a collection method, finding an alignment is the central task. For translation, those aligned examples become material from which a system can learn. [Learning to Mine Aligned Code and Natural Language Pairs from Stack Overflow](https://md.research.elamur.ai/free/en/papers/yin-2018-learning-mine-aligned-code-natural/)

CodeSearchNet focuses on semantic code search. This makes the relation between language and code serve a retrieval task. Given a language query, the system is evaluated on finding relevant code. NL2Bash uses the relation for generation, where the returned object is a proposed command. Both settings depend on what it means for a piece of code to answer an expressed need. The tasks put the difficulty in different places. In search, the collection supplies possible answers. In generation, the structure and argument values must be assembled into a candidate. [CodeSearchNet Challenge](https://md.research.elamur.ai/free/en/papers/husain-2020-codesearchnet-challenge-evaluating-state-semantic/)

#### Bringing execution into the evaluation

Natural Language to Code Translation with Execution takes up execution in the translation setting. NL2Bash discusses comparing command outcomes in a virtual environment as a possible form of evaluation and uses expert judgment in its own experiments. The later study’s focus connects the generated code to what happens when it runs. That creates a source of information beyond overlap with a given answer. Its significance for the comparison is the shift in available evidence. A candidate can be assessed through observed behavior as well as its textual form. [Natural Language to Code Translation with Execution](https://md.research.elamur.ai/free/en/papers/shi-2022-natural-language-code-translation-execution/)

LEVER places execution in a verification task. Its focus is learning to verify language-to-code generation using execution. This addresses a question that follows once a generator can propose multiple candidates. Their order under a translator’s score may differ from their order under a check that has execution evidence available. NL2Bash’s ranked accuracies already distinguish the first suggestion from success found deeper in a candidate list. Execution-based verification belongs to the part of that problem concerned with deciding which suggestion to trust. [LEVER](https://md.research.elamur.ai/free/en/papers/ni-2023-lever-learning-verify-language-code/)

InterCode uses execution feedback in a benchmark for interactive coding. The shared issue is how evidence from the behavior of code can help assess a proposed action. Interactivity extends that issue to a setting where feedback can inform subsequent work. In NL2Bash, the English sentence is fixed for each evaluated request and the system returns ranked suggestions. The interactive coding setting makes feedback part of the task. This connects to, but differs from, the original authors’ proposal to ask users for more information when a description is difficult to interpret. Feedback from running code and clarification from a user supply different evidence. [InterCode](https://md.research.elamur.ai/free/en/papers/yang-2023-intercode-standardizing-benchmarking-interactive-coding/)

#### Returning to the operating-system goal

OSWorld benchmarks multimodal agents on open-ended tasks in real computer environments. It connects to the ambition that originally motivated NL2Bash, namely to give people a way to express what they want a computer to do. The evaluated object has a wider scope. NL2Bash scores candidate shell commands for a particular English request, while OSWorld’s stated setting is open-ended work in a computer environment. That changes the role a correct command can play. An instruction that would count as a complete answer in a one-line translation benchmark can be one action within a broader task. NL2Bash provides a way to study that individual translation, including the gap between choosing the right operations and specifying all the values that make them do the requested work. [OSWorld](https://md.research.elamur.ai/free/en/papers/xie-2024-osworld-benchmarking-multimodal-agents-open/)

## Cite

Cite as Xi Victoria Lin, Chenglong Wang, Luke Zettlemoyer and Michael D. Ernst. 2018. NL2Bash: A Corpus and Semantic Parser for Natural Language Interface to the Linux Operating System. Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018).

The paper itself, not this page. BibTeX from the library's record of the work. [arXiv 1802.08979](https://arxiv.org/abs/1802.08979)

```bibtex
@inproceedings{lin2018nl2bash,
  title = {{NL2Bash: A Corpus and Semantic Parser for Natural Language Interface to the Linux Operating System}},
  author = {Xi Victoria Lin, Chenglong Wang, Luke Zettlemoyer and Michael D. Ernst},
  booktitle = {Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018)},
  year = {2018},
  doi = {10.63317/42er6x4bacdf},
  eprint = {1802.08979},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.63317/42er6x4bacdf}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
