Principle:Ggml org Llama cpp CLI Argument Parsing
| Knowledge Sources | |
|---|---|
| Domains | CLI, Configuration |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
CLI Argument Parsing is the principle of converting command-line inputs into structured configuration parameters for llama.cpp tools and examples.
Description
This principle covers the design and implementation of a unified argument parsing framework used across all llama.cpp command-line tools. The framework provides consistent parameter handling, validation, default values, and help text generation. It also supports preset configurations that bundle common argument combinations for typical use cases.
Usage
Apply this principle when building any new CLI tool or example that needs to accept user-configurable parameters at startup, or when extending the existing argument set with new options.
Theoretical Basis
CLI argument parsing in llama.cpp follows a centralized design where a common argument parser defines all known parameters in a single registry. Each parameter specifies its name, type, default value, help text, and validation constraints. Tools select which subset of parameters they support. Preset configurations allow bundling frequently used argument combinations (e.g., server defaults, chat defaults) to simplify user experience. The header-only separation allows argument definitions to be shared across compilation units without code duplication.