Developer Tools

llama.cpp b9860 adds API to query model quantization type

New public C API returns quantization name like 'Q8_0' for any loaded model.

Deep Dive

The latest release of llama.cpp (b9860) from ggml-org brings a developer‑friendly addition: a new public C API called `llama_ftype_name()`. This function exposes the quantisation type of a loaded model as a human‑readable string—for example, 'Q8_0', 'Q4_K - Medium', or 'FP16'. The returned pointer is guaranteed to be valid for the model’s entire lifetime, and `nullptr` is returned when the model is invalid or the type is unknown. The API is thread‑safe and allocation‑free, achieved by removing an earlier static `std::string` and instead prepending a '(guessed)' label when the type is inferred rather than explicitly stored.

Notably, the API also exports the underlying enum so that developers can map names to numeric values programmatically. The release notes show the commit was signed with GitHub’s verified signature and includes a wide range of CI builds across macOS (Apple Silicon & Intel), Linux (x64, arm64, Vulkan, ROCm, OpenVINO, SYCL), Windows (x64, arm64, CUDA, Vulkan, HIP), Android (arm64), and iOS. This broad platform support ensures the new function works wherever llama.cpp is used, from edge devices to cloud servers.

Key Points
  • New `llama_ftype_name()` C API returns quantization names like 'Q8_0' or 'Q4_K - Medium'
  • Allocation‑free implementation with pointer valid for model lifetime and `nullptr` for unknown types
  • Preprends '(guessed)' label for inferred types; exports underlying enum for programmatic mapping

Why It Matters

Gives developers a standardized, safe way to detect model quantization without parsing file names or relying on heuristics.

📬 Get the top 10 AI stories daily