# Magika: AI-Powered Content-Type Detection

Source: [Magika: AI-Powered Content-Type Detection](<https://www.sota2.com/research/paper/68fa74e91e209131cea64a67>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2025-10-26T03:21:26.418Z

Authors: Yanick Fratantonio, Luca Invernizzi, Loua Farah, Kurt Thomas, Marina Zhang, Ange Albertini, Francois Galilee, Giancarlo Metitieri, Julien Cretin, Alex Petit-Bianco, David Tao, Elie Bursztein

Published: 2024-09-18T17:24:39.000Z

## Abstract

The task of content-type detection -- which entails identifying the data encoded in an arbitrary byte sequence -- is critical for operating systems, development, reverse engineering environments, and a variety of security applications. In this paper, we introduce Magika, a novel AI-powered content-type detection tool. Under the hood, Magika employs a deep learning model that can execute on a single CPU with just 1MB of memory to store the model's weights. We show that Magika achieves an average F1 score of 99% across over a hundred content types and a test set of more than 1M files, outperforming all existing content-type detection tools today. In order to foster adoption and improvements, we open source Magika under an Apache 2 license on GitHub and make our model and training pipeline publicly available. Our tool has already seen adoption by the Gmail email provider for attachment scanning, and it has been integrated with VirusTotal to aid with malware analysis.   We note that this paper discusses the first iteration of Magika, and a more recent version already supports more than 200 content types. The interested reader can see the latest development on the Magika GitHub repository, available at https://github.com/google/magika.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

- [File Block Classification on MIME-125 headline cell (mid-file)](<https://www.sota2.com/research/sota/file-block-classification-on-mime-125-headline-cell-mid-file.md>): File Block Classification; MIME-125 headline cell (mid-file); Top-1 Accuracy: 11.2.

- [MIME classification on MAGIC-FILES network-capture (cleartext UDP) (n = 498 streams)](<https://www.sota2.com/research/sota/mime-classification-on-magic-files-network-capture-cleartext-udp-n-498-streams.md>): MIME classification; MAGIC-FILES network-capture (cleartext UDP) (n = 498 streams); Top-1 Accuracy: 61.8.

- [File-type classification on magic-files n=1,024 (held-out)](<https://www.sota2.com/research/sota/file-type-classification-on-magic-files-n-1-024-held-out.md>): File-type classification; magic-files n=1,024 (held-out); Performance Gap (pp): not recorded.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/2409.13768>)

[PDF](<https://arxiv.org/pdf/2409.13768.pdf>)
