Discovering the Syntax and Strategies of Natural Language Programming with Generative Language Models
Authors
Document Title
Discovering the Syntax and Strategies of Natural Language Programming with Generative Language Models
Document Information
- Domain: Human-Computer Interaction (HCI) and Natural Language Programming Tool Development
- Keywords: Natural language interface, code synthesis, large generative language models, user strategies, adaptive prompts, user experience evaluation
Research Background and Problem
- Problem Description:
- Although large generative language models (LLMs) can understand natural language and generate code or other content, users may still encounter obstacles during actual usage.
- Specifically, users need to explore and learn how to interact with the model using the correct "syntax," even though the input is in natural language.
- Users lack an accurate mental model of the scope of requests the model can fulfill (e.g., complexity or specificity).
- Research Importance: Exploring existing pain points and user experience limitations of natural language programming tools can promote more efficient human-computer collaboration paradigms and lower the entry barriers to programming.
- Research Motivation and Related Work:
- The introduction of LLMs has made it possible to adjust model outputs through prompts. Existing studies and tools (e.g., GPT-3 and related demonstrations) have shown that generative models can convert natural language into code such as HTML and SQL.
- Tools like GitHub CoPilot have attempted to integrate code suggestions based on generative models into development environments.
Solution
-
Proposed Method and Tool:
- Developed a tool named GenLine.
- This tool utilizes a 137-billion-parameter generative language model and a set of task-specific prompts to enable the direct conversion of natural language into code.
- Provides an interactive interface allowing users to input natural language requests using double brackets, select task-specific prompts, and browse or modify the generated code.
- For example: [[make this button blue <button>OK</button>]].
-
Innovative Aspects of the Solution:
- Combines natural language and code input methods, enhancing input flexibility.
- Offers dynamic fallback prompts to help users regenerate or adjust input when initial natural language requests fail.
- Supports diverse requests (e.g., overly generalized or overly specific tasks).
-
Key Technical Details:
- The tool consistently uses generative models to convert designed prompts into code outputs, enabling conversions from natural language to HTML, JavaScript, and CSS.
- Implements a few-shot learning prompt system, such as automatically generating code templates from natural language descriptions.
- Users can adjust the "temperature" (randomness parameter) to influence the diversity of generated results.
Research Results
-
User Study:
- Study Design: Recruited 14 participants with varying levels of front-end development experience to complete two programming tasks (building a static search page and an interactive flashcard application).
- Data Collection: Collected over 7 hours of user operation recordings and post-session interview feedback.
- Qualitative and Quantitative Analysis:
- Task Completion Rate: Approximately 50% of users successfully completed the more complex interactive task (Task 2).
- Model Output Usage Rate: Less than 50% of generated code was directly accepted.
- Participants exhibited discrepancies in their mental models regarding the tool's question scope and syntax, requiring significant trial and error.
-
Findings and Contributions:
- Challenges of using natural language code generation:
- Users need to learn the tool's "implicit syntax," despite the appearance of natural language input.
- Uncertainty exists regarding the scope of requests and model performance (e.g., whether it can generate complete functional blocks).
- Lack of support for referencing input file context or history.
- Debugging or correction strategies adopted by users:
- Rewording requests.
- Adjusting temperature (modifying generation randomness).
- Expanding or simplifying input scope.
- Reflections on the tool's future potential:
- Can be used to reduce tedious boilerplate code generation or serve as an auxiliary tool for learning programming.
- Challenges of using natural language code generation:
-
Design Recommendations and Improvement Directions:
- Provide input suggestions and semantic clarification within the system.
- Enhance user control through visualized internal model explanations.
- Develop stronger interaction mechanisms, such as decomposing complex requests into subtasks during prompt design.
-
Limitations and Future Directions:
- Limited by model error rates and the implementation of early prototype tools.
- Future work could test strategy effectiveness on large-scale user data, particularly regarding automatic fallback strategies.
Research Questions / Practical Problems
Question signals indexed for this paper.
Research Questions
3- What main difficulties do users encounter when programming with generative language models through natural language?Category: Coding Assistants and Multi-Turn Code SupportSimilar questionsarrow_forward
- How do users adjust input strategies to improve usability of generated code?Category: Coding Assistants and Multi-Turn Code SupportSimilar questionsarrow_forward
- Can generative language models effectively support users in complex programming tasks through dynamic prompting?Category: Coding Assistants and Multi-Turn Code SupportSimilar questionsarrow_forward
Practical Problems
1- When generating code with natural language, programmers spend time trial-and-erroring syntax and debugging.Category: Coding Assistants and Multi-Turn Code SupportSimilar questionsarrow_forward
- 100%
"What It Wants Me To Say": Bridging the Abstraction Gap Between End-User Programmers and Code-Generating Large Language Models
CHI '23· Generative AI (Text, Image, Music, Video) +1
- 100%
D-Twins: Your Digital Twin Designed for Real-Time Boredom Intervention
CHI '25· Generative AI (Text, Image, Music, Video) +1
- 100%
Take It, Leave It, or Fix It: Measuring Productivity and Trust in Human-AI Collaboration
IUI '24· Generative AI (Text, Image, Music, Video) +1
- 80%
Method for Exploring Generative Adversarial Networks (GANs) via Automatically Generated Image Galleries
CHI '21· Generative AI (Text, Image, Music, Video) +2
- 80%
MUD: Towards a Large-Scale and Noise-Filtered UI Dataset for Modern Style UI Modeling
CHI '24· Generative AI (Text, Image, Music, Video) +1
- 80%
Ivie: Lightweight Anchored Explanations of Just-Generated Code
CHI '24· Generative AI (Text, Image, Music, Video) +2
- 80%
Generative AI Uses and Risks for Knowledge Workers in a Science Organization
CHI '25· Generative AI (Text, Image, Music, Video) +2
- 80%
How the Role of Generative AI Shapes Perceptions of Value in Human-AI Collaborative Work
CHI '25· Generative AI (Text, Image, Music, Video) +1
- 80%
Exploring Empty Spaces: Human-in-the-Loop Data Augmentation
CHI '25· Generative AI (Text, Image, Music, Video) +2
- 80%
GenComUI: Exploring Generative Visual Aids as Medium to Support Task-Oriented Human-Robot Communication
CHI '25· Generative AI (Text, Image, Music, Video) +2
Based on Jaccard similarity of research subtopics & professions (≥60%)