A dependency-free tensor library aimed at simple setup, broad CPU and accelerator backends, and efficient quantized inference.
Overview
ggml is a tensor library for machine learning implemented in plain C and C++ without external dependencies. The stated goal is to stay small, portable, and efficient while remaining easy to adopt for inference and related workloads.
It runs across several CPU architectures, including x86, ARM, RISC-V, LoongArch, PowerPC, s390x, and WebAssembly, with SIMD kernels for common platforms. Backends include CPU, GPU, NPU, and browser environments. Quantization covers integer widths from 2 through 8 bits plus MXFP4 and NVFP4 microscaling formats.
The runtime is designed to avoid heap allocations during execution once set up. Documentation includes the GGUF file format used with the ecosystem. A minimal matrix-multiplication example is provided for newcomers building from source.
Key features
- Plain C/C++ with no mandatory dependencies
- SIMD-optimized kernels on major CPU families
- CPU, GPU, NPU, and WebAssembly backends
- 2–8-bit integer and microscaling quant formats
- Zero runtime memory allocations after setup
- Cross-platform architecture support
- GGUF file format documentation
- Simple commented example for matrix multiply
Use cases
- On-device or embedded ML inference
- Building tools that load GGUF model files
- Cross-platform tensor code without heavy frameworks
- Browser or WASM-accelerated ML experiments