On the Generalizability of Transformer Models to Code Completions of Different Lengths
Nathan Cooper, Rosalia Tufano, Gabriele Bavota, Denys Poshyvanyk

TL;DR
This study investigates whether large language models for code can generalize to input lengths not seen during training, finding that current encoding schemes do not support such generalization and emphasizing the importance of training data diversity.
Contribution
The paper provides a comprehensive empirical evaluation of length generalization in encoder-decoder LLMs for code, comparing multiple encoding schemes and highlighting the need for representative training data.
Findings
None of the evaluated encoding schemes generalize well to unseen lengths.
Ensuring training data includes all relevant lengths is crucial for reliable performance.
Current solutions like Sinusoidal, xPOS, ALiBi, and T5 are insufficient for length generalization.
Abstract
The programming landscape is nowadays being reshaped by the advent of Large Language Models (LLMs) able to automate code-related tasks related to code implementation (e.g., code completion) and comprehension (e.g., code summarization). Such a paradigm shift comes with a number of implications related to how software will be written, maintained, and evolved. Also, these LLMs are extremely expensive to train, posing questions on their sustainability over time. Given their training cost, their ability to generalize, namely their ability to work on task instances different from those on which they have been trained, is an aspect worth being investigated. Previous work already showed that transformer models can successfully support code completion in a cross-project setting. However, it is unclear whether LLM are able to generalize to inputs having lengths not seen during training. For…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsNeural Networks and Applications · Power Transformer Diagnostics and Insulation · Advanced Electrical Measurement Techniques
