[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-572802-105":3,"detail-sidebar-cat-1-en-105":80,"doc-detail-572802-en":126},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":73,"head_meta":75,"extra_data":77,"updated_unix":79},105,"en","enhancing-cross-site-scripting-xss-attacks-detection-through-modern-transformer-architecture-optimizations","Enhancing Cross-Site Scripting (XSS) Attacks Detection through Modern Transformer Architecture Optimizations","","Cross-Site Scripting (XSS) remains a widespread and damaging threat to web applications, as emphasized by OWASP Top 10. Existing detection methods often lag behind evolving attack vectors and obfuscation strategies. This paper enhances XSS detection using modern transformer architecture optimizations, including a custom transformer encoder trained on nearly 100,000 aggregated samples with newly collected XSS payloads. RoPE improves contextual understanding of payloads, and Flash Attention accelerates training and inference while lowering memory use. Results reach 99.38 accuracy, and ablation shows +0.11 percentage points with about 32% less training time and ~30% lower peak GPU memory versus standard transformers.",{"@graph":14,"@context":72},[15,34,55],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/template/","Template",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/template/presentations/","Presentations",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/template/enhancing-cross-site-scripting-xss-attacks-detection-through-modern-transformer-architecture-optimizations/572802/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/enhancing-cross-site-scripting-xss-attacks-detection-through-modern-transformer-architecture-optimizations/572802.png","ImageObject",442,249,{"name":42,"@type":43},"BigDaveOnline","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-10-19","2026-10-13",true,{"@type":52,"interactionType":53,"userInteractionCount":33},"InteractionCounter",{"@type":54},"ViewAction",{"@type":56,"mainEntity":57},"FAQPage",[58,64,68],{"name":59,"@type":60,"acceptedAnswer":61},"Why is Cross-Site Scripting (XSS) still a serious threat to web applications?","Question",{"text":62,"@type":63},"XSS remains pervasive and damaging, and OWASP ranks it among the top ten most common web application security risks. It can expose sensitive information, compromise privacy, and enable malicious code execution.","Answer",{"name":65,"@type":60,"acceptedAnswer":66},"How does the proposed method improve XSS detection compared with prior approaches?",{"text":67,"@type":63},"It uses a custom transformer encoder with architectural optimizations. Rotary Positional Embeddings (RoPE) enhance contextual understanding of payloads, and Flash Attention speeds up training and inference while reducing memory consumption.",{"name":69,"@type":60,"acceptedAnswer":70},"What performance improvements are reported for the optimized transformer model?",{"text":71,"@type":63},"The model achieves 99.38% accuracy with high recall and precision. Ablation shows the optimizations raise detection accuracy by 0.11 percentage points while reducing training time by about 32% and peak GPU memory usage by about 30%.","https://schema.org",{"og:url":32,"og:type":74,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":76,"canonical":32},"index,follow",{"doc_id":78,"site_id":7},572802,1792360078,{"code":4,"msg":81,"data":82},"success",[83,87,92,97,102,107,112,117,122],{"id":84,"doc_module":22,"doc_module_name":25,"category_name":29,"show_sort_weight":85,"slug":86},11,90,"presentations",{"id":88,"doc_module":22,"doc_module_name":25,"category_name":89,"show_sort_weight":90,"slug":91},12,"Resumes",80,"resumes",{"id":93,"doc_module":22,"doc_module_name":25,"category_name":94,"show_sort_weight":95,"slug":96},14,"Invoices",70,"invoices",{"id":98,"doc_module":22,"doc_module_name":25,"category_name":99,"show_sort_weight":100,"slug":101},15,"Posters",60,"posters",{"id":103,"doc_module":22,"doc_module_name":25,"category_name":104,"show_sort_weight":105,"slug":106},16,"Social Media",50,"social-media",{"id":108,"doc_module":22,"doc_module_name":25,"category_name":109,"show_sort_weight":110,"slug":111},17,"Forms",40,"forms",{"id":113,"doc_module":22,"doc_module_name":25,"category_name":114,"show_sort_weight":115,"slug":116},18,"Letters",30,"letters",{"id":118,"doc_module":22,"doc_module_name":25,"category_name":119,"show_sort_weight":120,"slug":121},21,"Paper Templates",5,"papers-templates",{"id":123,"doc_module":22,"doc_module_name":25,"category_name":124,"show_sort_weight":4,"slug":125},158,"General","general-158",{"code":4,"msg":81,"data":127},{"doc_id":78,"user_id":128,"nickname":42,"user_avatar":129,"doc_module":22,"category_id":84,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":130,"file_id":131,"file_url":132,"file_type":133,"file_size":134,"view_count":33,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":135,"language":136,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":137,"faqs":138,"seo_title":139,"seo_description":12,"update_tm":140,"read_time":141},962090896214,"https://ap-avatar.wpscdn.com/davatar_155a257f0dc6eb9ab79c44ca47cae57d","Journal of Intelligent Learning Systems and Applications, 2026, 18(3), 216-234  \n[https://www.scirp.org/journal/jilsa](https://www.scirp.org/journal/jilsa)  \nISSN Online: 2150-8410  \nISSN Print: 2150-8402  \nEnhancing Cross-Site Scripting (XSS) Attacks Detection through Modern Transformer Architecture Optimizations  \nEmil Wangilisasi, Judith Leo, Anael Sam  \nSchool of Computational and Communication Science and Engineering, Nelson Mandela African Institution of Science and Technology (NM-AIST), Arusha, Tanzania  \nHow to cite this paper: Wangilisasi, E., Leo, J. and Sam, A. (2026) Enhancing Cross-Site Scripting (XSS) Attacks Detection through Modern Transformer Architecture Optimizations. Journal of Intelligent Learning Systems and Applications, 18, 216-234.  \n[https://doi.org/10.4236/jilsa.2026.183014](https://doi.org/10.4236/jilsa.2026.183014)  \nReceived: May 16, 2026  \nAccepted: June 28, 2026  \nPublished: July 1, 2026  \nCopyright © 2026 by author(s) and Scientific Research Publishing Inc.  \nThis work is licensed under the Creative Commons Attribution International License (CC BY 4.0) .  \n[http://creativecommons.org/licenses/by/4.0/](http://creativecommons.org/licenses/by/4.0/)  \nOpen Access  \nAbstract  \nCross-Site Scripting (XSS) remains a widespread and damaging threats to web applications, as highlighted by the OWASP Top 10. While various detection methods exist, they often struggle to keep pace with the sophistication of attack vectors and obfuscation techniques. This paper implements an approach for enhancing XSS detection by leveraging modern optimizations within the transformer architecture. Our methodology uses a custom transformer encoder model trained on an aggregated dataset of nearly 100,000 samples, including newly collected XSS payloads. To enhance performance and efficiency, we integrate two key architectural improvements: Rotary Positional Embeddings (RoPE) to achieve a superior contextual understanding of [HTTP](HTTP)[ ](HTTP)payloads, and Flash Attention to significantly accelerate training and inference speeds while reducing memory consumption. Experimental results show good performance of our model that achieves an accuracy of 99.38 with high recall and precision. An ablation study demonstrates that the integrated optimizations improve detection accuracy by 0.11 percentage points, while reducing training time by approximately 32% and peak GPU memory usage by approximately 30% relative to standard Transformer configurations. Comparative evaluation against a Random Forest baseline further reveals a clear contextual understanding advantage over traditional frequency-based approaches, justifying the architectural complexity. The proposed model effectively captures structural patterns in sophisticated payloads that typically evade classical methods. This work presents an efficient, and accurate solution in real-time XSS threat detection.  \nKeywords  \nCross-Site Scripting (XSS), Transformer-Based Detection, Rotary Positional  \nDOI: 10.4236/jilsa.2026.183014 Jul. 1, 2026 216 Journal of Intelligent Learning Systems and Applications  \nEmbeddings, Flash Attention, Deep Learning  \n1. Introduction  \nThe rapid increase of web applications, mobile applications and online services has made safeguarding data and ensuring secure user interactions a critical priority. Among many threats in the cyber landscape, Cross-Site Scripting (XSS) vulnerabilities stand out as one of the most pervasive and damaging. According to the Open Web Application Security Project (OWASP) [1], XSS attacks rank among the top ten most common web application security risks. OWASP is a global community and nonprofit organization focused on improving software security. These vulnerabilities can expose sensitive information, compromise user privacy, and enable malicious actors to execute arbitrary code on web applications, potentially leading to catastrophic consequences. Figure 1 shows the OWASP top ten vulnerabilities for the year 2025. This list is u","cbCaiiG0uLAleF5h","https://ap.wps.com/l/cbCaiiG0uLAleF5h","pdf",2680069,19,"English","# Abstract\n# Keywords\n# 1. Introduction","[{\"question\":\"Why is Cross-Site Scripting (XSS) still a serious threat to web applications?\",\"answer\":\"XSS remains pervasive and damaging, and OWASP ranks it among the top ten most common web application security risks. It can expose sensitive information, compromise privacy, and enable malicious code execution.\"},{\"question\":\"How does the proposed method improve XSS detection compared with prior approaches?\",\"answer\":\"It uses a custom transformer encoder with architectural optimizations. Rotary Positional Embeddings (RoPE) enhance contextual understanding of payloads, and Flash Attention speeds up training and inference while reducing memory consumption.\"},{\"question\":\"What performance improvements are reported for the optimized transformer model?\",\"answer\":\"The model achieves 99.38% accuracy with high recall and precision. Ablation shows the optimizations raise detection accuracy by 0.11 percentage points while reducing training time by about 32% and peak GPU memory usage by about 30%.\"}]","Enhancing Cross-Site Scripting (XSS) Attacks Detection through Modern Transformer Architecture Optimizations | PDF",1791929317,7]