Type Prediction With Program Decomposition and Fill-in-the-Type Training

Federico Cassano, Ming-Ho Yee, Noah Shinn, Arjun Guha, Steven Holtzen
5/25/2023
cs.SEcs.LGcs.PL

Official code: GammaTauAI/opentau (112 stars, Apache-2.0, Rust, last commit 2023-12-10).

Abstract

TypeScript and Python are two programming languages that support optional type annotations, which are useful but tedious to introduce and maintain. This has motivated automated type prediction: given an untyped program, produce a well-typed output program. Large language models (LLMs) are promising for type prediction, but there are challenges: fill-in-the-middle performs poorly, programs may not fit into the context window, generated types may not type check, and it is difficult to measure how well-typed the output program is. We address these challenges by building OpenTau, a search-based approach for type prediction that leverages large language models. We propose a new metric for type prediction quality, give a tree-based program decomposition that searches a space of generated types, and present fill-in-the-type fine-tuning for LLMs. We evaluate our work with a new dataset for TypeScript type prediction, and show that 47.4% of files type check (14.5% absolute improvement) with an overall rate of 3.3 type errors per file. All code, data, and models are available at: https://github.com/GammaTauAI/opentau.

View on arXivView PDF

Code Implementations(1)

GammaTauAI/opentauOfficial100%
RustApache-2.0

Using Large Language Models for Repo-wide Type Prediction

1127HTML, RustSep 2, 20222 years agoApache-2.0
aillmopenairusttype-inference+1 more

Cite this paper

@article{cassano2023type,
  title  = {Type Prediction With Program Decomposition and Fill-in-the-Type Training},
  author = {Federico Cassano and Ming-Ho Yee and Noah Shinn and Arjun Guha and Steven Holtzen},
  year   = {2023},
  eprint = {2305.17145},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2305.17145v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2305.17145.svg)](https://codeofpaper.com/paper/2305.17145)

Discussion