Code Completion with Assistance from Token-Level Type Prediction | 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 Code Completion with Assistance from Token-Level Type Prediction Yun Yang, Jianxun Liu, Yiming Yin, Canyu Qiu This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-9121029/v1 This work is licensed under a CC BY 4.0 License Status: Under Review Version 1 posted 6 You are reading this latest preprint version Abstract Code completion is a pivotal feature within Integrated Development Environments (IDEs), which enhances development efficiency by predicting the next code token.The majority of current code completion techniques forecast the value based on Abstract Syntax Trees (ASTs) and contextual source code. However, they often model relative positional information and type information independently, lacking an effective framework for their unified modeling, which consequently limits the ability to characterize syntactic constraints and structural dependencies of code. To address this problem, we propose TAVP, a token-based type prediction-assisted code completion method. This model jointly models leaf node values, node types, and root-path structural information within a unified framework, and introduces Rotary Positional Embedding (RoPE) into the attention mechanism to capture the relative positional relationships among leaf nodes. During the inference stage, the model modulates the injection intensity of type semantic constraints based on the correctness and confidence of type prediction, thereby effectively assisting in the prediction of leaf node values. Experimental results demonstrate that TAVP outperforms baseline models in terms of Top-k accuracy and Mean Reciprocal Rank (MRR) on Python and JavaScript datasets. Furthermore, ablation experiments confirm each essential component's efficacy. Keywords:Code Completion; Type Assisted; Rotary Position; Abstract Syntax Trees Code Completion Type Assisted Rotary Position Abstract Syntax Trees Full Text Additional Declarations No competing interests reported. Cite Share Download PDF Status: Under Review Version 1 posted Reviews received at journal 04 Apr, 2026 Reviewers agreed at journal 17 Mar, 2026 Reviewers invited by journal 17 Mar, 2026 Editor assigned by journal 16 Mar, 2026 Submission checks completed at journal 16 Mar, 2026 First submitted to journal 14 Mar, 2026 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-9121029","acceptedTermsAndConditions":true,"allowDirectSubmit":false,"archivedVersions":[],"articleType":"Research Article","associatedPublications":[],"authors":[{"id":608961355,"identity":"c3e14f69-b39b-455b-bddf-09cfba9b3834","order_by":0,"name":"Yun Yang","email":"","orcid":"","institution":"Hunan University of Science and Technology","correspondingAuthor":false,"prefix":"","firstName":"Yun","middleName":"","lastName":"Yang","suffix":""},{"id":608961356,"identity":"69475cdd-4032-46de-924b-f7393b6c4e79","order_by":1,"name":"Jianxun Liu","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAzElEQVRIiWNgGAWjYBACPmYGBgOGigNQLhsRWtjAWs6AtDATqwVEMLaRpIWdx6CYd96dPIPz5w8wfCg7zMA/u4GQw3gMDGdue1ZscCOZgXHGucMMEncOENZi8HHb4cQNN5gZmHnbDjMYSCQQoSVxDlDL+cMMzH+J1vKxAajlQDIDMyNxWtgKDGccO5w480aywcGec+k8EjcIaOHnP7zNmKfmcGLf+YMPH/wos5bjn0FAC8giAxjrABDzEFQPBMwPiFE1CkbBKBgFIxgAAMZYQCDIKL8IAAAAAElFTkSuQmCC","orcid":"","institution":"Hunan University of Science and Technology","correspondingAuthor":true,"prefix":"","firstName":"Jianxun","middleName":"","lastName":"Liu","suffix":""},{"id":608961359,"identity":"5cd8f266-b0ca-429f-b0fb-ee50ac934756","order_by":2,"name":"Yiming Yin","email":"","orcid":"","institution":"Hunan University of Science and Technology","correspondingAuthor":false,"prefix":"","firstName":"Yiming","middleName":"","lastName":"Yin","suffix":""},{"id":608961360,"identity":"f1080dd6-8aa2-4e68-9f0e-6ecaa39126f7","order_by":3,"name":"Canyu Qiu","email":"","orcid":"","institution":"Hunan University of Science and Technology","correspondingAuthor":false,"prefix":"","firstName":"Canyu","middleName":"","lastName":"Qiu","suffix":""}],"badges":[],"createdAt":"2026-03-14 08:53:29","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-9121029/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-9121029/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":105563217,"identity":"6b07051d-e48a-487e-8850-c62b19c365ad","added_by":"auto","created_at":"2026-03-27 12:46:22","extension":"pdf","order_by":1,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":498279,"visible":true,"origin":"","legend":"","description":"","filename":"CodeCompletionwithAssistancefromTokenLevelTypePredictionclustercomputing.pdf","url":"https://assets-eu.researchsquare.com/files/rs-9121029/v1_covered_bb9a5a6d-b160-4c9e-8b61-58de39b028b9.pdf"}],"financialInterests":"No competing interests reported.","formattedTitle":"Code Completion with Assistance from Token-Level Type Prediction","fulltext":[],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":false,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":false,"hideJournal":false,"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":"cluster-computing","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":false,"externalIdentity":"","sideBox":"Learn more about [Cluster Computing](https://www.springer.com/journal/10586)","snPcode":"10586","submissionUrl":"https://submission.nature.com/new-submission/10586/3","title":"Cluster Computing","twitterHandle":"","acdcEnabled":true,"dfaEnabled":true,"editorialSystem":"stoa","reportingPortfolio":"Springer Hybrid","inReviewEnabled":true,"inReviewRevisionsEnabled":false},"keywords":"Code Completion, Type Assisted, Rotary Position, Abstract Syntax Trees","lastPublishedDoi":"10.21203/rs.3.rs-9121029/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-9121029/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"Code completion is a pivotal feature within Integrated Development Environments (IDEs), which enhances development efficiency by predicting the next code token.The majority of current code completion techniques forecast the value based on Abstract Syntax Trees (ASTs) and contextual source code. However, they often model relative positional information and type information independently, lacking an effective framework for their unified modeling, which consequently limits the ability to characterize syntactic constraints and structural dependencies of code. To address this problem, we propose TAVP, a token-based type prediction-assisted code completion method. This model jointly models leaf node values, node types, and root-path structural information within a unified framework, and introduces Rotary Positional Embedding (RoPE) into the attention mechanism to capture the relative positional relationships among leaf nodes. During the inference stage, the model modulates the injection intensity of type semantic constraints based on the correctness and confidence of type prediction, thereby effectively assisting in the prediction of leaf node values. Experimental results demonstrate that TAVP outperforms baseline models in terms of Top-k accuracy and Mean Reciprocal Rank (MRR) on Python and JavaScript datasets. Furthermore, ablation experiments confirm each essential component's efficacy.\nKeywords:Code Completion; Type Assisted; Rotary Position; Abstract Syntax Trees","manuscriptTitle":"Code Completion with Assistance from Token-Level Type Prediction","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2026-03-20 19:44:04","doi":"10.21203/rs.3.rs-9121029/v1","editorialEvents":[{"type":"communityComments","content":0},{"type":"editorInvitedReview","content":"","date":"2026-04-04T15:19:33+00:00","index":"hide","fulltext":""},{"type":"reviewerAgreed","content":"287774825059446489694351286842004040676","date":"2026-03-17T14:27:18+00:00","index":"hide","fulltext":""},{"type":"reviewersInvited","content":"","date":"2026-03-17T12:41:50+00:00","index":"","fulltext":""},{"type":"editorAssigned","content":"","date":"2026-03-16T13:55:54+00:00","index":"","fulltext":""},{"type":"checksComplete","content":"","date":"2026-03-16T09:14:53+00:00","index":"","fulltext":""},{"type":"submitted","content":"Cluster Computing","date":"2026-03-14T08:43:17+00:00","index":"","fulltext":""}],"status":"published","journal":{"display":true,"email":"
[email protected]","identity":"cluster-computing","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":false,"externalIdentity":"","sideBox":"Learn more about [Cluster Computing](https://www.springer.com/journal/10586)","snPcode":"10586","submissionUrl":"https://submission.nature.com/new-submission/10586/3","title":"Cluster Computing","twitterHandle":"","acdcEnabled":true,"dfaEnabled":true,"editorialSystem":"stoa","reportingPortfolio":"Springer Hybrid","inReviewEnabled":true,"inReviewRevisionsEnabled":false}}],"origin":"","ownerIdentity":"e52795a0-d12e-40af-8216-55f122615383","owner":[],"postedDate":"March 20th, 2026","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"under-review","subjectAreas":[],"tags":[],"updatedAt":"2026-03-20T19:44:04+00:00","versionOfRecord":[],"versionCreatedAt":"2026-03-20 19:44:04","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-9121029","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-9121029","identity":"rs-9121029","version":["v1"]},"buildId":"XKTyCvWXoU3ODBz1xrDgd","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.