AI model scan limits: known limitations¶
See also: AI model scan limits for the caps themselves, the wheel gate and what a format cannot record, and AI model formats for what each reader extracts.
The bounds keep a hostile file from being cheap to abuse; they do not make it free. Figures are approximate, from measurements on one machine.
- Memory and time of bounded input. A pickle's decimal numbers are never
converted, so a 1,000,000-digit number is refused in microseconds with the
limit at its default or off (converting it with the limit off took 3.4 s on
Python 3.10). The largest GGUF header accepted costs about 1.1 GB and 6
seconds. A Safetensors header just under 16 MiB peaks near 0.8 GB. A pickle
at the opcode cap costs about 100 MB and under a second in fickling. The
safetensorslibrary builds a model's whole__metadata__map, and the ONNX reader its whole result, before the entry cap trims them, so the cap bounds the SBOM, not one model's peak memory (about 0.6 GB for a 16 MiB__metadata__: 0.53 GB for one model, 0.58 GB for a wheel of 24 of them). The trimmed maps are rebuilt and the memory released, so a wheel's peak is its largest model's, not the sum of its models'. - Unbounded native parsers (fastText, HDF5, ONNX). They are not
bounded, only gated in wheels and for a model file or a project read from
a Git URL. Where the gate is off (
--trust-model-fileson a wheel or a Git URL, a scan of a local project, orloom model FILEon a local file), a crafted file can use gigabytes (a 16 MiB ONNX measured about 3 GB; a 308-byte fastText header reached 5 GB and kept climbing) or crash or hang libhdf5. - No Ctrl-C while a native parser runs. A signal handler does not run inside native code, so interrupting waits for the parser; kill the process if it hangs.
- Disk. A wheel scan copies each model it reads to a temporary directory, up to the budget (2 GiB by default), and removes it after.
- Planned. Header-only readers that never pass a file to a native
library are planned for a future release. They would let the gated
formats be read in wheels without
--trust-model-filesand replace several of the caps.
See also¶
- AI model scan limits -- caps, gated formats in wheels, and what a format cannot record.
- AI model formats -- formats, extensions, install extras.