cs.CRMar 11, 2026

DNS-GT: A Graph-based Transformer Approach to Learn Embeddings of Domain Names from DNS Queries

Authors: Massimiliano Altieri, Ronan Hamon, Roberto Corizzo, Michelangelo Ceci, Ignacio Sanchez

Organizations: Joint Research Centre, European Commission, Ispra, 21027, Italy. · Department of Computer Science, American University, 4400 Massachusetts Avenue NW, Washington, 20016, DC, USA. · Department of Computer Science, University of Bari Aldo Moro, Via Orabona, 4, Bari, 70125, Italy.

Abstract

Network intrusion detection systems play a crucial role in the security strategy employed by organisations to detect and prevent cyberattacks. Such systems usually combine pattern detection signatures with anomaly detection techniques powered by machine learning methods. However, the commonly proposed machine learning methods present drawbacks such as over-reliance on labeled data and limited generalization capabilities. To address these issues, embedding-based methods have been introduced to learn representations from network data, such as DNS traffic, mainly due to its large availability, that generalise effectively to many downstream tasks. However, current approaches do not properly consider contextual information among DNS queries. In this paper, we tackle this issue by proposing DNS-GT, a novel Transformer-based model that learns embeddings for domain names from sequences of DNS queries. The model is first pre-trained in a self-supervised fashion in order to learn the general behavior of DNS activity. Then, it can be finetuned on specific downstream tasks, exploiting interactions with other relevant queries in a given sequence. Our experiments with real-world DNS data showcase the ability of our method to learn effective domain name representations. A quantitative evaluation on domain name classification and botnet detection tasks shows that our approach achieves better results compared to relevant baselines, creating opportunities for further exploration of large-scale language models for intrusion detection systems. Our code is available at: https://github.com/m-altieri/DNS-GT.

Figures & tables

Appendix figures & tables11 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Evaluating Tabular Representation Learning for Network Intrusion Detection

    May 4, 2026Muhammad Usman Butt, Andreas Hotho, Daniel SchlörRepresentation LearningNetwork Intrusion Detection

  2. Do Transformers Actually Help Intrusion Detection? A Temporal Sequence Evaluation on CIC-IDS2017

    Jun 9, 2026Zach Moczkodan, Hany RagabData LeakageNetwork Intrusion Detection

  3. Improving DNS Exfiltration Detection via Transformer Pretraining

    Apr 9, 2026Miloš Tomić, Aleksa Cvetanović, Predrag TadićNetwork Intrusion DetectionDomain-Adaptive Pretraining