google

google/gemma.cpp

C++ Apache-2.0 AI & ML

lightweight, standalone C++ inference engine for Google's Gemma models.

7k stars
652 forks
active
GitHub +3 / week

7k

Stars

652

Forks

37

Open issues

30

Contributors

v0.1.4 25 Mar 2025

AI Analysis

gemma.cpp is a lightweight, standalone C++ inference engine for Google's Gemma language models (Gemma 2-3 and PaliGemma 2), designed explicitly for research and experimentation rather than production deployment. It targets researchers and ML practitioners who need to embed or modify LLM inference at a low level, offering a ~2K LoC core with minimal dependencies, mixed-precision GEMM optimizations, and backward-pass support for fine-tuning research. It is not intended for general-purpose LLM d...

AI & ML Research Project Discovery value: 5/10
Documentation 8/10
Activity 9/10
Community 8/10
Code quality 7/10

Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.

Overall score 8/10

AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.

llm-inference c++-runtime gemma-models simd-optimization research-tool
Actively maintained Well documented Niche/specialized use case Apache-2.0 licensed
Deep Analysis · Based on README and public signals
2w ago

Google's Gemma-specific C++ inference engine targets researchers and embedded developers, not mass deployment

gemma.cpp is a deliberately minimal, standalone C++ inference engine exclusively for Google's Gemma model family (Gemma 2, Gemma 3, PaliGemma 2). It targets researchers who need to co-design algorithms with low-level computation, and developers embedding LLM inference into C++ projects with minimal dependencies. The ~2K LoC core is intentionally small and readable. It uses Google Highway for portable SIMD CPU inference. Google itself recommends against using it for production deployments, pointing users toward JAX/PyTorch/Transformers instead.

Origin

Launched in February 2024 alongside the original Gemma model release. It has evolved from Gemma 1 support to covering Gemma 2, Gemma 3, and PaliGemma 2, adding quantization formats, a backward pass for fine-tuning research, and basic Python bindings over roughly 28 months.

Growth

Initial star spike coincided with the Gemma model announcement in early 2024. Growth has since plateaued — 8 stars in the last 7 days indicates very low organic discovery. The project appears to serve a stable niche of Gemma-specific researchers and Google-ecosystem developers rather than achieving broad viral adoption. It competes for mindshare against the vastly more popular llama.cpp, which already supports Gemma models via GGUF.

In production

Adoption not verified for production use. Google's own README explicitly recommends against production use of gemma.cpp, directing users to Python-based frameworks instead. No third-party case studies, package download metrics, or enterprise integrations are referenced in available metadata.

Code analysis
Architecture

Appears to be a vertically-integrated, header-heavy C++ codebase with a ~2K LoC core and ~4K LoC utilities. Likely uses Google Highway for SIMD abstraction, enabling runtime ISA selection. Tensor parallelism appears CCX-aware with a custom thread pool. Uses memory-mapped or parallel disk I/O. Supports mixed-precision GEMM (fp8, bf16, fp32, NUQ 4-bit). Has a custom binary weight format (.sbs) distinct from GGUF. CMake and Bazel build systems both supported.

Tests

Not documented in README.

Maintenance

Last push was 2026-06-27, one day before evaluation date — actively maintained. Development occurs on a 'dev' branch with 'main' as stable. A Discord community exists. The README is current, covering Gemma 3 and PaliGemma 2, suggesting ongoing model support. Maintenance appears steady and Google-backed, not community-driven momentum.

Honest verdict

ADOPT IF: you are doing research on Gemma architecture internals, need to embed Gemma inference directly into a C++ codebase with minimal dependencies, or want a readable reference implementation from Google for educational or algorithmic experimentation. AVOID IF: you need production-grade deployment, GPU acceleration, broad model support beyond Gemma, or want to benefit from the larger tooling ecosystem — use llama.cpp or Ollama instead. MONITOR IF: you are tracking whether Google eventually adds GPU backends or broader deployment features that would make this a production-viable option.

Independent dimensions

Mainstream potential

2/10

Technical importance

7/10

Adoption evidence

2/10

Risks
  • CPU-only inference limits practical use for larger Gemma models (27B+) where GPU acceleration is effectively required for reasonable latency.
  • Custom .sbs weight format is incompatible with the GGUF ecosystem, creating friction for users who want to move weights between tools.
  • If Google deprioritizes this project in favor of LiteRT-LM or other internal tooling, maintenance could slow with little community capacity to compensate.
  • Very low recent growth (8 stars/week) suggests limited new adopter discovery, which may reduce community contributions and external testing coverage over time.
  • Model conversion from Safetensors is noted as 'not yet open sourced' in the README, creating a dependency on Google-provided artifacts that limits reproducibility.
Prediction

Likely to remain a stable, narrowly used research tool maintained by Google for the Gemma model lifecycle. Mainstream breakout appears unlikely given llama.cpp's dominance and gemma.cpp's deliberately scoped design.

0 found this helpful

Newsletter

Get analyses like this every Monday

Free weekly digest of the most interesting open-source discoveries.

Languages

C++
92.3%
Starlark
2.3%
Python
2%
C#
1.4%
C
0.7%
Shell
0.7%
CMake
0.7%

Information

Language
C++
License
Apache-2.0
Last updated
20h ago
Created
29mo ago
Analyzed with
anthropic/claude-haiku-4-5

Stars over time

Loading…

Contributors over time

Top 100 contributors only — repos with more will plateau at 100.

Loading…

Similar repos

google-deepmind

google-deepmind/gemma

Gemma is Google DeepMind's open-weight LLM library built on JAX, enabling...

5.5k Python AI & ML
ggml-org

ggml-org/llama.cpp

llama.cpp is a C/C++ inference engine for running large language models...

119.9k C++ AI & ML
google-ai-edge

google-ai-edge/LiteRT-LM

LiteRT-LM is Google's production inference framework for deploying Large...

5.8k C++ AI & ML
ollama

ollama/ollama

Ollama is a local LLM runtime that lets developers and end users download, run,...

175.9k Go AI & ML
ggml-org

ggml-org/ggml

GGML is a C++ tensor library optimized for efficient machine learning inference...

15k C++ AI & ML
vs. alternatives
llama.cpp (ggml-org)

118K+ stars vs 7K. llama.cpp already supports Gemma models via GGUF format, has GPU backends, wider quantization support, broader model coverage, and a large ecosystem of downstream tools (Ollama, LM Studio, etc.). gemma.cpp offers a smaller, more readable codebase and a Google-authored reference implementation, but cannot match llama.cpp on breadth or ecosystem.

ollama (ollama/ollama)

175K+ stars. Ollama is an end-user and developer deployment tool, not a research engine. It wraps llama.cpp internally. gemma.cpp is not competitive in the deployment convenience category Ollama occupies.

google-ai-edge/LiteRT-LM

5.7K stars, also Google-backed. LiteRT-LM targets on-device deployment via LiteRT (formerly TFLite). gemma.cpp focuses on research/experimentation on general CPUs while LiteRT-LM targets mobile/edge deployment pipelines — different deployment targets within the same model family.

google-deepmind/gemma (Python)

5.5K stars. The Python Gemma repo is the JAX-based reference implementation. gemma.cpp is its C++ counterpart for those needing lower-level access or embedding in C++ systems. The two are complementary rather than competing.

ggml (ggml-org/ggml)

14.9K stars. ggml is the underlying tensor library powering llama.cpp. gemma.cpp uses Google Highway instead of ggml for SIMD, making it a parallel low-level approach — neither directly competes, but gemma.cpp's custom format creates ecosystem fragmentation relative to the ggml/GGUF ecosystem.