Detecting AI-Generated Text with Fine-Tuned RoBERTa: A Cross-Validated Study with Interpretability Analysis

Authors

DOI:

https://doi.org/10.29207/resti.v10i3.7660

Keywords:

AI-generated text, gradient saliency, large language models, natural language processing, RoBERTa

Abstract

The rapid proliferation of large language models capable of generating fluent and contextually coherent text has made reliable authorship attribution both a practical and ethical necessity. Outputs from systems such as GPT-4, LLaMA 2, and Claude are increasingly indistinguishable from human-authored prose, yet current detection methodologies remain insufficient to meet this challenge. This study aims to develop and evaluate a fine-tuned RoBERTa-base binary classifier for distinguishing AI-generated text from human-authored text under stratified cross-validation conditions; assess the model's robustness to a known length-based confound through a controlled ablation study; and provide interpretable explanations of the classifier's decisions through dual token-level attribution using Gradient × Input Saliency and Attention Rollout. The model is trained and evaluated via stratified five-fold cross-validation on a balanced corpus of 6,069 samples (3,069 AI-generated and 3,000 human-authored) and benchmarked against four established baselines spanning classical, neural, and zero-shot paradigms. The classifier achieves a mean accuracy of 99.93%, a weighted F1-score of 0.9993, and a mean AUC-ROC of 1.0000 across all five folds. A length-balanced ablation produces an accuracy decline of only 0.11 percentage points, providing empirical evidence that the model has learned genuine semantic and stylistic distinctions rather than superficial length-based cues. Gradient × Input Saliency maps indicate that AI-generated texts are characterised by technically precise, domain-specific vocabulary, whereas human-authored texts are identified through discourse markers and rhetorically structured expression, with both attribution methods converging on the same high-saliency tokens.

Downloads

Download data is not yet available.

References

H. Zhao et al., “Explainability for Large Language Models: A Survey,” ACM Trans. Intell. Syst. Technol., vol. 15, no. 2, 2024, doi: 10.1145/3639372.

J. Grindrod, “Large language models and linguistic intentionality,” Synthese, vol. 204, no. 2, p. 71, Aug. 2024, doi: 10.1007/s11229-024-04723-8.

Yuhefizar, R. Watrianthos, R. Komalasari, and G. Surendra, “What Drives Generative AI Research? A Topic Modeling Investigation of Contemporary Literature,” in International Conference on Applied Science and Technology on Engineering Science 2025 (iCAST-ES 2025), Atlantis Press, 2025, pp. 56–64. doi: 10.2991/978-94-6463-926-1_8.

Y. Yuhefizar, R. Watrianthos, and D. Marzuki, “Evaluating the Reliability of Generative AI in Distinguishing Machine from Human Text,” Data and Metadata, vol. 4, p. 1181, Sep. 2025, doi: 10.56294/dm20251181.

D. Irfan, R. Watrianthos, and F. A. Nur Bin Yunus, “AI in Education: A Decade of Global ResearchTrends and Future Directions,” International Journal of Modern Education and Computer Science, vol. 17, no. 2, pp. 135–153, Apr. 2025, doi: 10.5815/ijmecs.2025.02.07.

D. M. Katz, M. J. Bommarito, S. Gao, and P. Arredondo, “GPT-4 Passes the Bar Exam,” SSRN Electronic Journal, 2023, doi: 10.2139/ssrn.4389233.

J. Gallifant et al., “Peer review of GPT-4 technical report and systems card,” 2024. doi: 10.1371/journal.pdig.0000417.

H. Zhao et al., “Ophtha-LLaMA2: A Large Language Model for Ophthalmology,” 2023.

M. Sparkman and A. Witt, “Claude AI and Literature Reviews: An Experiment in Utility and Ethical Use,” Libr. Trends, vol. 73, no. 3, 2025, doi: 10.1353/lib.2025.a961199.

A. Sobo, A. Mubarak, A. Baimagambetov, and N. Polatidis, “Evaluating LLMs for Code Generation in HRI: A Comparative Study of ChatGPT, Gemini, and Claude,” Applied Artificial Intelligence, vol. 39, no. 1, Dec. 2025, doi: 10.1080/08839514.2024.2439610.

W. J. Kim and Y. Ryoo, “The literacy paradox: How AI literacy amplifies biases in evaluating AI-generated news articles,” Int. J. Inf. Manage., vol. 86, 2026, doi: 10.1016/j.ijinfomgt.2025.102992.

P. P. Ray, “ChatGPT: A comprehensive review on background, applications, key challenges, bias, ethics, limitations and future scope,” 2023. doi: 10.1016/j.iotcps.2023.04.003.

G. Eysenbach, “The Role of ChatGPT, Generative Language Models, and Artificial Intelligence in Medical Education: A Conversation With ChatGPT and a Call for Papers,” 2023. doi: 10.2196/46885.

R. Watrianthos, S. Triono Ahmad, and M. Muskhir, “Charting the Growth and Structure of Early ChatGPT-Education Research: A Bibliometric Study,” Journal of Information Technology Education: Innovations in Practice, vol. 22, pp. 235–253, 2023, doi: 10.28945/5221.

P. Sidorenko-Bautista, Á. Cabezas-Clavijo, J. Cantón-Correa, and R. Alba-Ruiz, “The Impact of ChatGPT on Journalism: Social Listening, Bibliographic Production, and Media Agenda,” BiD, vol. 53, 2024, doi: 10.1344/bid2024.53.06.

M. Javaid, A. Haleem, and R. P. Singh, “ChatGPT for healthcare services: An emerging stage for an innovative perspective,” BenchCouncil Transactions on Benchmarks, Standards and Evaluations, vol. 3, no. 1, 2023, doi: 10.1016/j.tbench.2023.100105.

J. Li, A. Dada, B. Puladi, J. Kleesiek, and J. Egger, “ChatGPT in healthcare: A taxonomy and systematic review,” 2024. doi: 10.1016/j.cmpb.2024.108013.

N. Marques, R. R. Silva, and J. Bernardino, “Using ChatGPT in Software Requirements Engineering: A Comprehensive Review,” 2024. doi: 10.3390/fi16060180.

M. Daun and J. Brings, “How ChatGPT Will Change Software Engineering Education,” in Proceedings of the 2023 Conference on Innovation and Technology in Computer Science Education V. 1, New York, NY, USA: ACM, Jun. 2023, pp. 110–116. doi: 10.1145/3587102.3588815.

T. Gorichanaz, “Accused: How students respond to allegations of using ChatGPT on assessments,” Learning: Research and Practice, vol. 9, no. 2, pp. 183–196, Jul. 2023, doi: 10.1080/23735082.2023.2254787.

W. Liang, M. Yuksekgonul, Y. Mao, E. Wu, and J. Zou, “GPT detectors are biased against non-native English writers,” Patterns, vol. 4, no. 7, p. 100779, Jul. 2023, doi: 10.1016/j.patter.2023.100779.

D. Weber-Wulff et al., “Testing of detection tools for AI-generated text,” International Journal for Educational Integrity, vol. 19, no. 1, p. 26, Dec. 2023, doi: 10.1007/s40979-023-00146-z.

S. Samsir, R. S. Saragih, S. Subagio, R. Aditiya, and R. Watrianthos, “BERTopic Modeling of Natural Language Processing Abstracts: Thematic Structure and Trajectory,” Jurnal Media Informatika Budidarma, vol. 7, no. 3, Jul. 2023.

N. Reimers and I. Gurevych, “Sentence-BERT: Sentence embeddings using siamese BERT-networks,” in EMNLP-IJCNLP 2019 - 2019 Conference on Empirical Methods in Natural Language Processing and 9th International Joint Conference on Natural Language Processing, Proceedings of the Conference, 2019. doi: 10.18653/v1/d19-1410.

