整行代码补全:将 AI 带到桌面端
Full Line Code Completion: Bringing AI to Desktop
AI总结:
本文介绍面向 JetBrains IntelliJ 平台的本地多 token 整行代码补全方案 Full Line Code Completion,通过轻量安全的端侧模型与离线、在线评估实现落地,并使 Python 补全生成代码量提升至 1.3 倍。
摘要:
近年来,针对多 token 代码补全问题出现了若干工业级解决方案,每一种都在该领域取得了重大进展,但大多聚焦于基于云的运行时,并避免在终端用户的设备上运行。在本工作中,我们描述了为 JetBrains 的 IntelliJ 平台构建多 token 代码补全功能的方法,我们将其称为 Full Line Code Completion。该功能仅建议语法正确的代码,并且完全在本地运行,即数据查询和建议生成都发生在终端用户的机器上。我们分享了代码补全引擎应当满足的重要时间与内存消耗限制,以及设计原则。由于完全在终端用户设备上工作,我们的代码补全引擎不仅快速、紧凑,而且安全,同时丰富了用户体验。我们分享了许多用于满足所述开发约束的实用技术,并描述了使我们能够做出更好决策的离线和在线评估流程。我们的在线评估表明,使用该工具后,IDE 中由代码补全生成的 Python 代码量增加到原来的 1.3 倍。所描述的解决方案最初是在研究人员的帮助下启动的,随后被集成到所有 JetBrains IDE 中,如今已被数百万用户使用。因此,我们认为本工作有助于弥合学术界与工业界之间的鸿沟,让研究人员了解当复杂的研究型解决方案被集成到真实产品中时会发生什么。
英文摘要:
In recent years, several industrial solutions for the problem of multi-token code completion appeared, each making a great advance in the area but mostly focusing on cloud-based runtime and avoiding working on the end user's device. In this work, we describe our approach for building a multi-token code completion feature for the JetBrains' IntelliJ Platform, which we call Full Line Code Completion. The feature suggests only syntactically correct code and works fully locally, i.e., data querying and the generation of suggestions happens on the end user's machine. We share important time and memory-consumption restrictions, as well as design principles that a code completion engine should satisfy. Working entirely on the end user's device, our code completion engine enriches user experience while being not only fast and compact but also secure. We share a number of useful techniques to meet the stated development constraints and also describe offline and online evaluation pipelines that allowed us to make better decisions. Our online evaluation shows that the usage of the tool leads to 1.3 times more Python code in the IDE being produced by code completion. The described solution was initially started with a help of researchers and was then bundled into all JetBrains IDEs where it is now used by millions of users. Thus, we believe that this work is useful for bridging academia and industry, providing researchers with the knowledge of what happens when complex research-based solutions are integrated into real products.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。