Evaluation of LLMs on Syntax-Aware Code Fill-in-the-Middle Tasks

Linyuan Gong, Sida Wang, Mostafa Elhoushi, Alvin Cheung
3/7/2024
cs.CLcs.AIcs.LG

Official code: gonglinyuan/safim (48 stars, MIT, last commit 2025-05-06).

Abstract

We introduce Syntax-Aware Fill-In-the-Middle (SAFIM), a new benchmark for evaluating Large Language Models (LLMs) on the code Fill-in-the-Middle (FIM) task. This benchmark focuses on syntax-aware completions of program structures such as code blocks and conditional expressions, and includes 17,720 examples from multiple programming languages, sourced from recent code submissions after April 2022 to minimize data contamination. SAFIM provides a robust framework with various prompt designs and novel syntax-aware post-processing techniques, facilitating accurate and fair comparisons across LLMs. Our comprehensive evaluation of 15 LLMs shows that FIM pretraining not only enhances FIM proficiency but also improves Left-to-Right (L2R) inference using LLMs. Our findings challenge conventional beliefs and suggest that pretraining methods and data quality have more impact than model size. SAFIM thus serves as a foundational platform for future research in effective pretraining strategies for code LLMs. The evaluation toolkit and dataset are available at https://github.com/gonglinyuan/safim, and the leaderboard is available at https://safimbenchmark.com.

View on arXivView PDF

Code Implementations(1)

gonglinyuan/safimOfficial100%
MIT
4811Shell, PythonFeb 2, 20241 years agoMIT

Similar Papers

Cite this paper

@article{gong2024evaluation,
  title  = {Evaluation of LLMs on Syntax-Aware Code Fill-in-the-Middle Tasks},
  author = {Linyuan Gong and Sida Wang and Mostafa Elhoushi and Alvin Cheung},
  year   = {2024},
  eprint = {2403.04814},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2403.04814v3},
  journal = {ICML 2024 2024}
}

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/2403.04814.svg)](https://codeofpaper.com/paper/2403.04814)

Discussion