ggml-org/ggml
Embeddable C/C++ tensor runtime for quantized inference across hardware backends
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
ggml is a native C/C++ tensor execution library, not a model server. An embedding application builds a graph from tensor operations and uses the scheduler and selected backends to execute it. Scratch reservation and ordered asynchronous host input copies in v1.1.0 expose two practical controls at that boundary: planning temporary workspace and managing input transfer order. The library is designed to avoid allocations during execution; the caller still has to provision tensor storage and workspace.
The repository separates interface and implementation into include/ and src/, with a minimal matmul integration example in examples/simple. The native core has no third-party dependencies. The Python packages in requirements.txt, including NumPy, PyTorch, Transformers, and gguf, are a separate dependency set and are not required to link the core. Backends provide hardware-specific execution, and the meta/TP backend can place an entire tensor on one device as of v1.2.0; that is a placement option, not automatic sharding for every graph.
Key Capabilities & Differentiators
ggml supports 2- to 8-bit integer quantization and MXFP4 and NVFP4 microscaling formats. In v1.2.0, extended matmul APIs add scale support for FP8 and NVFP4, and the FlashAttention sinks/bias API is revised. GGUF is a documented file format, not a guarantee that ggml can execute any model packaged in it: the host still needs to map the model to a compatible graph and select a backend with the required kernels.
Execution targets span CPU, GPU, NPU, and browser environments. CPU platforms include x86, ARM, RISC-V, LoongArch, PowerPC, and s390x, with SIMD kernels for x86, ARM, and RISC-V; WebAssembly is also a target. Backend development is hardware-specific: v1.1.1 adds Hexagon INT-HMX W8A8 matmul, revises CUDA FlashAttention data loading, and tunes small-K matrix-vector operations on Metal. Check operator and dtype coverage on the actual target rather than assuming a performance change on one backend applies to the others.
Trade-offs & Limitations
Choose ggml over a model-level runtime such as llama.cpp when the tensor graph, backend choice, or memory plan is part of what your product needs to control. If the job is to run a supported LLM with a standard application interface, the higher-level runtime avoids writing that integration yourself. Compared with a managed inference API, embedding ggml enables local execution and control over where model data is processed, but shifts deployment, upgrades, and hardware qualification to your team.
Quantization gives you a way to trade weight storage against numerical fidelity, but a format on the support list does not establish throughput or quality for your model. Benchmark the intended graph and quantization on each target, and size RAM or VRAM for resident tensors, workspace, and transfer buffers rather than weight size alone. For an LLM, also account for model state that grows with context and concurrency. MIT licensing eases redistribution of the library; it does not cover model weights or third-party accelerator components.
Hardware & Deployment Guide
The minimal path is a local source build with a C/C++ toolchain and CMake: run cmake -S . -B build, then cmake --build build --config Release -j 8 from the repository root. With a single-config generator, set -DCMAKE_BUILD_TYPE=Release when configuring. Use examples/simple as a CPU integration smoke test before enabling an accelerator. The Python manifest is not a native runtime prerequisite. Accelerator builds need a matching toolchain and driver where applicable; verify the selected backend's requirements rather than treating GPU as mandatory.
Ship the library with the host application and make model assets available locally if offline execution is required. Validate representative graphs, dtype combinations, and peak memory on each target you intend to support. The release sequence makes those checks especially useful: v1.1.0 adds scheduler controls, v1.1.1 changes several backend kernels, and v1.2.0 revises the FlashAttention API and introduces the experimental HRX backend. Pin a tested version and rerun integration checks when upgrading.
examples/simple demonstrates matrix multiplication.docs/gguf.md covers GGUF; requirements.txt includes gguf, SentencePiece, and PyTorch for Python-side workflows, not the native core.Teams embedding quantized inference in native applications that need control over tensor graphs, workspace, and hardware backends.
You need a turnkey LLM server, a managed API, or ready-made model integration rather than a tensor execution library.
Quick Start & Installation
git clone https://github.com/ggml-org/ggml cd ggml mkdir build && cd build cmake .. cmake --build . --config Release -j 8
Comparison vs. Top LLMs & Inference Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| ggml ★ | 16.3k | +97 | C++ | MIT | Embeddable C/C++ tensor runtime for quantized inference across hardware backends |
| tensorflow | 201.7k | +4 | C++ | Apache-2.0 | C++-backed ML framework for building models and embedding inference |
| transformers | 169.6k | +337 | Python | Apache-2.0 | A PyTorch model-definition SDK for unified inference and training across modalit |
| xgboost | 29.1k | +43 | C++ | Apache-2.0 | A C++ gradient-boosted tree library for local and distributed tabular learning |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/ggml-org/ggml.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about ggml
Where should I start when embedding ggml in a native application?
examples/simple to see how ggml represents and executes a matrix multiplication. Then map your model to tensor operations, validate the graph on your chosen backend, and integrate model loading and the application-facing interface separately. GGUF is documented in docs/gguf.md.Is a GPU required, and how should I estimate VRAM?
Can I ship ggml in a commercial, self-hosted product?
When should I choose ggml over llama.cpp or a managed inference API?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy