Skip to content

ggml

A small C/C++ library for building the math core of machine learning programs.

Stars
15.6k
Forks
1.9k
Licence
MIT
Language
C++
Last update
9 days ago
Type
Library

What it is

ggml is a tensor library: it provides the low-level building blocks for doing the number crunching behind machine learning models, written in plain C and C++ with no outside dependencies. It is designed to be simple, portable, and efficient, and it runs on many CPU types and some GPUs, NPUs, and browsers. It is mainly a foundation for other software rather than a finished end-user tool.

  • Build the library from source with CMake and run the bundled minimal matrix multiplication example
  • Study the commented examples/simple code to learn how tensor operations are expressed
  • Use quantized 2- to 8-bit number formats to reduce memory needs of a model
  • Compile the same code for x86, ARM, RISC-V, or WebAssembly targets

Great for

  • C/C++ developers who want to embed machine learning math into their own program
  • Engineers running models on modest or unusual hardware, such as ARM, RISC-V, or WebAssembly targets
  • People who need low-level control over memory and quantized (smaller, lower-precision) number formats
  • Developers exploring how tensor libraries work under the hood

Not ideal for

  • Beginners who want to run a chatbot or model without writing code: the README describes a library, not an application
  • Python-first data scientists: the README shows only C/C++ build steps and no Python interface
  • Teams needing a stable high-level API: the README does not describe API guarantees, and core changes are routed through another project
Step-by-step guide: how to use ggmlInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Clone and build from source

    You'll need: CMake · A C/C++ compiler

    Clone the repository

    git clone https://github.com/ggml-org/ggml

    Enter the directory and create a build folder

    cd ggml && mkdir build && cd build

    Configure the build with CMake

    cmake ..

    Build in Release mode

    cmake --build . --config Release -j 8
  2. 2

    Run it

    • Build the project using the commands above
    • Open the examples/simple directory
    • Read the commented matrix multiplication example
    • Run the compiled example binary from the build output
  3. 3

    Get the most out of it

    • Start with examples/simple, which the README describes as a minimal, fully commented example
    • Read docs/gguf.md to understand the GGUF file format used by the wider ecosystem
    • Read the linked introduction blog post and community tips page for background on ggml concepts
    • Try the quantized formats if you are working under memory limits

Downloads

Strengths

  • No external dependencies, in plain C/C++, which keeps setup and deployment simple
  • Broad platform support across CPU architectures plus GPU, NPU, and browser backends
  • Designed for efficiency, with SIMD-optimized kernels and no memory allocations at runtime

Trade-offs

  • The README is short and gives little API documentation, so using it directly requires reading the source and examples
  • Core library changes are directed to the llama.cpp project, so this repo is not the place for most contributions
  • Latest release lists no prebuilt binaries, so you must build from source

How it compares

ProjectStarsTypeLevelUpdatedBest for
ggml (this)15.6kLibraryadvanced9 days agoC/C++ developers who want to embed machine learning math into their own program
llama.cpp133kLibraryintermediate4 days agoDevelopers who want to run open-weight models locally without a cloud API
onnxruntime22.2kLibraryintermediate4 days agoDevelopers who want to deploy a trained model inside an application or service
spaCy34kLibraryintermediate10 days agoPython developers building text-processing features into an application
recommenders22kLibraryintermediate4 days agoData scientists prototyping recommendation models
nni14.4kLibraryintermediate2.3 years agoResearchers comparing hyperparameter tuning algorithms such as TPE, Hyperband, or Bayesian methods

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.