{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/evaluation-of-llms-on-syntax-aware-code-fill","title":"Evaluation of LLMs on Syntax-Aware Code Fill-in-the-Middle Tasks","arxiv_id":"2403.04814","date":"2024-03-07","proceeding":null,"authors":["Linyuan Gong","Sida Wang","Mostafa Elhoushi","Alvin Cheung"],"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.","url_abs":"https://arxiv.org/abs/2403.04814v3","url_pdf":"https://arxiv.org/pdf/2403.04814v3.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"evaluation-of-llms-on-syntax-aware-code-fill","repo_url":"https://github.com/gonglinyuan/safim","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"code-completion","task_name":"Code Completion"}],"methods":[],"datasets_introduced":[{"slug":"safim","name":"SAFIM","full_name":"Syntax-Aware Fill-In-the-Middle"}],"methods_introduced":[],"results":[{"leaderboard":"/sota/code-completion-on-safim","task":"Code Completion","dataset":"SAFIM","model":"deepseek-coder-33b-base","rank_in_archive_order":1,"of":15,"metrics":{"API":"75.16","Algorithmic":"60.78","Average":"69.01","Control":"71.10"},"uses_additional_data":false},{"leaderboard":"/sota/code-completion-on-safim","task":"Code Completion","dataset":"SAFIM","model":"deepseek-coder-6.7b-base","rank_in_archive_order":2,"of":15,"metrics":{"API":"69.68","Algorithmic":"54.74","Average":"63.40","Control":"65.79"},"uses_additional_data":false},{"leaderboard":"/sota/code-completion-on-safim","task":"Code Completion","dataset":"SAFIM","model":"starcoderbase","rank_in_archive_order":3,"of":15,"metrics":{"API":"68.06","Algorithmic":"44.11","Average":"55.54","Control":"54.46"},"uses_additional_data":false},{"leaderboard":"/sota/code-completion-on-safim","task":"Code Completion","dataset":"SAFIM","model":"gpt-4-1106-preview","rank_in_archive_order":4,"of":15,"metrics":{"API":"62.58","Algorithmic":"42.11","Average":"53.28","Control":"55.15"},"uses_additional_data":false},{"leaderboard":"/sota/code-completion-on-safim","task":"Code Completion","dataset":"SAFIM","model":"CodeLlama-13b-hf","rank_in_archive_order":5,"of":15,"metrics":{"API":"59.68","Algorithmic":"41.41","Average":"52.78","Control":"57.25"},"uses_additional_data":false},{"leaderboard":"/sota/code-completion-on-safim","task":"Code Completion","dataset":"SAFIM","model":"deepseek-coder-1.3b-base","rank_in_archive_order":6,"of":15,"metrics":{"API":"62.58","Algorithmic":"41.20","Average":"52.63","Control":"54.10"},"uses_additional_data":false},{"leaderboard":"/sota/code-completion-on-safim","task":"Code Completion","dataset":"SAFIM","model":"CodeLlama-34b-hf","rank_in_archive_order":7,"of":15,"metrics":{"API":"56.45","Algorithmic":"38.55","Average":"49.66","Control":"53.98"},"uses_additional_data":false},{"leaderboard":"/sota/code-completion-on-safim","task":"Code Completion","dataset":"SAFIM","model":"CodeLlama-7b-hf","rank_in_archive_order":8,"of":15,"metrics":{"API":"46.77","Algorithmic":"34.68","Average":"45.00","Control":"53.56"},"uses_additional_data":false},{"leaderboard":"/sota/code-completion-on-safim","task":"Code Completion","dataset":"SAFIM","model":"gpt-3.5-turbo-0301","rank_in_archive_order":9,"of":15,"metrics":{"API":"53.87","Algorithmic":"31.24","Average":"40.86","Control":"37.48"},"uses_additional_data":false},{"leaderboard":"/sota/code-completion-on-safim","task":"Code Completion","dataset":"SAFIM","model":"incoder-6B","rank_in_archive_order":10,"of":15,"metrics":{"API":"48.06","Algorithmic":"25.16","Average":"33.79","Control":"28.16"},"uses_additional_data":false},{"leaderboard":"/sota/code-completion-on-safim","task":"Code Completion","dataset":"SAFIM","model":"codegen-16B-multi","rank_in_archive_order":11,"of":15,"metrics":{"API":"31.29","Algorithmic":"25.94","Average":"30.99","Control":"35.74"},"uses_additional_data":false},{"leaderboard":"/sota/code-completion-on-safim","task":"Code Completion","dataset":"SAFIM","model":"codegen-2B-multi","rank_in_archive_order":12,"of":15,"metrics":{"API":"32.26","Algorithmic":"23.49","Average":"29.55","Control":"32.89"},"uses_additional_data":false},{"leaderboard":"/sota/code-completion-on-safim","task":"Code Completion","dataset":"SAFIM","model":"incoder-1B","rank_in_archive_order":13,"of":15,"metrics":{"API":"43.87","Algorithmic":"21.06","Average":"29.27","Control":"22.89"},"uses_additional_data":false},{"leaderboard":"/sota/code-completion-on-safim","task":"Code Completion","dataset":"SAFIM","model":"codegen-6B-multi","rank_in_archive_order":14,"of":15,"metrics":{"API":"27.74","Algorithmic":"23.60","Average":"28.71","Control":"34.80"},"uses_additional_data":false},{"leaderboard":"/sota/code-completion-on-safim","task":"Code Completion","dataset":"SAFIM","model":"codegen-350M-multi","rank_in_archive_order":15,"of":15,"metrics":{"API":"26.45","Algorithmic":"16.30","Average":"22.94","Control":"26.06"},"uses_additional_data":false}],"syntology":{"syntology_url":"https://syntology.ai/paper/2403.04814","atlas_url":"https://app.syntology.ai/?focus=2403.04814","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2403.04814"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/gonglinyuan/safim","reach":null}],"summary":{"ran_violates":1,"ran_draft_wrong":1},"by_repo_kind":{"official":{"samples":2,"ran":2,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"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"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"bc0bc2eea87dea80","entry":"function_calls_match","repo":"gonglinyuan/safim","repo_kind":"official","path":"evaluate.py","file_url":"https://github.com/gonglinyuan/safim/blob/HEAD/evaluate.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bc0bc2eea87dea80"}},{"code_sha256_prefix":"90e1dbbafc80af72","entry":"get_function_call_params","repo":"gonglinyuan/safim","repo_kind":"official","path":"evaluate.py","file_url":"https://github.com/gonglinyuan/safim/blob/HEAD/evaluate.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"90e1dbbafc80af72"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}