LLAMA-IMATRIX(1)

๐Ÿ“ฆ
version 10438 ยท 2 versions
, in ubuntu stonking

NAME

llama-imatrix โ€” it's giving llama-imatrix, periodt. That's the name and the command, bestie. No notes. ๐Ÿ’…

DESCRIPTION

okay so bestie, this page is serving up the common params shared across llama.cpp tools. It's a long list, no cap, but we're gonna go through every single one together. Grab a boba ๐Ÿง‹ and let's get into it. โœจ

โœจ ----- common params ----- โœจ

  • -h, --help, --usage โ€” prints the usage info and dips out, slay. ๐Ÿ’…
  • --version โ€” shows you the version and build info, cute. โœจ
  • -cl, --cache-list โ€” lists all the models chillin' in your cache, lowkey useful. ๐Ÿ—‚๏ธ
  • --completion-bash โ€” prints a source-able bash completion script for llama.cpp, so your tab key can go feral. ๐Ÿ”ฅ
  • -t, --threads N โ€” how many CPU threads to use during generation, bestie. default is <num_cpus>, and the env var is LLAMA_ARG_THREADS. ๐Ÿงต
  • -tb, --threads-batch N โ€” threads for batch and prompt processing. default is same as --threads, iykyk. ๐Ÿ“ฆ
  • -C, --cpu-mask M โ€” CPU affinity mask: arbitrarily long hex. it complements cpu-range, and default is "". ๐ŸŽญ
  • -Cr, --cpu-range lo-hi โ€” range of CPUs for affinity, complements --cpu-mask. ๐ŸŽฏ
  • --cpu-strict <0|1> โ€” use strict CPU placement, default 0. ๐Ÿ’…
  • --prio N โ€” set process/thread priority: low(-1), normal(0), medium(1), high(2), realtime(3), default 0. โšก
  • --poll <0...100> โ€” polling level to wait for work (0 = no polling), default 50. โณ
  • -Cb, --cpu-mask-batch M โ€” CPU affinity mask for batch: arbitrarily long hex. complements cpu-range-batch, default is same as --cpu-mask. ๐ŸŽญ
  • -Crb, --cpu-range-batch lo-hi โ€” ranges of CPUs for affinity, complements --cpu-mask-batch. ๐ŸŽฏ
  • --cpu-strict-batch <0|1> โ€” strict CPU placement for batch, default same as --cpu-strict. ๐Ÿ’…
  • --prio-batch N โ€” priority for batch: 0-normal, 1-medium, 2-high, 3-realtime, default 0. โšก
  • --poll-batch <0|1> โ€” use polling to wait for work, default same as --poll. โณ
  • -c, --ctx-size N โ€” size of the prompt context. default 512, 0 means loaded from model, env is LLAMA_ARG_CTX_SIZE. ๐Ÿ“
  • -n, --predict, --n-predict N โ€” number of tokens to predict. default -1, and -1 means infinity, env is LLAMA_ARG_N_PREDICT. ๐Ÿ”ฎ
  • -b, --batch-size N โ€” logical maximum batch size, default 2048, env LLAMA_ARG_BATCH. ๐Ÿ“ฆ
  • -ub, --ubatch-size N โ€” physical maximum batch size, default 512, env LLAMA_ARG_UBATCH. ๐Ÿ“ฆ
  • --keep N โ€” number of tokens to keep from the initial prompt. default 0, -1 means all. ๐Ÿ’พ
  • --swa-full โ€” use full-size SWA cache, default false. more info: https://github.com/ggml-org/llama.cpp/pull/13194#issuecomment-2868343055, env LLAMA_ARG_SWA_FULL. ๐Ÿ’พ
  • -fa, --flash-attn [on|off|auto] โ€” set Flash Attention use ('on', 'off', or 'auto', default 'auto'), env LLAMA_ARG_FLASH_ATTN. โšก
  • -p, --prompt PROMPT โ€” prompt to start generation with; for system message, use -sys. โœ๏ธ
  • --perf, --no-perf โ€” whether to enable internal libllama performance timings, default false, env LLAMA_ARG_PERF. โฑ๏ธ
  • -f, --file FNAME โ€” a file containing the prompt, default none. ๐Ÿ“„
  • -bf, --binary-file FNAME โ€” binary file containing the prompt, default none. ๐Ÿ—‚๏ธ
  • -e, --escape, --no-escape โ€” whether to process escape sequences (\n, \r, \t, \', \", \\), default false. ๐Ÿ”„
  • --rope-scaling {none,linear,yarn} โ€” RoPE frequency scaling method, defaults to linear unless specified by the model, env LLAMA_ARG_ROPE_SCALING_TYPE. ๐Ÿงฌ
  • --rope-scale N โ€” RoPE context scaling factor, expands context by a factor of N, env LLAMA_ARG_ROPE_SCALE. ๐Ÿ“ˆ
  • --rope-freq-base N โ€” RoPE base frequency, used by NTK-aware scaling, default is loaded from model, env LLAMA_ARG_ROPE_FREQ_BASE. ๐Ÿงฌ
  • --rope-freq-scale N โ€” RoPE frequency scaling factor, expands context by a factor of 1/N, env LLAMA_ARG_ROPE_FREQ_SCALE. ๐Ÿ“‰
  • --yarn-orig-ctx N โ€” YaRN: original context size of model, default 0 means model training context size, env LLAMA_ARG_YARN_ORIG_CTX. ๐Ÿงถ
  • --yarn-ext-factor N โ€” YaRN: extrapolation mix factor, default -1.00, 0.0 means full interpolation, env LLAMA_ARG_YARN_EXT_FACTOR. ๐Ÿงถ
  • --yarn-attn-factor N โ€” YaRN: scale sqrt(t) or attention magnitude, default -1.00, env LLAMA_ARG_YARN_ATTN_FACTOR. ๐Ÿงถ
  • --yarn-beta-slow N โ€” YaRN: high correction dim or alpha, default -1.00, env LLAMA_ARG_YARN_BETA_SLOW. ๐Ÿงถ
  • --yarn-beta-fast N โ€” YaRN: low correction dim or beta, default -1.00, env LLAMA_ARG_YARN_BETA_FAST. ๐Ÿงถ
  • -kvo, --kv-offload, -nkvo, --no-kv-offload โ€” whether to enable KV cache offloading, default enabled, env LLAMA_ARG_KV_OFFLOAD. ๐Ÿ’พ
  • --repack, -nr, --no-repack โ€” whether to enable weight repacking, default enabled, env LLAMA_ARG_REPACK. ๐Ÿ“ฆ
  • --no-host โ€” bypass host buffer allowing extra buffers to be used, env LLAMA_ARG_NO_HOST. ๐Ÿšซ
  • -ctk, --cache-type-k TYPE โ€” KV cache data type for K. allowed values: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1, default f16, env LLAMA_ARG_CACHE_TYPE_K. ๐Ÿงฎ
  • -ctv, --cache-type-v TYPE โ€” KV cache data type for V. allowed values: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1, default f16, env LLAMA_ARG_CACHE_TYPE_V. ๐Ÿงฎ
  • -dt, --defrag-thold N โ€” KV cache defragmentation threshold (DEPRECATED ๐Ÿšจ), env LLAMA_ARG_DEFRAG_THOLD. ๐Ÿ’€
  • -np, --parallel N โ€” number of parallel sequences to decode, default 1, env LLAMA_ARG_N_PARALLEL. ๐Ÿงต
  • --mlock โ€” DEPRECATED ๐Ÿšจ in favor of --load-mode: force system to keep model in RAM rather than swapping or compressing, env LLAMA_ARG_MLOCK. ๐Ÿ’€
  • --mmap, --no-mmap โ€” DEPRECATED ๐Ÿšจ in favor of --load-mode: whether to memory-map model. (if mmap disabled, slower load but may reduce pageouts if not using mlock), env LLAMA_ARG_MMAP. ๐Ÿ’€
  • -dio, --direct-io, -ndio, --no-direct-io โ€” DEPRECATED ๐Ÿšจ in favor of --load-mode: use DirectIO if available, env LLAMA_ARG_DIO. ๐Ÿ’€
  • -lm, --load-mode MODE โ€” model loading mode, default auto. options are:
    • auto: mmap, unless a device does not support it
    • none: no special loading mode
    • mmap: memory-map model (if mmap disabled, slower load but may reduce pageouts if not using mlock)
    • mlock: force system to keep model in RAM rather than swapping or compressing
    • mmap+mlock: mmap + force system to keep model in RAM rather than swapping or compressing
    • dio: use DirectIO if available (env: LLAMA_ARG_LOAD_MODE) ๐Ÿš€
  • --numa TYPE โ€” attempt optimizations that help on some NUMA systems. options:
    • distribute: spread execution evenly over all nodes
    • isolate: only spawn threads on CPUs on the node that execution started on
    • numactl: use the CPU map provided by numactl if run without this previously, it is recommended to drop the system page cache before using this. see https://github.com/ggml-org/llama.cpp/issues/1437 (env: LLAMA_ARG_NUMA) ๐Ÿง 
  • -dev, --device <dev1,dev2,..> โ€” comma-separated list of devices to use for offloading (none = don't offload). use --list-devices to see a list of available devices, env LLAMA_ARG_DEVICE. ๐ŸŽฎ
  • --list-devices โ€” prints list of available devices and exits, slay. ๐Ÿ“‹
  • -ot, --override-tensor <tensor name pattern>=<buffer type>,... โ€” override tensor buffer type, env LLAMA_ARG_OVERRIDE_TENSOR. ๐Ÿงฉ
  • -cmoe, --cpu-moe โ€” keep all Mixture of Experts (MoE) weights in the CPU, env LLAMA_ARG_CPU_MOE. ๐Ÿง 
  • -ncmoe, --n-cpu-moe N โ€” keep the Mixture of Experts (MoE) weights of the first N layers in the CPU, env LLAMA_ARG_N_CPU_MOE. ๐Ÿง 
  • -ngl, --gpu-layers, --n-gpu-layers N โ€” max. number of layers to store in VRAM, either an exact number, 'auto', or 'all', default auto, env LLAMA_ARG_N_GPU_LAYERS. ๐ŸŽฎ
  • -sm, --split-mode {none,layer,row,tensor} โ€” how to split the model across multiple GPUs, one of:
    • none: use one GPU only
    • layer (default): split layers and KV across GPUs (pipelined)
    • row: split weight across GPUs by rows (parallelized)
    • tensor: split weights and KV across GPUs (parallelized, EXPERIMENTAL ๐Ÿงช) (env: LLAMA_ARG_SPLIT_MODE) ๐ŸŽฎ
  • -ts, --tensor-split N0,N1,N2,... โ€” fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1, env LLAMA_ARG_TENSOR_SPLIT. ๐ŸŽฎ
  • -mg, --main-gpu INDEX โ€” the GPU to use for the model (with split-mode = none), or for intermediate results and KV (with split-mode = row), default 0, env LLAMA_ARG_MAIN_GPU. ๐ŸŽฎ
  • -fit, --fit [on|off] โ€” whether to adjust unset arguments to fit in device memory ('on' or 'off', default 'on'), env LLAMA_ARG_FIT. ๐ŸŽฏ
  • -fitt, --fit-target MiB0,MiB1,MiB2,... โ€” target margin per device for --fit, comma-separated list of values, single value is broadcast across all devices, default 1024, env LLAMA_ARG_FIT_TARGET. ๐ŸŽฏ
  • -fitc, --fit-ctx N โ€” minimum ctx size that can be set by --fit option, default 4096, env LLAMA_ARG_FIT_CTX. ๐Ÿ“
  • --check-tensors โ€” check model tensor data for invalid values, default false. ๐Ÿ”
  • --override-kv KEY=TYPE:VALUE,... โ€” advanced option to override model metadata by key. to specify multiple overrides, either use comma-separated values. types: int, float, bool, str. example: --override-kv tokenizer.ggml.add_bos_token=bool:false,tokenizer.ggml.add_eos_token=bool:false. ๐Ÿง 
  • --op-offload, --no-op-offload โ€” whether to offload host tensor operations to device, default true. ๐Ÿš€
  • --lora FNAME โ€” path to LoRA adapter (use comma-separated values to load multiple adapters). ๐Ÿงต
  • --lora-scaled FNAME:SCALE,... โ€” path to LoRA adapter with user defined scaling (format: FNAME:SCALE,...) note: use comma-separated values. ๐Ÿงต
  • --control-vector FNAME โ€” add a control vector note: use comma-separated values to add multiple control vectors. ๐ŸŽ›๏ธ
  • --control-vector-scaled FNAME:SCALE,... โ€” add a control vector with user defined scaling SCALE note: use comma-separated values (format: FNAME:SCALE,...). ๐ŸŽ›๏ธ
  • --control-vector-layer-range START END โ€” layer range to apply the control vector(s) to, start and end inclusive. ๐ŸŽ›๏ธ
  • -m, --model FNAME โ€” model path to load, env LLAMA_ARG_MODEL. ๐Ÿ“
  • -mu, --model-url MODEL_URL โ€” model download url, default unused, env LLAMA_ARG_MODEL_URL. ๐ŸŒ
  • -dr, --docker-repo [<repo>/]<model>[:quant]
  • Docker Hub model repository โ€” repo is optional, defaults to ai/. quant is optional, defaults to :latest. Example: gemma3 (default: unused) (env: LLAMA_ARG_DOCKER_REPO)
  • -hf, -hfr, --hf-repo <user>/<model>[:quant] โ€” pulls your model straight off Hugging Face ๐Ÿฆ‹. The quant bit is optional and case-insensitive, defaults to Q4_K_M, and if there's no Q4_K_M in the repo it gracefully falls back to the first file it finds. It also auto-downloads mmproj if the repo has one โ€” if that's not the vibe, hit it with --no-mmproj. Example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M (default: unused) (env: LLAMA_ARG_HF_REPO)
  • -hff, --hf-file FILE โ€” the actual Hugging Face model file. Heads up bestie: if you specify this, it overrides the quant you set in --hf-repo (default: unused) (env: LLAMA_ARG_HF_FILE)
  • -hft, --hf-token TOKEN โ€” your Hugging Face access token ๐Ÿ”‘ (default: whatever's in the HF_TOKEN environment variable) (env: HF_TOKEN)
  • --log-disable โ€” Log disable. Yeah. That's the whole description. It disables the log. ๐Ÿ’€
  • --log-file FNAME โ€” logs go to a file instead of screaming into your terminal (env: LLAMA_ARG_LOG_FILE)
  • --log-colors [on|off|auto] โ€” sets colored logging. You've got 'on', 'off', or 'auto', and the default is 'auto'. What does 'auto' do? It turns colors on when the output is going to a terminal, like it's reading the room โœจ (env: LLAMA_ARG_LOG_COLORS)
  • -v, --verbose, --log-verbose โ€” cranks the verbosity level to infinity, i.e. it logs every message. Chaotic but genuinely useful for debugging ๐Ÿ”ฅ
  • --offline โ€” offline mode, no cap. It forces the use of cache and flat-out prevents network access (env: LLAMA_ARG_OFFLINE)
  • -lv, --verbosity, --log-verbosity N โ€” sets the verbosity threshold. Any message with a higher verbosity than your threshold gets ignored, sorry babe. The values are:
    • 0: generic output
    • 1: error
    • 2: warning
    • 3: info
    • 4: trace (more info)
    • 5: debug

(default: 3) (env: LLAMA_ARG_LOG_VERBOSITY)

  • --log-prefix, --no-log-prefix โ€” enable the prefix in log messages (env: LLAMA_ARG_LOG_PREFIX)
  • --log-timestamps, --no-log-timestamps โ€” enable timestamps in log messages (env: LLAMA_ARG_LOG_TIMESTAMPS)
  • --spec-draft-type-k, -ctkd, --cache-type-k-draft TYPE โ€” the KV cache data type for K for the draft model. Allowed values: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1 (default: f16) (env: LLAMA_ARG_SPEC_DRAFT_CACHE_TYPE_K)
  • --spec-draft-type-v, -ctvd, --cache-type-v-draft TYPE โ€” same energy but for V, and for the draft model. Allowed values: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1 (default: f16) (env: LLAMA_ARG_SPEC_DRAFT_CACHE_TYPE_V)

๐Ÿ“ sampling params ๐Ÿ“

  • --samplers SAMPLERS โ€” the samplers used for generation, in order, separated by ; (default: penalties;dry;top_n_sigma;top_k;typ_p;top_p;min_p;xtc;temperature)
  • -s, --seed SEED โ€” RNG seed (default: -1, and -1 means use a random seed for you ๐ŸŽฒ)
  • --sampler-seq, --sampling-seq SEQUENCE โ€” a simplified sequence for the samplers that will be used (default: edskypmxt)
  • --ignore-eos โ€” ignores the end of stream token and just keeps generating, no thoughts head empty ๐Ÿ˜ญ (this implies --logit-bias EOS-inf)
  • --temp, --temperature N โ€” temperature (default: 0.80)
  • --top-k N โ€” top-k sampling (default: 40, 0 = disabled) (env: LLAMA_ARG_TOP_K)
  • --top-p N โ€” top-p sampling (default: 0.95, 1.0 = disabled)
  • --min-p N โ€” min-p sampling (default: 0.05, 0.0 = disabled)
  • --top-nsigma, --top-n-sigma N โ€” top-n-sigma sampling (default: -1.00, -1.0 = disabled)
  • --xtc-probability N โ€” xtc probability (default: 0.00, 0.0 = disabled)
  • --xtc-threshold N โ€” xtc threshold (default: 0.10, 1.0 = disabled)
  • --typical, --typical-p N โ€” locally typical sampling, parameter p (default: 1.00, 1.0 = disabled)
  • --repeat-last-n N โ€” the last n tokens to consider for penalize (default: 64, 0 = disabled)
  • --repeat-penalty N โ€” penalize a repeat sequence of tokens (default: 1.00, 1.0 = disabled)
  • --presence-penalty N โ€” repeat alpha presence penalty (default: 0.00, 0.0 = disabled)
  • --frequency-penalty N โ€” repeat alpha frequency penalty (default: 0.00, 0.0 = disabled)
  • --dry-multiplier N โ€” sets the DRY sampling multiplier (default: 0.00, 0.0 = disabled)
  • --dry-base N โ€” sets the DRY sampling base value (default: 1.75)
  • --dry-allowed-length N โ€” sets the allowed length for DRY sampling (default: 2)
  • --dry-penalty-last-n N โ€” sets the DRY penalty for the last n tokens (default: 64, 0 = disable)
  • --dry-sequence-breaker STRING โ€” adds a sequence breaker for DRY sampling, and when you do that it clears out the default breakers ('\n', ':', '"', '*') in the process. Use "none" if you don't want any sequence breakers at all ๐Ÿšซ
  • --adaptive-target N โ€” adaptive-p: selects tokens near this probability (valid range 0.0 to 1.0; negative = disabled) (default: -1.00) โ€” more info lives at https://github.com/ggml-org/llama.cpp/pull/17927 if you wanna go read the whole thing ๐Ÿ‘€
  • --adaptive-decay N โ€” adaptive-p: the decay rate for target adaptation over time. Lower values are more reactive, higher values are more stable ๐Ÿ“‰๐Ÿ“ˆ (valid range 0.0 to 0.99) (default: 0.90)
  • --dynatemp-range N โ€” dynamic temperature range (default: 0.00, 0.0 = disabled)
  • --dynatemp-exp N โ€” dynamic temperature exponent (default: 1.00)
  • --mirostat N โ€” use Mirostat sampling. Important: Top K, Nucleus and Locally Typical samplers are ignored if they're used alongside this. (default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)
  • --mirostat-lr N โ€” Mirostat learning rate, parameter eta (default: 0.10)
  • --mirostat-ent N โ€” Mirostat target entropy, parameter tau (default: 5.00)
  • -l, --logit-bias TOKEN_ID(+/-)BIAS โ€” modifies the likelihood of a token showing up in the completion, i.e. --logit-bias 15043+1 to increase the likelihood of the token ' Hello', or --logit-bias 15043-1 to decrease the likelihood of the token ' Hello'
  • --grammar GRAMMAR โ€” a BNF-like grammar to constrain generations (check the samples in the grammars/ dir) ๐ŸŽ€
  • --grammar-file FNAME โ€” the file to read the grammar from
  • -j, --json-schema SCHEMA โ€” a JSON schema to constrain generations (https://json-schema.org/), e.g. {} for any JSON object. For schemas with external $refs, use --grammar plus example/json_schema_to_grammar.py instead โœจ
  • -jf, --json-schema-file FILE โ€” a file containing a JSON schema to constrain generations (https://json-schema.org/), e.g. {} for any JSON object. Same deal: for schemas with external $refs, use --grammar plus example/json_schema_to_grammar.py instead โœจ
  • -bs, --backend-sampling โ€” enable backend sampling (experimental ๐Ÿ‘ฉโ€๐Ÿ”ฌ) (default: disabled) (env: LLAMA_ARG_BACKEND_SAMPLING)

๐ŸŽ€ example-specific params ๐ŸŽ€

  • --context-shift, --no-context-shift โ€” whether to use context shift on infinite text generation (default: disabled) (env: LLAMA_ARG_CONTEXT_SHIFT)
  • --chunks N โ€” max number of chunks to process (default: -1, -1 = all)
  • --in-file FNAME โ€” an input file (use comma-separated values to specify multiple files)
  • -o, --output, --output-file FNAME โ€” output file (default: 'imatrix.gguf')
  • -ofreq, --output-frequency N โ€” outputs the imatrix every N iterations (default: 10)
  • --output-format {gguf,dat} โ€” the output format for the imatrix file (default: gguf)
  • --save-frequency N โ€” saves an imatrix copy every N iterations (default: 0)
  • --process-output โ€” collects data for the output tensor (default: false)
  • --ppl, --no-ppl โ€” whether to compute perplexity (default: true)
  • --chunk, --from-chunk N โ€” starts processing the input from chunk N (default: 0)
  • --show-statistics โ€” shows imatrix statistics and then peaces out โœŒ๏ธ (default: false)
  • --parse-special โ€” parses special tokens (chat, tool, etc) (default: false)

example usage:

llama-imatrix \
       -m model.gguf -f some-text.txt [-o imatrix.gguf] [--output-format {gguf,dat}] [--no-ppl] \
       [--process-output] [--chunk 123] [--save-frequency 0] [--output-frequency 10] \
       [--in-file imatrix-prev-0.gguf --in-file imatrix-prev-1.gguf ...] [--parse-special] \
       [--show-statistics] [...]

okay that's the whole page bestie, you ate that ๐Ÿ’… this one ships out of debian, dated September 2026, and it's LLAMA-IMATRIX(1) in the manual โ€” go forth and build your imatrix, you've got this ๐Ÿซถโœจ

๐Ÿ“ฆ where this page comes from