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

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

7 Mar 2024arXiv:2403.04814archive 2025-07-28

Linyuan Gong, Sida Wang, Mostafa Elhoushi, Alvin Cheung

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.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2403.04814")

Code

Syntology Ran 2 of 2 code samples harvested from 1 repository linked to this paper; 0 have no recorded run. Of those that ran: 1 ran · violated contract; 1 ran · our draft was wrong.

By repository: official repository: 2 samples from 1 repository, 2 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

gonglinyuan/safim officialmentioned in papermentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

2 samples harvested; 2 ran; 0 honoured the contract we drafted; 0 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · violated contract
1ran · our draft was wrong

Licence: 0 of the 2 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from gonglinyuan/safim. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

function_calls_match gonglinyuan/safim/evaluate.py official repository ran · violated contract MIT (permissive) · bc0bc2eea87dea80 · report
get_function_call_params gonglinyuan/safim/evaluate.py official repository ran · our draft was wrong MIT (permissive) · 90e1dbbafc80af72 · report

Tasks

Code Completion

Datasets

Introduced by this paper, per the archive.

SAFIM

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Code Completion SAFIM deepseek-coder-33b-base API 75.16 #1 of 15 Archive leaderboard report
Code Completion SAFIM deepseek-coder-33b-base Algorithmic 60.78 #1 of 15 Archive leaderboard report
Code Completion SAFIM deepseek-coder-33b-base Average 69.01 #1 of 15 Archive leaderboard report
Code Completion SAFIM deepseek-coder-33b-base Control 71.10 #1 of 15 Archive leaderboard report
Code Completion SAFIM deepseek-coder-6.7b-base API 69.68 #2 of 15 Archive leaderboard report
Code Completion SAFIM deepseek-coder-6.7b-base Algorithmic 54.74 #2 of 15 Archive leaderboard report
Code Completion SAFIM deepseek-coder-6.7b-base Average 63.40 #2 of 15 Archive leaderboard report
Code Completion SAFIM deepseek-coder-6.7b-base Control 65.79 #2 of 15 Archive leaderboard report
Code Completion SAFIM starcoderbase API 68.06 #3 of 15 Archive leaderboard report
Code Completion SAFIM starcoderbase Algorithmic 44.11 #3 of 15 Archive leaderboard report
Code Completion SAFIM starcoderbase Average 55.54 #3 of 15 Archive leaderboard report
Code Completion SAFIM starcoderbase Control 54.46 #3 of 15 Archive leaderboard report
Code Completion SAFIM gpt-4-1106-preview API 62.58 #4 of 15 Archive leaderboard report
Code Completion SAFIM gpt-4-1106-preview Algorithmic 42.11 #4 of 15 Archive leaderboard report
Code Completion SAFIM gpt-4-1106-preview Average 53.28 #4 of 15 Archive leaderboard report
Code Completion SAFIM gpt-4-1106-preview Control 55.15 #4 of 15 Archive leaderboard report
Code Completion SAFIM CodeLlama-13b-hf API 59.68 #5 of 15 Archive leaderboard report
Code Completion SAFIM CodeLlama-13b-hf Algorithmic 41.41 #5 of 15 Archive leaderboard report
Code Completion SAFIM CodeLlama-13b-hf Average 52.78 #5 of 15 Archive leaderboard report
Code Completion SAFIM CodeLlama-13b-hf Control 57.25 #5 of 15 Archive leaderboard report
Code Completion SAFIM deepseek-coder-1.3b-base API 62.58 #6 of 15 Archive leaderboard report
Code Completion SAFIM deepseek-coder-1.3b-base Algorithmic 41.20 #6 of 15 Archive leaderboard report
Code Completion SAFIM deepseek-coder-1.3b-base Average 52.63 #6 of 15 Archive leaderboard report
Code Completion SAFIM deepseek-coder-1.3b-base Control 54.10 #6 of 15 Archive leaderboard report
Code Completion SAFIM CodeLlama-34b-hf API 56.45 #7 of 15 Archive leaderboard report
Code Completion SAFIM CodeLlama-34b-hf Algorithmic 38.55 #7 of 15 Archive leaderboard report
Code Completion SAFIM CodeLlama-34b-hf Average 49.66 #7 of 15 Archive leaderboard report
Code Completion SAFIM CodeLlama-34b-hf Control 53.98 #7 of 15 Archive leaderboard report
Code Completion SAFIM CodeLlama-7b-hf API 46.77 #8 of 15 Archive leaderboard report
Code Completion SAFIM CodeLlama-7b-hf Algorithmic 34.68 #8 of 15 Archive leaderboard report
Code Completion SAFIM CodeLlama-7b-hf Average 45.00 #8 of 15 Archive leaderboard report
Code Completion SAFIM CodeLlama-7b-hf Control 53.56 #8 of 15 Archive leaderboard report
Code Completion SAFIM gpt-3.5-turbo-0301 API 53.87 #9 of 15 Archive leaderboard report
Code Completion SAFIM gpt-3.5-turbo-0301 Algorithmic 31.24 #9 of 15 Archive leaderboard report
Code Completion SAFIM gpt-3.5-turbo-0301 Average 40.86 #9 of 15 Archive leaderboard report
Code Completion SAFIM gpt-3.5-turbo-0301 Control 37.48 #9 of 15 Archive leaderboard report
Code Completion SAFIM incoder-6B API 48.06 #10 of 15 Archive leaderboard report
Code Completion SAFIM incoder-6B Algorithmic 25.16 #10 of 15 Archive leaderboard report
Code Completion SAFIM incoder-6B Average 33.79 #10 of 15 Archive leaderboard report
Code Completion SAFIM incoder-6B Control 28.16 #10 of 15 Archive leaderboard report
Code Completion SAFIM codegen-16B-multi API 31.29 #11 of 15 Archive leaderboard report
Code Completion SAFIM codegen-16B-multi Algorithmic 25.94 #11 of 15 Archive leaderboard report
Code Completion SAFIM codegen-16B-multi Average 30.99 #11 of 15 Archive leaderboard report
Code Completion SAFIM codegen-16B-multi Control 35.74 #11 of 15 Archive leaderboard report
Code Completion SAFIM codegen-2B-multi API 32.26 #12 of 15 Archive leaderboard report
Code Completion SAFIM codegen-2B-multi Algorithmic 23.49 #12 of 15 Archive leaderboard report
Code Completion SAFIM codegen-2B-multi Average 29.55 #12 of 15 Archive leaderboard report
Code Completion SAFIM codegen-2B-multi Control 32.89 #12 of 15 Archive leaderboard report
Code Completion SAFIM incoder-1B API 43.87 #13 of 15 Archive leaderboard report
Code Completion SAFIM incoder-1B Algorithmic 21.06 #13 of 15 Archive leaderboard report
Code Completion SAFIM incoder-1B Average 29.27 #13 of 15 Archive leaderboard report
Code Completion SAFIM incoder-1B Control 22.89 #13 of 15 Archive leaderboard report
Code Completion SAFIM codegen-6B-multi API 27.74 #14 of 15 Archive leaderboard report
Code Completion SAFIM codegen-6B-multi Algorithmic 23.60 #14 of 15 Archive leaderboard report
Code Completion SAFIM codegen-6B-multi Average 28.71 #14 of 15 Archive leaderboard report
Code Completion SAFIM codegen-6B-multi Control 34.80 #14 of 15 Archive leaderboard report
Code Completion SAFIM codegen-350M-multi API 26.45 #15 of 15 Archive leaderboard report
Code Completion SAFIM codegen-350M-multi Algorithmic 16.30 #15 of 15 Archive leaderboard report
Code Completion SAFIM codegen-350M-multi Average 22.94 #15 of 15 Archive leaderboard report
Code Completion SAFIM codegen-350M-multi Control 26.06 #15 of 15 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections