使用大型语言模型在交互式机器学习笔记本中建议代码编辑
Suggesting Code Edits in Interactive Machine Learning Notebooks Using Large Language Models
AI总结:
本文构建首个含48,398项Jupyter编辑的数据集,评估LLM预测代码修改,发现编辑高度局部但模型准确率低,凸显上下文的重要性。
摘要:
机器学习开发者经常使用交互式计算笔记本(例如 Jupyter notebooks)来承载数据处理和模型训练代码。Jupyter notebooks 为编写机器学习流水线并交互式观察输出提供了便利工具;然而,由于笔记本的长度和复杂性,维护 Jupyter notebooks(例如添加新功能或修复缺陷)可能具有挑战性。此外,目前还没有与开发者在 Jupyter notebooks 上的编辑相关的基准。为解决这一问题,我们提出了首个包含 48,398 个 Jupyter notebook 编辑的数据集,这些编辑来自 GitHub 上 792 个机器学习仓库的 20,095 次修订,并开展了首个使用 LLM 预测 Jupyter notebook 中代码编辑的研究。我们的数据集捕获了单元级和行级修改的细粒度细节,为理解机器学习工作流中的真实维护模式提供了基础。我们观察到,Jupyter notebooks 上的编辑高度局部化,仓库中的变更平均仅涉及 166 行代码。尽管较大模型在代码编辑方面优于较小模型,但即使经过微调,所有模型在我们的数据集上准确率仍然很低,这表明真实世界机器学习维护任务具有复杂性。我们的发现强调了上下文信息在提升模型性能方面的关键作用,并指出了推进大型语言模型在工程化机器学习代码方面能力的有前景方向。
英文摘要:
Machine learning developers frequently use interactive computational notebooks, such as Jupyter notebooks, to host code for data processing and model training. Jupyter notebooks provide a convenient tool for writing machine learning pipelines and interactively observing outputs, however, maintaining Jupyter notebooks, e.g., to add new features or fix bugs, can be challenging due to the length and complexity of the notebooks. Moreover, there is no existing benchmark related to developer edits on Jupyter notebooks. To address this, we present the first dataset of 48,398 Jupyter notebook edits derived from 20,095 revisions of 792 machine learning repositories on GitHub, and perform the first study of the using LLMs to predict code edits in Jupyter notebooks. Our dataset captures granular details of cell-level and line-level modifications, offering a foundation for understanding real-world maintenance patterns in machine learning workflows. We observed that the edits on Jupyter notebooks are highly localized, with changes averaging only 166 lines of code in repositories. While larger models outperform smaller counterparts in code editing, all models have low accuracy on our dataset even after finetuning, demonstrating the complexity of real-world machine learning maintenance tasks. Our findings emphasize the critical role of contextual information in improving model performance and point toward promising avenues for advancing large language models' capabilities in engineering machine learning code.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。