Abstract
Cybersecurity information is often technically complex and relayed through unstructured text, making automation of cyber threat intelligence highly challenging. For such text domains that involve high levels of expertise, pretraining on in-domain corpora has been a popular method for language models to obtain domain expertise. However, cybersecurity texts often contain non-linguistic elements (such as URLs and hash values) that could be unsuitable with the established pretraining methodologies. Previous work in other domains have removed or filtered such text as noise, but the effectiveness of these methods have not been investigated, especially in the cybersecurity domain. We propose different pretraining methodologies and evaluate their effectiveness through downstream tasks and probing tasks. Our proposed strategy (selective MLM and jointly training NLE token classification) outperforms the commonly taken approach of replacing non-linguistic elements (NLEs). We use our domain-customized methodology to train CyBERTuned, a cybersecurity domain language model that outperforms other cybersecurity PLMs on most tasks.
Introduction
Cybersecurity text is distinct from general-purpose corpora due to its high density of technical indicators, or Non-Linguistic Elements (NLEs). These include SHA hashes, IP addresses, and URLs. Standard language models trained on general text often struggle with these elements, as they appear as random strings. Historically, researchers have either ignored these elements or replaced them with generic placeholders like [HASH] or [URL]. However, this "Replace All" strategy removes semantic context—for instance, a URL might contain keywords like "github" or "malware" that provide critical clues for threat intelligence.
Methodology: Handling NLEs
The authors introduce CyBERTuned, a model designed to leverage NLEs as auxiliary training signals rather than treating them as noise. The methodology relies on two key innovations:
1. Categorization and Selective Masking
The researchers distinguish between two types of NLEs:
- Semi-Linguistic Elements (SLEs): Elements like URLs and emails that contain human-readable, meaningful words.
- Fully Non-Linguistic Elements (FNLEs): Protocol-generated, random strings like hashes and IP addresses.
During pretraining, the model uses Selective Masked Language Modeling (MLM). It is allowed to predict SLEs to learn from their internal vocabulary but is restricted from masking FNLEs to avoid wasting computational resources on predicting random hex strings.
2. NLE Token Classification
To ensure the model still understands the nature of FNLEs without memorizing them, an auxiliary NLE Classification Head is added. This head performs a token-level classification task, identifying the type of NLE (e.g., CVE ID, Bitcoin address) for every token in the sequence.
Pretraining Strategies
The study evaluated several strategies for handling NLEs during pretraining. The "Replace All" method, while simplifying the text, was found to be a "double-edged sword" that hindered the model's ability to perform on complex probing tasks. In contrast, the proposed "Mask-Semis + NLEC" strategy (Selective masking + Classification) provided the best balance.
Data and Evaluation
The model was pretrained on a curated 1GB cybersecurity corpus, including 150k online security articles, academic abstracts, Wikipedia pages, and over 180k CVE descriptions. CyBERTuned was evaluated across six downstream tasks, including Named Entity Recognition (CyNER), Event Detection (CySecED, CASIE), and Multiple Choice QA (MTDB).
Key Results and Insights
- Performance: CyBERTuned achieved state-of-the-art results on 5 out of 6 downstream tasks, outperforming general models (RoBERTa) and specialized models like CyBERT and SecureBERT.
- Contextual Awareness: Probing tasks revealed that keeping NLEs (and handling them via selective masking) allows the model to associate specific indicators with malware families or attack patterns, a capability lost when NLEs are replaced by generic tags.
- Efficiency: The auxiliary NLE classification task is computationally efficient, adding only 0.6% to training time while significantly boosting performance.
Conclusion
The research demonstrates that NLEs in cybersecurity text are not merely noise to be filtered. By intelligently categorizing these elements and using them in auxiliary classification tasks, models can achieve deeper domain expertise. CyBERTuned serves as a robust foundation for automated cyber threat intelligence, proving that in technical domains, the "noise" often contains the most valuable signals.
Summary updated