BISCUIT: Scaffolding LLM-Generated Code with Ephemeral UIs in Computational Notebooks

Ruijia Cheng, Titus Barik, Alan Leung, Fred Hohman, Jeffrey Nichols

Introduction

While Large Language Models (LLMs) have revolutionized code generation, the "prompt-to-code" workflow in computational notebooks often lacks transparency and interactivity. Users, particularly novices, frequently treat generated code as a "black box," struggling to understand parameter choices or logic. Iterating on code via text prompts can also be cumbersome, requiring repetitive "prompt engineering" for minor adjustments like visualization colors or model hyperparameters. BISCUIT (Building Interactive Scaffolding for Code Understanding In Tutorials) addresses these challenges by introducing "ephemeral UIs"—dynamically generated, temporary interfaces that act as a bridge between natural language prompts and executable code.

The BISCUIT System

BISCUIT is implemented as a JupyterLab extension that inserts an interactive UI-centric step into the code generation pipeline. The system utilizes a multi-agent LLM architecture (GPT-4-turbo and GPT-3.5-turbo) to process user requests.

The workflow consists of four primary stages:

  1. User Request: The user enters a natural language intent into a specialized %prompt cell.
  2. UI Generation: A "UI Planner" and "UI Coder" agent generate an ephemeral interface in a side panel using the Gradio library. This UI is tailored to the specific request and the notebook's context.
  3. User Interaction: The user adjusts parameters via interactive widgets like sliders, dropdowns, and color pickers.
  4. Code Injection: Upon submission, a "Code Injector" agent generates and inserts the final Python code into the notebook, reflecting the user's UI selections.
The BISCUIT workflow: from user prompt to ephemeral UI interaction and final code injection.

User Study and Evaluation

The researchers evaluated BISCUIT through a user study with 10 participants, ranging from novices to experienced Python programmers. The study utilized two machine learning tutorials adapted from Kaggle: predicting hotel cancellations (binary classification) and distinguishing between images of cars and trucks (image classification).

Examples of dynamically generated ephemeral UIs for different tasks: (A) image gallery selection, (B) model architecture configuration, and (C) visualization customization.

The evaluation yielded highly positive results:

  • 80% of participants found the tool useful for ML tutorials.
  • 70% agreed it enhanced their understanding of the code examples.
  • 90% reported increased efficiency, as the embedded UI maintained their workflow and reduced the need for external documentation searches.

Discussion and Insights

The study revealed several key benefits of ephemeral UIs:

  • Visual Scaffolding: Representing variables as UI elements (e.g., a slider for "Number of Layers") helped users connect abstract machine learning concepts to concrete code implementations.
  • Reduced Cognitive Load: The UI serves as a template, allowing users to select options rather than recalling complex syntax, thereby minimizing the need for extensive prompt engineering.
  • Exploratory "Playground": Participants felt more comfortable experimenting within the UI than directly manipulating code, which often felt "definitive and fragile."

Conclusion and Future Work

BISCUIT demonstrates that ephemeral UIs can significantly improve the experience of using LLMs for code generation in exploratory environments like notebooks. However, the system's performance is tied to LLM reliability, and current limitations include the lack of real-time "previews" before code execution. Future work will focus on creating tighter feedback loops and expanding the library of available UI components to support more complex engineering tasks.

Summary updated

BibTeX
@inproceedings{cheng2024biscuit,
  author = {Ruijia Cheng and Titus Barik and Alan Leung and Fred Hohman and Jeffrey Nichols},
  title = {{BISCUIT: Scaffolding LLM-Generated Code with Ephemeral UIs in Computational Notebooks}},
  booktitle = {VL/HCC},
  year = {2024},
  doi = {10.1109/vl/hcc60511.2024.00012},
}
Figure