Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Lee, Celine, Mahmoud, Abdulrahman, Kurek, Michal, Campanoni, Simone, Brooks, David, Chong, Stephen, Wei, Gu-Yeon, Rush, Alexander M.
Format: Preprint
Veröffentlicht: 2023
Schlagworte:
Online-Zugang:https://arxiv.org/abs/2309.14396
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866929276987637760
author Lee, Celine
Mahmoud, Abdulrahman
Kurek, Michal
Campanoni, Simone
Brooks, David
Chong, Stephen
Wei, Gu-Yeon
Rush, Alexander M.
author_facet Lee, Celine
Mahmoud, Abdulrahman
Kurek, Michal
Campanoni, Simone
Brooks, David
Chong, Stephen
Wei, Gu-Yeon
Rush, Alexander M.
contents Maintaining legacy software requires many software and systems engineering hours. Assembly code programs, which demand low-level control over the computer machine state and have no variable names, are particularly difficult for humans to analyze. Existing conventional program translators guarantee correctness, but are hand-engineered for the source and target programming languages in question. Learned transpilation, i.e. automatic translation of code, offers an alternative to manual re-writing and engineering efforts. Automated symbolic program translation approaches guarantee correctness but struggle to scale to longer programs due to the exponentially large search space. Their rigid rule-based systems also limit their expressivity, so they can only reason about a reduced space of programs. Probabilistic neural language models (LMs) produce plausible outputs for every input, but do so at the cost of guaranteed correctness. In this work, we leverage the strengths of LMs and symbolic solvers in a neurosymbolic approach to learned transpilation for assembly code. Assembly code is an appropriate setting for a neurosymbolic approach, since assembly code can be divided into shorter non-branching basic blocks amenable to the use of symbolic methods. Guess & Sketch extracts alignment and confidence information from features of the LM then passes it to a symbolic solver to resolve semantic equivalence of the transpilation input and output. We test Guess & Sketch on three different test sets of assembly transpilation tasks, varying in difficulty, and show that it successfully transpiles 57.6% more examples than GPT-4 and 39.6% more examples than an engineered transpiler. We also share a training and evaluation dataset for this task.
format Preprint
id arxiv_https___arxiv_org_abs_2309_14396
institution arXiv
publishDate 2023
record_format arxiv
spellingShingle Guess & Sketch: Language Model Guided Transpilation
Lee, Celine
Mahmoud, Abdulrahman
Kurek, Michal
Campanoni, Simone
Brooks, David
Chong, Stephen
Wei, Gu-Yeon
Rush, Alexander M.
Software Engineering
Machine Learning
Programming Languages
Maintaining legacy software requires many software and systems engineering hours. Assembly code programs, which demand low-level control over the computer machine state and have no variable names, are particularly difficult for humans to analyze. Existing conventional program translators guarantee correctness, but are hand-engineered for the source and target programming languages in question. Learned transpilation, i.e. automatic translation of code, offers an alternative to manual re-writing and engineering efforts. Automated symbolic program translation approaches guarantee correctness but struggle to scale to longer programs due to the exponentially large search space. Their rigid rule-based systems also limit their expressivity, so they can only reason about a reduced space of programs. Probabilistic neural language models (LMs) produce plausible outputs for every input, but do so at the cost of guaranteed correctness. In this work, we leverage the strengths of LMs and symbolic solvers in a neurosymbolic approach to learned transpilation for assembly code. Assembly code is an appropriate setting for a neurosymbolic approach, since assembly code can be divided into shorter non-branching basic blocks amenable to the use of symbolic methods. Guess & Sketch extracts alignment and confidence information from features of the LM then passes it to a symbolic solver to resolve semantic equivalence of the transpilation input and output. We test Guess & Sketch on three different test sets of assembly transpilation tasks, varying in difficulty, and show that it successfully transpiles 57.6% more examples than GPT-4 and 39.6% more examples than an engineered transpiler. We also share a training and evaluation dataset for this task.
title Guess & Sketch: Language Model Guided Transpilation
topic Software Engineering
Machine Learning
Programming Languages
url https://arxiv.org/abs/2309.14396