Source-linked AI summary
In-IDE Code Generation from Natural Language: Promise and Challenges
Frank F. Xu, Bogdan Vasilescu, Graham Neubig
TL;DR
The paper addresses the limited evidence about whether benchmarked natural-language code generation and retrieval help developers in real workflows. It evaluates hybrid in-IDE assistance through a controlled study of developers performing Python tasks, finding positive user perceptions but no statistically significant average speed gains and broader quantitative outcomes that are inconclusive.
Problem
Research has rarely used human-centered evaluation to determine whether natural-language code generation and retrieval improve real developer workflows beyond automatic benchmark scores.
Method
The study evaluates in-IDE generation and retrieval with 31 participants completing Python programming tasks with and without the assistant.
Results
Participants generally enjoyed the assistant, but they did not complete tasks statistically significantly faster, and the study found no statistically significant gains in measurable outcomes.
Takeaways & Limitations
Current benchmark-leading NL2Code technology is not yet markedly useful in practice, and future assistants may need better snippet quality and additional documentation or context.
Takeaways & Limitations
BLEU-based code evaluation is an imperfect correctness measure because functionally equivalent snippets can differ substantially in token sequences.
Abstract
from arXiv · showhide
A great part of software development involves conceptualizing or communicating the underlying procedures and logic that needs to be expressed in programs. One major difficulty of programming is turning concept into code, especially when dealing with the APIs of unfamiliar libraries. Recently, there has been a proliferation of machine learning methods for code generation and retrieval from natural language queries, but these have primarily been evaluated purely based on retrieval accuracy or overlap of generated code with developer-written code, and the actual effect of these methods on the developer workflow is surprisingly unattested. We perform the first comprehensive investigation of the promise and challenges of using such technology inside the IDE, asking "at the current state of technology does it improve developer productivity or accuracy, how does it affect the developer experience, and what are the remaining gaps and challenges?" We first develop a plugin for the IDE that implements a hybrid of code generation and code retrieval functionality, and orchestrate virtual environments to enable collection of many user events. We ask developers with various backgrounds to complete 14 Python programming tasks ranging from basic file manipulation to machine learning or data visualization, with or without the help of the plugin. While qualitative surveys of developer experience are largely positive, quantitative results with regards to increased productivity, code quality, or program correctness are inconclusive. Analysis identifies several pain points that could improve the effectiveness of future machine learning based code generation/retrieval developer assistants, and demonstrates when developers prefer code generation over code retrieval and vice versa. We release all data and software to pave the road for future empirical studies and development of better models.
1 INTRODUCTION
The paper motivates in-IDE natural-language code assistance as a response to the recurring difficulty of translating programming ideas and API intentions into code. It evaluates generation and retrieval in a controlled human study because benchmark accuracy may not predict usefulness in real developer workflows.
- Motivation: Changing APIs and unfamiliar libraries repeatedly require developers to translate conceptual intentions into concrete implementations.The paper illustrates this need with common questions about file handling and dictionary operations.
- Motivation: Natural-language programming can help developers avoid routine typing and help non-programmers create computational scripts.
- Generation and retrieval: Code retrieval searches existing fragments, whereas code generation produces implementations when suitable target fragments may not already exist.
- Prior work: Recent machine-learning methods have expanded the flexibility of code generation and improved code retrieval using large online code repositories and more sophisticated models.
- Research gap: Human-centered evidence remains scarce on whether strong automatic evaluation scores translate into usefulness for developers completing real programming tasks.
- Study contribution: The study implements in-IDE generation and retrieval assistants and evaluates them with 31 participants performing Python tasks with and without assistance.
- Study contribution: Participants generally enjoyed the plugin, but assistance produced no statistically significant average gains in task completion speed or correctness.
- Contributions: The paper contributes a hybrid PyCharm plugin, a controlled user study, empirical analyses of developer interaction and outcomes, and a comparison of generated and retrieved snippets.
2 OVERVIEW OF OUR STUDY
The study examines whether current natural-language code generation and retrieval techniques are useful inside the development workflow. It contrasts a neural semantic-parsing generator with a Stack Overflow-based retrieval system.
- Study focus: The paper focuses on the practical usefulness of state-of-the-art natural-language code generation systems within developer workflows.
- Code generation: The selected generation method uses a tree-based neural network to encode natural-language utterances and generate syntactically correct target code snippets.
- Code retrieval: The study compares generated code with retrieved fragments returned by a custom Stack Overflow search engine inspired by Bing Developer Assistant.
2 Task design
The supplied passage labels a task-design element as popular coding education websites.
- Task design: Popular coding education websites are identified as a task-design element.
- Task design: The task-design passage names coding education websites without describing their tasks or evaluation role.
- Task design: No further task-design details are stated in the supplied passage.
3 Human study
The human study embeds code generation and retrieval in a PyCharm plugin and evaluates the assistants across diverse Python tasks using instrumented participant data. It also examines query behavior, user perceptions, and reproducibility.
- Human study: The study implements code generation and retrieval as a custom PyCharm plugin that accepts natural-language intents and displays corresponding snippets.
- Task design: The task set contains 14 representative Python programming tasks across 7 categories, spanning basic Python and data-science topics with varying difficulty.
- Participants: The study recruits 31 participants with varied Python experience and familiarity with the application domains.
- Experimental procedure: The researchers use an instrumented virtual environment to collect data for controlled comparisons of assisted and unassisted task performance.
- Research questions: The research questions examine task completion time and correctness, query characteristics and model choice, and perceived usefulness.
- Reproducibility: The study publishes its plugin, virtual environment, analysis scripts, and anonymized raw data to support replication.
3 NL2CODE IDE PLUGIN DESIGN
The PyCharm plugin combines neural code generation with Stack Overflow code retrieval, presenting ranked candidates for natural-language programming intents. Users can insert, edit, and upload snippets, while examples show that generation and retrieval can complement each other but may differ in suitability.
- Plugin architecture: The plugin accepts English descriptions of programming intent and returns ranked snippets from code generation and code retrieval systems.It displays the top seven generation results followed by the top seven retrieval results.
- Code generation: The generation model produces syntactically correct fragments and can incorporate API calls, variable names, and string literals from the natural-language input.The model was selected as a state-of-the-art semantic-parsing approach and evaluated on CoNaLa using BLEU.
- Code retrieval: Retrieval searches Stack Overflow through Bing, extracts snippets from the top three answers, and ranks them using search and answer ordering.Queries are prefixed for Python and Stack Overflow, while variables and most query structure are retained.
- Complementarity: Examples show retrieval can contain spurious code, while generation and retrieval can be closer to the desired answer in different cases.The two methods therefore provide complementary candidate sets rather than uniformly superior outputs.
- Interface design: The study displayed seven candidates per method, although later analysis found the most relevant snippets were typically within the top three.The choice of seven balanced candidate diversity against screen space and scrolling.
- Interaction and editing: Users can insert a selected snippet at the cursor, edit it for context, and upload the edited code with its surrounding context.The plugin records selections and supports post-insertion analysis.
4 HUMAN STUDY DESIGN
The human study evaluated the plugin with 31 Python programmers completing representative tasks under plugin and no-plugin conditions. Tasks covered seven categories and varied in difficulty, while assignments were tailored to participant experience and balanced across conditions.
- Study overview: The study involved 31 participants completing Python tasks with and without the NL2Code plugin.The controlled design compared treatment and control conditions using an instrumented virtual environment.
- Task design: Task categories were identified from Python courses and highly upvoted Stack Overflow questions representing common programming use cases.The team cross-checked course coverage against frequently upvoted practical questions.
- Task design: Participants received input data, directory structures, and example outputs so they could verify their solutions during the study.The task set included concrete data-visualization requirements such as plot dimensions, labels, dates, and colors.
- Participant assignments: Participants were assigned four task categories based on self-reported experience, with Basic Python and File assigned to everyone.The remaining categories were selected from those in which each participant reported the most experience.
- Experimental conditions: Within each selected category, one task was randomly assigned to the plugin condition and the other to the no-plugin condition.Eight participants who never used the plugin were filtered out, leaving the final analyzed sample of 31.
5 RQ1: NL2CODE PLUGIN EFFECTS ON TASK COMPLETION TIME AND PROGRAM CORRECTNESS
The study analyzed plugin effects with mixed-effects models that accounted for repeated observations, task differences, and participant experience. Plugin use produced no statistically significant difference in completion time or correctness, while user and task variability explained substantial outcome variation.
- Analysis: Mixed-effects regressions modeled plugin use while controlling for experience and random user and task effects.This approach addressed correlated observations from repeated tasks by the same participant and differences in task difficulty.
- Analysis: The refined model separated between-participant and within-participant experience effects while retaining plugin, user, and task terms.The specification was designed to address potential heterogeneity bias in the default model.
- Validity: The study acknowledged that uploading participant edits could add time in the plugin condition, although the upload process was designed to be brief.A keyboard shortcut automatically removed generated comments before uploading.
- Model fit: 64% was the conditional R^2 for task completion time, with most explained variance attributable to random task and user effects.The models fit reasonably well, but outcomes showed substantial user-to-user and task-to-task variability.
- Completion time: No statistically significant difference in completion time was found between plugin and control conditions.The analysis did not provide sufficient evidence that plugin users completed tasks faster or slower on average.
- Program correctness: No statistically significant difference in task correctness scores was found between plugin and control conditions.Code produced with the plugin appeared statistically indistinguishable in correctness from manually written code.
6 RQ2: COMPARISON OF GENERATED VS RETRIEVED CODE
The study finds distinct query patterns associated with choosing generated versus retrieved code, while query quality and presentation effects constrain interpretation. Generated snippets tend to serve basic functionality, whereas retrieval is favored for complex APIs and multi-step tasks.
- Generation versus retrieval: 65.9% accuracy versus a 55.6% baseline shows that query words predict whether users choose generated or retrieved snippets.The logistic regression learned patterns distinguishing the two outcomes, although the plugin’s fixed presentation order is a potential confound.
- Generation versus retrieval: Basic Python functionality, such as file handling, data structures, and random-number generation, most often corresponded to code generation choices.Examples include opening CSV files, listing text files, and obtaining dates and times.
- Generation versus retrieval: Queries involving complex functionality, including cross-validation, machine learning, data analysis, and visualization, more often led users to choose retrieved snippets.These tasks commonly require multiple steps or complex API usage patterns.
- Query specification: Only 20 of 50 queries, or 40%, were sufficiently specified for a human expert to implement without additional context.Source-file context increased the number judged good enough to 34 queries, or 68%.
- Query specification: Code-generation success was moderately associated with query quality: 𝜙=0.37 for well-specified queries and 𝜙=0.45 when context made queries informative.Both associations were statistically significant, with p=0.008 and p=0.001, respectively.
- Query specification: The generation model failed on 31 of 50 queries, or 62%, with 23 of those failures involving under-specified queries.Eight failures, or 26%, remained cases where a human expert could directly implement the intent, identifying targets for improvement.
- Post-selection editing: Retrieved snippets underwent a statistically significant mean-rank difference after editing, with a Hodges–Lehmann median difference of 18 tokens.The 95% confidence interval was 11–23 tokens, and mean edit distance was 13.2 tokens.
7 RQ3: USER PERCEPTIONS OF THE NL2CODE PLUGIN
Participants generally viewed the in-IDE NL2Code plugin positively or neutrally, especially for recalling small snippets without leaving the IDE. They also reported that result quality, contextual support, and query formulation limited usefulness, particularly for complex tasks.
- Overall experience: 15 of 31 participants rated the plugin experience neutral and another 15 of 31 rated it at least somewhat positive.Only one participant rated the experience somewhat negatively.
- Reported benefits: The plugin helped users recover small commands and unfamiliar API calls they had seen before but could not fully remember.Participants described these snippets as memory refreshers and convenient reminders.
- Reported benefits: Using the plugin inside the IDE was viewed as less disruptive and faster than switching to a web browser for solutions.Participants specifically valued avoiding distraction and keeping resources in one place.
- Pain points: Participants reported that plugin results were often low quality, unrelated, or unusable without modification.Respondents said direct use was rare and that the model needed improvement.
- Pain points: The plugin was less helpful for complex data-processing and machine-learning tasks involving complex APIs than for simple filesystem tasks.One participant reported needing full sklearn documentation to understand what to do in difficult cases.
- Requested improvements: Users wanted explanations, documentation, comments, and examples alongside snippets to understand their purpose and select among alternatives.Additional context was requested both for internet-derived examples and generated code.
- Requested improvements: Participants said the plugin assumed background knowledge and provided limited help with complex problems requiring theoretical understanding.They primarily valued help with small syntax details or forgotten API usage.
- Requested improvements: Participants requested stronger awareness of local IDE context, more natural query syntax, and interactive dialogue for refining or decomposing complex requests.Suggestions included matching insertion context, supporting keyword-style queries, and narrowing rough requests conversationally.
8 DISCUSSION AND IMPLICATIONS
The study finds that the current NL2Code plugin does not significantly improve completion time, correctness, or measured code quality, despite positive user experiences and evidence that generation and retrieval serve different needs. The authors therefore recommend improving hybrid assistance, contextual adaptation, explanatory support, and query interaction.
- Study and main findings: Plugin-assisted code was no more complex, less maintainable, or more correct on average than manually written code, and correctness differences were not statistically significant.Median correctness was 7 out of 10 with the plugin versus 6 without it, but regression analysis did not find the difference statistically significant.
- Study and main findings: Task completion was not statistically significantly faster with the plugin, although limited task fit and a 31-person sample may have obscured small effects.The authors note that some tasks may not have offered sufficient opportunities to benefit from NL2Code assistance.
- Study and main findings: Generation and retrieval produced fundamentally different snippets, and participants selected generated snippets almost as frequently as retrieved ones, indicating that neither method substitutes for the other.Only 13 of 173 unique queries had chosen fragments found verbatim in the generation model's training data, suggesting customization beyond simple memorization.
- Implications and future work: Future assistants should combine generation and retrieval, incorporate local context in inputs and outputs, and provide documentation or explanations alongside returned snippets.Recommended output adaptations include indentation, variable renaming, and coding conventions; additional context could help users judge unfamiliar API or domain-specific code.
- Implications and future work: Dialogue-based querying and a unified query syntax could help users express intent more precisely and reduce confusion across generation and retrieval systems.The authors report that users did not always formulate queries in the format expected by the models.
9 RELATED WORK
Prior work spans natural-language code generation, code retrieval, IDE assistance, and end-user programming, but automatic evaluation often poorly reflects developer workflow usefulness. This paper places hybrid generation and retrieval inside the IDE and collects fine-grained interaction data for empirical study.
- Natural-language programming: Neural code-generation systems have expanded beyond constrained templates by training on large repositories such as GitHub and Stack Overflow.
- Code retrieval: Code retrieval adapts information-retrieval models or learned relevance models to find code snippets matching natural-language queries.
- Evaluation: BLEU and token-overlap metrics can misrepresent code correctness because functionally equivalent programs may differ substantially in tokens.
- Evaluation: Retrieval evaluation requires costly expert relevance annotations and often covers few unique queries, limiting representation of real development scenarios.
- This paper: The paper contributes an IDE plugin combining generation and retrieval while recording detailed plugin interactions and code edits for future empirical research.
- Broader context: The work connects natural-language programming assistance to end-user development, no-code or low-code tools, program synthesis, and intelligent IDE completion.
10 CONCLUSION
The study built a controlled environment and collected detailed participant and workflow information for evaluating in-IDE code generation and retrieval. Its broader conclusion is mixed: developers enjoyed the tools, but effects on efficiency, correctness, and code quality were not consistently established.
- Conclusion: Results were mixed for workflow time, code correctness, and code quality, although developers subjectively enjoyed using the in-IDE tools.
- Study infrastructure: The study used a virtual-machine environment to standardize development conditions and record activity inside and outside the IDE.
- Study infrastructure: Participants completed Python tasks with a configured PyCharm environment containing the experimental plugin and study-support software.
- Participant data: The study collected participants’ programming experience, Python expertise, task-specific familiarity, IDE preferences, and use of assistive tools.
- Participant feedback: After tasks, participants reported task difficulty, self-assessed performance, help-seeking, and suggestions for improving the programming process.
- Participant feedback: Plugin users additionally rated its effects on time efficiency, coding ease, concentration, and related quality-of-life factors.
E PLUGIN EFFECT ON CODE COMPLEXITY METRICS
The study evaluated whether the plugin changed source-code length and cyclomatic complexity. Complexity was statistically indistinguishable across conditions, while plugin users produced code that was on average about four lines longer.
- Measures: The analysis measured source lines of code and McCabe’s cyclomatic complexity as proxies for program complexity.
- Expectation: The study expected plugin-generated or retrieved code might be more idiomatic, shorter, or less complex than participant-written code.
- Distributions: Figures 9 and 10 show distributions of cyclomatic complexity and source-line counts across tasks and experimental conditions.
- Results: There was no statistically significant difference in cyclomatic complexity between plugin and control conditions.
- Results: Plugin-condition programs were statistically indistinguishable from control programs in correctness and complexity.
- Results: ~4 source lines of code separated plugin-condition programs from control programs on average, a small effect below the ~6-line random-user-intercept standard deviation.
H USER QUERIES
The user-query analysis catalogs natural-language requests submitted to the NL2Code plugin across tasks. Queries cover basic programming, file operations, dates, CSV and dataframe manipulation, and other common API-oriented intents.
- Query outcomes: Table 10 distinguishes successful queries by whether participants selected generated snippets or retrieved snippets.
- Basic programming: Queries include elementary list, dictionary, sorting, randomization, and date-time operations expressed as short natural-language intents.
- File operations: Many requests concern file and directory manipulation, including copying, encoding conversion, traversal, filtering, and recursive operations.
- Data operations: Data-oriented queries ask for CSV creation or editing, dataframe transformations, grouping, renaming, aggregation, and export.
I RANDOMLY SAMPLED USER QUERIES FOR THE ORACLE ANALYSIS
The oracle analysis samples user queries alongside mixed-effects models of task performance, including code-complexity metrics.
- Oracle query samples: Sampled oracle queries mark those where users chose a code-generation snippet in boldface.The table also distinguishes queries good enough independently from those good enough with the rest of the source file as context.
- Oracle query samples: The oracle annotations distinguish snippets that are good enough alone from those requiring source-file context.Queries good enough on their own form a strict subset of those good enough with contextual source code.
- Task-performance models: The task-performance analysis uses de-meaned task experience mixed-effects regressions with code-complexity metrics.The models are presented as LMER task-performance models.