← Lab /AI/ML

Transformer model detects malware from raw bytes with 98.35% accuracy

MalwareFormer achieves >98% accuracy and low false positive rate for byte-level malware detection

AI/ML arXiv 13 Oct 2026 Method Simulation evidence

Published as “Bytes to Threats: Byte-Sequence Transformer For Malware Detection”

Why it matters

The low overall false positive rate and high detection accuracy suggest MalwareFormer could be integrated into production anti-virus pipelines to improve detection while keeping alert fatigue low.

Summary

MalwareFormer, a transformer-based byte-level malware detector, achieves 98.35% accuracy and a 1.94% false positive rate on a 30,233-sample test set, outperforming the CNN baselines MalConv and AvastNet on all threshold-dependent metrics. Fine-tuning a pretrained ByteFormer model speeds convergence and yields slightly better performance than training from scratch. The model remains stable with truncated inputs (as little as 50 KB), though it shows a pronounced false-positive bias (14.24% FPR) on very high-entropy files. The evidence consists of absolute performance numbers reported in the paper; no abstract was provided, so the summary relies on the introduction, results, and conclusion sections.

What they found 2

  1. MalwareFormer outperforms CNN baselines on accuracy, balanced accuracy, macro-F1, and false positive rate.

    “MalwareFormer achieves the highest overall classification performance, with an accuracy of 98.35%, a balanced accuracy of 98.32%, a macro-F1 of 98.32%, and a false positive rate (FPR) of 1.94%, the lowest among all evaluated models.”

  2. On a test set of 30,233 samples, MalwareFormer missed only 245 malware files (FNR 1.42%) and produced 253 false alarms (FPR 1.94%).

    “On the shared test set of 30,233 samples (17,211 malware, 13,022 benign), MalwareFormer correctly detects 16,966 malware samples while missing only 245 (FNR: 1.42%), and correctly classifies 12,769 benign files with just 253 false alarms (FPR: 1.94%).”

Caveats 2

  • In the highest entropy bin (7-8) the false positive rate jumps to 14.24%, revealing a significant bias despite the overall low 1.94% FPR.
  • the model exhibits an entropy-induced false positive bias in the highest entropy bin (7-8), near-zero FNR (0.08%) but an elevated FPR (14.24%)

What’s new here 4

  • Applies a transformer (ByteFormer) to raw executable bytes without handcrafted features.
  • Demonstrates that fine-tuning pretrained representations accelerates training and improves stability.
  • Shows that high detection accuracy can be achieved with only the first 50 KB of a file.
  • Provides an entropy-stratified analysis revealing a specific failure mode in high-entropy regions.