A. R. Aryani and E. B. Setiawan, “Big Five Personality Assessment Using KNN method with RoBERTA,” Jurnal RESTI (Rekayasa Sistem dan Teknologi Informasi), vol. 6, no. 5, pp. 818–823, 2022, doi: 10.29207/resti.v6i5.4394.

J. Chen, Z. Yang, and D. Yang, “MixText: Linguistically-informed interpolation of hidden space for semi-supervised text classification,” in Proceedings of the Annual Meeting of the Association for Computational Linguistics, 2020. doi: 10.18653/v1/2020.acl-main.194.

A. Laios et al., “RoBERTa-Assisted Outcome Prediction in Ovarian Cancer Cytoreductive Surgery Using Operative Notes,” Cancer Control, vol. 30, 2023, doi: 10.1177/10732748231209892.

K. L. Tan, C. P. Lee, and K. M. Lim, “RoBERTa-GRU: A Hybrid Deep Learning Model for Enhanced Sentiment Analysis,” Applied Sciences (Switzerland), vol. 13, no. 6, 2023, doi: 10.3390/app13063915.

M. M. Rahman, A. I. Shiplu, Y. Watanobe, and M. A. Alam, “RoBERTa-BiLSTM: A Context-Aware Hybrid Model for Sentiment Analysis,” IEEE Trans. Emerg. Top. Comput. Intell., vol. 9, no. 6, 2025, doi: 10.1109/TETCI.2025.3572150.

A. Uchendu, Z. Ma, T. Le, R. Zhang, and D. Lee, “TURINGBENCH: A Benchmark Environment for Turing Test in the Age of Neural Text Generation,” in Findings of the Association for Computational Linguistics, Findings of ACL: EMNLP 2021, 2021. doi: 10.18653/v1/2021.findings-emnlp.172.

J. Wang, J. Tuyls, E. Wallace, and S. Singh, “Gradient-based analysis of NLP models is manipulable,” in Findings of the Association for Computational Linguistics Findings of ACL: EMNLP 2020, 2020. doi: 10.18653/v1/2020.findings-emnlp.24.

K. H. Guo, N. N. Chaudhari, T. Jafar, N. F. Chowdhury, P. Bogdan, and A. Irimia, “Anatomic Interpretability in Neuroimage Deep Learning: Saliency Approaches for Typical Aging and Traumatic Brain Injury,” Neuroinformatics, vol. 22, no. 4, 2024, doi: 10.1007/s12021-024-09694-2.

J. Rahnfeld, M. Naouar, G. Kalweit, J. Boedecker, E. Dubruc, and M. Kalweit, “A comparative study of explainability methods for whole slide classification of lymph node metastases using vision transformers,” PLOS Digital Health, vol. 4, no. 4 April, 2025, doi: 10.1371/journal.pdig.0000792.

S. Jo, G. Jang, and H. Park, “GMAR: Gradient-Driven Multi-Head Attention Rollout for Vision Transformer Interpretability,” 2025. doi: 10.1109/icip55913.2025.11084559.

A. Javed, I. Rashid, S. Tahir, S. Saeed, A. M. Almuhaideb, and K. Alissa, “AdamW+: Machine Learning Framework to Detect Domain Generation Algorithms for Malware,” IEEE Access, vol. 12, 2024, doi: 10.1109/ACCESS.2024.3407546.

Downloads

Published

2026-06-21

Issue

Section

Artificial Intelligence

How to Cite

Yuhefizar, Y., Ronal Watrianthos, & Marzuki, D. (2026). Detecting AI-Generated Text with Fine-Tuned RoBERTa: A Cross-Validated Study with Interpretability Analysis. Jurnal RESTI (Rekayasa Sistem Dan Teknologi Informasi), 10(3), 767-775. https://doi.org/10.29207/resti.v10i3.7660