ml-dtypes
ml_dtypes is a stand-alone implementation of several NumPy dtype extensions used in machine learning.
Decision gist · record as of 2026-08-14
Yes. ml_dtypes is actively maintained, has no known vulnerabilities, carries permissive licensing, and fills a genuine gap for ML practitioners needing low-precision NumPy dtypes. Install if you work with quantization, model compression, or hardware-specific numeric formats; skip if you only use standard NumPy types.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later; precompiled wheels available for common platforms, but source builds require git submodules and a C++ compiler.
- Medium install friction with precompiled wheels for Python 3.10–3.14 across macOS, Linux, and Windows.
- Active maintenance as of 2026-08-13 with a single runtime dependency on numpy.
License · maintenance · safety
Apache-2.0 (permissive) — Apache 2.0 licensed source code; precompiled wheels include EIGEN (MPL 2.0). Permissive licensing allows use in most projects, though binary distributions carry dual licensing implications.
last release 2026-08-13 (1 days) · last repo commit 2026-08-13 · 357 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 36,116,003 downloads/mo, #737 on PyPI
Alternatives
Verify before relying
pip install ml_dtypes
from ml_dtypes import bfloat16
import numpy as np
arr = np.zeros(4, dtype=bfloat16)
print(arr)- Whether JAX or other ML frameworks automatically handle precision accumulation with ml_dtypes types as claimed in the description.
- Performance characteristics and memory overhead of unpacked 1-, 2-, and 4-bit integer representations compared to standard NumPy types.
- Compatibility with NumPy operations beyond basic array creation (e.g., ufuncs, broadcasting, reductions).
What it is and what it does
ml_dtypes is a standalone NumPy extension library that registers specialized numeric data types used in machine learning workflows. It provides bfloat16 (a truncated single-precision float), multiple 8-bit floating-point variants (float8_e4m3, float8_e5m2, etc.), 4- and 6-bit microscaling formats, and narrow integer types (int1, int2, int4, uint1, uint2, uint4). These types integrate directly with NumPy's dtype system, allowing you to create and manipulate arrays using string names like 'bfloat16' or 'float8_e5m2'.
The library is designed for scenarios where reduced precision is acceptable or desirable—such as model quantization, memory-constrained inference, or hardware acceleration. It depends only on numpy and is actively maintained. Note that low-precision arithmetic introduces quirks: aggregations like sum may lose precision, and you may need to explicitly use higher-precision accumulators for correct results.
Use it for
- Quantize neural network weights and activations to bfloat16 or float8 formats for reduced memory footprint and faster inference.
- Experiment with sub-byte integer encodings (int1, int2, int4) for extreme model compression in embedded or edge-deployment scenarios.
- Implement microscaling (MX) formats for hardware-accelerated low-precision arithmetic in custom training or inference pipelines.
- Prototype machine learning algorithms that require non-standard floating-point representations not natively supported by NumPy.
- Validate numerical stability and precision loss in ML workflows by comparing results across multiple float8 variants.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
ml_dtypes is actively maintained, has no known vulnerabilities, carries permissive licensing, and fills a genuine gap for ML practitioners needing low-precision NumPy dtypes. Install if you work with quantization, model compression, or hardware-specific numeric formats; skip if you only use standard NumPy types.
Install
ml-dtypes on PyPI
Before you install
Medium install friction with precompiled wheels for Python 3.10–3.14 across macOS, Linux, and Windows. Active maintenance as of 2026-08-13 with a single runtime dependency on numpy.
Requires Python 3.10 or later; precompiled wheels available for common platforms, but source builds require git submodules and a C++ compiler.
License in practice
Apache 2.0 licensed source code; precompiled wheels include EIGEN (MPL 2.0). Permissive licensing allows use in most projects, though binary distributions carry dual licensing implications.
Quickstart
pip install ml_dtypes
from ml_dtypes import bfloat16
import numpy as np
arr = np.zeros(4, dtype=bfloat16)
print(arr)
Verify before relying
- Whether JAX or other ML frameworks automatically handle precision accumulation with ml_dtypes types as claimed in the description.
- Performance characteristics and memory overhead of unpacked 1-, 2-, and 4-bit integer representations compared to standard NumPy types.
- Compatibility with NumPy operations beyond basic array creation (e.g., ufuncs, broadcasting, reductions).
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 1 packagenumpy |
| Maintenance | Actively maintained 1 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 36,116,003 / month, #737 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: Science/ResearchProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: Only |
Evidence: ml_dtypes-0.6.0-cp310-cp310-macosx_10_9_universal2.whl; ml_dtypes-0.6.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; ml_dtypes-0.6.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; ml_dtypes-0.6.0-cp310-cp310-win_amd64.whl; ml_dtypes-0.6.0-cp311-cp311-macosx_10_9_universal2.whl; ml_dtypes-0.6.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; ml_dtypes-0.6.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; ml_dtypes-0.6.0-cp311-cp311-win_amd64.whl; ml_dtypes-0.6.0-cp311-cp311-win_arm64.whl; ml_dtypes-0.6.0-cp312-cp312-macosx_10_13_universal2.whl; ml_dtypes-0.6.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; ml_dtypes-0.6.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; ml_dtypes-0.6.0-cp312-cp312-win_amd64.whl; ml_dtypes-0.6.0-cp312-cp312-win_arm64.whl; ml_dtypes-0.6.0-cp313-cp313-macosx_10_13_universal2.whl; ml_dtypes-0.6.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; ml_dtypes-0.6.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; ml_dtypes-0.6.0-cp313-cp313-win_amd64.whl; ml_dtypes-0.6.0-cp313-cp313-win_arm64.whl; ml_dtypes-0.6.0-cp314-cp314-macosx_10_15_universal2.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “bfloat16 numpy dtype”
- ml-dtypesml_dtypes provides NumPy-compatible data types for machine learning,…
- jmpJMP provides mixed precision training support for JAX by managing…
- numkongNumKong provides mixed-precision linear algebra and distance kernels…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also lilcom · numkong · cint · fxpmath · lovely-numpy · bitarray-hardbyte · fastnumbers · mda-xdrlib · DataProperty · jmp