LLAMA-IMATRIX(1)
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 isLLAMA_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 complementscpu-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, default0. ๐--prio Nโ set process/thread priority:low(-1),normal(0),medium(1),high(2),realtime(3), default0. โก--poll <0...100>โ polling level to wait for work (0= no polling), default50. โณ-Cb,--cpu-mask-batch Mโ CPU affinity mask for batch: arbitrarily long hex. complementscpu-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, default0. โก--poll-batch <0|1>โ use polling to wait for work, default same as--poll. โณ-c,--ctx-size Nโ size of the prompt context. default512,0means loaded from model, env isLLAMA_ARG_CTX_SIZE. ๐-n,--predict,--n-predict Nโ number of tokens to predict. default-1, and-1means infinity, env isLLAMA_ARG_N_PREDICT. ๐ฎ-b,--batch-size Nโ logical maximum batch size, default2048, envLLAMA_ARG_BATCH. ๐ฆ-ub,--ubatch-size Nโ physical maximum batch size, default512, envLLAMA_ARG_UBATCH. ๐ฆ--keep Nโ number of tokens to keep from the initial prompt. default0,-1means all. ๐พ--swa-fullโ use full-size SWA cache, defaultfalse. more info:https://github.com/ggml-org/llama.cpp/pull/13194#issuecomment-2868343055, envLLAMA_ARG_SWA_FULL. ๐พ-fa,--flash-attn [on|off|auto]โ set Flash Attention use ('on','off', or'auto', default'auto'), envLLAMA_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, defaultfalse, envLLAMA_ARG_PERF. โฑ๏ธ-f,--file FNAMEโ a file containing the prompt, defaultnone. ๐-bf,--binary-file FNAMEโ binary file containing the prompt, defaultnone. ๐๏ธ-e,--escape,--no-escapeโ whether to process escape sequences (\n,\r,\t,\',\",\\), defaultfalse. ๐--rope-scaling {none,linear,yarn}โ RoPE frequency scaling method, defaults tolinearunless specified by the model, envLLAMA_ARG_ROPE_SCALING_TYPE. ๐งฌ--rope-scale Nโ RoPE context scaling factor, expands context by a factor ofN, envLLAMA_ARG_ROPE_SCALE. ๐--rope-freq-base Nโ RoPE base frequency, used by NTK-aware scaling, default is loaded from model, envLLAMA_ARG_ROPE_FREQ_BASE. ๐งฌ--rope-freq-scale Nโ RoPE frequency scaling factor, expands context by a factor of1/N, envLLAMA_ARG_ROPE_FREQ_SCALE. ๐--yarn-orig-ctx Nโ YaRN: original context size of model, default0means model training context size, envLLAMA_ARG_YARN_ORIG_CTX. ๐งถ--yarn-ext-factor Nโ YaRN: extrapolation mix factor, default-1.00,0.0means full interpolation, envLLAMA_ARG_YARN_EXT_FACTOR. ๐งถ--yarn-attn-factor Nโ YaRN: scalesqrt(t)or attention magnitude, default-1.00, envLLAMA_ARG_YARN_ATTN_FACTOR. ๐งถ--yarn-beta-slow Nโ YaRN: high correction dim or alpha, default-1.00, envLLAMA_ARG_YARN_BETA_SLOW. ๐งถ--yarn-beta-fast Nโ YaRN: low correction dim or beta, default-1.00, envLLAMA_ARG_YARN_BETA_FAST. ๐งถ-kvo,--kv-offload,-nkvo,--no-kv-offloadโ whether to enable KV cache offloading, defaultenabled, envLLAMA_ARG_KV_OFFLOAD. ๐พ--repack,-nr,--no-repackโ whether to enable weight repacking, defaultenabled, envLLAMA_ARG_REPACK. ๐ฆ--no-hostโ bypass host buffer allowing extra buffers to be used, envLLAMA_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, defaultf16, envLLAMA_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, defaultf16, envLLAMA_ARG_CACHE_TYPE_V. ๐งฎ-dt,--defrag-thold Nโ KV cache defragmentation threshold (DEPRECATED ๐จ), envLLAMA_ARG_DEFRAG_THOLD. ๐-np,--parallel Nโ number of parallel sequences to decode, default1, envLLAMA_ARG_N_PARALLEL. ๐งต--mlockโ DEPRECATED ๐จ in favor of--load-mode: force system to keep model in RAM rather than swapping or compressing, envLLAMA_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), envLLAMA_ARG_MMAP. ๐-dio,--direct-io,-ndio,--no-direct-ioโ DEPRECATED ๐จ in favor of--load-mode: use DirectIO if available, envLLAMA_ARG_DIO. ๐-lm,--load-mode MODEโ model loading mode, defaultauto. options are:auto: mmap, unless a device does not support itnone: no special loading modemmap: 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 compressingmmap+mlock: mmap + force system to keep model in RAM rather than swapping or compressingdio: 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 nodesisolate: only spawn threads on CPUs on the node that execution started onnumactl: use the CPU map provided by numactl if run without this previously, it is recommended to drop the system page cache before using this. seehttps://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-devicesto see a list of available devices, envLLAMA_ARG_DEVICE. ๐ฎ--list-devicesโ prints list of available devices and exits, slay. ๐-ot,--override-tensor <tensor name pattern>=<buffer type>,...โ override tensor buffer type, envLLAMA_ARG_OVERRIDE_TENSOR. ๐งฉ-cmoe,--cpu-moeโ keep all Mixture of Experts (MoE) weights in the CPU, envLLAMA_ARG_CPU_MOE. ๐ง-ncmoe,--n-cpu-moe Nโ keep the Mixture of Experts (MoE) weights of the firstNlayers in the CPU, envLLAMA_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', defaultauto, envLLAMA_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 onlylayer(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, envLLAMA_ARG_TENSOR_SPLIT. ๐ฎ-mg,--main-gpu INDEXโ the GPU to use for the model (withsplit-mode = none), or for intermediate results and KV (withsplit-mode = row), default0, envLLAMA_ARG_MAIN_GPU. ๐ฎ-fit,--fit [on|off]โ whether to adjust unset arguments to fit in device memory ('on'or'off', default'on'), envLLAMA_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, default1024, envLLAMA_ARG_FIT_TARGET. ๐ฏ-fitc,--fit-ctx Nโ minimum ctx size that can be set by--fitoption, default4096, envLLAMA_ARG_FIT_CTX. ๐--check-tensorsโ check model tensor data for invalid values, defaultfalse. ๐--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, defaulttrue. ๐--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 scalingSCALEnote: 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, envLLAMA_ARG_MODEL. ๐-mu,--model-url MODEL_URLโ model download url, defaultunused, envLLAMA_ARG_MODEL_URL. ๐-dr,--docker-repo [<repo>/]<model>[:quant]- Docker Hub model repository โ
repois optional, defaults toai/.quantis 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 ๐ฆ. Thequantbit is optional and case-insensitive, defaults toQ4_K_M, and if there's noQ4_K_Min the repo it gracefully falls back to the first file it finds. It also auto-downloadsmmprojif 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 theHF_TOKENenvironment 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 output1: error2: warning3: info4: 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-1means 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, parameterp(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 range0.0to1.0; negative = disabled) (default:-1.00) โ more info lives athttps://github.com/ggml-org/llama.cpp/pull/17927if 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 range0.0to0.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, parametereta(default:0.10)--mirostat-ent Nโ Mirostat target entropy, parametertau(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+1to increase the likelihood of the token' Hello', or--logit-bias 15043-1to decrease the likelihood of the token' Hello'--grammar GRAMMARโ a BNF-like grammar to constrain generations (check the samples in thegrammars/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--grammarplusexample/json_schema_to_grammar.pyinstead โจ-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--grammarplusexample/json_schema_to_grammar.pyinstead โจ-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
- ubuntu stonking: llama.cpp-tools-extra 10438+dfsg-1ubuntu1 ยท MIT
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms