KiloGrams: Very Large N-Grams for Malware Classification

Author/Creator ORCID





Citation of Original Publication

raff2019kilograms, KiloGrams: Very Large N-Grams for Malware Classification Edward Raff; William Fleming; Richard Zak; Hyrum Anderson; Bill Finlayson; Charles Nicholas; Mark McLean; 2019 Cite as:arXiv:1908.00200v1 [cs.CR]


This item is likely protected under Title 17 of the U.S. Copyright Law. Unless on a Creative Commons license, for uses protected by Copyright Law, contact the copyright holder or the author.


N-grams have been a common tool for information retrieval and machine learning applications for decades. In nearly all previous works, only a few values of n are tested, with n>6 being exceedingly rare. Larger values of n are not tested due to computational burden or the fear of overfitting. In this work, we present a method to find the top-k most frequent n-grams that is 60× faster for small n, and can tackle large n≥1024. Despite the unprecedented size of n considered, we show how these features still have predictive ability for malware classification tasks. More important, large n-grams provide benefits in producing features that are interpretable by malware analysis, and can be used to create general purpose signatures compatible with industry standard tools like Yara. Furthermore, the counts of common n-grams in a file may be added as features to publicly available human-engineered features that rival efficacy of professionally-developed features when used to train gradient-boosted decision tree models on the EMBER dataset.