Free-text Keystroke Authentication using Transformers: A Comparative Study of Architectures and Loss Functions | 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 Free-text Keystroke Authentication using Transformers: A Comparative Study of Architectures and Loss Functions Saleh Momeni, bagher babaali This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-3960768/v1 This work is licensed under a CC BY 4.0 License Status: Published Journal Publication published 08 Feb, 2025 Read the published version in Soft Computing → Version 1 posted 5 You are reading this latest preprint version Abstract Keystroke biometrics is a promising approach for user identification and verification, leveraging the unique patterns in individuals’ typing behavior. In this paper, we propose a Transformer-based network that employs self-attention to extract informative features from keystroke sequences, surpassing the performance of traditional Recurrent Neural Networks. We explore two distinct architectures, namely bi-encoder and cross-encoder, and compare their effectiveness in keystroke authentication. Furthermore, we investigate different loss functions, including triplet, batch-all triplet, and WDCL loss, along with various distance metrics such as Euclidean, Manhattan, and cosine distances. These experiments allow us to optimize the training process and enhance the performance of our model. To evaluate our proposed model, we employ the Aalto desktop keystroke dataset. The results demonstrate that the bi-encoder architecture with batch-all triplet loss and cosine distance achieves the best performance, yielding an exceptional Equal Error Rate of 0.0186%. Furthermore, alternative algorithms for calculating similarity scores are explored to enhance accuracy. Notably, the utilization of a one-class Support Vector Machine reduces the Equal Error Rate to an impressive 0.0163%. The outcomes of this study indicate that our model surpasses the previous state-of-the-art in free-text keystroke authentication. These findings contribute to advancing the field of keystroke authentication and offer practical implications for secure user verification systems. Biometrics Keystroke Dynamics Keystroke Authentication Contrastive Learning Transformers Deep Learning Full Text Cite Share Download PDF Status: Published Journal Publication published 08 Feb, 2025 Read the published version in Soft Computing → Version 1 posted Editorial decision: Major Revision 27 Jun, 2024 Reviewers agreed at journal 25 May, 2024 Reviewers invited by journal 25 May, 2024 Editor assigned by journal 24 May, 2024 First submitted to journal 24 May, 2024 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-3960768","acceptedTermsAndConditions":true,"allowDirectSubmit":false,"archivedVersions":[],"articleType":"Research Article","associatedPublications":[],"authors":[{"id":306694635,"identity":"f116e00f-e05a-4e17-985d-6ce6f0aec886","order_by":0,"name":"Saleh Momeni","email":"","orcid":"","institution":"University of Tehran College of Science","correspondingAuthor":false,"prefix":"","firstName":"Saleh","middleName":"","lastName":"Momeni","suffix":""},{"id":306694636,"identity":"e36881fa-50c4-404f-8330-f6af979ff08f","order_by":1,"name":"bagher babaali","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAABC0lEQVRIiWNgGAWjYBACAwYGNhCdwCABJB8Y2ABJxsYDxGtJMEgDaWkgRQvDYbAoXi3m7MevPfi4hyGPf3bzww8JBeft1rYfBtpSYxONS4tlT0654YxnDMUSd44ZSyQY3E7ediYRqOVYWm4DLocdyEmT5jnAkNhwI8EArMXsAFALY8Nh3FrOv0mT/gPUMv9G+ucfCQbnks3OPySg5Ub6MWmgdxM33MgxA9pywM7sBgFbLGe8YZPsOSBRbHjnTJlFgkFygtkNoC0JePxizp/+TOLHAZs8udvtm298+GNnb3Y+/eGDDzU2OLUwMPAAowYcKRCQCFaZgFM5CLA/QOHa41U8CkbBKBgFIxIAAPNiaeW5VvRvAAAAAElFTkSuQmCC","orcid":"","institution":"University of Tehran","correspondingAuthor":true,"prefix":"","firstName":"bagher","middleName":"","lastName":"babaali","suffix":""}],"badges":[],"createdAt":"2024-02-16 08:54:47","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-3960768/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-3960768/v1","draftVersion":[],"editorialEvents":[{"content":"https://doi.org/10.1007/s00500-025-10524-z","type":"published","date":"2025-02-08T15:57:02+00:00"}],"editorialNote":"","failedWorkflow":false,"files":[{"id":75929971,"identity":"7023e122-8afb-4ed9-9605-ad52f57563bf","added_by":"auto","created_at":"2025-02-10 16:08:20","extension":"pdf","order_by":1,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":610319,"visible":true,"origin":"","legend":"","description":"","filename":"KeystrokeSpringer.pdf","url":"https://assets-eu.researchsquare.com/files/rs-3960768/v1_covered_a14935ca-61b1-45c4-88ae-0c3280419e54.pdf"}],"financialInterests":"","formattedTitle":"Free-text Keystroke Authentication using Transformers: A Comparative Study of Architectures and Loss Functions","fulltext":[],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":false,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":false,"hideJournal":false,"highlight":"","institution":"","isAcceptedByJournal":true,"isAuthorSuppliedPdf":true,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":true,"isPdf":true,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"
[email protected]","identity":"soft-computing","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":false,"externalIdentity":"soco","sideBox":"Learn more about [Soft Computing](https://www.springer.com/journal/500)","snPcode":"500","submissionUrl":"https://submission.nature.com/new-submission/500/3","title":"Soft Computing","twitterHandle":"","acdcEnabled":true,"dfaEnabled":true,"editorialSystem":"em","reportingPortfolio":"Springer Hybrid","inReviewEnabled":true,"inReviewRevisionsEnabled":false},"keywords":"Biometrics, Keystroke Dynamics, Keystroke Authentication, Contrastive Learning, Transformers, Deep Learning","lastPublishedDoi":"10.21203/rs.3.rs-3960768/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-3960768/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"Keystroke biometrics is a promising approach for user identification and verification, leveraging the unique patterns in individuals’ typing behavior. In this paper, we propose a Transformer-based network that employs self-attention to extract informative features from keystroke sequences, surpassing the performance of traditional Recurrent Neural Networks. We explore two distinct architectures, namely bi-encoder and cross-encoder, and compare their effectiveness in keystroke authentication. Furthermore, we investigate different loss functions, including triplet, batch-all triplet, and WDCL loss, along with various distance metrics such as Euclidean, Manhattan, and cosine distances. These experiments allow us to optimize the training process and enhance the performance of our model. To evaluate our proposed model, we employ the Aalto desktop keystroke dataset. The results demonstrate that the bi-encoder architecture with batch-all triplet loss and cosine distance achieves the best performance, yielding an exceptional Equal Error Rate of 0.0186%. Furthermore, alternative algorithms for calculating similarity scores are explored to enhance accuracy. Notably, the utilization of a one-class Support Vector Machine reduces the Equal Error Rate to an impressive 0.0163%. The outcomes of this study indicate that our model surpasses the previous state-of-the-art in free-text keystroke authentication. These findings contribute to advancing the field of keystroke authentication and offer practical implications for secure user verification systems.","manuscriptTitle":"Free-text Keystroke Authentication using Transformers: A Comparative Study of Architectures and Loss Functions","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2024-06-06 13:50:27","doi":"10.21203/rs.3.rs-3960768/v1","editorialEvents":[{"type":"communityComments","content":0},{"type":"decision","content":"Major Revision","date":"2024-06-28T02:42:42+00:00","index":"","fulltext":""},{"type":"reviewerAgreed","content":"","date":"2024-05-25T14:06:14+00:00","index":0,"fulltext":""},{"type":"reviewersInvited","content":"","date":"2024-05-25T14:04:03+00:00","index":"","fulltext":""},{"type":"editorAssigned","content":"","date":"2024-05-24T15:23:46+00:00","index":"","fulltext":""},{"type":"submitted","content":"Soft Computing","date":"2024-05-24T11:22:58+00:00","index":"","fulltext":""}],"status":"published","journal":{"display":true,"email":"
[email protected]","identity":"soft-computing","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":false,"externalIdentity":"soco","sideBox":"Learn more about [Soft Computing](https://www.springer.com/journal/500)","snPcode":"500","submissionUrl":"https://submission.nature.com/new-submission/500/3","title":"Soft Computing","twitterHandle":"","acdcEnabled":true,"dfaEnabled":true,"editorialSystem":"em","reportingPortfolio":"Springer Hybrid","inReviewEnabled":true,"inReviewRevisionsEnabled":false}}],"origin":"","ownerIdentity":"b5e8c22d-a2c9-4ae4-bba6-8600d9a64e2d","owner":[],"postedDate":"June 6th, 2024","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"published-in-journal","subjectAreas":[],"tags":[],"updatedAt":"2025-02-10T15:59:26+00:00","versionOfRecord":{"articleIdentity":"rs-3960768","link":"https://doi.org/10.1007/s00500-025-10524-z","journal":{"identity":"soft-computing","isVorOnly":false,"title":"Soft Computing"},"publishedOn":"2025-02-08 15:57:02","publishedOnDateReadable":"February 8th, 2025"},"versionCreatedAt":"2024-06-06 13:50:27","video":"","vorDoi":"10.1007/s00500-025-10524-z","vorDoiUrl":"https://doi.org/10.1007/s00500-025-10524-z","workflowStages":[]},"version":"v1","identity":"rs-3960768","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-3960768","identity":"rs-3960768","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.