ChatPaper.aiChatPaper

Statisch contextualiseren van grote taalmodellen met getypeerde gaten

Statically Contextualizing Large Language Models with Typed Holes

September 2, 2024
Auteurs: Andrew Blinn, Xiang Li, June Hyung Kim, Cyrus Omar
cs.AI

Samenvatting

Grote taalmodellen (LLM's) hebben het landschap van programsynthese hervormd. Hedendaagse LLM-gebaseerde codecompleteringssystemen produceren echter vaak gebroken code door hallucinatie, omdat ze niet over de juiste context beschikken. Dit is met name het geval bij het werken met definities die niet in de trainingsdata staan en niet in de buurt van de cursor zijn. Dit artikel toont aan dat een nauwe integratie met de type- en bindingsstructuur van een programmeertaal, zoals blootgelegd door zijn taalserver, dit contextualiseringsprobleem op een token-efficiënte manier kan aanpakken. Kortom, wij stellen dat AI's ook IDE's nodig hebben! In het bijzonder integreren we LLM-codegeneratie in de Hazel live programmeerschetsomgeving. De Hazel Language Server identificeert het type en de typeringscontext van het in te vullen gat, zelfs in de aanwezigheid van fouten, waardoor altijd een betekenisvolle programma-schets beschikbaar is. Hierdoor kan worden geprompt met contextuele informatie uit de gehele codebase die niet lexicaal lokaal is ten opzichte van de cursor, noch noodzakelijkerwijs in hetzelfde bestand staat, maar die waarschijnlijk semantisch lokaal is ten opzichte van het doel van de ontwikkelaar. Door de LLM gesynthetiseerde aanvullingen worden vervolgens iteratief verfijnd via verdere dialoog met de taalserver. Om deze technieken te evalueren, introduceren we MVUBench, een dataset van model-view-update (MVU) webapplicaties. Deze applicaties dienen als uitdagende problemen vanwege hun afhankelijkheid van applicatiespecifieke datastructuren. Wij constateren dat contextualisering met typedefinities bijzonder effectief is. Na het introduceren van onze ideeën in de context van Hazel, repliceren we onze technieken en porten we MVUBench naar TypeScript om de toepasbaarheid van deze methoden op talen met meer middelen te valideren. Ten slotte schetsen we ChatLSP, een conservatieve uitbreiding van het Language Server Protocol (LSP) die taalservers kunnen implementeren om capaciteiten bloot te leggen die AI-codecompleteringssystemen van verschillende ontwerpen kunnen gebruiken om statische context op te nemen bij het genereren van prompts voor een LLM.
English
Large language models (LLMs) have reshaped the landscape of program synthesis. However, contemporary LLM-based code completion systems often hallucinate broken code because they lack appropriate context, particularly when working with definitions not in the training data nor near the cursor. This paper demonstrates that tight integration with the type and binding structure of a language, as exposed by its language server, can address this contextualization problem in a token-efficient manner. In short, we contend that AIs need IDEs, too! In particular, we integrate LLM code generation into the Hazel live program sketching environment. The Hazel Language Server identifies the type and typing context of the hole being filled, even in the presence of errors, ensuring that a meaningful program sketch is always available. This allows prompting with codebase-wide contextual information not lexically local to the cursor, nor necessarily in the same file, but that is likely to be semantically local to the developer's goal. Completions synthesized by the LLM are then iteratively refined via further dialog with the language server. To evaluate these techniques, we introduce MVUBench, a dataset of model-view-update (MVU) web applications. These applications serve as challenge problems due to their reliance on application-specific data structures. We find that contextualization with type definitions is particularly impactful. After introducing our ideas in the context of Hazel we duplicate our techniques and port MVUBench to TypeScript in order to validate the applicability of these methods to higher-resource languages. Finally, we outline ChatLSP, a conservative extension to the Language Server Protocol (LSP) that language servers can implement to expose capabilities that AI code completion systems of various designs can use to incorporate static context when generating prompts for an LLM.
PDF42November 14, 2024