Variable Naming Impact on AI Code Completion: An Empirical Study

preprint OA: closed
Full text JSON View at publisher

Abstract

Abstract As AI code completion tools become central to software development, a fundamental question emerges: do variable naming conventions that aid human comprehension also improve AI model performance? We investigate this question using a controlled experimental design with 500 Python code examples generated by mistralai/Magistral-Small-2506 (24B parameters, quantized to 8bit), transformed into 7 naming schemes (descriptive, minimal, obfuscated, original, Pascal-Case, SCREAM SNAKE CASE, snake case), and tested across 8 models (0.5B-8B parameters) spanning two architectures (Llama and Qwen). The same model performs renaming transformations and serves as a semantic judge for evaluating completion outputs. Despite requiring more tokens, descriptive variable names consistently achieved the best semantic similarity (0.874), while obfuscated names performed worst (0.802) — consistent with human cognition research. Our evaluation combines exact token matching, Levenshtein similarity, and semantic similarity. Strong correlations between syntactic and semantic metrics (r=0.945) validate our evaluation approach. Model scaling effects demonstrate clear performance improvements with size, with semantic similarity ranging from 0.743 (1B) to 0.898 (7B) for Llama models. These findings provide initial quantitative evidence for code style considerations in AI code completion, with implications for developers using AI coding assistants.
Full text 10,180 characters · extracted from preprint-html · click to expand
Variable Naming Impact on AI Code Completion: An Empirical Study | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Research Article Variable Naming Impact on AI Code Completion: An Empirical Study Alexey Yakubov This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-7180885/v1 This work is licensed under a CC BY 4.0 License Status: Posted Version 1 posted You are reading this latest preprint version Abstract As AI code completion tools become central to software development, a fundamental question emerges: do variable naming conventions that aid human comprehension also improve AI model performance? We investigate this question using a controlled experimental design with 500 Python code examples generated by mistralai/Magistral-Small-2506 (24B parameters, quantized to 8bit), transformed into 7 naming schemes (descriptive, minimal, obfuscated, original, Pascal-Case, SCREAM SNAKE CASE, snake case), and tested across 8 models (0.5B-8B parameters) spanning two architectures (Llama and Qwen). The same model performs renaming transformations and serves as a semantic judge for evaluating completion outputs. Despite requiring more tokens, descriptive variable names consistently achieved the best semantic similarity (0.874), while obfuscated names performed worst (0.802) — consistent with human cognition research. Our evaluation combines exact token matching, Levenshtein similarity, and semantic similarity. Strong correlations between syntactic and semantic metrics (r=0.945) validate our evaluation approach. Model scaling effects demonstrate clear performance improvements with size, with semantic similarity ranging from 0.743 (1B) to 0.898 (7B) for Llama models. These findings provide initial quantitative evidence for code style considerations in AI code completion, with implications for developers using AI coding assistants. Code completion Large language models AI code generation Variable naming Programming productivity LLM evaluation Full Text Additional Declarations The authors declare no competing interests. Cite Share Download PDF Status: Posted Version 1 posted You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-7180885","acceptedTermsAndConditions":true,"allowDirectSubmit":true,"archivedVersions":[],"articleType":"Research Article","associatedPublications":[],"authors":[{"id":488805851,"identity":"c85186da-4566-45e0-aa08-162df4626dc8","order_by":0,"name":"Alexey Yakubov","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAABAUlEQVRIiWNgGAWjYDACdhiDh4ENSNoAMWPjAbxamFG1pIG0NJCk5TCYjVcLfzPzMYmPbQyJ/T1nzB58bDtvt7b9MNCWGptoXFokDrMlG84EaplxtsccyLidvO1MIlDLsbTcBlx6DvMYPuYFamk4z2MmzXPmdrLZAaAWxobDOLXIH+b/cPgvUMt8iJZzyWbnH+LXYnCYh/ExI1DLhrM9QC0VB+zMbhCwxfAwm7FhzzkJ441njpUbzqhITjC7AbQlAY9f5I43P5P4UWYjO+9M8rYHHwzs7M3Opz988KHGBrf3QYCRTcIRpiARzEjApxwM/jDYw5j2+NSNglEwCkbByAQAc/Vjd4mTTj4AAAAASUVORK5CYII=","orcid":"","institution":"","correspondingAuthor":true,"prefix":"","firstName":"Alexey","middleName":"","lastName":"Yakubov","suffix":""}],"badges":[],"createdAt":"2025-07-21 21:34:40","currentVersionCode":1,"declarations":{"humanSubjects":false,"vertebrateSubjects":false,"conflictsOfInterestStatement":false,"humanSubjectEthicalGuidelines":false,"humanSubjectConsent":false,"humanSubjectClinicalTrial":false,"humanSubjectCaseReport":false,"vertebrateSubjectEthicalGuidelines":false},"doi":"10.21203/rs.3.rs-7180885/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-7180885/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":87347376,"identity":"7ee3c3f8-b1d3-4b9a-a2c7-cdf0afb8aae5","added_by":"auto","created_at":"2025-07-23 02:38:32","extension":"pdf","order_by":1,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":2939900,"visible":true,"origin":"","legend":"","description":"","filename":"paper.pdf","url":"https://assets-eu.researchsquare.com/files/rs-7180885/v1_covered_b9b4be91-5746-4a79-a944-015d65fe9d49.pdf"}],"financialInterests":"The authors declare no competing interests.","formattedTitle":"\u003cp\u003eVariable Naming Impact on AI Code Completion: An Empirical Study\u003c/p\u003e","fulltext":[],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":false,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":true,"hideJournal":true,"highlight":"","institution":"","isAcceptedByJournal":false,"isAuthorSuppliedPdf":true,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":true,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true},"keywords":"Code completion, Large language models, AI code generation, Variable naming, Programming productivity, LLM evaluation","lastPublishedDoi":"10.21203/rs.3.rs-7180885/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-7180885/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"\u003cp\u003eAs AI code completion tools become central to software development, a fundamental question emerges: do variable naming conventions that aid human comprehension also improve AI model performance? We investigate this question using a controlled experimental design with 500 Python code examples generated by mistralai/Magistral-Small-2506 (24B parameters, quantized to 8bit), transformed into 7 naming schemes (descriptive, minimal, obfuscated, original, Pascal-Case, SCREAM SNAKE CASE, snake case), and tested across 8 models (0.5B-8B parameters) spanning two architectures (Llama and Qwen). The same model performs renaming transformations and serves as a semantic judge for evaluating completion outputs. Despite requiring more tokens, descriptive variable names consistently achieved the best semantic similarity (0.874), while obfuscated names performed worst (0.802) — consistent with human cognition research. Our evaluation combines exact token matching, Levenshtein similarity, and semantic similarity. Strong correlations between syntactic and semantic metrics (r=0.945) validate our evaluation approach. Model scaling effects demonstrate clear performance improvements with size, with semantic similarity ranging from 0.743 (1B) to 0.898 (7B) for Llama models. These findings provide initial quantitative evidence for code style considerations in AI code completion, with implications for developers using AI coding assistants.\u003c/p\u003e","manuscriptTitle":"Variable Naming Impact on AI Code Completion: An Empirical Study","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2025-07-23 02:30:20","doi":"10.21203/rs.3.rs-7180885/v1","editorialEvents":[{"type":"communityComments","content":0}],"status":"published","journal":{"display":true,"email":"[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"42ddc187-8720-47e9-95af-cd4e279c5057","owner":[],"postedDate":"July 23rd, 2025","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"posted","subjectAreas":[],"tags":[],"updatedAt":"2025-07-23T02:30:20+00:00","versionOfRecord":[],"versionCreatedAt":"2025-07-23 02:30:20","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-7180885","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-7180885","identity":"rs-7180885","version":["v1"]},"buildId":"8U1c8b4HqxoKbykW_rLl7","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}

Text is read by the "Ask this paper" AI Q&A widget below. Extraction quality varies by source — PMC NXML preserves structure cleanly, OA-HTML may include some navigation residue, and OA-PDF can have broken hyphenation. The publisher copy (via DOI) is the canonical version.

My notes (saved in your browser only)

Ask this paper AI returns verbatim quotes from the full text · source: preprint-html

Answers must be backed by verbatim quotes from this paper's full text. Hallucinated quotes are dropped automatically; if no verbatim passage answers the question, we say so. How this works

Citation neighborhood (no data yet)

We don't have any in-corpus citations linked to this paper yet. This is a recent paper (2025) — citers typically take a year or two to land, and the OpenAlex reference graph may still be filling in.

Source provenance

europepmc
last seen: 2026-05-20T01:45:00.602351+00:00