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 View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

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

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 2 code samples harvested from 1 repository linked to this paper: 2 ran (of which 0 constructed an object rather than computing a result; 1 with no instrument failure: 0 honoured, 1 violated, 0 with no contract checked; 1 where Syntology's instrument failed) · 0 unverified. Where Syntology's instrument failed: 1 where our contract draft was wrong; failures of Syntology's instrument, not of the code.

By repository: official repository: 2 samples from 1 repository, 2 ran (1 with no instrument failure; 1 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Levels written on 2026-09-22 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

gonglinyuan/safim officialmentioned in papermentioned on GitHubpytorchSyntology: 2 samples, 2 ran (1 instrument-failed) · 0 unverified 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 (of which 0 constructed an object rather than computing a result; 1 with no instrument failure: 0 honoured, 1 violated, 0 with no contract checked; 1 where Syntology's instrument failed) · 0 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page has not changed since , the first build that kept a record date for it; when this build read Syntology's graph is in the build record. That date is 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. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (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 are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. 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 six 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; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. 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.

gonglinyuan/safim official repository 2 samples, 2 ran (1 instrument-failed) · 0 unverified
function_calls_match evaluate.py ran · violated contract MIT (permissive) · bc0bc2eea87dea80 · report fixture: signature call1:Call/0/?, call2:Call/0/? · returned bool · level recorded 2026-09-22
get_function_call_params evaluate.py ran · our draft was wrong MIT (permissive) · 90e1dbbafc80af72 · report fixture: signature node:Call/0/? · returned tuple · level recorded 2026-09-22

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