[Paper Review] JuICe: A Large Scale Distantly Supervised Dataset for Open Domain Context-based Code Generation
This paper introduces JuICe, a large-scale, distantly supervised dataset of 1.5 million Jupyter notebook examples for open-domain, context-based code generation, using curated nbgrader notebooks for high-quality evaluation. Experiments show that both context length and training data size significantly improve model performance, with strong gains from distant supervision, though current models still struggle with complex reasoning and long-context dependencies.
Interactive programming with interleaved code snippet cells and natural language markdown is recently gaining popularity in the form of Jupyter notebooks, which accelerate prototyping and collaboration. To study code generation conditioned on a long context history, we present JuICe, a corpus of 1.5 million examples with a curated test set of 3.7K instances based on online programming assignments. Compared with existing contextual code generation datasets, JuICe provides refined human-curated data, open-domain code, and an order of magnitude more training data. Using JuICe, we train models for two tasks: (1) generation of the API call sequence in a code cell, and (2) full code cell generation, both conditioned on the NL-Code history up to a particular code cell. Experiments using current baseline code generation models show that both context and distant supervision aid in generation, and that the dataset is challenging for current systems.
Motivation & Objective
- To address the lack of large-scale, high-quality datasets for open-domain, context-based code generation in interactive computing environments like Jupyter notebooks.
- To enable research on code generation conditioned on interleaved natural language and code history, a setting not well-supported by existing datasets.
- To provide a benchmark with a curated test set derived from real programming assignments to ensure reliable evaluation of code generation models.
- To investigate the impact of context length and training data size on model performance for two code generation tasks: API sequence and full code generation.
Proposed method
- The dataset JuICe is constructed from 659K publicly available GitHub Jupyter notebooks, with target code cells paired with prior NL and code context.
- A curated test set of 3,718 instances is extracted from 13,905 nbgrader notebooks, which contain instructor-created assignments with blank code cells for student solutions.
- Two tasks are defined: (1) generating the sequence of API calls needed to achieve a goal, and (2) generating a complete, executable code cell.
- Neural sequence-to-sequence models, including LSTMs and retrieval baselines, are trained and evaluated on both tasks using varying context lengths and training data sizes.
- Performance is measured using exact match (EM), BLEU, precision, and recall, with human evaluation estimating performance upper bounds.
- Error analysis is performed on 50 model predictions to identify failure modes such as misinterpreting intent, missing arguments, or failing to reason over long contexts.
Experimental results
Research questions
- RQ1How does increasing the amount of training data affect performance in context-based code generation?
- RQ2To what extent does incorporating longer sequences of prior NL and code context improve code generation accuracy?
- RQ3How do current neural models perform on open-domain, interactive code generation compared to retrieval baselines?
- RQ4What are the main failure modes of current models when generating code conditioned on long contextual histories?
- RQ5What is the upper bound of performance for code generation in this setting, as estimated by human annotators?
Key findings
- Performance on both code generation and API sequence tasks improves significantly with more training data, peaking around 200K examples before plateauing.
- Increasing context length improves model performance up to three prior cells, after which performance plateaus due to difficulty in reasoning over longer sequences.
- The best-performing LSTM model, trained on 1.5 million examples with a context length of 3, achieves 23% EM and 60% BLEU on the test set for full code generation.
- The retrieval baseline, despite access to the full context, underperforms neural models by over 2% BLEU, indicating that models must reason beyond retrieval to generate correct code.
- Human performance is estimated at 60% BLEU and 23% EM for code generation, suggesting significant room for improvement over current models.
- Over 30% of model errors stem from misinterpreting the core intent of the NL instruction, highlighting challenges in contextual reasoning and semantic understanding.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.