Code Shaping: Iterative Code Editing with Free-form AI-Interpreted Sketching

Best Paper
Generative AI (Text, Image, Music, Video)Human-LLM CollaborationAI-Assisted Creative WritingSoftware Engineers & DevelopersAI/ML Researchers & Engineers

Research Background and Problem

  • What problems or challenges did the authors identify?

    1. Current programming is predominantly text-centric, with hand-drawn sketches often relegated to auxiliary roles. This forces programmers to frequently switch between sketching and coding, potentially losing critical ideas in the process.
    2. There is a lack of clear interaction mechanisms between hand-drawn sketches and code modifications, which hinders programmers' cognitive flow and workflows.
    3. Existing sketch-based code generation systems are typically designed for non-programmers, and the generated code is often not directly editable, limiting their applicability to advanced programming tasks.
    4. The ambiguity and polysemy of hand-drawn sketches make it difficult for systems to interpret user intent, and iterative corrections of these unclear interpretations may further disrupt the coding process.
  • Why is this problem important? Programming tasks often require programmers to express complex ideas through sketches or abstract forms, yet there is currently no simple and efficient tool that directly links freehand sketches with real-time code editing. Addressing this issue could reduce cognitive load for programmers and improve development efficiency.

  • Research Motivation and Related Work

    1. The evolution of programming—from handwritten notes and typewriter input to modern text editors—has seen significant advancements, but remains predominantly text-input-based.
    2. Existing research on sketch-to-code systems (e.g., SILK, DENIM) focuses on early-stage prototyping or UI generation, emphasizing functionality rather than the role of sketches as interactive media.
    3. Recent developments in multimodal input technologies, such as voice and gestures, combined with large language models (LLMs), have expanded the possibilities for code generation, sparking interest in exploring sketches as a direct and flexible input modality.

Solution

  • What methods or solutions did the authors propose? The authors proposed a novel programming interaction paradigm—Code Shaping, which enables developers to directly draw freeform sketches on the code layer and output layer to guide AI models in modifying code structure and functionality.

  • What are the innovative aspects of this solution?

    1. Integration of sketches and code editing: Combines hand-drawn sketches with code modifications, making sketches not just static external representations but dynamic interactive media.
    2. Support for multi-level abstraction: Allows programmers to express intent at different abstraction levels (e.g., flowcharts, pseudocode, or natural language) and uses AI to translate sketches into specific code changes.
    3. Real-time iterative improvement: Facilitates iterative adjustments of sketches and AI feedback, reducing the rigidity of direct text-based coding workflows.
    4. Error recovery mechanisms: Incorporates transparent explanations and strategies for correcting errors in generated code.
  • What are the implementation steps and key technologies used?

    1. User Interface Design:
      • Overlay a drawing layer on the code editor, allowing users to freely draw arrows, annotations, pseudocode, and other sketches, with real-time reflections in code modifications.
      • Include functional buttons (e.g., “Generate,” “Run,” and “Submit”) to enable sketch-to-code interaction.
    2. Artificial Intelligence Interpretation:
      • Leverage the GPT-4 model to jointly analyze sketches, code context, and generation history.
      • Utilize abstract syntax tree (AST) analysis to dynamically identify affected code regions and provide visual feedback (e.g., annotation lines, code highlights).
    3. Iterative Workflow:
      • Users express intent through sketches, the model interprets the intent and generates code—users review, modify sketches or results, forming a continuous optimization feedback loop.
    4. Exploring Transparency and Controllability:
      • Add an Always-On Feedforward Interpretation mechanism to help users understand and control the generation process.

Research Outcomes

  • What specific outcomes were achieved?

    1. Validated the feasibility of Code Shaping as an interaction paradigm, enabling programmers to define functionality or adjust structures through sketches and directly interact with code views.
    2. Categorized types of sketches used by programmers (e.g., functional, procedural, goal-oriented) and their distribution across abstraction-concreteness and semantic-syntax levels.
    3. Demonstrated significant improvement in user satisfaction through multi-stage studies (UMUX-LITE increased from an initial 60.82 to 82.48).
    4. Explored strategies programmers use to handle AI errors, such as adjusting sketches, annotations, and directly modifying code to recover from errors.
  • What advantages does it have compared to existing solutions?

    1. Combination of directness and flexibility: Compared to methods that generate code through text or predefined GUIs, sketches offer a more freeform and intuitive way of expression.
    2. Enhanced error recovery support: Iterative design with “visible intent explanations before generation” and bidirectional sketch modifications reduced frustration caused by misinterpretations.
    3. Integration of multiple code editing methods: Seamless integration between traditional code editing and sketch-based correction workflows received positive user feedback.
  • What were the experimental or evaluation results?

    1. In a three-stage experiment involving 18 programmers solving real-world programming tasks in Python:
      • Found that 23.2% of generated results required iterative adjustments.
      • After system improvements, generation usage and accuracy significantly increased, and users became more receptive to the system (UMUX-LITE: Stage 2 66.23 → Stage 3 82.48).
    2. In the third stage, approximately one-third of users significantly reduced keyboard usage, relying solely on sketches to complete programming workflows.
    3. Users actively adopted flexible sketching methods across different tasks, showcasing the versatility of sketches (e.g., arrows used for semantic constraints, parameter annotations, etc.).
  • Limitations and Future Directions

    1. Alignment challenges between hand-drawn sketches and code syntax: Ambiguous sketch expressions still limit interpretive AI performance in certain tasks, such as fine-grained code operations.
    2. Adaptability to large-scale codebases: Current system support for multi-file and large codebases needs enhancement, such as through incremental syntax analysis or cross-file dependency management.
    3. Impact of long-term usage: Future research should explore the effects of Code Shaping on programmer efficiency, code quality, and long-term maintainability.
    4. Technical scalability issues: The system’s applicability to other programming languages and frameworks needs verification.

This paper provides a new perspective on programming interaction paradigms. Code Shaping successfully integrates sketches with real-time code editing, laying a solid technical and tool foundation for future research and design.

Quick Actions

Share

Share this page

ios_share

https://hci.top/en/papers/chi/189580/2025

AdRecommended

Learn AI Coding at CodeNow

open_in_newOpen DOI Link
DOI: https://dl.acm.org/doi/10.1145/3706598.3713822
At a Glance

Paper Snapshot

fact_check
dataset
Source
CHI
calendar_month
Year
2025
emoji_events
Award
Best Paper
group
Authors
3 authors
sell
Subtopics
Generative AI (Text, Image, Music, Video), Human-LLM Collaboration, AI-Assisted Creative Writing
work
Professions
Software Engineers & Developers, AI/ML Researchers & Engineers
article
Content Status
Full text indexed
hub
Related Papers
10 related papers