A Tensor Library That Runs Anywhere, With Zero Dependencies
You've probably been here: you want to experiment with a machine learning idea, but before you can even load a tensor, you're untangling a dependency tree, fighting a build system, or discovering that your chosen framework doesn't play nice with the platform you're targeting. What if the library itself just got out of the way? That's the premise behind ggml, a tensor library for machine learning that's written in plain C/C++ with no dependencies at all.
What It Does
ggml is a tensor library for machine learning built around a simple goal: stay portable, efficient, and easy to set up. It's implemented in plain C/C++ without pulling in any external dependencies, and it runs across a wide range of platforms—x86, ARM, RISC-V, LoongArch, PowerPC, s390x, and WebAssembly. So the same core library can follow you from a conventional CPU target all the way into the browser.
Under the hood, it ships SIMD-optimized kernels for x86, ARM, and RISC-V, and supports a broad set of backends including CPU, GPU, NPU, and browser environments. It also handles 2- to 8-bit integer quantization, plus the MXFP4 and NVFP4 microscaling formats. One design detail worth noting: it's built to perform zero memory allocations during runtime, which keeps behavior predictable once you're past setup.
Why It's Cool
-
No dependencies means no dependency hell. This is the headline feature, and it's a real one. You clone the repo, build it with CMake, and you're working with tensors. There's no package manager negotiation, no version conflicts, no transitive surprises. For a library that sits at the foundation of an ML stack, that kind of simplicity is genuinely useful.
-
The platform list is unusually broad. Going from x86 to ARM to RISC-V to PowerPC to s390x to WebAssembly in a single library is a lot of ground. If you've ever wanted the same tensor code to run on a server, an embedded board, and in a browser, ggml is aiming directly at that.
-
Quantization is a first-class concern. Support for 2- to 8-bit integer quantization, along with the MXFP4 and NVFP4 microscaling formats, means the library takes reduced-precision workloads seriously rather than treating them as an afterthought. That matters if you're trying to fit models into constrained memory.
-
Zero runtime allocations. Committing to no allocations during runtime is a deliberate constraint that tends to make performance more predictable and behavior easier to reason about. It's the kind of decision that signals the library was designed with real deployment in mind.
-
Backends beyond the CPU. CPU, GPU, NPU, and browser support in one library gives you room to move workloads around without switching ecosystems.
How to Try It
Getting started is about as direct as it gets. Clone the repository and build from source:
git clone https://github.com/ggml-org/ggml
cd ggml
mkdir build && cd build
cmake ..
cmake --build . --config Release -j 8
Once it's built, the README points you to examples/simple—a minimal, fully commented example covering matrix multiplication. That's a smart place to start, since it shows you the core API without burying you in setup.
If you want to go deeper, the project links to a few solid resources: documentation on the GGUF file format, an introduction to ggml published on Hugging Face, and a "tips and tricks" page on the llama.cpp wiki.
One thing to know before you start contributing: changes to the core ggml library (including the CMake build system) should go through a PR in llama.cpp rather than the ggml repo directly. The reasoning is practical—your PR will be more visible, better tested, and more likely to get reviewed there.
You can find everything at github.com/ggml-org/ggml.
Final Thoughts
ggml is best suited to developers who care about portability and minimal setup—people building ML tooling that needs to run in places where heavyweight frameworks are awkward or impossible. The dependency-free design and the wide platform coverage are the real draw here, and the quantization support makes it practical for constrained environments. It's not trying to be everything to everyone, and that focus is a strength. If your work involves getting tensor operations onto unusual hardware or into a browser, this is worth a serious look.
Follow @githubprojects for more developer tools and open source projects.